You can't reuse a schema that is defined inside
an configuration-point. Define it standalone and
it will accept the id attribute:

<schema id="AddressSchema">
        <element name="datum">
        <attribute name="key" required="true"/>
        <attribute name="value" required="true"/>
        <conversion class="test.config.Datum"/>
        </element>
</schema>

<configuration-point id="Address" schema-id="AddressSchema" />
<configuration-point id="Address2" schema-id="AddressSchema" />

More info here:
http://jakarta.apache.org/hivemind/configurations.html

Achim


Martin Pike wrote:

I am attempting to initialise an instance of a class with one of two sets of data, specified in a hivemodule.xml file, defined as contributions attached to configuration points.

The code shows instantiating of the object. If the service point called is 'testConfig.address' the code runs ok, but if I call the service point 'testConfig.address2' which references the second contribution it fails with error:

Error at file:...../META-INF/hivemodule.xml, line 41, column 72: Unable to update property data of object [EMAIL PROTECTED]: java.lang.reflect.InvocationTargetException org.apache.hivemind.ApplicationRuntimeException: Unable to update property data of object [EMAIL PROTECTED]: java.lang.reflect.InvocationTargetException

I am new to HiveMind and would appreciate any pointers as to what I'm doing wrong.

--Code

   public static void main(String[] args) {
       Registry registry = RegistryBuilder.constructDefaultRegistry();
Address address = (Address)registry.getService("testConfig.address2", Address.class);
       System.out.print(address.getAddress());
   }

-- hivemodule.xml

<?xml version="1.0"?>
<module id="testConfig" version="1.0.0" package = "test.config">

   <configuration-point id="Address">
     <schema>
       <element name="datum">
         <attribute name="key" required="true"/>
           <attribute name="value" required="true"/>
         <conversion class="test.config.Datum"/>
       </element>
     </schema>
   </configuration-point>
   <configuration-point id="Address2" schema-id="Address" />
     <contribution configuration-id="Address">
     <datum key="road"     value="Temple Quay"/>
     <datum key="town"     value="Bristol"/>
     <datum key="postcode" value="BS1"/>
     <datum key="country"     value="UK"/>
   </contribution>
   <contribution configuration-id="Address2" >
     <datum key="road"     value="Pall Mall"/>
     <datum key="town"     value="London"/>
     <datum key="postcode" value="SW1"/>
     <datum key="country"     value="UK"/>
   </contribution>

 <service-point id="address" interface="test.config.Address">
   <invoke-factory>
     <construct class="test.config.AddressImpl">
         <set-configuration property="data" configuration-id="Address"/>
     </construct>
   </invoke-factory>
 </service-point>

<service-point id="address2" interface="test.config.Address">
   <invoke-factory>
     <construct class="test.config.AddressImpl">
         <set-configuration property="data" configuration-id="Address2"/>
     </construct>
   </invoke-factory>
 </service-point>

</module>

Regards
Martin Pike



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to