2

How can I reach the information that is available through the "ls" and "comp [id]" commands in the OSGi console programmatically so that I can log information about unsatisfied references?

2 Answers2

3

You can get all information via the OSGi service that is registered with the ServiceComponentRuntime interface.

Balazs Zsoldos
  • 6,036
  • 2
  • 23
  • 31
1

In Equinox org.apache.felix.scr.ScrService serves a purpose similar to the SerivceComponentRuntime mentioned above, which I couldn't find in Eclipse Mars 2.

org.apache.felix.scr.ScrService is located in org.eclipse.equinox.ds bundle.

Sample reference definition:

 <reference 
    bind="setScrService" 
    cardinality="0..1" 
    interface="org.apache.felix.scr.ScrService" 
    name="ScrService" 
    policy="static"/>
Pavel Vlasov
  • 131
  • 5
  • Thank you. This is the one I needed. I am using the service from outside of the OSGi framework, so I found [this solution](http://stackoverflow.com/questions/16150855/using-service-component-runtime) to get it to work in stead of the sample reference you have provided. – Katrine Skovbo Apr 25 '16 at 12:04