Table of Contents

Apache Felix

http://felix.apache.org/

Apache Felix is a community effort to implement the OSGi Framework and Service platform and other interesting OSGi-related technologies under the Apache license.

Apache Felix Gogo

http://felix.apache.org/documentation/subprojects/apache-felix-gogo.html

Apache Felix Gogo is a subproject of Apache Felix implementing a command line shell for OSGi. It is used in many OSGi runtimes and servers (Felix distro, Eclipse IDE, Apache Karaf, …).

All commands here: http://felix.apache.org/documentation/subprojects/apache-felix-gogo.html

Commands

Launch Gogo

java -jar bin/felix.jar 
Welcome to Apache Felix Gogo

List bundles

lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (6.0.1)|6.0.1
    1|Active     |    1|JLine Bundle (3.7.0)|3.7.0
    2|Active     |    1|Apache Felix Gogo Command (1.0.2)|1.0.2
    3|Active     |    1|Apache Felix Gogo JLine Shell (1.1.0)|1.1.0
    4|Active     |    1|Apache Felix Gogo Runtime (1.1.0)|1.1.0
    5|Active     |    1|MJ-OSGIHelloWorldProvider (1.0.0)|1.0.0
    6|Installed  |    1|osgi.core (6.0.0.201403061837)|6.0.0.201403061837

Install bundle

install file:///E:/MJ/OSGIHelloWorldProvider/target/osgi.hello-world-provider-1.2-SNAPSHOT.jar         
Bundle ID: 5

Start bundle

start 5

Check bundle status

bundle 5
Location             file:/E:/MJ/OSGIHelloWorld/target/osgi.hello-world.jar
State                32
LastModified         1548357508506
Headers              [Export-Package=ro.medjava.osgi.provider.able;version="1.0.0",ro.medjava.osgi.provider;uses:="org.osgi.framework";version="1.0.0", Bundle-ManifestVersion=2, Bundle-SymbolicName=MJ-OSGIHelloWorldProvider, Bundle-Version=1.0.0, Created-By=1.8.0_111 (Oracle Corporation), Manifest-Version=1.0, Bnd-LastModified=1548356548522, Bundle-Name=MJ-OSGIHelloWorldProvider, Import-Package=org.osgi.framework,ro.medjava.osgi.provider.able, Bundle-Activator=ro.medjava.osgi.provider.ProviderActivator, Require-Capability=osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))", Tool=Bnd-4.0.0.201805111645]
Version              1.0.0
BundleContext        org.apache.felix.framework.BundleContextImpl@9bf0b04
RegisteredServices   [HelloWorldService]
Bundle                   5|Active     |    1|MJ-OSGIHelloWorldProvider (1.0.0)
Revisions            [MJ-OSGIHelloWorldProvider [5](R 5.0)]
SymbolicName         MJ-OSGIHelloWorldProvider
BundleId             5
ServicesInUse        null

Stop bundle

stop 5

Uninstall bundle

uninstall 5

List all services

inspect capability service

or - short version:

inspect cap service
org.apache.felix.framework [0] provides:
----------------------------------------
service; org.osgi.service.resolver.Resolver with properties:
   service.bundleid = 0
   service.id = 1
   service.scope = singleton
service; org.osgi.service.packageadmin.PackageAdmin with properties:
   service.bundleid = 0
   service.id = 2
   service.scope = singleton
service; org.osgi.service.startlevel.StartLevel with properties:
   service.bundleid = 0
   service.id = 3
   service.scope = singleton
   Used by:
      org.apache.felix.framework [0]

org.jline [1] provides:
-----------------------
service [EMPTY]

org.apache.felix.gogo.command [2] provides:
-------------------------------------------
service; org.apache.felix.gogo.command.Basic with properties:
   osgi.command.function = bundlelevel, frameworklevel, headers, help, install, lb, log, refresh, resolve, start, stop, uninstall, update, which
   osgi.command.scope = felix
   service.bundleid = 2
   service.id = 4
   service.scope = singleton
service; org.apache.felix.gogo.command.Inspect with properties:
   osgi.command.function = inspect
   osgi.command.scope = felix
   service.bundleid = 2
   service.id = 5
   service.scope = singleton
   Used by:
      org.apache.felix.gogo.runtime [4]
service; org.apache.felix.gogo.command.Files with properties:
   osgi.command.function = cd, ls
   osgi.command.scope = felix
   service.bundleid = 2
   service.id = 6
   service.scope = singleton

org.apache.felix.gogo.jline [3] provides:
-----------------------------------------
service; org.apache.felix.service.command.Converter with properties:
   service.bundleid = 3
   service.id = 9
   service.scope = singleton
   Used by:
      org.apache.felix.gogo.runtime [4]
service; org.apache.felix.gogo.jline.Builtin with properties:
   osgi.command.function = format, getopt, new, set, tac, type, jobs, fg, bg, keymap, setopt, unsetopt, complete, history, widget, __files, __directories, __usage_completion
   osgi.command.scope = gogo
   service.bundleid = 3
   service.id = 10
   service.scope = singleton
service; org.apache.felix.gogo.jline.Procedural with properties:
   osgi.command.function = each, if, not, throw, try, until, while, break, continue
   osgi.command.scope = gogo
   service.bundleid = 3
   service.id = 11
   service.scope = singleton
service; org.apache.felix.gogo.jline.Posix with properties:
   osgi.command.function = cat, echo, grep, sort, sleep, cd, pwd, ls, less, watch, nano, tmux, head, tail, clear, wc, date, ttop
   osgi.command.scope = gogo
   service.bundleid = 3
   service.id = 12
   service.scope = singleton
service; org.apache.felix.gogo.jline.Shell with properties:
   osgi.command.function = gosh, sh, source, help
   osgi.command.scope = gogo
   service.bundleid = 3
   service.id = 13
   service.scope = singleton

org.apache.felix.gogo.runtime [4] provides:
-------------------------------------------
service; org.apache.felix.service.threadio.ThreadIO with properties:
   service.bundleid = 4
   service.id = 7
   service.scope = singleton
service; org.apache.felix.service.command.CommandProcessor with properties:
   service.bundleid = 4
   service.id = 8
   service.scope = singleton
   Used by:
      org.apache.felix.gogo.jline [3]

MJ-OSGIHelloWorldProvider [5] provides:
---------------------------------------
service; ro.medjava.osgi.provider.able.HelloWorldService with properties:
   service.bundleid = 5
   service.id = 15
   service.scope = singleton

Bundle 6 is not resolved.

Lists all services provided by a bundle

inspect cap service 5
MJ-OSGIHelloWorldProvider [5] provides:
---------------------------------------
service; ro.medjava.osgi.provider.able.HelloWorldService with properties:
   service.bundleid = 5
   service.id = 15
   service.scope = singleton

Exit shell

CTRL + D