Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to view registered services in an OSGi application?

Tags:

list

service

osgi

I have an OSGi application running Equinox. I'd like to see the services that are provided by the application. How can I do this?

like image 634
user840930 Avatar asked Aug 07 '12 15:08

user840930


2 Answers

From the gogo shell type:

inspect cap service

That will show all services registered by all bundles. If you want to show services for a specific bundle then type:

inspect cap service <id>

Where <id> is the numeric bundle ID of the bundle you are interested in.

like image 129
Neil Bartlett Avatar answered Sep 19 '22 16:09

Neil Bartlett


It depends whether you mean interactively, using an OSGi shell, or programmatically from your application.

Interactively

You can use the Equinox console. See 'services'. To only see the services you have deployed you need to use an LDAP filter. Here's an example:

(objectClass=my.package.name.*)

Also see @Neil Bartlett's answer which might be easier as you can just constrain by bundle id (assuming you know it, but that's easy to find).

Programatically

Use the ServiceTracker approach. Neil also wrote all about this, so make sure to give him your upvotes too :)

like image 42
Dan Gravell Avatar answered Sep 22 '22 16:09

Dan Gravell