felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kriens <Peter.Kri...@aQute.biz>
Subject Re: Bundle plugin/BND question -- Service-Component header
Date Fri, 23 Feb 2007 07:32:24 GMT
It turned out that the ProSyst implementation of Declarative Services
threw an exception if there was a bind method and no unbind method. I
think this is wrong, but I was not up for a fight about it so I added
the unbind method. I'll update the documentation to reflect this.

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

Kind regards,

     Peter Kriens

SEH> The BND documentation¹ states that a Service-Component reference with 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 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 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

View raw message