Katrine Skovbo
Katrine Skovbo

Reputation: 23

How to discover unsatisfied declarative services references in OSGi programmatically

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?

Upvotes: 2

Views: 461

Answers (2)

Pavel Vlasov
Pavel Vlasov

Reputation: 161

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"/>

Upvotes: 1

Balazs Zsoldos
Balazs Zsoldos

Reputation: 6046

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

Upvotes: 3

Related Questions