Hi Christian,

As you noticed, bnd generates these requirements with effective:=active. This 
has no particular meaning in the OSGi specification. The spec only states that 
any value of effective other than “resolve” is ignored by the OSGi Framework*. 
Therefore these requirements should never prevent the bundle being resolved in 
an OSGi Framework.

So it’s entirely up to your resolver implementation how you want to deal with 
these requirements.

In Bndtools we usually do look for providers matching the effective:=active 
requirements, with the exception of requirements in the osgi.service namespace. 
For example we will resolve a requirement for the Blueprint extender 
("osgi.extender=osgi.blueprint”) but we will ignore the service requirements. 
This is because services can be provided remotely via RSA, and we don’t want to 
constraint all of the service providers to appear in a single Framework.

Regards,
Neil.


* Note that the default value for the effective directive is also “resolve”, so 
leaving the directive unset has the same result



> On 5 Jun 2015, at 14:14, Christian Schneider <ch...@die-schneider.net> wrote:
> 
> We are currently discussing at karaf how to treat Require-Capability headers 
> for services like this one:
> osgi.service; effective:=active; filter:="(objectClass=my.Interface)"
> 
> These headers are automaatically created by bnd when it scans blueprint 
> contexts or DS configs.
> 
> So while these headers are created for bundles using services they are not 
> always created as capabilities for bundles that provide the services.
> Karaf 4 currently checks these headers in a strict way when it installs 
> features. This leads to deployment failures when no bundle is found that 
> announces that it provides the service.
> 
> You could say this is only a transitionary period till all bundles providing 
> services announce this. There are cases though where it would be difficult to 
> create the capability headers.
> For example aries jpa container creates EntityManagerFactory services for 
> persistence unit bundles it encounters. So it is not known at compile time 
> that this service will be created.
> 
> So my questions are:
> How should these Require-Capbility headers to be treated? Should they be 
> followed strictly or are they more of a recommendation?
> Does effective:=active mean that the bundle should be resolved but not 
> started until the capability is present or should it even fail to be 
> installed or resolved?
> If these headers are to be followed stictly then the question is does bnd 
> behave correctly by adding them or should it rather omit them?
> 
> Many thanks in advance for your feedback
> 
> Christian
> 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Open Source Architect
> http://www.talend.com
> 
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to