The Felix iPOJO Gogo Command bundle (previously arch)
provides access to the components and instances held by the iPOJO service. It is a useful tool when debugging injection by providing information on the instances and interconnects that iPOJO holds.
It can be started from the following OBR:
g! deploy -s "Apache Felix iPOJO Gogo Command"
At the time of writing this section, the iPOJO Gogo Command was just released and still had a few install issues (for example, deploying using OBR attempts to install another version of iPOJO). If you face a similar issue, then install it using a direct link to one of the available mirrors:
g! start http://www.ibiblio.org/pub/mirrors/apache/felix/org.apache.felix.ipojo.arch.gogo-1.0.0.jar
[WARNING] org.apache.felix.ipojo.arch.gogo.Arch : The specification org.
apache.felix.ipojo.arch.gogo.Arch is not implemented by org.apache.felix.
ipojo.arch.gogo.Arch it might be a superclass or the class itself.
The warning we just saw can be ignored.
The following commands are provided by the iPOJO Gogo Command bundle. They are in the ipojo
scope:
factories:
To list the registered factoriesfactory factoryName:
To display information on the given factoryinstances:
To list the registered instancesinstance instanceName:
To display information on the given instancehandlers:
To list registered handlersThe factories are our component declarations. Handlers are a more advanced topic, worth exploring if you'd like to extend iPOJO.
For example, the following command is used to list the instances iPOJO currently knows about:
g! instances
Instance bookshelf.inventory.impl.mock -> valid
Instance org.apache.felix.ipojo.arch.gogo.Arch-0 -> valid
The first item in the list is our bookshelf inventory implementation instance. Its details are retrieved as follows (output reformatted):
g! instance bookshelf.inventory.impl.mock
instance
component.type="BookInventoryMockImpl"
state="valid"
bundle="6"
name="bookshelf.inventory.impl.mock"
handler
state="valid"
name="org.apache.felix.ipojo:provides"
provides
service.id="27"
state="registered"
specifications=
"[com.packtpub.felix.bookshelf.inventory.api.BookInventory]"
property value="BookInventoryMockImpl"
name="factory.name"
property value="bookshelf.inventory.impl.mock"
name="instance.name"
handler
state="valid"
name="org.apache.felix.ipojo:architecture"
Notice the instance is bound to the bookshelf-inventory-mock-impl
bundle (ID 6), and it provides the com.packtpub.felix.bookshelf.inventory.api.BookInventory
service specification.