Hi!
I had the same problem, but solved it writing my own "string" translator:
package xx.yy.zz;
import org.apache.hivemind.Location; import org.apache.hivemind.internal.Module; import org.apache.hivemind.schema.Translator;
public class StringTranslator implements Translator{public Object translate(Module contributingModule, Class propertyType, String inputValue, Location location){
return inputValue;
}
}
Then I contributed my translator to hivemind.Translators:
<contribution configuration-id="hivemind.Translators">
<translator name="string" class="xx.yy.zz.StringTranslator"/>
</contribution>And used the new translator inside the schema:
<element name="lookup">
<attribute name="key" required="true" translator="string" />
<rules>
<push-attribute attribute="key" />
<invoke-parent method="addElement" />
</rules>
</element>Don't know if this is better than the string object provider suggested by Knut - honestly, I've not quite understood the difference between an object provider and a translator! :)
Knut Wannheden wrote:
Markus,
This was reported as a bug against HiveMind 1.0 (http://issues.apache.org/jira/browse/HIVEMIND-15) and has been fixed in HiveMind 1.1.
If you would like to stay with HiveMind 1.0 you have the following possibilities:
- Use the "resource" translator (it seems like it would work for you) - Create Java objects with a writable String property (e.g. setLocation(String location)) to wrap your strings - Implement a "string" object provider and use the "object" translator (e.g. <config location="string:/usr/bin/pdftotext"/>
HTH,
--knut
On Mon, 7 Mar 2005 14:41:05 +0100, Markus Wiederkehr <[EMAIL PROTECTED]> wrote:
I'm writing a service that requires a single string as configuration. Here's the definition of the configuration point and contribution:
<configuration-point id="Factory" occurs="1"> <schema> <element name="config"> <attribute name="location" required="true"/>
<rules> <push-attribute attribute="location"/> <invoke-parent method="addElement"/> </rules> </element> </schema> </configuration-point>
<contribution configuration-id="Factory"> <config location="/usr/bin/pdftotext"/> </contribution>
According to the documentation the attribute should be treated as a single sting, since I don't provide a translator. Nevertheless I get this error:
org.apache.hivemind.ApplicationRuntimeException: Unable to translate '/usr/bin/pdftotext' to type java.lang.Object: No property editor for java.lang.Object.
What am I missing here?
Markus
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
