Composite provisioning

Composite provisioning

As you could see in the rest of provisioning options, you are able to specify just one "type" of source of bundles. But what if you wanna combine them? For example you need to combine some bundles you know the urls, a pom and all the bundles from a directory on the file system. That is what scan-composite: is all about: combine any other provisioning options of Pax Runner.

You can use this provisioning option using the following provisioning spec:

scan-composite:<url>

where url is any url supported by standard Java or Pax URL and it must refer to a file that is compliant to the following format.

Examples of composite scanner usage

Here are some examples of how to use the composite scanner with Pax Runner:

The provision file foo.composite is on the file system in the current directory:

pax-run scan-composite:file:foo.composite

The provision file foo.composite is on the file system in directory /Users/Somebody:

pax-run scan-composite:file:/Users/Somebody/foo.composite

The provision file is on the web accessible via http:

pax-run scan-composite:https://www.foo.org/bar

The provision file is a maven artifact of type composite (not necessary)

pax-run scan-composite:mvn:some.group/foo/1.2.0/composite

Composite file format

The file specified by the scan-composite: URL must be a plain text file that contains on each line another provisioning spec. The file can contain also empty lines or lines that are starting with #, lines that will be just skipped, meaning that have no effect on the bundles that are provisioned.

Lets take an example file (this file is actually a composite file used when you specify the spring.dm/1.1.2 profile):

foo.composite
#SpringSource Framework
scan-composite:mvn:org.ops4j.pax.runner.profiles/spring/2.5.5/composite

#SpringSource Dynamic Modules (DM)
scan-bundle:mvn:org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3
scan-bundle:mvn:edu.emory.mathcs.backport/com.springsource.edu.emory.mathcs.backport/3.1.0
scan-bundle:mvn:net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3
scan-bundle:mvn:org.springframework.osgi/spring-osgi-annotation/1.1.2
scan-bundle:mvn:org.springframework.osgi/spring-osgi-core/1.1.2
scan-bundle:mvn:org.springframework.osgi/spring-osgi-extender/1.1.2
scan-bundle:mvn:org.springframework.osgi/spring-osgi-io/1.1.2

and discuss it:

  • lines 1 and 4 contain comment s(starting with # and will be just skipped.
  • line 3 is an empty line and will be skipped as well
  • line 2 will instruct the composite scanner to provision the bundles that will be scanned by another composite scanner from an maven url containing actually the bundles needed by spring (yes, a composite file can contain another composite scanner specs)
  • lines from 5 till 11 contain simple bundle references using a maven URL.

Advanced usage

Usually the above explained usage is just enough but there are some advanced features supported by composite scanner that you may take advantage of. Read more...