Wednesday, 30 October 2013

Felix GoGo inspect command (OSGi R4.3)

I don't really know why I was not able to find a more prominent location on the web for the details of the Apache Felix inspect command in an OSGi shell, but at least I found something:

We've got the mailing list and a corresponding issue, from which I want to summarize the details in this post.

In the Felix gogo command bundle version 0.12.0 the inspect shell command was changed to the following signature:

inspect ('capability' | 'requirement') <namespace> [<bundles>]

Before OSGi R4.3 the namespace was one of  bundle, package, host and service, which now changed to one of  
  • osgi.wiring.bundle
  • osgi.wiring.package
  • and 
  • service

"capability" and "requirement" can be abbreviated with "cap" and "req" respectively, furthermore you can use wildcards for the namespace.

Let' give some examples:

In an OSGi shell, executing a command like

  inspect cap service <bundleId>

might give you something like

The output gives you all the details about the service capabilities of the referenced bundle.

  inspect req service <bundleId>

on the contrary, lists all the service requirements:

What about the other namespaces?

Let's try

  inspect cap osgi.wiring.package <bundleId>

This is the list of all the provided packages of that bundle which comes in handy when trying to understand the package relations if a bundle doesn't want to resolve.

A last tip:

In the gogo shell you can grep the output like this

  inspect cap * 54 | grep pid

This will query all the capabilities of bundle 54 and then grep for the string "pid".