Spring DM Support

Easy startup of Spring DM enabled bundles using spring.dm profile (available starting with version 0.6.0 of Pax Runner)
Pax Runner has a built in profile that facilitates easy startup of Spring DM enabled bundles. To achieve this you just have to use the startup option --profiles=spring.dm.
For example to startup all the spring dm related bundles you just have to:

pax-run --profiles=spring.dm

See bellow how you can startup the simple service example bundle from Spring DM (note that you have to have the simple-bundle-service in your local maven repository). The example does not do much but you will be able to see in the console logging output from spring and after the startup is done you can use a framework command to verify that the simple service bundle has a couple of registered services and services in use. This means that the spring dm extender did it's job.

pax-run --profiles=spring.dm mvn:org.springframework.osgi.samples/simple-service-bundle

Use any of Pax Runner url handlers via Spring OSGi <osgi:bundle/> support

Spring-DM offers a dedicated schema element for interacting with existing bundles or for installing new ones (read more about on Spring DM site).
Where Pax Runner can help is related to the fact that it allows you to easy install any bundle that can be handled by Pax Runner handlers such as:

  • Pax URL - mvn
    Error rendering macro 'excerpt-include' : No link could be created for 'Handler - Maven 2'.
  • Pax URL - wrap
    Error rendering macro 'excerpt-include' : No link could be created for 'Handler - Wrap'.
    The wrap handler is the one you should use to replace the (now moved to spring samples) <osgi:virtual-bundle/>

Here are some examples:

Wrap commons logging that is found in the working dir using a file protocol:

<osgi:bundle
  symbolic-name="org.apache.commons.looging"
  location="wrap:file:commons-logging-1.1.jar"
  state="start"/>

Wrap commons logging that is downloaded via http:

<osgi:bundle
  symbolic-name="org.apache.commons.looging"
  location="wrap:http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"
  state="start"/>

A nice one is a combination of the two pax runner handlers, wrap and mvn. This will automatically wrap the commons logging that is found using
a similar discovery mechanism as maven (local-repo,remote repos,...):

<osgi:bundle
  symbolic-name="org.apache.commons.looging"
  location="wrap:mvn:commons-logging/commons-logging/1.1"
  state="start"/>

As you can find out also in the documentation of wrap handler you can specify the instructions in the url or you can specify another file in the url (see examples on the wiki page).

To be able to use this facility the only requirement is that you will have the coresponding bundles (the one that you want to use) deployed
together with your bundles. Read about installation instructions in each handlers documentation page.

Starting up Spring DM enabled profiles without using profile option

If you don't want to use the sprin-dm profile you can still start up all required bundles as follow (watch a screencast)

Alternatively you can even start the same thing without download as:

pax-run --profiles=log --args=http://ops4j1.jira.com/wiki/confluence/download/attachments/5047169/spring-dm-1.0-rc2.args
http://ops4j1.jira.com/wiki/confluence/download/attachments/5047169/spring-dm-1.0-rc2.bundles

Note that the example command line is split in two lines to fit the page but you should have just one line.