Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 246757 - [ds] Compliance with section 112.3.4 and 112.6 of R4.1 spec
Summary: [ds] Compliance with section 112.3.4 and 112.6 of R4.1 spec
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 critical with 1 vote (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Stoyan Boshev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 249852 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-09-09 12:28 EDT by Joerg-Christian Boehme CLA
Modified: 2008-11-05 09:32 EST (History)
6 users (show)

See Also:


Attachments
Patch (3.08 KB, patch)
2008-09-09 12:28 EDT, Joerg-Christian Boehme CLA
tjwatson: iplog+
Details | Diff
Example to reproduce the problem (37.52 KB, application/octet-stream)
2008-09-09 12:29 EDT, Joerg-Christian Boehme CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg-Christian Boehme CLA 2008-09-09 12:28:08 EDT
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:
Comment 1 Joerg-Christian Boehme CLA 2008-09-09 12:29:56 EDT
Created attachment 112096 [details]
Example to reproduce the problem
Comment 2 Thomas Watson CLA 2008-09-22 18:07:34 EDT
Stoyan, I say you released code to fix this in CVS.  Should this be closed as fixed?
Comment 3 Thomas Watson CLA 2008-09-22 18:16:18 EDT
Comment on attachment 112095 [details]
Patch

Adding Joerg-Christian Boehme as a contributor to the iplog.  Thanks Joerg-Christian!
Comment 4 Thomas Watson CLA 2008-09-22 18:17:33 EDT
(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 ..."
Comment 5 Stoyan Boshev CLA 2008-09-23 02:40:14 EDT
The patch is applied and committed to CVS. Thanks Joerg!
Comment 6 Simon Archer CLA 2008-11-05 09:32:50 EST
*** Bug 249852 has been marked as a duplicate of this bug. ***