...
A service assembly is a collection service units that can be deployed together, it creates a zip archive containing each of the service units (SU's)
Building and
...
Installing Shared
...
Libraries
The best place to start with the tooling is with the logically lowest component in the JBI spec, which I suppose would be the Shared Library. In essence a shared library is basically a JAR contains a set of JARs and a JBI.xml, the important bits about the Shared Library is that it is named and versioned. This fits nicely with the Maven approach since all maven artifacts have id's and versions, and also the dependencies within your shared library POM can quickly be used to allow the JBI tooling to create the Shared Libraries zip archive.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.servicemix</groupId>
<artifactId>MySharedLibrary</artifactId>
<packaging>jbi-shared-library</packaging>
<version>1.0-SNAPSHOT</version>
<name>A custom project</name>
...
</project>
|
Once you have set the packaging to be jbi-shared-library you can run mvn install and you will create both the standard jar packaging which will be set to your repository and also a ZIP packaging which will incorporate your dependencies and also a jbi.xml.
...
This will call the ANT tasks from within Maven giving the shared library to install as the one built in the install phase.
Building and Installing Components
JBI logically separates Binding Components and Service Engines as two flavours of a component, the Maven JBI tooling provides that you can define a project as a jbi-component and then specify whether it is a service-engine or binding-component. Like the shared libraries we have just covered the definition of a jbi-component firstly requires the steps from Getting Started (plugin repositories and plugin) and then it also requires you change the packaging of your project.
Code Block | ||||
---|---|---|---|---|
| ||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.servicemix</groupId>
<artifactId>MyBindingComponent</artifactId>
<packaging>jbi-component</packaging>
<version>1.0-SNAPSHOT</version>
<name>An example binding component</name>
...
</project>
|
Since a binding component or service engine has more settings than can be derived from your Maven POM.xml we also need to update the plugin section we added to configure these additional settings:
Code Block | ||||
---|---|---|---|---|
| ||||
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<type>binding-component</type>
<bootstrap>org.apache.servicemix.MyBootstrap</bootstrap>
<component>org.apache.servicemix.MyComponent</component>
</configuration>
</plugin>
|
The parameters allow you to specify the following :
type - whether this is a binding-component or a service-engine
bootstrap - the name of the class that will be your bootstrap implementation
component - the name of the class that will be your component implementation
Once you have configured these steps you can run mvn install and much like the shared library maven will create both a standard jar and also a component installer:
Code Block |
---|
Maven Log - Missing
|
If you have a locally running Apache ServiceMix instance (which its default settings) you can even use the plugin to install the Component by simply typing:
mvn jbi:installComponent
This will call the ANT tasks from within Maven giving the component to install as the one built in the install phase.
...