You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Peter Kriens <Pe...@aQute.biz> on 2007/02/23 14:00:23 UTC

Re[2]: Bundle plugin/BND question -- Service-Component header

BH> The DS spec does not require you to specify both bind and unbind. So the
BH> ProSyst implementation is incorrect in this respect.
Thais exactly what I concluded ... just did not feel the need to go
into the fight :-)

Kind regards,

     Peter Kriens
     
BH> BJ Hargrave
BH> Senior Technical Staff Member, IBM
BH> OSGi Fellow and CTO of the OSGi Alliance
BH> hargrave@us.ibm.com

BH> office: +1 386 848 1781
BH> mobile: +1 386 848 3788




BH> Peter Kriens <Pe...@aQute.biz> 
BH> 02/23/2007 02:32 AM
BH> Please respond to
BH> felix-dev@incubator.apache.org


BH> To
BH> "Steven E. Harris" <se...@panix.com>
BH> cc
BH> felix-dev@incubator.apache.org
BH> Subject
BH> Re: Bundle plugin/BND question -- Service-Component header






BH> It turned out that the ProSyst implementation of Declarative Services
BH> threw an exception if there was a bind method and no unbind method. I
BH> think this is wrong, but I was not up for a fight about it so I added
BH> the unbind method. I'll update the documentation to reflect this.

BH> I find it is no real problem to not implement the unbind method even
BH> though it is i the XML file.

BH> Kind regards,

BH>      Peter Kriens
BH>  



SEH>> The BND documentation¹ states that a Service-Component reference with 
BH> a
SEH>> lowercase name provokes a bean-style "set" method to be mentioned in
SEH>> the generated XML resource:

SEH>> ,----[ Service-Component Header section ]
SEH>> | In that case the reference is augmented with a set<Name> method
SEH>> | according to the standard bean rules. An unset<Name> method is 
BH> added
SEH>> | when the name appears in the list that is given to the dynamic
SEH>> | directive.
SEH>> `----

SEH>> Note the second sentence, which says that a corresponding "unset"
SEH>> method will be mentioned if the reference is noted as being of
SEH>> "dynamic" policy.

SEH>> Later the document states that the default policy is "static":

SEH>> ,----
SEH>> | The defaults are therefore aligned with the SCR: a cardinality of
SEH>> | 1..1, and static policy.
SEH>> `----

SEH>> However, I notice that with a maven-bundle-plugin directive like 
BH> this:

SEH>>   <Service-Component>com.foo.impl.BarImpl;
SEH>>                      provide:=com.foo.Bar;
SEH>>                      quux=com.foo.Quux</Service-Component>

SEH>> The resulting OSGI-INF/com.foo.impl.BarImpl.xml file contains a
SEH>> "reference" element like so:

SEH>>     <reference name='quux'
SEH>>                interface='com.foo.Quux'
SEH>>                bind='setQuux'
SEH>>                unbind='unsetQuux'/>

SEH>> Note the presence of the "unbind" attribute. This conflicts with the
SEH>> documentation above that states that the unbind method will only be
SEH>> mentioned for "dynamic" policies.

SEH>> Am I missing something, or is this a bug in BND?


SEH>> Footnotes: 
SEH>> ¹ http://www.aqute.biz/Code/Bnd





-- 
Peter Kriens                              Tel +33467542167
9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
34160 Beaulieu, France                    ICQ 255570717
Skype pkriens                             Fax +1 8153772599