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
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 — The page Handler - Maven 2 does not exist.
- Pax URL - wrap — The page Handler - Wrap does not exist.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"/>
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)
- Download a provision file and args file that matches the version you want to start up and put them into an arbitrary folder:
- Provision file (File Scanner) for Spring DM bundles: [1.0-m3|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-m3.bundles] [1.0-rc1|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-rc1.bundles] [1.0-rc2|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-rc2.bundles] [1.0-SNAPSHOT|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-SNAPSHOT.bundles]
- Args file (to be used with that contains the repositories required for above bundles: [1.0-m3|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-m3.args] [1.0-rc1|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-rc1.args] [1.0-rc2|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-rc2.args] [1.0-SNAPSHOT|ops4j:4.6. Pax Runner - Spring DM^spring-dm-1.0-SNAPSHOT.args]
- From the directory you have downloaded the files, start Pax Runner depending on the version you have downloaded:
Note that the option --profiles=log should be there only if you want to also see the logging output.
pax-run --profiles=log --args=file:spring-dm-1.0-rc2.args spring-dm-1.0-rc2.bundles
Alternatively you can even start the same thing without download as:
pax-run --profiles=log --args=http://wiki.ops4j.org/confluence/download/attachments/5047169/spring-dm-1.0-rc2.args http://wiki.ops4j.org/confluence/download/attachments/5047169/spring-dm-1.0-rc2.bundles