Bundles - 7.0

Talend ESB Container Administration Guide

EnrichVersion
7.0
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Administration and Monitoring
Design and Development
Installation and Upgrade
EnrichPlatform
Talend ESB

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/nmr/   \\
   org.apache.servicemix.nmr.api/1.0.0-m2/   \\
   org.apache.servicemix.nmr.api-1.0.0-m2.jar</bundle>

Doing this will make sure the above bundle is installed while installing the feature. However, 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.

Maven URL Handler

The equivalent of the above bundle would be:

<bundle>
   mvn:org.apache.servicemix.nmr/org.apache.servicemix.nmr.api/1.0.0-m2
</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.

The org.ops4j.pax.url.mvn bundle resolves mvn URLs. This flexible tool can be configured through the configuration service. For example, to find the current repositories type: karaf@trun:/> config:list and the following will display:

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://svn.apache.org/repos/asf/servicemix/m2-repo 
   below = list of repositories and even before the local repository

The repositories checked are controlled by these configuration properties. For example, org.ops4j.pax.url.mvn.repositories is a comma separated list of repository URLs specifying those remote repositories to be checked. So, to replace the defaults with a new repository at http://www.example.org/repo on the local machine:

karaf@trun:/> config:edit org.ops4j.pax.url.mvn
karaf@trun:/> config:property-list                  
   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://svn.apache.org/repos/asf/servicemix/m2-repo
   below = list of repositories and even before the local repository
karaf@trun:/> config:property-set org.ops4j.pax.url.mvn.repositories 
       http://www.example.org/repo
karaf@trun:/> config:update

By default, snapshots are disabled. To enable an URL for snapshots append @snapshots. For example: http://www.example.org/repo@snapshots. Repositories on the local are supported through file:/ URLs.

Bundle start-level

By default, the bundles deployed through the feature mechanism will have a start-level equals to the value defined in the configuration file config.properties with the variable karaf.startlevel.bundle=60. This value can be changed using the xml attribute start-level.

<feature name='my-project' version='1.0.0'>
   <feature version='2.4.0'>camel-spring</feature>
   <bundle start-level='80'>mvn:com.mycompany.myproject/   \\
      myproject-dao</bundle>    
   <bundle start-level='85'>mvn:com.mycompany.myproject/   \\
      myproject-service</bundle>
   <bundle start-level='85'>mvn:com.mycompany.myproject/   \\
      myproject-camel-routing</bundle>
</feature>

The advantage to define the start-level of a bundle is that you can deploy all your bundles including those of the project with the 'infrastructure' bundles required (e.g : camel, activemq) at the same time and you will have the guaranty when you use Spring Dynamic Module (to register service through OSGi service layer), Blueprint that by example Spring context will not be created without all the required services installed.

Bundle stop/start

The OSGi specification allows to install a bundle without starting it. To use this functionality, simply add the following attribute in your <bundle> definition

<feature name='my-project' version='1.0.0'>
   <feature version='2.4.0'>camel-spring</feature>
   <bundle start-level='80' start='false'>mvn:com.mycompany.myproject/   \\
      myproject-dao</bundle>    
   <bundle start-level='85' start='false'>mvn:com.mycompany.myproject/   \\
      myproject-service</bundle>
   <bundle start-level='85' start='false'>mvn:com.mycompany.myproject/   \\
      myproject-camel-routing</bundle>
</feature>

Bundle dependency

A bundle can be flagged as being a dependency. Such information can be used by resolvers to compute the final list of bundles to be installed.