You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

4.6. Provisioning

ServiceMix Kernel provides a simple, yet flexible, way to provision applications or "features". Such a mechanism is mainly provided by a set of commands available in the features shell. The provisioning system uses xml "repositories" that define a set of features.

Repositories

The xml repositories use the following Relax NG Compact syntax:

Repository schema
element features {
  element feature {
    attribute name { text },
    element feature { text }*,
    element config {
      attribute name { text },
      text
    }*,
    element bundle { text }*
  }*
}

Here is an example of such a repository:

<features>
  <feature name="nmr">
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.api/1.0-SNAPSHOT</bundle>
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.core/1.0-SNAPSHOT</bundle>
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.osgi/1.0-SNAPSHOT</bundle>
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.spring/1.0-SNAPSHOT</bundle>
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.commands/1.0-SNAPSHOT</bundle>
    <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.management/1.0-SNAPSHOT</bundle>
  </feature>
</features>

A repository includes a list of feature elements, each one representing an application that can be installed. The feature is identified by its name which must be unique amongst all the repositories used and consists in a set of bundles that need to be installed along with some optional dependencies on other features and some optional configurations for the Configuration Admin OSGi service.

Bundles

The main information provided by a feature is the set of OSGi bundles that defines the application. Such bundles are URLs pointing to the actual bundle jars. For example, one would write the following definition:

<bundle>http://repo1.maven.org/maven2/org/apache/servicemix/jbi/org.apache.servicemix.jbi.api/1.0-m1/org.apache.servicemix.jbi.api-1.0-m1.jar</bundle>

Doing this will make sure the above bundle is installed while installing the feature.

However, ServiceMix Kernel provides several URL handlers, in addition to the usual ones (file, http, etc...). One of these is the maven URL handler, which allow reusing maven repositories to point to the bundles. The equivalent of the above bundle would be:

<bundle>mvn:org.apache.servicemix.jbi/org.apache.servicemix.jbi.api/1.0-m1</bundle>

In addition to being less verbose, the maven url handlers can also resolve snapshots and can use a local copy of the jar if one is available in your maven local repository.

Dependant features

Dependant features are usefull when a given feature depends on another feature to be installed. Such a dependency can be expressed easily in the feature definition:

<feature name="jbi">
  <feature>nmr</feature>
  ...
</feature>

The effect of such a dependency is to automatically install the required jbi feature when the nmr feature will be installed.

Configurations

TODO

Commands

TODO

features addUrl http://svn.apache.org/repos/asf/servicemix/smx4/obr-repo/features-nmr-1.0-m1.xml
features install nmr

#top

  • No labels