Petals-SE-BPMN2 1.0.0-SNAPSHOT

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (82)

View Page History
{column}

{multi-excerpt-include:Petals-SE-Activiti|name=features|nopanel=true} {multi-excerpt-include:Petals-SE-BPMN2|name=features|nopanel=true}

{column}
{section}

h1. Introduction

The version 1.0.0 of the component embeds the BPMN 2.0 engine "Activiti". In this first version, only Activiti extensions can be used at the runtime level.

h1. Using the mode "service"

h3. Creating the service contract

The SE Activiti BPMN2 provides a service with several operation for a process definition. A WSDL is associated to this service. This WSDL can be written freely. The user can use its own namespace, its own names, ... It is only constraint by the following rules:
* the operations of the binding section *are annotated* to link them to the supported operations (create an instance of the process definition, complete the current task of the process instance, ...)
* the mandatory parameters of the operation *are annotated* to retrieve the right values.

{tip}For a unit test purpose, an extension of JUnit is available to validate your WSDL not only in a pur WSDL point of view, but also in a SE Activiti BPMN2 point of view. See chapter "[Unit testing|#Unit_Testing]".{tip}

h4. Identifying operations

The mapping between operations of the WSDL and operations supported by the BPMN 2.0 embedded in the SE Activiti BPMN2 is declared using a dedicated binding. The binding "Activiti" "BPMN2" is done adding the element {{\{http://petals.ow2.org/se/activiti/1.0}operation}} {{\{http://petals.ow2.org/se/bpmn2.0/1.0}operation}} to the element operation of the binding. Its attribute *{{activitiAction}}* *{{bpmnAction}}* defines the operation that will be executed.

h4. Identifying input parameters of operations

In the same way, input parameters of operations are mapped through an annotation placed inside the message of the binding operation. Two natures of input parameters exists: the expected input parameters and variables. Each Activiti BPMN 2.0 engine API operation can require mandatory or optional input parameter and can accept to set several variables in the same time.

Input parameters are identified by the annotation adding the element {{\{http://petals.ow2.org/se/activiti/1.0}input-parameter}}. {{\{http://petals.ow2.org/se/bpmn2.0/1.0}input-parameter}}. This annotation takes also two attributes:
* the attribute *{{name}}* defines a name of an expected input parameter of the Activiti BPMN 2.0 engine API operation,
* the attribute *{{value}}* defines the value to set to the expected input parameter using an XPath expression.
See operation details to know the expected input parameters.

Variables are identified by the annotation adding the element {{\{http://petals.ow2.org/se/activiti/1.0}variable}}. {{\{http://petals.ow2.org/se/bpmn2.0/1.0}variable}}. This annotation takes also two attributes:
* the attribute *{{name}}* defines the variable name used in the process definition.
* the attribute *{{value}}* defines the value to set to the variable using an XPath expression.
See operation details to know if variables can be set.
No extra check is done by the SE Activiti BPMN2 about the compliance of the variable with the process definition.

{color:red}*TODO. Les types ?; les arborescences*{color}
h4. Identifying output parameters of operations

Output parameters of the Activiti BPMN 2.0 engine API operation can not be set into the output reply of the service operation using a simple XPath expression as for input parameters. An XSL style-sheet is required to generated the full output reply. It is identified using the annotation adding the element {{\{http://petals.ow2.org/se/activiti/1.0}output}}. {{\{http://petals.ow2.org/se/bpmn2.0/1.0}output}}. The XSL style-sheet name is set into the attribute {{*xsl*}} and loaded from the classloader. The XSL style-sheets are mainly located in the service-units, they can also be packaged as a shared library.

According to the Activiti operation executed by the BPMN 2.0 engine, its output parameters are transmitted to the XSL style-sheet through XSL parameters. You will use these XSL parameters to generate your service reply from your service request payload. See operation details to know the available XSL parameters.

{tip}For a unit test purpose, an extension of JUnit is available to test your XSL. See chapter "[Unit testing|#Unit_Testing]".{tip}
h4. Associating an operation to the creation of an process definition instance

The operation creating instances of process definition is identified by the value *{{createProcInstOp}}* set on the attribute {{activitiAction}}: {{bpmnAction}}:
{code}
<wsdl:binding name="Order" xmlns:activiti="http://petals.ow2.org/se/activiti/1.0"> xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0">
<wsdl:operation name="newOrder" type="...">
<activiti:operation activitiAction="createProcInstOp" <bpmn:operation bpmnAction="createProcInstOp" />
<activiti:variable <bpmn:variable name="customerName" value="/newOrderRequest/customerName" />
<activiti:variable <bpmn:variable name="address" value="/newOrderRequest/address" />
<activiti:output <bpmn:output xsl="newOrderOutput.xsl" />
<wsdl:input/>
<wsdl:output/>
h4. Associating an operation to the completion of a process instance task

The operation completing a task of a process instance is identified by the value *{{completeTaskOp}}* set on the attribute {{activitiAction}}: {{bpmnAction}}:
{code}
<wsdl:binding name="Order" xmlns:activiti="http://petals.ow2.org/se/activiti/1.0" xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0" >
<wsdl:operation name="validOrder">
<activiti:operation activitiAction="completeTaskOp" <bpmn:operation bpmnAction="completeTaskOp" />
<activiti:input-parameter <bpmn:input-parameter name="processInstanceId" value="/validOrderRequest/orderId" />
<activiti:input-parameter <bpmn:input-parameter name="taskDefinitionKey" value="validOrder" />
<activiti:variable <bpmn:variable name="validationApproved" value="/validOrderRequest/isValidated" />
<activiti:variable <bpmn:variable name="creditCardNumber" value="/validOrderRequest/creditCardNumber" />
<activiti:output <bpmn:output xsl="validOrderOutput.xsl" />
<wsdl:input/>
<wsdl:output/>
h4. Associating an operation to retrieve process instances

The operation retrieving process instances is identified by the value *{{retrieveProcInst}}* set on the attribute {{activitiAction}}: {{bpmnAction}}:
{code}
<wsdl:binding name="Order" xmlns:activiti="http://petals.ow2.org/se/activiti/1.0"> xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0">
<wsdl:operation name="searchOrder" type="...">
<activiti:operation activitiAction="retrieveProcInst" <bpmn:operation bpmnAction="retrieveProcInst" />
<activiti:input-parameter <bpmn:input-parameter name="isActive" value="/searchOrderRequest/isInProgress" />
<activiti:input-parameter <bpmn:input-parameter name="responsibleUser" value="/searchOrderRequest/responsibleUser" />
<activiti:input-parameter <bpmn:input-parameter name="responsibleGroup" value="/searchOrderRequest/responsibleGroup" />
<activiti:output <bpmn:output xsl="searchOrderOutput.xsl" />
<wsdl:input/>
<wsdl:output/>
h1. Using the mode "integration"

The mode "integration" provides different services to interact directly with the engine Activity. It goes back over the Activiti Java API. Available services are:
The mode "integration" provides different services to interact directly with the BPMN 2.0 engine embedded in the SE BPMN 2.0. It goes back over the BPMN 2.0 engine API. Available services are:
|| Interface name || Service name || Description ||
| {{Runtime}} | {{RuntimeService}} | To manage process instances |
{color:red}*A completer avec Bertrand*{color}

See the WSDL of the service and Activiti Java API documentation to get more information.
For this version of the SE BPMN 2.0, see the WSDL of the service and the Activiti Java API documentation to get more information.
{tip}The namespace of interface name and service name is {{http://petals.ow2.org/se/activiti/1.0}}{tip} {{http://petals.ow2.org/se/bpmn2.0/1.0}}{tip}

h2. The service "RuntimeService"
h1. Configuring the component

The component is can be configured through the parameters of its JBI descriptor file. These parameters are divided in following groups:
* *JBI parameters* that have not to be changed otherwise the component will not work,
* *CDK parameters* that are parameters driving the processing of the CDK layer,
* and *Activiti parameters" that are relative to the engine "Activiti".
* and *BPMN 2.0 engine parameters" that are relative to the BPMN 2.0 engine.

{color:red}*TODO: Mettre une copie en exemple d'un descripteur JBI du SE*{color}
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:xslt="http://petals.ow2.org/components/activiti/version-1"> xmlns:xslt="http://petals.ow2.org/components/bpmn/version-1">

<component type="service-engine">
<identification>
<name>petals-se-activiti</name> <name>petals-se-bpmn2</name>
<description>An Activiti Service Engine</description>
<description>An BPMN 2.0 Service Engine</description>
</identification>

<component-class-name description="Activiti Component class">org.ow2.petals.se.activiti.ActivitiSe</component-class-name>
<component-class-name description="BPMN 2.0 Component class">org.ow2.petals.se.bpmn2.Bpmn2Se</component-class-name>
<component-class-path><path-element/></component-class-path>
<bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name>
<petalsCDK:processor-max-pool-size>50</petalsCDK:processor-max-pool-size>
<petalsCDK:properties-file></petalsCDK:properties-file>
<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.activiti.ActivitiJBIListener</petalsCDK:jbi-listener-class-name> <petalsCDK:jbi-listener-class-name>org.ow2.petals.se.bpmn2.BPMN2JBIListener</petalsCDK:jbi-listener-class-name>
</component>
</jbi>{code}
h2. Component specific parameters

These parameters drive features proposed by the component and configure the engine Activiti 5.13:
These parameters drive features proposed by the component and configure the BPMN 2.0 engine "Activiti 5.14" embedded in the SE:
* activation of the mode 'integration',
* database parameters. Your are responsible to provide this database according to your needs. And especially, you must assume that the database is highly available to have a SE Activiti BPMN2 highly available.

{center}*Configuration of the component, Specific parameter part, Database*{center}
h1. Logging

To enable traces of the Activiti engine, BPMN 2.0 engine "Activiti", you add in the logging configuration file of Petals ESB the following logger with the right level: {{xxxx}}

h1. Monitoring the component
h2. Unit-testing your XSD

A framework is available to unit-test the service unit deployed on the SE Activiti. BPMN2. It provides facilities for:
* check the compliance of the WSDL with the attendees of the component,
* verify easily the XSL used to generate output replies.
{code:lang=java}
import static org.junit.Assert.assertNotNull;
import static org.ow2.petals.se.activity.unittest.Assert.assertIsCompliant; org.ow2.petals.se.bpmn2.unittest.Assert.assertIsCompliant;

import java.io.InputStream;
.getResourceAsStream("myService.wsdl");
assertNotNull("WSDL not found as resource !", isWsdl);
assertIsCompliant("WSDL not compliant with SE Activiti BPMN2 attendes !", isWsdl);
}

{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="http://petals.ow2.org/se/activiti/sample/order" xmlns:tns="http://petals.ow2.org/se/bpmn2/sample/order"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://petals.ow2.org/se/activiti/sample/order"> targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order">

<!-- Type definitions for input and output parameters for service -->
<wsdl:types>
<xs:schema targetNamespace="http://petals.ow2.org/se/activiti/sample/order"> targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order">
<xs:complexType name="ItemType">
<xs:sequence>
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="http://petals.ow2.org/se/activiti/sample/order" xmlns:tns="http://petals.ow2.org/se/bpmn2/sample/order"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:activiti="http://petals.ow2.org/se/activiti/1.0" targetNamespace="http://petals.ow2.org/se/activiti/sample/order">
xmlns:bpmn="http://petals.ow2.org/se/bpmn2/1.0" targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order">

<wsdl:import location="OrderAbstract.wsdl"
namespace="http://petals.ow2.org/se/activiti/sample/order" namespace="http://petals.ow2.org/se/bpmn2/sample/order" />

<!-- Port bindings to SE Activiti BPMN2 -->
<wsdl:binding name="OrderBinding" type="tns:Order">
<wsdl:operation name="newOrder">
<activiti:operation activitiAction="createProcInstOp" />
<bpmn:operation bpmnAction="createProcInstOp" />
<activiti:variable <bpmn:variable name="customerName" value="/newOrderRequest/customerName" />
<activiti:variable <bpmn:variable name="address" value="/newOrderRequest/address" />
<activiti:output <bpmn:output xsl="newOrderOutput.xsl" />
<wsdl:input />
<wsdl:output />
</wsdl:operation>
<wsdl:operation name="validOrder">
<activiti:operation activitiAction="completeTaskOp" />
<bpmn:operation bpmnAction="completeTaskOp" />
<activiti:input-parameter <bpmn:input-parameter name="processInstanceId" value="/validOrderRequest/orderId" />
<activiti:input-parameter <bpmn:input-parameter name="taskDefinitionKey" value="validOrder" />
<activiti:variable <bpmn:variable name="validationApproved" value="/validOrderRequest/isValidated" />
<activiti:variable <bpmn:variable name="creditCardNumber" value="/validOrderRequest/creditCardNumber" />
<activiti:output <bpmn:output xsl="validOrderOutput.xsl" />
<wsdl:input />
<wsdl:output />
</wsdl:operation>
<wsdl:operation name="searchOrder">
<activiti:operation activitiAction="retrieveProcInst" />
<bpmn:operation bpmnAction="retrieveProcInst" />
<activiti:input-parameter <bpmn:input-parameter name="processInstanceId" value="/searchOrderRequest/orderId" />
<activiti:input-parameter <bpmn:input-parameter name="isActive" value="/searchOrderRequest/isInProgress" />
<activiti:input-parameter <bpmn:input-parameter name="responsibleUser" value="/searchOrderRequest/responsibleUser" />
<activiti:input-parameter <bpmn:input-parameter name="responsibleGroup" value="/searchOrderRequest/responsibleGroup" />
<activiti:output <bpmn:output xsl="searchOrderOutput.xsl" />
<wsdl:input />
<wsdl:output />