Hey,
If you need access bundle services then you can use a 
bundle.getBundleContext().getRegisteredServices().

One marker here - you will get list of service references only if bundle is in 
active state.
Aries and Spring DM by default expose the container as service. It's a bit more 
tricky to get state of them because container start up is asynchronous and do 
not block bundle to start. 

https://github.com/splatch/karaf-webconsole/blob/develop/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/BlueprintBundleStateTracker.java

This class implements two interfaces BundleListener and BlueprintListener (part 
of osgi-blueprint spec).

I hope this will help!

Best regards,
Lukasz Dywicki
--
Code-House
http://code-house.org

Wiadomość napisana przez homeration w dniu 26 mar 2012, o godz. 11:52:

> Thanks Lukasz.
> 
> I already use this solution to determine if bundle is active. 
> Unfortunately, this is not enough: a bundle can be active while its services
> are not started (start failure).
> In this case, karaf ssh "list" command correctly display this bundle in
> "failure" state.
> 
> I do not know how to retrieve this failure state: the function
> Bundle.getState() continues to return "Active".
> 
> Christophe.
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Retrieves-bundle-registration-state-tp3851245p3857779.html
> Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to