Community
Participate
Working Groups
Created attachment 112095 [details] Patch Build ID: N/A Steps To Reproduce: Reading the OSGi Service Platform Service Compendium R4 V4.1 spec I am concerned the Equinox implementation of Declarative services does not follow Section 112.3.4 and 112.6, which states: Section 112.3.4 Selecting Target Services [...] Since the target filter is manifested as a component property, called the tar- get property, the deployer can modify the target filter by establishing a con- figuration for the component which sets the value of the target property. See Component Properties on page 305 for more information. Section 112.6 Component Properties [...] 3 Properties specified in the component description. Later properties override earlier properties that have the same name. Properties can be specified in the component description in the following ways: • Target properties – The key of a target properties is the name of the reference appended with .target. The value of these properties is the value of the target attribute of the reference. For example, a reference with the name http whose target attribute has the value “(http.port=80)" results in the component property having the name http.target and value “(http.port=80)“. The target property is not set if the target attribute of the reference is not specified. See Selecting Target Services on page 292. [...] ----------------Example to reproduce the problem----------------------------------------- You can use the three provided projects to reproduce the problem. The bundle de.devolab.osgi.example.service registers a service 'SimpleService' that is used by the component 'SimpleComponent' in the bundle de.devolab.osgi.example.component. The component 'SimpleComponent' specifies the filter "(example.id=Test1)" in the target property of the reference to the 'SimpleService'. When the value of the target filter is changed by a configuration to the new value "(example.id=Test2)", according to the specification R4.1, the reference to 'SimpleService' should be unbound and the component should be deactivated. As soon as 'SimpleService' is updated by a configuration containing a property 'example.id' with value 'Test2', the component 'SimpleComponent' should be activated again and a new reference to 'SimpleService' should be bound. The bundle de.devolab.osgi.example.cm is used to update the configurations of 'SimpleComponent' and 'SimpleService'. ----------------Description of 'SimpleComponent'----------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"> <component enabled="true" name="de.devolab.osgi.example.component.internal.SimpleComponent"> <implementation class="de.devolab.osgi.example.component.internal.SimpleComponent"/> <property name="service.pid" value="de.devolab.osgi.example.component.internal.SimpleComponent"/> <reference name="simpleServiceExample" interface="de.devolab.osgi.example.service.SimpleService" cardinality="1..1" policy="static" target="(example.id=Test1)" bind="bindSimpleServiceExample" unbind="unbindSimpleServiceExample"/> </component> </components> ----------------Description of the bug----------------------------------------- The current Equinox implementation of Declarative Services does not take the new target filter into account during re-binding of 'SimpleService' into 'SimpleComponent'. Even though the property 'example.id' of the service and the value of the target filter 'example.id' do not match, the service with the configuration value 'Test1' is bound. Expected behaviour is that 'SimpleComponent' gets a reference to 'SimpleService' with configuration containing "(example.id=Test2)" and not "(example.id=Test1)". The provided patch fixes the issue. It would be nice if you would apply the patch before the next release of Equinox implementation of Declarative services. More information:
Created attachment 112096 [details] Example to reproduce the problem
Stoyan, I say you released code to fix this in CVS. Should this be closed as fixed?
Comment on attachment 112095 [details] Patch Adding Joerg-Christian Boehme as a contributor to the iplog. Thanks Joerg-Christian!
(In reply to comment #2) > Stoyan, I say you released code to fix this in CVS. Should this be closed as > fixed? > Opps. That should read "I saw you released code ..."
The patch is applied and committed to CVS. Thanks Joerg!
*** Bug 249852 has been marked as a duplicate of this bug. ***