Apache Felix GoGo Shell provides the command line
interface to manage bundle in the OSGi container. We can use Gogo shell to
interact with OSGi bundles and we can manage its lifecycle like install bundles, start bundles, stop
bundles and uninstall bundles. Apache Felix implementing the OSGi RFC 147, which describes a
standard shell for OSGi-based environments.
More information 
Felix Gogo Shell implemented as three bundles and the following are three bundles which should be available
in OSGi container then only we can use Apache
Felix Gogo shell.
| 
runtime - implements
  the core command processing functionality. 
shell - provides a simple textual user
  interface to interact with the command processor. 
command - implements a
  set of basic commands. | 
When we start Apache Felix OSGi container Gogo shell automatically started and available
for use. These three bundles are alredy deployed in auto deploy directory of
Apache Felix, so that as soon as Apache Felix started then Gogo shell will be available.
The following three bundles, which are available in Apache Felix “bundles” directory and
its auto deployment directory for Apache Felix OSGi container.
Once we started Apache
Felix then Gogo shell, it will be available as command line interface where
we can use defined commands to interact with OSGi container to manage bundles.
Once you started Apache Felix then you can see “Welcome to Apache Felix Gogo” message
with g! , this is Gogo shell. 
We can list available bundle in the OSGi container by
using lb command.
The
following are few important GoGo Shell commands which we can use regularly.
| 
felix:headers : To see
  available Bundle headers in OSGi container 
OR
   
headers : To see
  available Bundle headers in OSGi container | 
The
following screen shows available bundles headers in the OSGi container
| 
felix:help : To get help
  related to available commands. We can see all available commands in the
  shell. 
OR
   
help : To get help related to available
  commands. We can see all available commands in the shell. | 
The
following screen shows the help command
| 
felix:install : Install OSGi
  bundles 
OR
   
install : Install OSGi
  bundles 
Note:  
We
  need to specify the bundle path to install bundle. Once bundle is installed then
  it will show the bundle ID. | 
The
following screen shows the install a bundle
| 
felix:start : This command
  will use to start installed bundle in the OSGi container. it means activate
  bundle in the OSGi container 
OR 
start : This command
  will use to start installed bundle in the OSGi container. it means activate
  bundle in the OSGi container. 
Note: 
This
  start command will expect the bundle ID to start the bundle. When we list the
  bundles, we can see Bundle IDs or when we installed the bundle then it will
  return the current installed bundle ID. | 
The
following screen shows the start bundle
| 
felix:stop : This command
  will stop bundle or deactivate bundle from OSGi container 
OR 
stop : This command will stop bundle or
  deactivate bundle from OSGi container. 
Note: 
This
  stop command will expect the bundle ID to stop the bundle. When we list the
  bundle then we can see Bundle IDs. When bundle is deactivated then it goes to
  resolved state it means bundle is installed but not in use. | 
The
following screen shows stop bundle 
| 
felix:uninstall : This command
  uninstall the bundle from container 
OR 
uninstall : This command
  uninstall the bundle from container 
Note: 
We
  need to specify the bundle path to uninstall bundle. Once bundle is uninstalled
  then it will disappear from the bundles list, it means it’s not available in
  the OSGi container. | 
The
following screen show uninstall bundle
Apart from above commands we can find many commands in
the Gogo shell and all we can see by using help command.
Liferay 7 already deployed Apache Felix Gogo Shell bundles in the OSGi container and it will
start when we start Liferay 7 portal. We can see complete details about Apache Felix
Gogo Shell usage in the Liferay 7 portal in the future articles.
Author
 

 
 
 Posts
Posts
 
 
