JPDL specifies an xml schema and the mechanism to package all the process definition related files into a process archive.
A process archive is a zip file. The central file in the process archive is processdefinition.xml. The main information in that file is the process graph. The processdefinition.xml also contains information about actions and tasks. A process archive can also contain other process related files such as classes, ui-forms for tasks, ...
Deploying process archives can be done in 3 ways: with the process designer tool, with an ant task or programatically.
Deploying a process archive with the designer tool is still under construction.
Deploying a process archive with an ant task can be done as follows:
<target name="deploy.par"> <taskdef name="deploypar" classname="org.jbpm.jpdl.par.ProcessArchiveDeployerTask"> <classpath --make sure the jbpm-[version].jar is in this classpath--/> </taskdef> <deploypar par="build/myprocess.par" /> </target>
To deploy more process archives at once, use the nested fileset elements. The file attribute itself is optional. Other attributes of the ant task are:
Process archives can also be deployed programmatically with the class org.jbpm.jpdl.par.ProcessArchiveDeployer
Process definitions should never change because it is extremely difficult (if not, impossible) to predict all possible side effects of process definition changes.
To get around this problem, jBPM has a sophicticated process versioning mechanism. The versioning mechanism allows multiple process definitions of the same name to coexist in the database. A process instance can be started in the latest version available at that time and it will keep on executing in that same process definition for its complete lifetime. When a newer version is deployed, newly created instances will be started in the newest version, while older process instances keep on executing in the older process defintions.
Process definitions are a combination of a declaratively specified process graph and optionally, a set of related java classes. The java classes can be made available to the jBPM runtime environment in 2 ways : by making sure these classes are visible to the jBPM classloader. This usually means that you can put your delegation classes in a .jar file next to the jbpm-[version].jar. The java classes can also be included in the process archive. When you include your delegation classes in the process archive (and they are not visible to the jbpm classloader), jBPM will also apply versioning on these classes. More information about process classloading can be found in Section 13.2, “Delegation”
When a process archive gets deployed, it creates a process definition in the jBPM database. Process definitions can be versioned on the basis of the process definition name. When a named process archive gets deployed, the deployer will assign a version number. To assign this number, the deployer will look up the highest version number for process definitions with the same name and adds 1. Unnamed process definitions will always have version number -1.
A conversion class has been made available to assist you with converting your jBPM 2.0 process archives into jBPM 3.0 compatible process archives. Create an output directory to hold the converted process archives. Enter the following command line from the build directory of the jBPM 3.0 distribution:
java -jar converter.jar indirectory outdirectory
Substitute the input directory where your jBPM 2.0 process archives reside for "indirectory". Substitute the output directory for the one you created to hold the newly converted process archives for "outdirectory".
Delegation is the mechanism used to include the users' custom code in the execution of processes.
The jBPM class loader is the class loader that loads the jBPM classes. Meaning, the classloader that has the library jbpm-3.x.jar in its classpath. To make classes visible to the jBPM classloader, put them in a jar file and put the jar file besides the jbpm-3.x.jar. E.g. in the WEB-INF/lib folder in the case of webapplications.
Delegation classes are loaded with the process class loader of their respective process definition. The process class loader is a class loader that has the jBPM classloader as a parent. The process class loader adds all the classes of one perticular process definition. You can add classes to a process definition by putting them in the /classes folder in the process archive. Note that this is only useful when you want to version the classes that you add to the process definition. If versioning is not necessary, it is much more efficient to make the classes available to the jBPM class loader.
Delegation classes contain user code that is called from within the execution of a process. The most common example is an action. In the case of action, an implementation of the interface ActionHandler can be called on an event in the process. Delegations are specified in the processdefinition.xml. 3 pieces of data can be supplied when specifying a delegation :
Next is a description of all the configuration types:
This is the default configuration type. The config-type field will first instantiate an object of the delegation class and then set values in the fields of the object as specified in the configuration. The configuration is xml, where the elementnames have to correspond with the field names of the class. The content text of the element is put in the corresponding field. If necessary and possible, the content text of the element is converted to the field type.
Supported type conversions:
For example in the following class...
public class MyAction implements ActionHandler { // access specifiers can be private, default, protected or public private String city; Integer rounds; ... }
...this is a valid configuration:
... <action class="org.test.MyAction"> <city>Atlanta</city> <rounds>5</rounds> </action> ...
Same as config-type field but then the properties are set via setter methods, rather then directly on the fields. The same conversions are applied.
This instantiator will take the complete contents of the delegation xml element and passes this as text in the delegation class constructor.
The JPDL schema is the schema used in the file processdefinition.xml in the process archive.
Table 13.1.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the process |
swimlane | element | [0..*] | the swimlanes used in this process. the swimlanes represent process roles and they are used for task assignments. |
start-state | element | [0..1] | the start state of the process. Note that a process without a start-state is valid, but cannot be executed. |
{end-state|state|node|task-node|process-state|super-state|fork|join|decision} | element | [0..*] | the nodes of the process definition. Note that a process without nodes is valid, but cannot be executed. |
event | element | [0..*] | the process events that serve as a container for actions |
{action|script|create-timer|cancel-timer} | element | [0..*] | global defined actions that can be referenced from events and transitions. Note that these actions must specify a name in order to be referenced. |
task | element | [0..*] | global defined tasks that can be used in e.g. actions. |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process definition. |
Table 13.2.
Name | Type | Multiplicity | Description |
---|---|---|---|
{action|script|create-timer|cancel-timer} | element | 1 | a custom action that represents the behaviour for this node |
common node elements | See common node elements |
Table 13.3.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | required | the name of the node |
transition | element | [0..*] | the leaving transitions. Each transition leaving a node *must* have a distinct name. A maximum of one of the leaving transitions is allowed to have no name. The first transition that is specifed is called the default transition. The default transition is taken when the node is left without specifying a transition. |
event | element | [0..*] | supported event types: {node-enter|node-leave} |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node. |
timer | element | [0..*] | specifies a timer that monitors the duration of an execution in this node. |
Table 13.4.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the node |
event | element | [0..*] | supported event types: {node-leave} |
transition | element | [0..*] | the leaving transitions. Each transition leaving a node *must* have a distinct name. |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node. |
Table 13.5.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | required | the name of the end-state |
event | element | [0..*] | supported event types: {node-enter} |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node. |
Table 13.7.
Name | Type | Multiplicity | Description |
---|---|---|---|
signal | attribute | optional | {unsynchronized|never|first|first-wait|last|last-wait}, default is last. signal specifies the effect of task completion on the process execution continuation. |
create-tasks | attribute | optional | {yes|no|true|false}, default is true. can be set to false when a runtime calculation has to determine which of the tasks have to be created. in that case, add an action on node-enter, create the tasks in the action and set create-tasks to false. |
task | element | [0..*] | the tasks that should be created when execution arrives in this task node. |
common node elements | See common node elements |
Table 13.8.
Name | Type | Multiplicity | Description |
---|---|---|---|
sub-process | element | 1 | the sub process that is associated with this node |
variable | element | [0..*] | specifies how data should be copied from the super process to the sub process at the start and from the sub process to the super process upon completion of the sub process. |
common node elements | See common node elements |
Table 13.9.
Name | Type | Multiplicity | Description |
---|---|---|---|
{end-state|state|node|task-node|process-state|super-state|fork|join|decision} | element | [0..*] | the nodes of the superstate. superstates can be nested. |
common node elements | See common node elements |
Table 13.12.
Name | Type | Multiplicity | Description |
---|---|---|---|
handler | element | either a 'handler' element or conditions on the transitions should be specified | the name of a org.jbpm.jpdl.Def.DecisionHandler implementation |
transition | element | [0..*] | the leaving transitions. The leaving transitions of a decision can be extended with a condition. The decision will look for the first transition for which the condition evaluates to true. A transition without a condition is considered to evaluate to true (to model the 'otherwise' branch). See the condition element |
common node elements | See common node elements |
Table 13.13.
Name | Type | Multiplicity | Description |
---|---|---|---|
type | attribute | required | the event type that is expressed relative to the element on which the event is placed |
{action|script|create-timer|cancel-timer} | element | [0..*] | the list of actions that should be executed on this event |
Table 13.14.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the transition. Note that each transition leaving a node *must* have a distinct name. |
to | attribute | required | the hierarchical name of the destination node. For more information about hierarchical names, see Section 7.5.3, “Hierarchical names” |
{action|script|create-timer|cancel-timer} | element | [0..*] | the actions to be executed upon taking this transition. Note that the actions of a transition do not need to be put in an event (because there is only one) |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node. |
Table 13.15.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the action. When actions are given names, they can be looked up from the process definition. This can be useful for runtime actions and declaring actions only once. |
class | attibute | either this or ref-name | the fully qualified class name of the class that implements the org.jbpm.graph.def.ActionHandler interface. |
ref-name | attibute | either this or class | the name of the referenced action. The content of this action is not processed further if a referenced action is specified. |
accept-propagated-events | attribute | optional | {yes|no|true|false}. Default is yes|true. If set to false, the action will only be executed on events that were fired on this action's element. for more information, see Section 7.4.4, “Event propagation” |
config-type | attribute | optional | {field|bean|constructor|configuration-property}. Specifies how the action-object should be constructed and how the content of this element should be used as configuration information for that action-object. |
{content} | optional | the content of the action can be used as configuration information for your custom action implementations. This allows the creation of reusable delegation classes. For more about delegation configuration, see Section 13.2.3, “Configuration of delegations”. |
Table 13.16.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the script-action. When actions are given names, they can be looked up from the process definition. This can be useful for runtime actions and declaring actions only once. |
accept-propagated-events | attribute | optional [0..*] | {yes|no|true|false}. Default is yes|true. If set to false, the action will only be executed on events that were fired on this action's element. for more information, see Section 7.4.4, “Event propagation” |
expression | element | [0..1] | the beanshell script. If you don't specify variable elements, you can write the expression as the content of the script element (omitting the expression element tag). |
variable | element | [0..*] | in variable for the script. If no in variables are specified, all the variables of the current token will be loaded into the script evaluation. Use the in variables if you want to limit the number of variables loaded into the script evaluation. |
Table 13.18.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | required | the process variable name |
access | attribute | optional | default is read,write. it is a comma separated list of access specifiers. the only access specifiers used so far are |
mapped-name | attribute | optional | this defaults to the variable name. it specifies a name to which the variable name is mapped. the meaning of the mapped-name is dependent on the context in which this element is used. for a script, this will be the script-variable-name. for a task controller, this will be the label of the task form parameter and for a process-state, this will be the variable name used in the sub-process. |
Table 13.19.
Name | Type | Multiplicity | Description |
---|---|---|---|
class | attibute | either this or ref-name | the fully qualified class name of the class that implements the org.jbpm.graph.node.DecisionHandler interface. |
config-type | attribute | optional | {field|bean|constructor|configuration-property}. Specifies how the action-object should be constructed and how the content of this element should be used as configuration information for that action-object. |
{content} | optional | the content of the handler can be used as configuration information for your custom handler implementations. This allows the creation of reusable delegation classes. For more about delegation configuration, see Section 13.2.3, “Configuration of delegations”. |
Table 13.20.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the timer. If no name is specified, the name of the enclosing node is taken. Note that every timer should have a unique name. |
duedate | attribute | required | the duration (optionally expressed in business hours) that specifies the the time period between the creation of the timer and the execution of the timer. See Section 11.1, “Duration” for the syntax. |
repeat | attribute | optional | {duration | 'yes' | 'true'}after a timer has been executed on the duedate, 'repeat' optionally specifies duration between repeating timer executions until the node is left. If yes of true is specified, the same duration as for the due date is taken for the repeat. See Section 11.1, “Duration” for the syntax. |
transition | attribute | optional | a transition-name to be taken when the timer executes, after firing the the timer event and executing the action (if any). |
cancel-event | attribute | optional | this attribute is only to be used in timers of tasks. it specifies the event on which the timer should be cancelled. by default, this is the task-end event, but it can be set to e.g. task-assign or task-start. The cancel-event types can be combined by specifying them in a comma separated list in the attribute. |
Table 13.21.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the timer. The name can be used for cancelling the timer with a cancel-timer action. |
duedate | attribute | required | the duration (optionally expressed in business hours) that specifies the the time period between the creation of the timer and the execution of the timer. See Section 11.1, “Duration” for the syntax. |
repeat | attribute | optional | {duration | 'yes' | 'true'}after a timer has been executed on the duedate, 'repeat' optionally specifies duration between repeating timer executions until the node is left. If yes of true is specified, the same duration as for the due date is taken for the repeat. See Section 11.1, “Duration” for the syntax. |
transition | attribute | optional | a transition-name to be taken when the timer executes, after firing the the timer event and executing the action (if any). |
Table 13.23.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | optional | the name of the task. Named tasks can be referenced and looked up via the TaskMgmtDefinition |
blocking | attribute | optional | {yes|no|true|false}, default is false. If blocking is set to true, the node cannot be left when the task is not finished. If set to false (default) a signal on the token is allowed to continue execution and leave the node. The default is set to false, because blocking is normally forced by the user interface. |
duedate | attribute | optional | is a duration expressed in absolute or business hours as explained in Chapter 11, Business calendar |
swimlane | attribute | optional | reference to a swimlane. If a swimlane is specified on a task, the assignment is ignored. |
priority | attribute | optional | one of {highest, high, normal, low, lowest}. alternatively, any integer number can be specified for the priority. FYI: (highest=1, lowest=5) |
assignment | element | optional | describes a delegation that will assign the task to an actor when the task is created. |
event | element | [0..*] | supported event types: {task-create|task-start|task-assign|task-end}. Especially for the task-assign we have added a non-persisted property previousActorId to the TaskInstance |
exception-handler | element | [0..*] | a list of exception handlers that applies to all exceptions thrown by delegation classes thrown in this process node. |
timer | element | [0..*] | specifies a timer that monitors the duration of an execution in this task. special for task timers, the cancel-event can be specified. by default the cancel-event is task-end, but it can be customized to e.g. task-assign or task-start. |
controller | element | [0..1] | specifies how the process variables are transformed into task form parameters. the task form paramaters are used by the user interface to render a task form to the user. |
Table 13.24.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | required | the name of the swimlane. Swimlanes can be referenced and looked up via the TaskMgmtDefinition |
assignment | element | [1..1] | specifies a the assignment of this swimlane. the assignment will be performed when the first task instance is created in this swimlane. |
Table 13.25.
Name | Type | Multiplicity | Description |
---|---|---|---|
class | attribute | required | the fully qualified classname of an implementation of org.jbpm.taskmgmt.def.AssignmentHandler |
config-type | attribute | optional | {field|bean|constructor|configuration-property}. Specifies how the assignment-handler-object should be constructed and how the content of this element should be used as configuration information for that assignment-handler-object. |
{content} | optional | the content of the assignment-element can be used as configuration information for your AssignmentHandler implementations. This allows the creation of reusable delegation classes. for more about delegation configuration, see Section 13.2.3, “Configuration of delegations”. |
Table 13.26.
Name | Type | Multiplicity | Description |
---|---|---|---|
class | attribute | optional | the fully qualified classname of an implementation of org.jbpm.taskmgmt.def.TaskControllerHandler |
config-type | attribute | optional | {field|bean|constructor|configuration-property}. Specifies how the assignment-handler-object should be constructed and how the content of this element should be used as configuration information for that assignment-handler-object. |
{content} | either the content of the controller is the configuration of the specified task controller handler (if the class attribute is specified. if no task controller handler is specified, the content must be a list of variable elements. | ||
variable | element | [0..*] | in case no task controller handler is specified by the class attribute, the content of the controller element must be a list of variables. |
Table 13.27.
Name | Type | Multiplicity | Description |
---|---|---|---|
name | attribute | required | the name of the sub process. To know how you can test subprocesses, see Section 15.3, “Testing sub processes” |
version | attribute | optional | the version of the sub process. If no version is specified, the latest version of the given process will be taken. |
Table 13.29.
Name | Type | Multiplicity | Description |
---|---|---|---|
exception-class | attribute | optional | specifies the fully qualified name of the java throwable class that should match this exception handler. If this attribute is not specified, it matches all exceptions (java.lang.Throwable). |
action | element | [1..*] | a list of actions to be executed when an exception is being handled by this exception handler. |