...
Anchor | ||||
---|---|---|---|---|
|
4.6. Provisioning
ServiceMix Kernel Karaf 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.
...
Code Block | ||
---|---|---|
| ||
<features> <feature name="nmrspring" version="12.5.06.0SEC01"> <bundle>mvn:org.apache.servicemix.document/org.apache.servicemix.document/1.0.0</bundle> <bundle>mvn:org.apache.servicemix.nmrbundles/org.apache.servicemix.nmrbundles.apiaopalliance/1.0.0<_1</bundle> <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.core/1.0.0</bundle> springframework/spring-core/2.5.6.SEC01</bundle> <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.osgi/1.0.0<springframework/spring-beans/2.5.6.SEC01</bundle> <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.spring/1.0.0</bundle> springframework/spring-aop/2.5.6.SEC01</bundle> <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.commands/1.0.0</bundle> springframework/spring-context/2.5.6.SEC01</bundle> <bundle>mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.management/1.0.0</bundle> springframework/spring-context-support/2.5.6.SEC01</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 of 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.
...
Doing this will make sure the above bundle is installed while installing the feature.
However, ServiceMix Kernel Karaf 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.
...
Code Block |
---|
karaf@root:/> config/:list ... ---------------------------------------------------------------- Pid: org.ops4j.pax.url.mvn BundleLocation: mvn:org.ops4j.pax.url/pax-url-mvn/0.3.3 Properties: service.pid = org.ops4j.pax.url.mvn org.ops4j.pax.url.mvn.defaultRepositories = file:/opt/development/karaf/assembly/target/apache-felix-karaf-1.2.0-SNAPSHOT/system@snapshots org.ops4j.pax.url.mvn.repositories = http://repo1.maven.org/maven2, http://people.apache.org/repo/m2-snapshot-repository<at:var at:name="snapshots" />noreleases, http://repository.ops4j.org/maven2, http://svn.apache.org/repos/asf/servicemix/m2-repo below = list of repositories and even before the local repository |
...
Code Block |
---|
karaf@root:/> config/:edit org.ops4j.pax.url.mvn karaf@root:/> config/:proplist service.pid = org.ops4j.pax.url.mvn org.ops4j.pax.url.mvn.defaultRepositories = file:/opt/development/karaf/assembly/target/apache-felix-karaf-1.2.0-SNAPSHOT/system@snapshots org.ops4j.pax.url.mvn.repositories = http://repo1.maven.org/maven2, http://people.apache.org/repo/m2-snapshot-repository<at:var at:name="snapshots" />noreleases, http://repository.ops4j.org/maven2, http://svn.apache.org/repos/asf/servicemix/m2-repo below = list of repositories and even before the local repository karaf@root:/> config/:propset org.ops4j.pax.url.mvn.repositories http://www.example.org/repo karaf@root:/> config/:update |
By default, snapshots are disable. To enable an URL for snapshots append @snapshots. For example
...
Such configuration as usually used with Spring-DM or Blueprint support for the Configuration Admin service, as in the following example, but using plain OSGi APIs will of course work the same way:
...
The following commands can be used to manage the list of descriptors known by ServiceMix KernelKaraf. They use URLs pointing to features descriptors. These URLs can use any protocol known to the ServiceMix Kernel, the most common ones being http, file and mvn.
Code Block |
---|
features/:addUrl Add a list of repository URLs to the features service features/:removeUrl Remove a list of repository URLs from the features service features/:listUrl Display the repository URLs currently associated with the features service. features/:refreshUrl Reload the repositories to obtain a fresh list of features |
ServiceMix Kernel Karaf maintains a persistent list of these repositories so that if you add one URL and restart the KernelKaraf, the features will still be available.
...
Features management
Code Block |
---|
features/:install features/:uninstall features/:list |
Examples
Code Block |
---|
features/addUrl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0-m2/xml/features features/install nmr |
...
Wiki Markup |
---|
A simple configuration file located in {{\[SMX4KNLFELIX:kernelkaraf\]/etc/org.apache.servicemix.features.cfg}} can be modified to customize the behavior when starting the Kernel for the first time. This configuration file contains two properties: |
...