Tuesday, 1 December 2009

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.

The interesting thing about nimble resolution is that it doesn't just figure out the bundles that need to be installed. It also figures out what state these bundles should be in. If you look at the bundles in the nimble container using the command lsb you will see that not only are all the bundles installed but certain key bundles have also been activated:

lsb
*nimble/com.paremus.util.cmds-1.0.4.jar 00:00 59Kb
0 ACTIVE org.eclipse.osgi:3.5.1.R35x_v20090827
1 ACTIVE com.paremus.posh.runtime:1.0.4
2 ACTIVE com.paremus.posh.shell:1.0.4
3 RESOLVED com.paremus.util.types:1.0.4
4 ACTIVE com.paremus.nimble.core:1.0.4
5 ACTIVE com.paremus.nimble.repos:1.0.4
6 ACTIVE com.paremus.nimble.cli:1.0.4
7 RESOLVED javax.servlet:2.5.0.v200806031605
8 RESOLVED com.springsource.slf4j.api:1.5.6
9 RESOLVED com.springsource.slf4j.nop:1.5.6
10 RESOLVED com.springsource.net.sf.cglib:2.1.3
11 RESOLVED com.springsource.edu.emory.mathcs.backport:3.1.0
12 RESOLVED org.springframework.osgi.log4j.osgi:1.2.15.SNAPSHOT
13 RESOLVED com.springsource.org.aopalliance:1.0.0
14 RESOLVED org.springframework.osgi.jsp-api.osgi:2.0.0.SNAPSHOT
15 RESOLVED com.springsource.slf4j.org.apache.commons.logging:1.5.6
16 RESOLVED osgi.cmpn:4.2.0.200908310645
17 RESOLVED org.mortbay.jetty.util:6.1.9
18 RESOLVED org.springframework.osgi.jstl.osgi:1.1.2.SNAPSHOT
19 RESOLVED org.springframework.core:2.5.6.A
20 RESOLVED org.springframework.osgi.commons-el.osgi:1.0.0.SNAPSHOT
21 RESOLVED org.mortbay.jetty.server:6.1.9
22 ACTIVE org.springframework.osgi.samples.simplewebapp:0.0.0
23 RESOLVED org.springframework.beans:2.5.6.A
24 RESOLVED org.springframework.osgi.io:1.2.0
25 RESOLVED org.springframework.osgi.jasper.osgi:5.5.23.SNAPSHOT
26 RESOLVED org.springframework.aop:2.5.6.A
27 RESOLVED org.springframework.osgi.catalina.osgi:5.5.23.SNAPSHOT
28 RESOLVED org.springframework.context:2.5.6.A
29 ACTIVE org.springframework.osgi.catalina.start.osgi:1.0.0
30 RESOLVED org.springframework.osgi.core:1.2.0
31 RESOLVED org.springframework.web:2.5.6.A
32 RESOLVED org.springframework.osgi.web:1.2.0
33 ACTIVE org.springframework.osgi.web.extender:1.2.0
34 ACTIVE com.paremus.posh.readline:1.0.4
35 ACTIVE com.paremus.util.cmds:1.0.4

This listing also demonstates another key feature of nimble. Typing lsb resulted in the following log line:

*nimble/com.paremus.util.cmds-1.0.4.jar                           00:00    59Kb

This demonstrates that the nimble container resolved the lsb command from its repository index and installed it on the fly. In fact if you look at the Nimble download it is only 55K in size. All of the extra functionality is automatically downloaded based on information provided via the nimble index files and traversing package and service level dependencies!

To complete this blog post you can browse the simple web app running from nimble by opening:

http://localhost:8080/simple-web-app/

Nimble is available for download here.

3 comments:

Rayan said...

Hey David

Just tried it and got an error:

....
*equinox-cmpn/equinox-cmpn-1.xml 00:00 15Kb
--command: IllegalArgumentException: Command not found: jline
________________________________________
Welcome to Paremus Nimble!
Type 'help' for help.
posh: java.lang.IllegalArgumentException: Command not found: jline

David Savage said...

So this is related to an old ~/.posh/posh_profile file

Your seeing this as you've tried out a previous release of Nimble as part of the Paremus Service Fabric.

Basically this error is caused by the fact that the posh_profile script referenced the jline command that has since been removed.

To fix this error using the nuclear option you can simply delete the ~/.posh directory and nimble will regenerate it when it restarts.

Unknown said...

The springdm exists no longer! Any hope of an update with a camparable replacement (say, Gemini Blueprint)?