Target Runtime Extensions

While it has its merits as a graphical modeling tool to simply document complex business processes, BPMN2 Modeler was primarily designed to be used by software architects for building artifacts that can be deployed, and executed by a business process engine. The authors of the BPMN 2.0 spec have intentionally left many of the implementation details for execution engines open to interpretation by software vendors because they understood that software and hardware technologies are constantly evolving and BPMN2 Modeler was designed to evolve with them.

The so-called “Target Runtime” represents a specific BPM engine technology and is encapsulated by an extension plug-in. BPMN2 Modeler defines a flexible, and open programming API to facilitate development of new Target Runtime plug-ins by third-party vendors. These plug-ins may contribute one or more components to BPMN2 Modeler, for example:

·         Extension Models in the form of EMF model definitions

·         Tool Profiles

·         Property View tabs

·         Preference Pages

·         Editor UI components (Dialogs, Menus, behavior, etc.)

·         New File Wizards

·         Model Validation constraints

A Target Runtime is defined on a Workspace Project using the Project Property Page (from the Project’s Properties context menu action.) Once the Project has been declared as being associated with a specific Target Runtime, the extension plug-in that implements that Target Runtime will be invoked whenever a BPMN file needs to be edited, created, validated or manipulated in any way required by the Target Runtime.

One such Target Runtime has already been developed as part of the BPMN2 Modeler project and, indeed was the inspiration behind many of the design decisions made during development. The jBPM Target Runtime demonstrates BPMN2 Modeler’s extensibility and is described in more detail in the sections that follow.

The jBPM Target Runtime

BPMN 2.0 Language Subset and Extensions

This section describes the jBPM language subset of BPMN 2.0 as well as extension elements.

Elements not supported

The following BPMN 2.0 elements are not supported by jBPM and, while they can be enabled using the Tool Profile Preferences, there is no guarantee that a Process containing any of these unsupported elements can be successfully deployed and executed.


 

Table 2: BPMN 2.0 Elements not supported by jBPM

·         Call Choreography

·         Call Conversation

·         Choreography

·         Choreography Task

·         Collaboration

·         Complex Gateway

·         Conversation

·         Conversation Link

·         Correlation Property

·         Correlation Subscription

·         Data Store

·         Global Tasks

·         Import

·         Message Flow

·         Participant

·         Standard Loop

·         Sub Choreography

·         Sub Conversation

·         Transaction

      Characteristics

BPMN 2.0 Element Extensions

This section lists all of the jBPM extension elements and attributes. See the jBPM User Guide for more information about these extensions [7].

·         Process – This element has the following extension attributes and elements:

o    Version – Version number of the file

o    Package Name – The name of the Guvnor package that owns this Process.

o    Ad Hoc – A Boolean attribute that identifies this as an Ad Hoc Process. See the discussion of Ad Hoc Sub-Process in the Appendix.

o    Import – This extension element is used instead of the BPMN 2.0 Import element.

§  Name – the name of a Java class

o    Global – This extension element is used to define Process global variables. Global variables differ from normal Process variables in that they can be accessed outside the scope of the Process.

§  Identifier – name of the global variable

§  Type – Java Type name of the variable

·         Call Activity– This element has the following extension attributes:

o    Wait For Completion - If this property is true, the Call Activity will only continue after the child Process (the Called Activity) has finished executing. If false, the parent process flow will continue immediately after starting the child process.

o    Independent - If this property is true, the child process is started as an independent process, which means that it will not be terminated if the parent process finishes or, if the Sub-Process containing the Call Activity is cancelled for some reason. If false, the active child process will be cancelled on termination of the parent process (or on cancellation of the Sub-Process).

·         Activities – all Activities have extension elements for scripts that can be evaluated before and after execution.

o    On Entry Script – evaluated just before the Activity is executed.

§  Script Format – either Java or MVEL. The default is Java

§  Script – the script text

o    On Exit Script – evaluated after Activity execution.

§  Script Format – either Java or MVEL. The default is Java

§  Script – the script text

·         Business Rule Task– This element has the following extension attribute:

o    Ruleflow Group – In jBPM a Business Rule Task defines a set of rules that need to be evaluated. This attribute is the name of a specific Ruleflow group, which determines the evaluation semantics of these rules.

·         Sequence Flow– This element has the following extension attribute:

o    Priority – The decision which outgoing flow from an Exclusive Gateway to take, is made by evaluating the constraints that are linked to each of the outgoing connections. The constraint with the lowest priority number that evaluates to true is selected.

Tool Palette Profiles

The jBPM Target Runtime is configured with three sets of Tool Profiles: “Full”, “Simple” and “RuleFlow”. These are predefined with the BPMN2 elements most likely to be used for various modeling tasks. These Tool Profiles can be configured in the Preference Page as desired to enable more or fewer elements, as shown below:

Figure 74: jBPM Tool Profiles Preference Page

Note that the Target Runtime Model Extensions towards the bottom of the Extension Elements tree contains all of the BPMN 2.0 extensions defined by jBPM. These can also be enabled or disabled in the UI as desired.

Work Item Definitions

The jBPM Target Runtime plug-in will automatically load work item definition files and add a Tool Palette entry for each definition found. These will be created in the Custom Tasks tool drawer. These configuration files can be located anywhere within the Project directory hierarchy.

See the jBPM documentation for information regarding work definition configuration files [7].

Java Type Import Wizard

Because the jBPM process engine is Java-centric, the jBPM Target Runtime plug-in defines Java data types as the BPMN2 Type Language. Importing of different files types, e.g. WSDL or XSD, is not supported. Instead, the BPMN2 Modeler’s File Import Dialog is replaced by the Java Type Import Wizard, shown here:

Figure 75: Java Type Import Dialog

There are two ways to invoke the Import Wizard:

1.    From the Imports List in the Process Definitions Property tab – this simply adds the Java Type definition to the list of Imports and creates Process Data Types for all of the Java classes and interfaces used or defined in the imported Type.

2.    From the Interfaces List in the Process Interfaces Property tab – this not only adds the Java Type definition to the list of Imports, but it also creates Process Interface, Operation, Message and Data Type definitions from the imported Java class.

As you start typing text into the Type field, the Java Types list is updated to show the Java classes and interfaces that match the text. If the Import Wizard was invoked from the Interfaces List, it will also have a Create Process Variables check box; setting this will cause the Import Wizard to create Process variables for each of the Java Types found in the imported class or interface, including method parameter and return value Types.

To illustrate how the Import Wizard works, we will use the following Java class as an example. This class defines an inner class (named “Parameter”) several methods that define parameters and return values of this type, and a method with a “throw” declaration.

package org.jboss.jbpm5.runtime;

 

public class Configuration {

 

      public static class Parameter {

               String name;

               String value;

              

               public String getName() {

                         return name;

               }

               public void setName(String name) {

                         this.name = name;

               }

               public String getValue() {

                         return value;

               }

               public void setValue(String value) {

                         this.value = value;

               }

      }

     

      Parameter parameter;

 

      public Parameter getParameter() {

               return parameter;

      }

 

      public void setParameter(Parameter parameter) {

               this.parameter = parameter;

      }

     

      public boolean apply() throws IllegalArgumentException {

               if (parameter==null)

                         throw new IllegalArgumentException("Parameter is not set");

               return true;

      }

}

When we click the  Import button on the Interfaces Property tab and select this class, the Import Wizard creates the following Process definitions: A new Interface is created; this will have the same name as the imported Java Type:

New Imports are created for each of the defined or referenced Java Types found:

New Data Type definitions are created for each of the Java Types found:

Message definitions are created for each of the methods found:

Error definitions are created for each “throw” declaration on methods:

And finally, Process variables are created for each Java Type found: