Daily Archives: December 1, 2009


And for my next trick

Just for fun and to demonstrate the power of the Posh (sh)ell environment I decided to knock together the following trivial script to do a “traditional” OSGi bundle file install from a directory:

// create a temporary array for storing ids
array = new java.util.ArrayList;

// iterate over the files passed
// in as arguement 1 to this script
each (glob $1/*) {

// use the BundleContext.installBundle
// method to install each bundle
id=osgi:installBundle $it;

// store the bundle id for start later
$array add $id;
};

// iterate over our installed bundles
each ($array) {
// use the BundleContext.start method
//to start it
osgi:start $it;
};

To try this out for yourself or to find out more about Nimble you look here once installed you can run the above script using the following command:

posh -k http://chronological-thought.googlecode.com/svn/trunk/nimble-examples/file-install.osh <your bundles dir>

Where you should replace <your bundles dir> with a path to a directory on your local file system that contains bundles.

Hmmm what to blog next…ponders…

Laters,


Nimble OSGi

So I just sent a rather cryptic twitter message with the instructions:

posh -kc “repos -l springdm;add org.springframework.osgi.samples.simplewebapp@active”

I figure it’s probably worth a short note to explain what this is doing given the narrowband aspect of twitter communications.

This command is running an instance of the posh (sh)ell which ships with Nimble. There are two switch parameters parsed to the shell:

-c: Tells posh to execute the command passed in from the unix shell in the posh (sh)ell environment
-k: Tells posh to remain running after the command has completed and open a tty session for user input

Now we come to the actual commands:

repos -l springdm: tells posh to load the spring dm repository index into the nimble resolver

add org.springframework.osgi.samples.simplewebapp@active: tells nimble to resolve all dependencies for the spring simplewebapp from it’s configured repositories. (more…)