
</project>
{code}
To run following usecases using a configuration packaged as Maven artifact (org.foo.bar:configuration:1.0.0), it is needed to have the following dummy POM file:
{code:language=xml|theme=Eclipse}
<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>
<name>Dummy POM</name>
<artifactId>foo-bar</artifactId>
<groupId>com.foo.bar</groupId>
<version>0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.ow2.petals</groupId>
<artifactId>maven-petals-plugin</artifactId>
<version>2.1.4</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.foo.bar</groupId>
<artifactId>configuration</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
{code}
{note}
h4. Use-case 1 : How to set a JMS driver into a component
For example, we wish, on the same JBI container:
* to use the ActiveMQ v4.1.1 as JMS server and the BC JMS to interact with Petals ESB through JMS messages. So the BC JMS needs the shared library associated to its ActiveMQ server version.
* to use the ActiveMQ v5.2.0 as JMS server and the BC Soap to interact with Petals ESB through SOAP over JMS. So the BC Soap needs the shared library associated to its ActiveMQ server version.
In one hand, we need to deploy these shared libraries on the JBI container. So, each shared library MUST have a different JBI identifier name, for example petals-sl-jms-activemq-4 et petals-sl-jms-activemq-5.
In other hand, we don't want to change the content of the component JBI descriptor when upgrading a shared library because of bug fixes. So, we can you use the major digit of the version as version attribute for shared library identifier.
So, we need to inject this JBI identifier name and version attribute of the shared libraries in the JBI components:
* First, we configure the shared libraries using the goal 'jbi-configure':
{code}
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-sl-jms-activemq -Dversion=4.1.1 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-sl-jms-activemq -Dversion=5.2.0 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties
{code}
* Next, we configure the components:
{code}
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-jms -Dversion=3.1.1 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties -DjbiSharedLibrariesMappingFileURL=http://myhost:myport/myPath/jbi-shared-libraries-list-mapping-file.properties -DjbiVersionsMappingFileURL=http://myhost:myport/myPath/jbi-versions-mapping-file.properties
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-soap -Dversion=4.0.2 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties -DjbiSharedLibrariesMappingFileURL=http://myhost:myport/myPath/jbi-shared-libraries-list-mapping-file.properties -DjbiVersionsMappingFileURL=http://myhost:myport/myPath/jbi-versions-mapping-file.properties
{code}
* using the following content of the file 'jbi-identifiers-mapping-file.properties':
{code}
*\:*\:*\:jbi-component = ${artifactId}-${version.major}
*\:*\:*\:jbi-shared-library = ${artifactId}-${version.major}
*\:*\:*\:jbi-service-unit = ${artifactId}-${version}
*\:*\:*\:jbi-service-assembly = ${artifactId}-${version}
{code}
* using the following content of the file 'jbi-shared-libraries-list-mapping-file.properties':
{code}
org.ow2.petals\:petals-bc-jms\:*\:1 = org.ow2.petals:petals-sl-jms-activemq:4.1.1
org.ow2.petals\:petals-bc-soap\:*\:1 = org.ow2.petals:petals-sl-jms-activemq:5.2.0
{code}
* using the following content of the file 'jbi-versions-mapping-file.properties':
{code}
*\:*\:*\:jbi-shared-library = ${version.major}
{code}
h4. Use-case 2 : How to package an interceptor
The Petals CDK proposes some extension points to add specific processing. These points are named 'interceptors'. An interceptor must be packaged into the JBI component archive. This packaging can be done by the goal 'jbi-configure'.
For example, we wish to package our interceptor, available as a Maven artifact: org.ow2.petals.samples:my-interceptor:1.0.0:jar, into the BC Soap. So we will configure the BC Soap with an extra class-path element (our interceptor). And, as our interceptor is only needed to the component runtime, not to the component bootstrap, we will use the following command line:
{code}
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-soap -Dversion=4.0.2 -DjbiExtraComponentClasspathMappingURL=file:///home/myuser/my-extra-component-classpath-mapping.properties
{code}
where the file /home/myuser/my-extra-component-classpath-mapping.properties contains:
{code}
org.ow2.petals\:petals-bc-soap\:*\:1=org.ow2.petals.samples\:my-interceptor\:1.0.0
{code}
h4. Use-case 3 : How to install the same component in two different versions on the same container
For example, we wish, on the same JBI container:
* to use the BC Soap version 3.1.4 to connect old service assemblies,
* to use the BC Soap version 4.0.5 to use the last functions provided by the BC Soap.
This needs different JBI identifier in each component. So we can suffix the JBI identifier with the major digit of the version two create different identifiers for each component:
{code}
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-soap -Dversion=3.1.4 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-soap -Dversion=4.0.5 -DjbiIdentifiersMappingFileURL=http://myhost:myport/myPath/jbi-identifiers-mapping-file.properties
{code}
using the following content of the file 'jbi-identifiers-mapping-file.properties':
{code}
*\:*\:*\:jbi-component = ${artifactId}-${version.major}
*\:*\:*\:jbi-shared-library = ${artifactId}-${version.major}
*\:*\:*\:jbi-service-unit = ${artifactId}-${version}
*\:*\:*\:jbi-service-assembly = ${artifactId}-${version}
{code}
{tip}
To use a configuration available as Maven artifact, use the following command line:
{code}
mvn org.ow2.petals:maven-petals-plugin:2.1.4:jbi-configure -DgroupId=org.ow2.petals -DartifactId=petals-bc-soap -Dversion=3.1.4 -DjbiIdentifiersMappingFile=jbi-identifiers-mapping-file.properties
{code}
where jbi-identifiers-mapping-file.properties is available as resource into the configuration Maven artifact.
{tip}
{tip}
Don't forget to configure your service assemblies to be able to deploy them on the right component identified by the right JBI identifier.
{tip}
h3. Parameters
|| Parameter || Type || Default Value || Packaging || Description ||
| verbose | Boolean | false | \* \\ | Verbose mode. When activated, information logged at the INFO level are displayed. Information from other levels are always displayed, independently of this mode activation. |
| jbiIdentifiersMappingFile | String | jbi-identifiers-mapping-file.properties | \* \\ | JBI identifiers mapping configuration file. Must be available through the plug in class-path. \\
Each file line contains a key and a value. The value is used as expression defining the JBI identifier of the artifact matching the key. The key is composed of 4 mandatory fields separated by ":" (caution to use the escape character), each field can contain the value "*" to match any value: \\
* groupId,
* artifactId,
* version,
* packaging: one of jbi-component, jbi-shared-library, jbi-service-unit, jbi-service-assembly. \\
Example, the following mapping rules define that all component identifiers contain the major version part except for the BC Soap: \\
\\ {code}
org.ow2.petals\:petals-bc-soap\:*\:jbi-component = ${artifactId}
*\:*\:*\:jbi-component = ${artifactId}-${version.major}
{code} |
| jbiIdentifiersMappingFileURL | URL | \- \\ | \* \\ | If the JBI identifiers mapping configuration file (jbiIdentifiersMappingFile) does not exist through the classpath, the file is look for according to this URL. |
| jbiSharedLibrariesMappingFile | String | jbi-shared-libraries-list-mapping-file.properties | \* \\ | JBI shared library list mapping configuration file. Must be available through the plug-in class-path. \\
Each file line contains a key and a value. The value is used as a Maven artifact to use as shared library by the artifact matching the key. Use one line per shared library. \\
The key is composed of 4 mandatory fields separated by ":" (caution to use the escape character), each field (except the fourth) can contain the value "*" to match any value: \\
* groupId,
* artifactId,
* version,
* ordering number: in case of several shared library this field will define the declaration order of shared libraries. In case of only one sahred library use the value "1". \\
The value is composed of 3 mandatory fields separated by ":" defining a Maven artifact to use as shared library: \\
* groupId,
* artifactId,
* version. \\
Example, the following mapping rules define that all versions of the BC JMS will use the shared library including the ActiveMQ JMS client and an other one: \\
\\ {code}
org.ow2.petals\:petals-bc-jms\:*\:1 = org.ow2.petals:petals-sl-jms-activemq:5.2.0
org.ow2.petals\:petals-bc-jms\:*\:2 = org.ow2.petals:petals-sl-jms-otherjmsprovider:1.0.0
{code} |
| jbiSharedLibrariesMappingFileURL | URL | \- \\ | \* \\ | If the JBI shared library list mapping configuration file (jbiSharedLibrariesMappingFile) does not exist through the classpath, the file is look for according to this URL. |
| jbiVersionsMappingFile | String | jbi-versions-mapping-file.properties | \* \\ | JBI versions mapping configuration file. Must be available through the plugin classpath. \\
Each file line contains a key and a value. The value is used as expression defining the JBI version of the artifact matching the key. The key is composed of 4 mandatory fields separated by ":" (caution to use the escape character), each field can contain the value "*" to match any value: \\
* groupId,
* artifactId,
* version,
* packaging: one of jbi-component, jbi-shared-library, jbi-service-unit, jbi-service-assembly. \\
Example, the following mapping rules define that all shared libraries version identifiers are the major version: \\
\\ {code}
*\:*\:*\:jbi-shared-library = ${version.major}
{code} |
| jbiVersionsMappingFileURL | URL | \- \\ | \* \\ | If the JBI versions mapping configuration file (jbiVersionsMappingFile) does not exist through the classpath, the file is look for according to this URL. |
| sharedLibraryNameMappingInComponent | String | $$\{artifactId} | jbi-component | This parameter is used as pattern to defined the JBI identifier name of a shared library into the component JBI descriptor if nothing is defined into mapping files (jbiIdentifiersMappingFile or jbiIdentifiersMappingFileURL) \\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. \\ |
| groupId | String | \- \\ | \* \\ | GroupId of the deliverable JBI artefact to configure. |
| artifactId | String | \- \\ | \* \\ | ArtifactId of the deliverable JBI artefact to configure. |
| version | String | \- \\ | \* \\ | Version of the deliverable JBI artefact to configure. |
| configuredArtifactOutputDirectory | File \\ | $\{project.build.directory}/configured-artifacts | \* \\ | Configured JBI artifact output directory |
| targetName | String | \- \\ | \* \\ | Configured JBI artifact target file name, without the extension (.zip) |
| jbiExtraBootstrapClasspathMappingFile | String \\ | jbi-extra-bootstrap-classpath-mapping-file.properties | jbi-component \\ | Extra bootstrap class-path elements list mapping configuration file. Must be available through the plug-in class-path. \\
Each file line contains a key and a value. The value is used as a Maven artifact to use as extra class-path elements by the artifact matching the key. Use one line per extra class-path element. \\
The key is composed of 4 mandatory fields separated by ":" (caution to use the escape character), each field (except the fourth) can contain the value "*" to match any value: \\
* groupId,
* artifactId,
* version,
* ordering number: in case of several artifacts completing the classpath elements, this field will define the declaration order of artifact. In case of only one artifact use the value "1". \\
The value is composed of 3 mandatory fields and 1 optional field separated by ":" defining a Maven artifact to use as extra class-path element: \\
* groupId,
* artifactId,
* version,
* packaging (optional, default is 'jar'). \\
Example, the following mapping rules define that all versions of the BC SOAP will use the extra bootstrap class-path elements provided by all dependencies of the artifact com.foo.bar:foo-bar:1.2.0 and artifact com.foo.bar:foo-resources:1.2.0:zip : \\
{code}
org.ow2.petals\:petals-bc-soap\:*\:1=com.foo.bar:foo-bar:1.2.0
org.ow2.petals\:petals-bc-soap\:*\:2=com.foo.bar:foo-resources:1.2.0:zip
{code} |
| jbiExtraBootstrapClasspathMappingFileURL | URL \\ | \- \\ | jbi-component \\ | If the extra bootstrap class-path elements list mapping configuration file (jbiExtraBootstrapClasspathMappingFile) does not exist through the class-path, the file is look for according to this URL. \\ |
| jbiExtraComponentClasspathMappingFile | String \\ | jbi-extra-component-classpath-mapping-file.properties | jbi-component | Extra component class-path elements list mapping configuration file. Must be available through the plug-in class-path. \\
Each file line contains a key and a value. The value is used as a Maven artifact to use as extra class-path elements by the artifact matching the key. Use one line per extra class-path element. \\
The key is composed of 4 mandatory fields separated by ":" (caution to use the escape character), each field (except the fourth) can contain the value "*" to match any value: \\
* groupId,
* artifactId,
* version,
* ordering number: in case of several artifacts completing the classpath elements, this field will define the declaration order of artifact. In case of only one artifact use the value "1". \\
The value is composed of 3 mandatory fields and 1 optional field separated by ":" defining a Maven artifact to use as extra class-path element:
* groupId,
* artifactId,
* version,
* packaging (optional, default is 'jar'). \\
Example, the following mapping rules define that all versions of the BC SOAP will use the extra component class-path elements provided by all dependencies of the artifact com.foo.bar:foo-bar:1.2.0 and artifact com.foo.bar:foo-resources:1.2.0:zip : \\
\\ {code}
org.ow2.petals\:petals-bc-soap\:*\:1=com.foo.bar:foo-bar:1.2.0
org.ow2.petals\:petals-bc-soap\:*\:2=com.foo.bar:foo-resources:1.2.0:zip
{code} \| |
| jbiExtraBootstrapClasspathMappingFileURL | URL | \- \\ | jbi-component | If the extra component class-path elements list mapping configuration file (jbiExtraComponentClasspathMappingFile) does not exist through the class-path, the file is look for according to this URL. |
h2. jbi-install
This goal allows the installation or the deployment of a JBI archive. According to the JBI archive nature, defined in the associated Maven POM file, the right JMX API will be used.
For remote installation, the JBI archive will be uploaded on the remote platform. Apache Wagon is in charge of uploading the JBI archive, using the parameters: protocol, serverId, remoteDirectory.
When installing a JBI component that needs one or more uninstalled previously shared libraries, they will be installed automatically if:
* the parameter installMissingSharedLibraries is enabled,
* the shared libraries are declared as dependencies in the component project POM file.
{tip}
You can't use this feature if shared libraries of the component have been set using the goal jbi-configure.
{tip}
When installaing a JBI service assembly that needs one or more uninstalled previously components, they will be installed automatically if:
* the parameter startMissingComponents is enabled,
* the components are declared as dependencies in the service units project POM files. Note, as components have not to be packaged into service-unit archive, their dependency scopes MUST be set to 'provided'.
* if one component needs a shared library installation, it will be driven by the parameter installMissingSharedLibraries.
This goal has no sens for a service-unit archive. If you invoke jbi-install on a service-unit project, it will be ignored.
h3. Parameters
|| Parameter || Type || Default Value || Description ||
| jbiName | String | $\{project.artifactId}-$\{project.version} | Name of the JBI archive without path and extension \\ |
| verbose | Boolean | false | Verbose mode. When activated, information logged at the INFO level are displayed. Information from other levels are always displayed, independently of this mode activation. |
| jbiDirectory | String | $\{basedir}/src/main/jbi | Path to JBI sources. This path contains the JBI descriptor (jbi.xml). Every file being in this directory will be packaged in the JBI archive under the *META-INF* folder. |
| host \\ | String | localhost \\ | Host-name or IP address of the Petals container in which the archive will be installed \\ |
| port \\ | String \\ | 7700 \\ | JMX port number of Petals container \\ |
| username | String \\ | \- \\ | JMX username \\ |
| password \\ | String \\ | \- \\ | JMX user password \\ |
| force \\ | Boolean \\ | false | If enabled and needed, according to the JBI archive: \\
* jbi-component
** if the component is already installed, it will be uninstalled before to be installed. Otherwise an error is raised.
** if a service assembly is deployed on the component, it will be undeployed before to uninstall the component,
** if a shared library is needed and not installed, it will be installed from Maven repositories
* jbi-service-assembly
** if the service assembly is already deployed, it will be undeployed before to be deployed. Otherwise an error is raised.
** missing components are installed from Maven repositories
* jbi-shared-library
** shutdown installed components using the shared library
** if the shared library is already installed, it will be uninstalled before to be installed. Otherwise an error is raised. |
| startMissingComponents | Boolean \\ | true \\ | This parameter makes sense only to deploy a service assembly. \\
If enabled, the components needed by the service assembly will be installed and started automatically. If shared libraries are needed by a component, their automatic installation is driven by the parameter 'installMissingSharedLibraries'. \\
{warning}Components MUST be declared as dependency in service unit projects. \\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\ \\
\\ \\
\\ \\
\\ \\
\\ \\
\\
{warning} |
| installMissingSharedLibraries | Boolean | true \\ | This parameter makes sense only to deploy a component or a service assembly. \\
If enabled, shared libraries needed by the component will be automatically installed, \\ |
| serverId | String \\ | \- \\ | This parameter makes sense only to install or deploy on a remote container. \\
It's a reference to retrieve credential to upload archive on the remote container. This identifier MUST be defined in the Maven file: settings.xml in the server section. \\ |
| protocol | String \\ | scp \\ | This parameter makes sense only to install or deploy on a remote container. \\
Defines the protocol to use to upload the JBI archive on the remote container. The protocol MUST be supported by Apache Wagon. \\ |
| remoteDirectory | String \\ | /tmp \\ | This parameter makes sense only to install or deploy on a remote container. \\
Defines the directory on the remote container that will receive uploaded JBI archive. \\ |
h2. jbi-start
This goal allows the start of a JBI archive. According to the JBI archive nature, defined in the associated Maven POM file, the right JMX API will be used. This goal makes no sens for shared library and service unit. If you invoke jbi-start on such a project, it will be ignored.
|| Parameter || Type || Default Value || Description ||
| jbiName | String | $\{project.artifactId}-$\{project.version} | Name of the JBI archive without path and extension \\ |
| verbose | Boolean | false | Verbose mode. When activated, information logged at the INFO level are displayed. Information from other levels are always displayed, independently of this mode activation. |
| jbiDirectory | String | $\{basedir}/src/main/jbi | Path to JBI sources. This path contains the JBI descriptor (jbi.xml). Every file being in this directory will be packaged in the JBI archive under the *META-INF* folder. |
| host \\ | String | localhost \\ | Host-name or IP address of the Petals container in which the archive will be installed \\ |
| port \\ | String \\ | 7700 \\ | JMX port number of Petals container \\ |
| username | String \\ | \- \\ | JMX username \\ |
| password \\ | String \\ | \- \\ | JMX user password \\ |
| force (not implemented yet) \\ | Boolean \\ | false | This parameter makes sense only to start a service assembly. \\
If enabled and needed, components will start automatically. |
h2. jbi-stop
This goal allows the stop of a JBI archive. According to the JBI archive nature, defined in the associated Maven POM file, the right JMX API will be used. This goal makes no sens for shared library and service unit. If you invoke jbi-stop on such a project, it will be ignored.
|| Parameter || Type || Default Value || Description ||
| jbiName | String | $\{project.artifactId}-$\{project.version} | Name of the JBI archive without path and extension \\ |
| verbose | Boolean | false | Verbose mode. When activated, information logged at the INFO level are displayed. Information from other levels are always displayed, independently of this mode activation. |
| jbiDirectory | String | $\{basedir}/src/main/jbi | Path to JBI sources. This path contains the JBI descriptor (jbi.xml). Every file being in this directory will be packaged in the JBI archive under the *META-INF* folder. |
| host \\ | String | localhost \\ | Host-name or IP address of the Petals container in which the archive will be installed \\ |
| port \\ | String \\ | 7700 \\ | JMX port number of Petals container \\ |
| username | String \\ | \- \\ | JMX username \\ |
| password \\ | String \\ | \- \\ | JMX user password \\ |
| force \\ | Boolean \\ | false | This parameter makes sense only to stop a component. \\
If enabled and needed, service assemblies running on the component will be shutdowned. Moreover, if 'undeploySAs' is enabled, service assemblies will be undeployed. |
| undeploySAs | Boolean | false \\ | if 'force' is enabled, service assemblies running on the component are undeployed. \\ |
h2. jbi-uninstall (not implemented yet)
This goal allows the uninstall a JBI archive. According to the JBI archive nature, defined in the associated Maven POM file, the right JMX API will be used. This goal makes no sens for service unit. If you invoke jbi-uninstall on such a project, it will be ignored.
|| Parameter || Type || Default Value || Description ||
| jbiName | String | $\{project.artifactId}-$\{project.version} | Name of the JBI archive without path and extension \\ |
| verbose | Boolean | false | Verbose mode. When activated, information logged at the INFO level are displayed. Information from other levels are always displayed, independently of this mode activation. |
| jbiDirectory | String | $\{basedir}/src/main/jbi | Path to JBI sources. This path contains the JBI descriptor (jbi.xml). Every file being in this directory will be packaged in the JBI archive under the *META-INF* folder. |
| host \\ | String | localhost \\ | Host-name or IP address of the Petals container in which the archive will be installed \\ |
| port \\ | String \\ | 7700 \\ | JMX port number of Petals container \\ |
| username | String \\ | \- \\ | JMX username \\ |
| password \\ | String \\ | \- \\ | JMX user password \\ |