Felix Commands Pack
Written by Clement   
Thursday, 22 March 2007

This project aims to provide useful commands for the Felix console and the possibility to write scripts using these commands. Moreover, these commands can use system or shell variables.

 

These commands are packaged are deployed in one bundle. It gathers several useful commands to write script and to help OSGi development. They need iPOJO to work. This project is directly based on the Didier Donsez works. For any question or feedback, do not hesitate to send me an email.

Image

List of commands 

Comments 

 

It is possible to write comments (useful for scripts). Each comment should begin by '#' or 'rem' or "//".

Examples:

  • # This line is a comment
  • rem This line is another comment 
  • // This line is a third comment 

Deploy Command 

 

This command deploys a bundle as the “start” and “install” commands. However, this command supports variable.  

Examples: 

  • if the variable "repo" is defined and points on a repository, deploy ${repo}/my_bundle.jar installs and starts my_bundle
  •  if the variable "repo" is defined and points on a repository, deploy --install ${repo}/my_bundle.jar installs my_bundle only

Echo Command 

 

This command prints the given message. Variables are supported.

Examples:

  • echo Hello World displays "Hello World"
  • if the variable 'w' is defined and 'w = world', echo Hello ${w} displays "Hello World"

Garbage ColLECtor Command

 

This command launches the garbage collector.

Examples:

  • gc : displays the number of collected bytes.

Log Command

 

If a log service is available, this command prints the last messages. This command is not accessible if no log service is available.

Examples:

  • log : displays logged message with as "[Log.Level] Message"

MVN DEPLOY COMMAND

 

The “mvndeploy” command looks for a bundle inside a bundle repository. This command uses the "m2.repo" variable. This variable needs to point on the local maven repository.

The “mvndeploy” command searches inside the maven repository all artifacts (jar file) containing the given argument in their name. If several matching artifacts are found, the list is displayed and you need to refine your query.

Examples:

  • mvndeploy logservice : looks for a Jar file containing 'logservice' in the name, if found install and start the bundle. 
  • mvndeploy --install compendium : look for the compendium in the maven repository, if found it install the bundle.

Properties Command

 

The properties command display all defined variable. The properties are: system properties, framework properties, and shell properties.

Examples:

  • Properties : displays the list of defined properties

Run Command

 

The run command allows executing a script file. The script can contain any available command. The script supports variable. A script file is a simple text file containing the sequence of commands to execute.

Examples:

  •  run <url of the script file> : executes the script

SET COMMAND

The set command allows defining a variable for this shell. Properties are stored inside the Shell context service. A command can substitute variable by using this service.

Examples:

  • set nickname clement : associates the nickname variable to clement
  • echo My nickname is ${nickname} : displays 'My nickname is clement'.

SETPROPERTY COMMAND

This command set a system property.

Examples: 

  • setproperty nickname=clement set the system property nickname to clement

WAIT COMMAND

This command waits for a given time in second.

Examples:

  • wait 1 : waits one second.

WAITFOR COMMAND

This command allow to stop the execution of a script until an event. This event can be the the registering of a service or the availability of a class.

Examples :

  • waitfor service (OBJECTCLASS="org.osgi.log.LogService") : waits  for the apparition of the log service.
  • waitfor service 10 (OBJECTCLASS="org.osgi.log.LogService") : waits  for the apparition of the log service, if no log service are available in the 10s, the command fails.
  • waitfor class org.osgi.log.LogService : waits for the apparition of a bundle exporting the log service. 
  • waitfor class 10 org.osgi.log.LogService : waits for the apparition of a bundle exporting the log service class. After 10s , the command fails.

Downloads

You can find binaries and source code here. The actual version is the 0.1.0.

Changelog 

  • 2007-03-22 : release of the 0.1.0 version.
Last Updated ( Saturday, 24 March 2007 )