Felix' support for fragments should be good in 1.8.x and is actually passing 
the TCK in the trunk build...I won't claim it is without bugs, though. :-)

I am not convinced the fragments are the best way to do this, but I agree that 
it is a workable approach.

Using META-INF/services is not great in OSGi, largely due to its design. The 
most common approach, as mentioned, is to use the extender pattern where you 
probe bundles for META-INF/services and then inject them were appropriate. 
However, as pointed out, this can be problematic if the code getting injected 
doesn't ever expect those to go away, which can happen with a bundle.

To follow a more OSGi-like approach you can have the extender just register 
services for each META-INF/services object (or directly create wrapper bundles 
for each that does this). Then you could have a wrapper bundle for the core 
that listens for the appropriate services in the OSGi registry and injects them 
appropriately. This way, you only need to have OSGi API in the 
wrappers/extender, not in the core or the extensions. Of course, dynamism is 
still an issue here.

Not sure if such an approach is possible here, but some thoughts...

-> richard (Apache Felix)

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2382917

Reply via email to