So if you remove target="(TECHNOLOGY_HA=ZIGBEE)" from the first XML file, that component gets the proper ManagerService? --
BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance hargr...@us.ibm.com office: +1 386 848 1781 mobile: +1 386 848 3788 From: "David Conde" <dco...@citic.es> To: "'OSGi Developer Mail List'" <osgi-dev@mail.osgi.org> Date: 2011/01/19 10:53 Subject: RE: [osgi-dev] Problem with Declarative Services and Filtering Sent by: osgi-dev-boun...@mail.osgi.org Hi again, Here I write the component.xml of MyService (the one which I want to activate when the Service with TECHNOLOGY_HA=ZIGBEE is ACTIVE): <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" configuration-policy="optional" deactivate="deactivate" factory="es.citic.puedes.homeautomation.zigbee.tech.factory" modified="modified" name="es.citic.puedes.homeautomation.zigbee.tech"> <implementation class="es.citic.puedes.homeautomation.zigbee.tech.impl.ZBTechManager"/> <property name="TECHNOLOGY_HA" type="String" value="ZIGBEE"/> <service> <provide interface="es.citic.puedes.homeautomation.devicemanager.ITechnologymanager"/> </service> <reference bind="bindPreferencesService" cardinality="1..1" interface="org.osgi.service.prefs.PreferencesService" name="PreferencesService" policy="dynamic" unbind="unbindPreferencesService"/> <reference bind="bindConfigurationAdmin" cardinality="1..1" interface="org.osgi.service.cm.ConfigurationAdmin" name="ConfigurationAdmin" policy="dynamic" unbind="unbindConfigurationAdmin"/> <reference bind="bindZBCommunicationManager" cardinality="1..1" interface="es.citic.puedes.homeautomation.communicationdevicemanager.ICommunicationDeviceManager" name="ICommunicationDeviceManager" policy="dynamic" target="(TECHNOLOGY_HA=ZIGBEE)" unbind="unbindZBCommunicationManager"/> </scr:component> And next you can see the component.xml of the ManagerService which should activate the first one. <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" configuration-policy="optional" deactivate="deactivate" factory="es.citic.puedes.homeautomation.zigbee.comm.factory" immediate="false" modified="modified" name="es.citic.puedes.homeautomation.zigbee.comm.impl.ZBCommManager"> <implementation class="es.citic.puedes.homeautomation.zigbee.comm.impl.ZBCommManager"/> <service> <provide interface="es.citic.puedes.homeautomation.communicationdevicemanager.ICommunicationDeviceManager"/> </service> <property name="TECHNOLOGY_HA" type="String" value="ZIGBEE"/> <reference bind="bindPreferenceService" cardinality="1..1" interface="org.osgi.service.prefs.PreferencesService" name="PreferencesService" policy="dynamic" unbind="unbindPreferenceService"/> </scr:component> I have either tried by writing (& (name="TECHNOLOGY_HA)(type="String")(value="ZIGBEE")) and I get the same result. Thank you for your time and help! Regards David -----Mensaje original----- De: osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-boun...@mail.osgi.org] En nombre de Felix Meschberger Enviado el: miércoles, 19 de enero de 2011 15:40 Para: OSGi Developer Mail List Asunto: RE: [osgi-dev] Problem with Declarative Services and Filtering Hi, Am Mittwoch, den 19.01.2011, 14:49 +0100 schrieb David Conde: > Hi, I have just tried (TECH=AAA) and I get the same result as > (TECH=”AAA”), I got that the component is not satisfied like If the > ManagerService with TECH=AAA does not exist, could this be because of > I am using TECHNOLOGY_HA instead of TECH as key property?I mean > because of the “_” char. Consider this: Hashtable props = new Hashtable(); props.put("TECHNOLOGY_HA", "AAA"); bundleContext.registerService(ManagerService.class, managerService, props); In this case the reference must be: <Reference ... target="(TECHNOLOGY_HA=AAA)" ... /> Of course the names of the properties must exactly match otherwise, there will never be a service provided.... Otherwise, please provide samples. Thanks. Regards Felix > > > > Thanks in advance > > > > > > > > De: osgi-dev-boun...@mail.osgi.org > [mailto:osgi-dev-boun...@mail.osgi.org] En nombre de BJ Hargrave > Enviado el: miércoles, 19 de enero de 2011 14:38 > Para: OSGi Developer Mail List > Asunto: Re: [osgi-dev] Problem with Declarative Services and Filtering > > > > > Don't put the quote *in* the attribute value of the filter > expression. > > (TECH=AAA) not (TECH="AAA") > > The latter is looking for a 5 character string that starts and ends > with double quote. > -- > > BJ Hargrave > Senior Technical Staff Member, IBM > OSGi Fellow and CTO of the OSGi > Alliance > hargr...@us.ibm.com > > > > > > office: +1 386 848 1781 > > mobile: +1 386 848 3788 > > > > > > > > > > > > > > From: "David Conde" <dco...@citic.es> > To: "'OSGi Developer Mail List'" <osgi-dev@mail.osgi.org> > Date: 2011/01/19 07:54 > Subject: [osgi-dev] Problem with Declarative Services and > Filtering > Sent by: osgi-dev-boun...@mail.osgi.org > > > ______________________________________________________________________ > > > > Hi, > > I have a service MyService which is waiting for another service > ManagerService to be activated. The problem is that there are more > than one ManagerService in the platform so the first ManagerService > ACTIVE will call the method bindManagerService(ManagerService ms) from > MyService and this will activate MyService. The problem is that I do > not want any of them but I need the ManagerService whose property is > TECH=AAA (which is specified in the component.xml of the > ManagerService right). > > In this way, in order to get the ManagerService whose property is > TECH=AAA and not other one, I specified in the component.xml of my > service in the “target” field the next LDAP filter: (TECH=”AAA”) , > the problem is that MyService is never satisfied since it does not > find a ManagerService with this property. > > How could I specified the one that I need in the component.xml in > order to active MyService just when the ManagerService that I am > waiting for is ACTIVE? > > Thank you in advance > > Best Regards_______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev