osgi Getting started with osgi Using Apache Felix


Example

Download the Apache Felix Framework Distribution and extract it into a directory:

$ tar xf org.apache.felix.main.distribution-5.4.0.tar.gz
$ cd felix-framework-5.4.0

And then start the framework with the following command:

$ java -jar bin/felix.jar
____________________________
Welcome to Apache Felix Gogo
    
g!

By default, Felix uses Apache Felix Gogo as its interactive shell. The default command prompt, g!, is shown above.

The Gogo shell provides some simple builtin commands to interact with both the Gogo runtime environment, as well as with the OSGi framework itself. Type the help command at the g! prompt to see a list of builtin commands.

One example is the lb (short for list bundles) command which outputs a listing of the OSGi bundles that are currently installed in the framework:

g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (5.4.0)|5.4.0
    1|Active     |    1|Apache Felix Bundle Repository (2.0.6)|2.0.6
    2|Active     |    1|Apache Felix Gogo Command (0.16.0)|0.16.0
    3|Active     |    1|Apache Felix Gogo Runtime (0.16.2)|0.16.2
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)|0.10.0