Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] DS optional cardinality question

I have a simple collaborator pattern where a Manager component has a optional multiple reference to several Listener services as shown below:

<component
name="Manager" immediate="true">
<implementation class="com.ibm.listener.Manager"/>
<reference
name="Listener"
interface="com.ibm.listener.Listener"
cardinality="0..n"
policy="dynamic"
bind="addListener"
unbind="removeListener"
/>
</component>

<component
name="Listener1">
<implementation class="com.ibm.listener.Listener1"/>
<service>
<provide interface="com.ibm.listener.Listener"/>
</service>
</component>

<component
name="Listener2">
<implementation class="com.ibm.listener.Listener2"/>
<service>
<provide interface="com.ibm.listener.Listener"/>
</service>
</component>

Components Listener1 and Listener2 are not immediate components, where as the Manager component is. I would think that DS will activate Manager component without having to activate Listener1 or Listener 2 as they are not immediate components, and they are not mandatory for Manager (0..n cardinality). However, when I ran this example (with M5 bundles), both Listener 1 and Listener 2 were activated and injected into Manager component. Could this be a bug ?

Regards,
Subbarao


Back to the top