Hello Istvan,
I do not have a full answer to your question but I can suggest you one
solution (maybe other persons here who know better about Hivemind can
provide a better solution):
- simple solution:
Use translator="class"
This is easy. Of course, it will not fulfill all your requirements, ie
Hivemind will not control that the provided class is for an actual
translator. But you could possibly check this yourself at the time you get
the configuration (in one of your services I suppose)
- a bit harder solution:
1. Create an enumerated class that define names for every translator in
Hivemind (actually, I did not check but I would not be surprised if this
class already existed somewhere in Hivemind source...). Let's call it
TranslatorEnum.java. Also add a method getTranslatorClass() to this class
and have it return the translator class for the current value of the enum.
2. Define your schema this way:
<schema>
<element name="parameter">
...
<attribute name="translator"
Translator="enumeration,TranslatorEnum,int=..."/>
<rules>...</rules>
</element>
</schema>
For more details about the enumeration translator have a look to Hivemind
doc.
Then Hivemind will emit errors when it reads the configuration.
3. Then when you get the configuration in one of your service, Hivemind will
have created (according to your <rules>) a List of instances of some
"Contribution" class of your own, this class will probably have a
getTranslator() that will return a TranslatorEnum instance, from that
instance you can get the Translator class that you want and use the way you
want.
Hope this helps
Cheers
-----Original Message-----
From: Istvan Orban [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 20, 2004 12:15 AM
To: [email protected]
Subject: question about Translators
Hi,
I would like to define a configuration when you can have 3 fields name,
input-name, converter
<schema>
<element name="parameter">
<attribute name="name" required="true">
name
</attribute>
<attribute name="input-name">
if not given it uses the original name
</attribute>
<attribute name="translator" translator="??????">
defines the translator class which is a standard
hivemind translator
</attribute>
<rules>
</rules>
</element>
</schema>
the idea is the following,
I need a service which can translates name=string; value=string into
Objects (Integer, Long, String, Date ...)
and I would like to use the Translators already provided by Hivemind..
So I want to have a service which gets parameters about how to convert
certain parameters (name) into Objects.
<contrubition configuration-id="MyConfig" >
<parameter name="firstname"> <!-- this is string so default
translator -->
<parameter name="housnumber" translator="int">
............
</contrubition>
so how to deinfe in the SCHEMA element that in the XML I only acceppt
'hivemind translator'???????
Maybe it's little stupid, but I hope I made myself understood. :)
Thanks a lot
Istvano
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]