A request for comments (RFC 147) by Peter Kriens, an attachment to the OSGi 4.2 specifications document early draft, describes a proposed interface for the processing and launching of commands for the OSGi framework. It defines the blueprint for a shell service and its language.
The goal behind such an endeavor is to attempt to standardize the way humans and external systems to interact with an OSGi framework using a text command-based interface. For example, such an interface would be used for launching, configuring, and controlling the framework using a local or remote console or scripting without locking an enterprise platform to a specific OSGi framework implementation.
Felix Gogo, a sub-project of Apache Felix, is an implementation of this early draft specification. The Gogo shell is included with the Felix Framework Distribution since version 3.0.
The Tiny Shell Language:
The command syntax for the shell interface is based on the Tiny Shell Language (TSL). It is simple enough to allow a lightweight implementation, yet provides features such as pipes, closures, variable setting and referencing, collection types such as lists and maps, and so on.The TSL syntax allows the creation of scripts that can be executed by the shell runtime service.
Access Gogo Shell in Liferay:
We can use Felix Gogo Shell to interact with Liferay’s module framework. Using telnet client we can connect to the port 11311 to access Gogo shell in Liferay 7. In your command prompt type the below to access Gogo shell
telnet localhost 11311
Note 1: By default in windows telnet command may not work. Before using it we must have to enable it.
Note 2: We can also use putty software to access the Gogo shell
Note 3: In this article we have used putty for connecting to Gogo shell
Connect to Gogo Shell by Putty:
Here is the screen shot how we connected to Gogo shell using putty
Once you are successfully connected the Gogo shell looks like below. The g! indicates the gogo shell
Now we are ready to execute our command in the shell. Here is the few examples
List Bundle Command (lb):
We can use list bundle command (lb) to display all the bundles that are installed. Below is the screen shot
Help Command (help):
Just type help in the gogo shell and press enter. It will list out all the available commands that we can run. Below is the full list of commands
Welcome to Apache Felix Gogo g! help dependencymanager:dm equinox:b equinox:bundle equinox:bundles equinox:classSpaces equinox:close equinox:diag equinox:disconnect equinox:exec equinox:exit equinox:fork equinox:gc equinox:getPackages equinox:getprop equinox:h equinox:headers equinox:help equinox:i equinox:init equinox:install equinox:man equinox:p equinox:packages equinox:pr equinox:profilelog equinox:props equinox:r equinox:refresh equinox:requiredBundles equinox:s equinox:se equinox:services equinox:setbsl equinox:setfwsl equinox:setibsl equinox:setp equinox:setprop equinox:shutdown equinox:sl equinox:ss equinox:sta equinox:start equinox:status equinox:sto equinox:stop equinox:t equinox:telnet equinox:threads equinox:un equinox:uninstall equinox:up equinox:update felix:bundlelevel felix:cd felix:frameworklevel felix:headers felix:help felix:inspect felix:install felix:lb felix:log felix:ls felix:refresh felix:resolve felix:start felix:stop felix:uninstall felix:update felix:which gogo:cat gogo:each gogo:echo gogo:format gogo:getopt gogo:gosh gogo:grep gogo:not gogo:set gogo:sh gogo:source gogo:tac gogo:telnetd gogo:type gogo:until obr:deploy obr:info obr:javadoc obr:list obr:repos obr:source scr:config scr:disable scr:enable scr:info scr:list upgrade:execute upgrade:list verify:execute verify:executeAll verify:list verify:show verify:showReports g!
Know more about a command using help command:
We can use help command to know more about a command. For example we want to know more about lb command . So we can use help command as below
Welcome to Apache Felix Gogo g! help lb lb - list installed bundles matching a substring scope: felix flags: -l, --location show location -s, --symbolicname show symbolic name -u, --updatelocation show update location parameters: String subtring matched against name or symbolic name lb - list all installed bundles scope: felix flags: -l, --location show location -s, --symbolicname show symbolic name -u, --updatelocation show update location g!
Using grep command along with lb command:
When we execute lb command it list out all the installed bundles. The output may be huge. So to narrow down our output items we can use grep command. grep is basically used for searching string in unix system. For example in the below we are listing out all the installed bundles which has Apache word in the bundle name.By default below command is case sensitive.
Welcome to Apache Felix Gogo g! lb | grep Apache 1|Active | 6|Apache Felix Configuration Admin Service (1.8.8) 5|Active | 6|Apache Felix EventAdmin (1.4.6) 6|Active | 6|Apache Aries JMX API (1.1.1) 7|Active | 6|Apache Aries Util (1.0.0) 8|Active | 6|Apache Aries JMX Core (1.1.3) 9|Active | 6|Apache Felix Declarative Services (2.0.2) 10|Active | 6|Apache Felix Bundle Repository (2.0.2) 11|Active | 6|Apache Felix Gogo Runtime (0.10.0) 12|Active | 6|Apache Felix Gogo Shell (0.10.0) 13|Active | 6|Apache Felix Gogo Command (0.12.0) 21|Active | 6|Apache Felix File Install (3.5.1.SNAPSHOT) 40|Active | 1|Apache Commons FileUpload Bundle (1.2.1) 41|Active | 1|Apache Commons IO Bundle (1.4.0) 122|Active | 1|Apache Felix Dependency Manager (3.2.0) 133|Active | 1|Apache Felix Dependency Manager Shell (3.2.0) true g!
In this article we have just given idea on how to use gogo shell and we demonstrated only basic commands. However we can do more complex stuff in the gogo shell. For example we can install bundle, uninstall bundle, stop bundle etc. using the shell. You can explore all the commands by executing help command in the shell.
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.