1

I’m currently “struggling” with OSGi services, or to be more specific, with the wiring between the services. I’m aware of the basics of DS, SCR and the general strategies for a component instance to acquire services. Anyway, here is my problem:

Following DS, components declare e.g. their provided and consumed services in a XML-file. In my case, I’m interested in the “consumed/referenced” services of a particular component (which are declared by the “Reference” tag in the component’s XML-file).

E.g. consider a running OSGi-application: a bunch of bundles collaborating with each other based on services (DS). Now, I want to pick a particular bundle and query all its references to the services it (may) consume - no matter if these services are currently available or not.

Referring to Apache Felix GoGo shell commands, like inspect requirements *, I do get information about the imported packages etc. but not a complete overview about the consumed services (-> both currently consumed services and services the component is waiting for).

I’ve read about the Framework API which provides insight in the registration, modification and deregistration of service but apparently, it does not provide the information about what services bundles are waiting for. Following the OSGi core specification, this could be achieved by a Listener Hook.

Isn’t there a way, where I just can query e.g. the SCR to get all referenced services of a specific bundle? Obviously, the SCR is supposed to read the bundle’s Service-Component-XML-file and to “register” some kind of “Service Tracker” to track the consumed/referenced services – hence the information of a bundle’s consumed/referenced services should somehow be available, shouldn’t it?

It would be great if you could help me with this.

Thanks, Don

don
  • 11
  • 1

1 Answers1

0

Checkout xray, http://softwaresimplexity.blogspot.com/2012/07/xray-again.html, from Peter Kriens.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27
  • That's exactly the information I'm looking for. I'll have a look at the code, thanks. However, as I supposed in the above-mentioned question, it seems like there _isn't a way, where I just can query e.g. the SCR to get all referenced services of a specific bundle_, right? – don Mar 20 '14 at 10:09
  • The DS spec does not offer such an introspective API yet. [RFC 190](https://github.com/osgi/design/raw/master/rfcs/rfc0190/rfc-0190-Declarative_Services_Enhancements.pdf) proposes adding one in the next release. Apache Felix DS implementation has its own implementation specific introspection API which is what xray uses. – BJ Hargrave Mar 20 '14 at 11:30