View Source

{section}
{column}

h1. Introduction

This Maven plugin supports:

* Several _packaging_:
** *jbi-component*: used for a JBI component (binding component or service engine).
** *jbi-service-unit*: used for a service-unit.
** *jbi-service-assembly*: used for a service assembly.
** *jbi-shared-library*: used for a shared-library.

* Several _goals_:
** *jbi-package*: used to create a JBI archive.
** *jbi-configure*: used to configure a deliverable JBI archive.
** *jbi-install*: used to install a JBI archive on a Petals node.
** *jbi-start*: used to start a Petals component on a Petals node.
** *jbi-stop*: used to stop a Petals component on a Petals node.
** *jbi-uninstall*: used to uninstall a JBI archive from a Petals node (not implemented yet).
{column}
{column}
{panel:title=Table of content}{toc:maxLevel=3}{panel}
{panel:title=Contributors}{contributors}{panel}
{column}
{section}

h1. Packaging

As described previously, the plugin supports different packaging to build JBI artifacts.
This section details and illustrates them. As a general matter, defining specific packaging allows to use JBI archives as dependencies in other projects.
It also allows to define the build life cycle to apply on such a project.

{note}
When installing such artifacts in a repository, only the JBI archive is installed.
{note}


h2. jbi-component

This packaging identifies a Maven2 project as being the development of a JBI component (either a binding component, or a service engine).
The associated language is Java, which allows to use *maven-eclipse-plugin* to make this project an Eclipse project.

The build life cycle of a JBI component is:

|| Phases || Goals ||
| process-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:resources |
| compile | 1. org.apache.maven.plugins:maven-compiler-plugin:compile |
| process-test-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:testResources |
| test-compile | 1. org.apache.maven.plugins:maven-compiler-plugin:testCompile |
| test | 1. org.apache.maven.plugins:maven-surefire-plugin:test |
| package | 1. org.apache.maven.plugins:maven-jar-plugin:jar, \\
2. org.ow2.petals:maven-petals-plugin:jbi-package |
| install | 1. org.apache.maven.plugins:maven-install-plugin:install |
| deploy | 1. org.apache.maven.plugins:maven-deploy-plugin:deploy |


h2. jbi-service-unit

This packaging identifies a Maven2 project as being the development of a service-unit.
The associated language is Java, which allows to use *maven-eclipse-plugin* to make this project an Eclipse project.

The build life cycle of a service-unit is:

|| Phases || Goals ||
| process-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:resources |
| compile | 1. org.apache.maven.plugins:maven-compiler-plugin:compile |
| process-test-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:testResources |
| test-compile | 1. org.apache.maven.plugins:maven-compiler-plugin:testCompile |
| test | 1. org.apache.maven.plugins:maven-surefire-plugin:test |
| package | 1. org.apache.maven.plugins:maven-jar-plugin:jar, \\
2. org.ow2.petals:maven-petals-plugin:jbi-package |
| install | 1. org.apache.maven.plugins:maven-install-plugin:install |
| deploy | 1. org.apache.maven.plugins:maven-deploy-plugin:deploy |


h2. jbi-service-assembly

This packaging identifies a Maven2 project as being the development of a service assembly.
The associated language is Maven2's default language.

The build life cycle of a service assembly is:

|| Phases || Goals ||
| package | 1. org.ow2.petals:maven-petals-plugin:jbi-package |
| install | 1. org.apache.maven.plugins:maven-install-plugin:install |
| deploy | 1. org.apache.maven.plugins:maven-deploy-plugin:deploy |


h2. jbi-shared-library

This packaging identifies a Maven2 project as being the development of a shared-library.
The associated language is Java, which allows to use *maven-eclipse-plugin* to make this project an Eclipse project.

The build life cycle of a shared-library is:

|| Phases || Goals ||
| process-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:resources |
| compile | 1. org.apache.maven.plugins:maven-compiler-plugin:compile |
| process-test-ressources | 1. org.apache.maven.plugins:maven-resources-plugin:testResources |
| test-compile | 1. org.apache.maven.plugins:maven-compiler-plugin:testCompile |
| test | 1. org.apache.maven.plugins:maven-surefire-plugin:test |
| package | 1. org.apache.maven.plugins:maven-jar-plugin:jar, \\
2. org.ow2.petals:maven-petals-plugin:jbi-package |
| install | 1. org.apache.maven.plugins:maven-install-plugin:install |
| deploy | 1. org.apache.maven.plugins:maven-deploy-plugin:deploy |


h2. Additional jbi resources packaging

For service unit, component, shared library ... you can provided a directory thank to following xml element _additionalJBIResourceDirectory,_

which allows to specify a directory where all contained files will be added to zip archive of the su, sl, component ...

This previous mechanism provide a way to package additional jbi resources into your su, sl, component as in the following example:
{code:lang=xml|title=pom.xml} <build>
<plugins>
<plugin>
<groupId>org.ow2.petals</groupId>
<artifactId>maven-petals-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<additionalJBIResourceDirectory>${project.build.directory}/additionals/</additionalJBIResourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>unpackaging</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.ebmwebsourcing.petals-esb-enterprise.usecase1.node2</groupId>
<artifactId>su-filetransfer-P6-provide</artifactId>
<version>0-SNAPSHOT</version>
<type>jbi-service-unit</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/additionals/</outputDirectory>
<includes>**/*.wsdl</includes>
<excludes>**/*.class,**/*.jar</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>{code}
In the previous example, during the *mvn clean install* of the su-bpel-S9-provide, maven just unpackage the P6.wsdl located in +su-filetransfer-P6-provide+ dependency and copy the wsdl into&nbsp;

{noformat}${project.build.directory}/additionals/ --> corresponding to target/additionals/{noformat}After that the maven-petals-plugin take the P6.wsdl file located into target/additionals precised by the following line:
{noformat}<additionalJBIResourceDirectory>${project.build.directory}/additionals</additionalJBIResourceDirectory>{noformat}

and copy this wsdl file into your _su-bpel-S9-provided.zip_ (it will be copy directly at the root path into zip file)

h1. Goals

As explained in introduction, the Petals plugin for Maven2 supports several goals.
This section details and illustrates them.

The available goals are:
* *jbi-package*: used to package a JBI archive.
* *jbi-configure*: used to configure a deliverable JBI archive.
* *jbi-install*: used to install a JBI archive.
* *jbi-start*: used to start a composant or a service assembly.
* *jbi-stop*: used to stop a composant or a service assembly.
* *jbi-uninstall*: used to uninstall a JBI archive.


h2. jbi-package

This goal allows the creation of a JBI archive.
Depending on the project nature (which is defined by its packaging attribute in the pom.xml), the right archive will be created.

{tip}
For a service assembly project, the service-units that are contained in this assembly must be declared as dependencies in the POM.
{tip}

\\
|| Parameter || Type || Default Value || Packaging || Description ||
| jbiName | String | $\{project.artifactId\}-$\{project.version\} | \* | The file name of the JBI archive (no file path or file 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. |
| {anchor:jbi-package-updateJbiXml}updateJBIXml | Boolean | true | \* | When true, the packaging updates the JBI descriptor from the project's POM. \\
This option must be activated to configure the JBI archive. |
| serviceUnitFileNameMappingInSA | String | $$\{artifactId\}-$$\{version\}.$$\{extension\} | jbi-service-assembly | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
It defines the name format of JBI archives for the service-units this assembly embeds. It can be used to make them match the content of the JBI descriptor of the assembly. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| serviceUnitNameMappingInSA | String | $$\{artifactId\}-$$\{version\} | jbi-service-assembly | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
It defines the name format (the <name> mark-up> of service-units embedded by the service assembly archive. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| serviceAssemblyNameMapping | String | $$\{artifactId\}-$$\{version\} | jbi-service-assembly | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
It defines the format of the service assembly name in the JBI descriptor. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| sharedLibraryNameMappingInComponent | String | $$\{artifactId\} | jbi-component | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
When a component depends on a shared library, this last one can be automatically added in the component's JBI descriptor. This parameter defines the name of the shared-libraries to add in the JBI descriptor. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| componentNameMapping | String | $$\{artifactId\} | jbi-component | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
This parameter defines the name format of the component in the JBI descriptor. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| sharedLibraryNameMapping | String | $$\{artifactId\} | jbi-shared-library | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. \\
This parameter defines the name format of the shared library in the JBI descriptor. \\
\\
Configuring this parameter should work correctly when the issue [MNG-3558|http://jira.codehaus.org/browse/MNG-3558] is fixed. |
| includeConfiguration \\ | Boolean \\ | true \\ | \* \\ | Flag to activate JBI archive configuration when packaging it. To authorize the component configuration when packaging it, JBI descriptor update MUST be activated (see [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml]). \\
\\
If one of files needed by the component configuration is missing, no configuration is applied. \\ |
| 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 shared library list mapping configuration file (jbiSharedLibrariesMappingFile) does not exist through the class-path, 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 plug-in class-path. \\
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 class-path, the file is look for according to this URL. |
| toExcludes | String | \- \\ | jbi-component \\
jbi-shared-library \\ | This parameter makes sense only if the [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] option is activated. It contains a list a JAR files (comma separated) to exclude from the packaging. \\ |


h3. How is updated the JBI descriptor ?

As explain below, the parameter [petalsesbsnapshot:updateJBIXml\|#jbi-package-updateJbiXml] is used to generated the JBI descriptor from the Maven POM file. Updates are done according to the nature of the JBI archive and following rules.

h4. JBI descriptor updates of a component archive

|| JBI descriptor node \\ || Source of the value \\ ||
| jbi/component/identification/name | The value is controlled by the parameter 'componentNameMapping' and identification values defined in the POM file of the component project. Can be overridden by the content of the configuration parameters if artifact configuration is enabled (includeConfiguration). \\ |
| jbi/component/identification/description | The value is the content of the tag <description> of the POM file, if not null. Otherwise the initial value is kept. \\ |
| jbi/component/component-class-path | Contains all dependencies resolved by Maven. Transitive dependencies of shared-library are not included. \\
Initial content is kept, even if not contained in the dependencies resolved by Maven. \\ |
| jbi/component/bootstrap-class-path | Same as jbi/component/component-class-path |
| jbi/component/shared-library | If the configuration mode is enabled (includeConfiguration): \\
* a tag <shared-library> is created for each shared library declared in:
** the configuration files (jbiSharedLibrariesMappingFile or jbiSharedLibrariesMappingFileURL), if they exist.
** otherwise, in the project POM file. shared library must be declared as a provided dependency with type set to 'jbi-shared-library'.
* If an identifier mapping is defined (see jbiIdentifiersMappingFile or jbiIdentifiersMappingFileURL) for the shared library, the resulting identifier is used as JBI identifier. Otherwise, it will be defined by the parameter 'sharedLibraryNameMappingInComponent'.
* If a version mapping configuration exists (jbiVersionsMappingFile or jbiVersionsMappingFileURL) for the shared library, the resulting value is used as version attribute of the shared library. Otherwise, the version defined into the POM is used. |

h4. JBI descriptor updates of a service unit

|| JBI descriptor node \\ || Source of the value \\ ||
| jbi/services/consumes/\* | Each placeholder as $\{my_variable} is replaced by the value of the property, defined in the POM, that as the same name. \\ |
| jbi/services/provides/\* | Same as previous one. \\ |

h4. JBI descriptor updates of a service assembly

|| JBI descriptor node \\ || Source of the value \\ ||
| jbi/service-assembly/identification/name | The value is controlled by the parameter 'serviceAssemblyNameMapping' and identification values defined in the POM file of the component project. Can be overridden by the content of the configuration parameters if artifact configuration is enabled (includeConfiguration). |
| jbi/service-assembly/identification/description | The value is the content of the tag <description> of the POM file, if not null. Otherwise the initial value is kept. |
| jbi/service-assembly/service-unit/identification/name | The value is controlled by the parameter 'serviceUnitNameMappingInSA' and identification values defined in the POM file of the service units. Can be overridden by the content of the configuration parameters if artifact configuration is enabled (includeConfiguration). |
| jbi/service-assembly/service-unit/identification/description | The value is the content of the tag <description> of the service unit POM file. |
| jbi/service-assembly/service-unit/target/artifacts-zip | The value is controlled by the parameter 'serviceUnitNameMappingInSA'. |
| jbi/service-assembly/service-unit/target/component-name | Content of the tag jbi/component/identification/name of the JBI descriptor of the component on which the service unit must be deployed. It's needed that the component is declared as dependency into the service unit project. Can be overridden by the content of the configuration parameters if artifact configuration is enabled (includeConfiguration). |

h4. JBI descriptor updates of a shared library

|| JBI descriptor node \\ || Source of the value \\ ||
| jbi/shared-library/identification/name | If the configuration mode is enabled (includeConfiguration): \\
* if a identifier mapping exists (jbiIdentifiersMappingFile or jbiIdentifiersMappingFileURL) for the shared library, it is used to define the JBI identifier. Otherwise it is defined by the parameter 'sharedLibraryNameMappingInComponent'. \\
otherwise: \\
* the JBI identifier is defined by the parameter 'sharedLibraryNameMappingInComponent'. |
| jbi/shared-library/@version | If the configuration mode is enabled (includeConfiguration): \\
* if a version mapping exists (jbiVersionsMappingFile orjbiVersionsMappingFileURL ) for the shared library, it is used to define the version attribute. Otherwise the version attribute is defined by the version declared in the POM file of the shared library. \\
otherwise: \\
* the version attribute is defined by the version declared in the POM file of the shared library. |
| jbi/shared-library/shared-library-class-path | Defined according to all dependencies (direct and transitive) defined in the POM of the shared library. \\ |

h2. jbi-configure

This goal allows the configuration of a JBI archive. Depending on the JBI archive nature (which is defined by its packaging attribute), the right configuration archive will be applied. Only deliverable JBI archives (component, service assembly and shared library) can be configured by this goal, ie. service unit archive is excluded. The main use-case is the configuration of a JBI archive delivered by a provider.

{tip}
Configuration of a service assembly, ans its service units, is not implemented yet.
{tip}

h3. Use-case example

{note}

To run following usecases fully on command line, 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>SNAPSHOT</version>
<packaging>pom</packaging>

</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&nbsp; 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&nbsp; 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 \\ |