[jbpm-commits] JBoss JBPM SVN: r5676 - in jbpm4/branches/tbaeyens: modules/distro/src/main/files/examples and 27 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Oct 1 12:13:49 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-10-01 12:13:41 -0400 (Thu, 01 Oct 2009)
New Revision: 5676
Added:
jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl-4.2.xsd
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParserVersion.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransition.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransitions.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/CustomActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/UserCodeEventListener.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionConditionDescriptor.java
Removed:
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlBindingsParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.eventlisteners.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java
Modified:
jbpm4/branches/tbaeyens/modules/distro/src/main/files/examples/build.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
jbpm4/branches/tbaeyens/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
jbpm4/branches/tbaeyens/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
jbpm4/branches/tbaeyens/qa/build.xml
Log:
adding versioning to parsing on tbaeyens branch
Added: jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl-4.2.xsd
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl-4.2.xsd (rev 0)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl-4.2.xsd 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,1186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://jbpm.org/4.2/jpdl"
+ xmlns:tns="http://jbpm.org/4.2/jpdl"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <annotation>
+ <documentation>Schema for jPDL 4 process descriptions;
+ element process is the top level element.
+ </documentation>
+ </annotation>
+
+ <!-- ### PROCESS DEFINITION ############################################# -->
+
+ <element name="process">
+ <annotation><documentation>A jPDL process definition description; This
+ is the top level element in a jPDL process file.</documentation></annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="name" use="required" type="string">
+ <annotation>
+ <documentation>
+ The process name. Multiple processes can be deployed with the same name, as long as they have a different
+ version.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="key" type="string">
+ <annotation>
+ <documentation>
+ The key can be used to provide a short acronym that will replace the name as the basis for the generated
+ process definition id
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="int">
+ <annotation>
+ <documentation>
+ Indicates the sequence number of this version for all processes with the same name. By specifying a version
+ automatic deployment can figure out if this process is already deployed or not.
+ </documentation>
+ </annotation>
+ </attribute>
+ <anyAttribute processContents="skip">
+ <annotation><documentation>for extensibility
+ </documentation></annotation>
+ </anyAttribute>
+ </complexType>
+ </element>
+
+ <!-- ### ACTIVITIES ##################################################### -->
+
+ <group name="activityGroup">
+ <choice>
+ <!-- ~~~ START ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="start">
+ <annotation><documentation>Start event
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="form" type="string">
+ <annotation><documentation>the resource name of the form in the
+ deployment.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- ~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="end">
+ <annotation><documentation>End event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="state" default="ended" type="string">
+ <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="end-cancel">
+ <annotation><documentation>End cancel event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="end-error">
+ <annotation><documentation>End cancel event.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="ends" default="process-instance">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="execution"/>
+ <enumeration value="process-instance"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- ~~~ STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="state">
+ <annotation><documentation>A wait state. When an execution arrives in this
+ activity, the execution will wait until an external trigger is received
+ with execution.signal() or execution.getActivityInstance().signal()
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="decision">
+ <annotation><documentation>Decision gateway: selects one path out of many alternatives.
+ When an execution comes in, exactly one outgoing transition is taken.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element name="handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element name="condition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <!-- TODO add conditions -->
+ </element>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script that will be evaluated and resolve to
+ the name of the outgoing transition.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use for the expr attribute.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- ~~~ FORK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="fork">
+ <annotation><documentation>Spawns multiple concurrent paths of
+ execution.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ JOIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="join">
+ <annotation><documentation>Spawns multiple concurrent paths of
+ execution.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attribute name="multiplicity" type="int" />
+ <attribute name="lockmode" default="upgrade">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="none"/>
+ <enumeration value="read"/>
+ <enumeration value="upgrade"/>
+ <enumeration value="upgrade_nowait"/>
+ <enumeration value="write"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- ~~~ SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="script">
+ <annotation><documentation>Evaluates a piece of text as a script
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:scriptType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ HQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="hql">
+ <annotation><documentation>Performs a hibernate query
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:qlType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="sql">
+ <annotation><documentation>Performs a hibernate SQL query
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:qlType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ MAIL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="mail">
+ <annotation><documentation>Sends an email
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:mailType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ JAVA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="java">
+ <annotation><documentation>Invokes a method on a java object.
+ Either the java class is instantiated with reflection, or the
+ java object is fetched from the environment. Then values from the
+ environment are injected into the fields and a method is executed.
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:javaType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ CUSTOM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="custom">
+ <annotation><documentation>Uses a user defined, custom implementation of
+ ActivityBehaviour
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:wireObjectType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <!-- ~~~ TASK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="task">
+ <annotation><documentation>Creates a task in the task component.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="notification" minOccurs="0">
+ <complexType>
+ <attribute name="continue" type="tns:continueType" default="sync" />
+ <attribute name="template" type="tns:templateType" use="optional" />
+ </complexType>
+ </element>
+ <element name="reminder" minOccurs="0">
+ <complexType>
+ <attribute name="duedate" type="string" />
+ <attribute name="repeat" type="string" />
+ <attribute name="continue" type="tns:continueType" default="sync" />
+ <attribute name="template" type="tns:templateType" use="optional"/>
+ </complexType>
+ </element>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ <attributeGroup ref="tns:assignmentAttributes"/>
+ <attribute name="swimlane" type="string" />
+ <attribute name="form" type="string">
+ <annotation><documentation>the resource name of the form in the
+ deployment.</documentation></annotation>
+ </attribute>
+ <attribute name="duedate" type="string" />
+ <attribute name="on-transition" default="cancel">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="keep"/>
+ <enumeration value="cancel"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="completion" type="string" default="complete" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="sub-process">
+ <annotation><documentation>Waits while a sub process instance is
+ being executed and continues when the sub process instance ends.
+ </documentation></annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element name="parameter-in" type="tns:parameterType" minOccurs="0" maxOccurs="unbounded" />
+ <element name="parameter-out" type="tns:parameterType" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
+ </element>
+ <element name="swimlane-mapping" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="swimlane" type="string" use="required" />
+ <attribute name="sub-swimlane" type="string" use="required" />
+ </complexType>
+ </element>
+ <element name="transition" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <complexContent>
+ <extension base="tns:transitionType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element name="outcome-value">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="sub-process-id" type="string">
+ <annotation><documentation>Identifies the sub process by the id. This means that a specific
+ version of a process definition is referenced
+ </documentation></annotation>
+ </attribute>
+ <attribute name="sub-process-key" type="string">
+ <annotation><documentation>Identifies the sub process by the key. This means that the latest
+ version of the process definition with the given key is referenced. The latest version
+ of the process is looked up each time the activity executes.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="outcome" type="string">
+ <annotation><documentation>Expression that is evaluated when the sub process
+ instance ends. The value is then used for outcome transition mapping.
+ </documentation></annotation>
+ </attribute>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+
+ <!-- ~~~ group ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="group">
+ <annotation><documentation>Scope enclosing a number of activities.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
+ </element>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </complexType>
+ </element>
+ </choice>
+ </group>
+
+ <group name="wireObjectGroup">
+ <choice>
+ <!-- SPECIAL OBJECTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="null">
+ <annotation><documentation>the null value
+ </documentation></annotation>
+ </element>
+ <element name="ref">
+ <annotation><documentation>A reference to an object in the current environment</documentation></annotation>
+ <complexType>
+ <attribute name="object" type="string" use="required">
+ <annotation><documentation>The name of the referred object</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="env-ref">
+ <annotation><documentation>The current environment.
+ </documentation></annotation>
+ </element>
+ <element name="jndi">
+ <annotation><documentation>A lookup from JNDI through the InitialContext
+ </documentation></annotation>
+ <complexType>
+ <attribute name="jndi-name" type="string" use="required" />
+ </complexType>
+ </element>
+
+ <!-- COLLECTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="list">
+ <annotation><documentation>A java.util.List</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="class" type="string" default="java.util.ArrayList">
+ <annotation><documentation>Implementation class for this list.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedList(List)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="map">
+ <annotation><documentation>A java.util.Map</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="entry">
+ <complexType>
+ <choice minOccurs="0">
+ <element name="key" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ <element name="value" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ </choice>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string" default="java.util.HashMap">
+ <annotation><documentation>Implementation class for this map.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedList(List)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="set">
+ <annotation><documentation>A java.util.Set
+ </documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="class" type="string" default="java.util.HashList">
+ <annotation><documentation>Implementation class for this set.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedSet(Set)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="properties">
+ <annotation><documentation>A java.util.Properties</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="property">
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attribute name="value" type="string" use="required" />
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="file" type="string">
+ <annotation><documentation>A file on the file system</documentation></annotation>
+ </attribute>
+ <attribute name="resource" type="string">
+ <annotation><documentation>A file as a resource in the classpath</documentation></annotation>
+ </attribute>
+ <attribute name="url" type="string">
+ <annotation><documentation>the contents is fetched by loading a url</documentation></annotation>
+ </attribute>
+ <attribute name="is-xml" type="tns:booleanValueType">
+ <annotation><documentation>optionally indicates if the content of referenced file in attributes
+ 'file', 'resource' or 'url' is XML. The default is the
+ plain properties format with a space or the equals character (=) separating key and value on
+ each line.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- OBJECT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="object" type="tns:wireObjectType" />
+
+ <!-- BASIC TYPES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="string">
+ <complexType>
+ <attribute name="name">
+ <annotation><documentation>the name of the string object</documentation></annotation>
+ </attribute>
+ <attribute name="value">
+ <annotation><documentation>the actual string value</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="byte">
+ <annotation><documentation>A java.lang.Byte</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="byte" use="required" />
+ </complexType>
+ </element>
+ <element name="char">
+ <annotation><documentation>A java.lang.Character</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" use="required">
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="1" />
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="double">
+ <annotation><documentation>A java.lang.Double</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="double" use="required" />
+ </complexType>
+ </element>
+ <element name="false">
+ <annotation><documentation>java.lang.Boolean.FALSE
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="float">
+ <annotation><documentation>A java.lang.Float
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="float" use="required" />
+ </complexType>
+ </element>
+ <element name="int">
+ <annotation><documentation>A java.lang.Integer
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="int" use="required"/>
+ </complexType>
+ </element>
+ <element name="long">
+ <annotation><documentation>A java.lang.Long</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="long" use="required"/>
+ </complexType>
+ </element>
+ <element name="short">
+ <annotation><documentation>a java.lang.Short
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="short" use="required"/>
+ </complexType>
+ </element>
+ <element name="true">
+ <annotation><documentation>java.lang.Boolean.TRUE
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+ </choice>
+ </group>
+
+ <complexType name="wireObjectType">
+ <annotation><documentation>Any java object that will be created by reflection. .
+ <p>There are three main ways to create an object: by constructor or by a factory
+ object or a static factory method.</p>
+ <p><b>Using the constructor</b>: Then the <code>class</code> attribute must provide the
+ fully qualified class name. In case another constructor then the default is
+ targetted, a <code>constructor</code> child element can be provided.
+ The <code>factory</code> attribute should not be provided for using a constructor.
+ </p>
+ <p><b>Using a factory</b>: Then the <code>factory</code> attribute or one
+ <code>factory</code> element must be provided along with the attribute
+ <code>method</code>.
+ </p>
+ <p><b>Using a static factory method</b>: Then the <code>class</code> and
+ <code>method</code> attributes should be specified. There should be no
+ reference to a <code>factory</code> attribute of element.
+ </p>
+ <p><b>Construction and initialization</b>: all objects (constructor and factory)
+ are build in two phases: construction and initialisation phase. During construction
+ all is done until a pointer is obtained to the object. In initialisation, operations
+ are applied to the object until it is ready to be used. The separation between
+ construction and initialisation is made to allow for bidirectional references. In
+ that case, at least one of both ends can not be fully initialised before it is injected
+ into the other end.
+ </p>
+ <p><b>Operations</b>: after construction, various operations can be applied to objects
+ like e.g. direct field injection, injection through setters, method invocation,
+ enlist with the standard transaction, subscribe the object as a listener to an observable
+ </p>
+ <p><b>Arguments</b>: There are two different places for arguments. The <code>arg</code>
+ elements for the factory method invocation should be placed as child elements under the
+ <code>object</code> element. The <code>arg</code> elements for the constructor should be
+ placed as child elements under the <code>constructor</code> element.
+ </p>
+ </documentation></annotation>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="factory">
+ <annotation><documentation>Contains one element that describes the factory object.</documentation></annotation>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ <element name="constructor">
+ <annotation><documentation>Specifies the arguments to use for a non-default constructor.</documentation></annotation>
+ <complexType>
+ <choice maxOccurs="unbounded">
+ <element name="arg" type="tns:argType" />
+ </choice>
+ </complexType>
+ </element>
+ <element name="arg" type="tns:argType">
+ <annotation><documentation>The factory method arguments.</documentation></annotation>
+ </element>
+ <element name="field">
+ <annotation><documentation>Injects a value into a member field of this object.
+ Exactly one child element must specify the value.
+ </documentation></annotation>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name">
+ <annotation><documentation>The member field name</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="property">
+ <annotation><documentation>Injects a value through a setter method.
+ Exactly one child element must specify the value.
+ </documentation></annotation>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name">
+ <annotation><documentation>The name of the property (without the 'set' prefix)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="invoke">
+ <annotation><documentation>Invokes a method</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="arg" type="tns:argType" />
+ </choice>
+ <attribute name="method" type="string" use="required">
+ <annotation><documentation>the method name</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string">
+ <annotation><documentation>The fully qualified class name</documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The class to instantiate.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>The class to instantiate.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="factory" type="string">
+ <annotation><documentation>The name of the factory object</documentation></annotation>
+ </attribute>
+ <attribute name="method" type="string">
+ <annotation><documentation>The factory method name</documentation></annotation>
+ </attribute>
+ <attribute name="auto-wire" type="string">
+ <annotation><documentation>Indicates if the member fields and setter properties
+ should be automatically wired based on matching the property names and types with the
+ object names and types</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="argType">
+ <annotation><documentation>The method arguments.
+ Each 'arg' element should have exactly one child element
+ that represents the value of the argument.
+ </documentation></annotation>
+ <attribute name="type" type="string">
+ <annotation><documentation>The java class name representing
+ the type of the method. This is optional and can be used to
+ indicate the appropriate method in case of method overloading.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="javaType">
+ <sequence>
+ <element name="field" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Field injections from the environment
+ invocation.</documentation></annotation>
+ </element>
+ <element name="arg" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Method arguments.</documentation></annotation>
+ </element>
+ </sequence>
+ <attribute name="object" type="string">
+ <annotation><documentation>Name of the object in the environment
+ </documentation></annotation>
+ </attribute>
+ <attribute name="method" type="string" use="required">
+ <annotation><documentation>The name of the method to invoke.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation><documentation>The class to instantiate.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>Expression that resolves to the target object
+ on which the method should be invoked.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>The language in which attribute 'expr' is to be
+ resolved.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>The variable name to store the return value
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="scriptType">
+ <sequence>
+ <element name="text" type="string" minOccurs="0">
+ <annotation><documentation>The content of this expression element
+ is the script text that will be evaluated. This is mutually
+ exclusive with the expression attribute.</documentation></annotation>
+ </element>
+ </sequence>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated. This
+ is mutually exclusive with the expression element.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use.</documentation></annotation>
+ </attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>Name of the variable in which the result
+ of the script evaluation will be stored</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="qlType">
+ <sequence>
+ <element name="query" type="string">
+ <annotation><documentation>The query text.</documentation></annotation>
+ </element>
+ <element name="parameters" minOccurs="0">
+ <annotation><documentation>Query parameters.</documentation></annotation>
+ <complexType>
+ <sequence>
+ <group ref="tns:wireObjectGroup" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="var" type="string">
+ <annotation><documentation>Name of the variable in which the result
+ of the script evaluation will be stored</documentation></annotation>
+ </attribute>
+ <attribute name="unique" type="string">
+ <annotation><documentation>Does this query return a unique result or a list
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <attributeGroup name="activityAttributes">
+ <attribute name="name" type="string">
+ <annotation><documentation>The id of this activity. The name should be unique
+ in the complete scope of the process.</documentation></annotation>
+ </attribute>
+ <attribute name="g" type="string">
+ <annotation><documentation>Graphical information used by process designer tool.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="continue" default="sync" type="tns:continueType">
+ <annotation><documentation>To specify async continuations.
+ sync is the default.
+ </documentation></annotation>
+ </attribute>
+ </attributeGroup>
+
+ <simpleType name="continueType">
+ <restriction base="string">
+ <enumeration value="async" />
+ <enumeration value="sync" />
+ <enumeration value="exclusive" />
+ </restriction>
+ </simpleType>
+
+
+ <attributeGroup name="assignmentAttributes">
+ <annotation><documentation>the assignment attributes will be used in
+ tasks and swimlanes to specify to whom these respectively are assigned.
+ </documentation></annotation>
+ <attribute name="assignee" type="string">
+ <annotation><documentation>Expression that resolves to a userId referencing
+ the person to which the task or swimlane will be assigned.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="assignee-lang" type="string">
+ <annotation><documentation>Expression language for the assignee attribute.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="candidate-users" type="string">
+ <annotation><documentation>Expression that resolves to a comma separated
+ list of userId's. All the referred people will be candidates for
+ take the task or swimlane.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-users-lang" type="string">
+ <annotation><documentation>Expression language for the
+ candidate-users attribute.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-groups" type="string">
+ <annotation><documentation>Resolves to a comma separated list of groupId's.
+ All the referred people will be candidates to
+ take the task or swimlane.</documentation></annotation>
+ </attribute>
+ <attribute name="candidate-groups-lang" type="string">
+ <annotation><documentation>Expression language for the
+ candidate-groups attribute.</documentation></annotation>
+ </attribute>
+ </attributeGroup>
+
+ <element name="swimlane">
+ <annotation><documentation>A process role.</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attributeGroup ref="tns:assignmentAttributes" />
+ </complexType>
+ </element>
+
+ <complexType name="transitionType">
+ <annotation><documentation>The outgoing transitions. The first in the list
+ will be the default outgoing transition.
+ </documentation></annotation>
+ <sequence>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="name" type="string">
+ <annotation><documentation>Name of this outgoing transition</documentation></annotation>
+ </attribute>
+ <attribute name="to" type="string">
+ <annotation><documentation>Name of the destination activity of this transition.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="g" type="string">
+ <annotation><documentation>Graphical information used by process designer tool.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <element name="transition" type="tns:transitionType">
+ <annotation><documentation>A transition from one activity to another.</documentation></annotation>
+ </element>
+
+ <element name="on">
+ <complexType>
+ <sequence>
+ <element ref="tns:timer" minOccurs="0" />
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>A list of event listeners that will
+ be notified when the event is fired</documentation></annotation>
+ </group>
+ </sequence>
+ <attribute name="event" type="string">
+ <annotation><documentation>The event identification. start, end, take or
+ any other custom event.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <complexType name="parameterType">
+ <attribute name="subvar" type="string">
+ <annotation><documentation>The name of the sub process variable.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>An expression for which the resulting
+ value will be used as value.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Language of the expression.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>Name of the process variable
+ in the super process execution..
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+
+
+ <element name="timer">
+ <complexType>
+ <sequence>
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>A list of event listeners that will
+ be notified when the timer fires</documentation></annotation>
+ </group>
+ </sequence>
+ <attribute name="duedate" type="string">
+ <annotation><documentation>Timer duedate expression that defines the duedate of this
+ timer relative to the creation time of the timer. E.g. '2 hours' or '4 business days'
+ </documentation></annotation>
+ </attribute>
+ <attribute name="repeat" type="string">
+ <annotation><documentation>Timer duedate expression that defines repeated scheduling
+ relative to the last timer fire event. E.g. '2 hours' or '4 business days'
+ </documentation></annotation>
+ </attribute>
+ <attribute name="duedatetime" type="string">
+ <annotation><documentation>Absolute time in format <code>HH:mm dd/MM/yyyy</code>
+ (see SimpleDateFormat). The format for the absolute time can be customized in the
+ jbpm configuration.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <group name="eventListenerGroup">
+ <choice>
+ <element name="event-listener" type="tns:wireObjectType" />
+ <element name="hql" type="tns:qlType" />
+ <element name="sql" type="tns:qlType" />
+ <element name="java" type="tns:javaType" />
+ <element name="script" type="tns:scriptType" />
+ <element name="mail" type="tns:mailType" />
+ </choice>
+ </group>
+
+ <complexType name="mailType">
+ <sequence>
+ <element name="from" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="to" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="cc" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="bcc" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="subject" type="string" minOccurs="0" />
+ <element name="text" type="string" minOccurs="0" />
+ <element name="html" type="string" minOccurs="0" />
+ <element name="attachments" minOccurs="0" >
+ <complexType>
+ <sequence>
+ <element name="attachment" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="url" type="string">
+ <annotation><documentation>URL reference to the attachment</documentation></annotation>
+ </attribute>
+ <attribute name="resource" type="string">
+ <annotation><documentation>Name of the attachment resource on the classpath</documentation></annotation>
+ </attribute>
+ <attribute name="file" type="string">
+ <annotation><documentation>File reference to the attachment</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="template" type="tns:templateType" />
+ </complexType>
+
+ <complexType name="mailRecipientType">
+ <attribute name="addresses" type="string">
+ <annotation><documentation>list of email address separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ </attribute>
+ <attribute name="users" type="string">
+ <annotation><documentation>list of user ids that are resolved to the email address against configured identity component.
+ user ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ </attribute>
+ <attribute name="groups" type="string">
+ <annotation><documentation>list of group ids that are resolved to the email address against configured identity component.
+ group ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <simpleType name="booleanValueType">
+ <restriction base="string">
+ <enumeration value="true" />
+ <enumeration value="on" />
+ <enumeration value="enabled" />
+ <enumeration value="false" />
+ <enumeration value="off" />
+ <enumeration value="disabled" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="templateType">
+ <annotation><documentation>Reference to the email template</documentation></annotation>
+ <restriction base="string"></restriction>
+ </simpleType>
+</schema>
Property changes on: jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl-4.2.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/files/examples/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/examples/build.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/examples/build.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -2,97 +2,84 @@
<project name="jbpm.examples">
- <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
- <property file="${user.home}/.jbpm4/build.properties" />
+ <property name="database" value="hsqldb" />
+ <property name="jbpm.home" value=".." />
+
+ <target name="deploy.examples.bar" description="Creates business archive target/examples.bar">
- <!-- DEFAULT PROPERTY VALUES -->
- <property name="database" value="hsqldb" />
- <property name="jbpm.parent.dir" value="../.." />
- <property name="jbpm.version" value="4.2-SNAPSHOT" />
- <property name="jboss.version" value="5.0.0.GA" />
- <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
+ <!-- compile src to target/classes -->
+ <path id="compile.classpath">
+ <fileset dir="${jbpm.home}">
+ <include name="jbpm.jar" />
+ </fileset>
+ <fileset dir="${jbpm.home}/lib" />
+ </path>
+ <mkdir dir="target/classes" />
+ <javac srcdir="src"
+ destdir="target/classes"
+ classpathref="compile.classpath" />
- <!-- JDBC PROPERTIES -->
- <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />
- <property file="${jbpm.home}/db/jdbc/${database}.properties" />
+ <!-- copy resources to target/classes -->
+ <copy todir="target/classes">
+ <fileset dir="src">
+ <exclude name="**/*.java" />
+ </fileset>
+ </copy>
- <!-- ### LOG PROPERTIES ################################################# -->
- <target name="log.properties">
- <echo message="database: ${database}" />
- <echo message="jdbc.driver........ ${jdbc.driver}" />
- <echo message="jdbc.url........... ${jdbc.url}" />
- <echo message="jdbc.username...... ${jdbc.username}" />
- <echo message="jbpm.version....... ${jbpm.version}" />
- <echo message="jbpm.home.......... ${jbpm.home}" />
- </target>
+ <!-- package examples.bar business archive containing classes and processes -->
+ <jar destfile="target/examples.bar">
+ <fileset dir="target/classes">
+ <exclude name="jbpm.cfg.xml" />
+ <exclude name="jbpm.hibernate.cfg.xml" />
+ <exclude name="jbpm.mail.properties" />
+ <exclude name="jbpm.mail.templates.examples.xml" />
+ <exclude name="logging.properties" />
+ <exclude name="org/jbpm/examples/task/swimlane/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/candidates/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/concurrency/graphbased/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/timer/repeat/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/script/text/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/decision/handler/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/script/expression/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/assignee/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/mail/inline/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/eventlistener/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/timer/event/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/assignmenthandler/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/java/JavaInstantiateTest.java" />
+ <exclude name="org/jbpm/examples/decision/conditions/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/decision/expression/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/java/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/notification process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/reminder process.jpdl.xml" />
+ </fileset>
+ </jar>
- <target name="jbpm.libs.path">
- <path id="jbpm.libs.incl.dependencies">
- <pathelement location="${jbpm.home}/examples/target/classes" />
- <fileset dir="${jbpm.home}">
- <include name="jbpm.jar" />
- </fileset>
- <fileset dir="${jbpm.home}/lib" />
- </path>
- </target>
+ <!-- create the jbpm configuration for deployment -->
+ <mkdir dir="target/deploycfg" />
+ <copy file="${jbpm.home}/install/src/cfg/hibernate/jdbc/${database}.hibernate.cfg.xml"
+ tofile="target/deploycfg/jbpm.hibernate.cfg.xml"
+ overwrite="true">
+ <filterset filtersfile="${jbpm.home}/install/jdbc/${database}.properties" />
+ </copy>
+ <copy file="${jbpm.home}/install/src/cfg/jbpm/standalone.testsuite.jbpm.cfg.xml"
+ tofile="target/deploycfg/jbpm.cfg.xml"
+ overwrite="true" />
- <!-- ### DEPLOY EXAMPLE BUSINESS ARCHIVES ############################### -->
- <target name="create.and.deploy.examples"
- depends="jbpm.libs.path, examples.jar">
- <mkdir dir="${jbpm.home}/examples/target" />
- <copy file="${jbpm.home}/install/src/cfg/hibernate/jdbc/${database}.hibernate.cfg.xml"
- tofile="${jbpm.home}/examples/target/classes/jbpm.hibernate.cfg.xml"
- overwrite="true">
- <filterset filtersfile="${jbpm.home}/install/jdbc/${database}.properties" />
- </copy>
- <jar destfile="${jbpm.home}/examples/target/examples.bar">
- <fileset dir="${jbpm.home}/examples/src">
- <exclude name="jbpm.cfg.xml" />
- <exclude name="jbpm.hibernate.cfg.xml" />
- <exclude name="jbpm.mail.properties" />
- <exclude name="jbpm.mail.templates.examples.xml" />
- <exclude name="logging.properties" />
- <exclude name="org/jbpm/examples/task/swimlane/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/task/candidates/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/concurrency/graphbased/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/timer/repeat/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/script/text/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/decision/handler/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/script/expression/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/task/assignee/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/mail/inline/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/eventlistener/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/timer/event/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/task/assignmenthandler/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/java/JavaInstantiateTest.java" />
- <exclude name="org/jbpm/examples/decision/conditions/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/decision/expression/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/java/process.jpdl.xml" />
- <exclude name="org/jbpm/examples/task/notification process.jpdl.xml" />
- <exclude name="org/jbpm/examples/task/reminder process.jpdl.xml" />
- </fileset>
- </jar>
- <taskdef name="jbpm-deploy" classname="org.jbpm.pvm.internal.ant.JbpmDeployTask" classpathref="jbpm.libs.incl.dependencies" />
- <jbpm-deploy file="${jbpm.home}/examples/target/examples.bar" />
- </target>
+ <!-- define the jbpm-deploy task in the proper classpath -->
+ <path id="deploy.classpath">
+ <pathelement location="target/classes" />
+ <pathelement location="target/deploycfg" />
+ <path refid="compile.classpath" />
+ </path>
+ <taskdef name="jbpm-deploy"
+ classname="org.jbpm.pvm.internal.ant.JbpmDeployTask"
+ classpathref="deploy.classpath" />
- <target name="examples.jar" depends="jbpm.libs.path">
- <mkdir dir="${jbpm.home}/examples/target/classes" />
- <javac srcdir="${jbpm.home}/examples/src"
- destdir="${jbpm.home}/examples/target/classes"
- classpathref="jbpm.libs.incl.dependencies" />
- <copy todir="${jbpm.home}/examples/target/classes">
- <fileset dir="${jbpm.home}/examples/src">
- <exclude name="**/*.java" />
- </fileset>
- </copy>
- <jar destfile="${jbpm.home}/examples/target/examples.jar" >
- <fileset dir="${jbpm.home}/examples/target/classes">
- <include name="**/*.class" />
- </fileset>
- </jar>
- </target>
+ <!-- deploy the examples business archive -->
+ <jbpm-deploy file="target/examples.bar" />
+ </target>
</project>
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/custom/CustomTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -38,6 +38,7 @@
deploymentId = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/examples/custom/process.jpdl.xml")
+ .addResourceFromClasspath("org/jbpm/examples/custom/PrintDots.class")
.deploy();
}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.pvm.internal.wire.JbpmClassNotFoundException;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CustomBinding extends JpdlBinding {
-
- static ObjectBinding objectBinding = new ObjectBinding();
-
- public CustomBinding() {
- super("custom");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor customActivitydescriptor = (ObjectDescriptor) objectBinding.parse(element, parse, wireParser);
- try {
- ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(customActivitydescriptor);
- return customActivityBehaviour;
-
- } catch (JbpmClassNotFoundException e) {
- return customActivitydescriptor;
- }
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import java.util.List;
-
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionBinding extends JpdlBinding {
-
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
- public DecisionBinding() {
- super("decision");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- if (element.hasAttribute("expr")) {
- DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
- String expr = element.getAttribute("expr");
- decisionExpressionActivity.setExpr(expr);
- return decisionExpressionActivity;
- }
-
- if (element.hasAttribute("handler-ref")) {
- String decisionHandlerName = element.getAttribute("handler-ref");
- DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
- return decisionHandlerActivity;
- }
-
- Element handlerElement = XmlUtil.element(element, "handler");
- if (handlerElement!=null) {
- DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
- objectBinding.parse(handlerElement, parse, wireParser);
- decisionHandlerActivity.setDecisionHandlerDescriptor(decisionHandlerDescriptor);
- return decisionHandlerActivity;
- }
-
- boolean hasConditions = false;
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- ActivityImpl activity = parse.findObject(ActivityImpl.class);
- List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
-
- for (int i=0; i<transitionElements.size(); i++) {
- TransitionImpl transition = transitions.get(i);
- Element transitionElement = transitionElements.get(i);
-
- Element conditionElement = XmlUtil.element(transitionElement, "condition");
- if (conditionElement!=null) {
- hasConditions = true;
-
- if (conditionElement.hasAttribute("expr")) {
- String expr = conditionElement.getAttribute("expr");
- String lang = XmlUtil.attribute(conditionElement, "expr-lang");
- ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
- transition.setConditionDescriptor(expressionDescriptor);
-
- } else if (conditionElement.hasAttribute("ref")) {
- String expr = conditionElement.getAttribute("ref");
- ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
- transition.setConditionDescriptor(refDescriptor);
-
- } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
- ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
- transition.setConditionDescriptor(conditionDescriptor);
- }
- }
- }
-
- if (hasConditions) {
- return new DecisionConditionActivity();
- } else {
- parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
- }
-
- return null;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.jpdl.DecisionHandler;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionHandlerActivity extends JpdlActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String decisionHandlerName;
- protected Descriptor decisionHandlerDescriptor;
- protected DecisionHandler decisionHandler;
-
- public void execute(ActivityExecution execution) {
- execute((ExecutionImpl) execution);
- }
-
- public void execute(ExecutionImpl execution) {
- Activity activity = execution.getActivity();
-
- String transitionName = null;
-
- DecisionHandler usedDecisionHandler = null;
- if (decisionHandlerDescriptor!=null) {
-
- usedDecisionHandler = getDecisionHandler(activity.getProcessDefinition());
-
- } else if (decisionHandlerName!=null) {
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- Object object = environment.get(decisionHandlerName);
- if (object==null) {
- throw new JbpmException("decision handler for "+activity+" is null");
- }
- if (! (object instanceof DecisionHandler)) {
- throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
- }
- usedDecisionHandler = (DecisionHandler) object;
- } else {
- throw new JbpmException("no decision handler specified");
- }
-
- transitionName = usedDecisionHandler.decide(execution);
-
- Transition transition = activity.getOutgoingTransition(transitionName);
- if (transition==null) {
- throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
- }
-
- execution.historyDecision(transitionName);
-
- execution.take(transition);
- }
-
- public synchronized DecisionHandler getDecisionHandler(ProcessDefinition processDefinition) {
- if ( (decisionHandlerDescriptor!=null)
- && (decisionHandler==null)
- ) {
- decisionHandler = (DecisionHandler) ReflectUtil.instantiateUserCode(decisionHandlerDescriptor, (ProcessDefinitionImpl) processDefinition);
- }
- return decisionHandler;
- }
-
- public void setDecisionHandlerName(String decisionHandlerName) {
- this.decisionHandlerName = decisionHandlerName;
- }
- public void setDecisionHandler(DecisionHandler decisionHandler) {
- this.decisionHandler = decisionHandler;
- }
- public void setDecisionHandlerDescriptor(Descriptor decisionHandlerDescriptor) {
- this.decisionHandlerDescriptor = decisionHandlerDescriptor;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.JbpmClassNotFoundException;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EventListenerBinding extends JpdlBinding {
-
- public EventListenerBinding() {
- super("event-listener");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- Descriptor eventListenerDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
- try {
- EventListener eventListener = (EventListener) WireContext.create(eventListenerDescriptor);
- return eventListener;
-
- } catch (JbpmClassNotFoundException e) {
- return eventListenerDescriptor;
- }
- }
-
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GroupBinding extends JpdlBinding {
-
- public GroupBinding() {
- super("group");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- GroupActivity groupActivity = new GroupActivity();
-
- ActivityImpl activity = parse.findObject(ActivityImpl.class);
-
- JpdlParser jpdlParser = (JpdlParser) parser;
- jpdlParser.parseActivities(element, parse, activity);
-
- return groupActivity;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireException;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JavaActivity extends JpdlAutomaticActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected String targetExpression;
- protected String targetLanguage;
- protected Object target;
-
- protected String methodName;
- protected String variableName;
- protected InvokeOperation invokeOperation;
-
- public void perform(OpenExecution execution) throws Exception {
-
- Object invocationTarget = null;
-
- WireContext wireContext = new WireContext();
-
- if (target!=null) {
- invocationTarget = target;
-
- } else if (targetExpression!=null) {
- ScriptManager scriptManager = ScriptManager.getScriptManager();
- invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
-
- } else {
- throw new JbpmException("no target specified");
- }
-
- try {
- List<ArgDescriptor> argDescriptors = null;
- Object[] args = null;
- if (invokeOperation!=null) {
- argDescriptors = invokeOperation.getArgDescriptors();
- args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
- }
-
- Class<?> clazz = invocationTarget.getClass();
- Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
- if (method==null) {
- throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
- }
-
- Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
-
- if (variableName!=null) {
- execution.setVariable(variableName, returnValue);
- }
-
- } catch (WireException e) {
- throw e;
- } catch (Exception e) {
- throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
- }
- }
-
- public void setTarget(Object target) {
- this.target = target;
- }
- public void setMethodName(String methodName) {
- this.methodName = methodName;
- }
- public void setVariableName(String variableName) {
- this.variableName = variableName;
- }
- public void setInvokeOperation(InvokeOperation invokeOperation) {
- this.invokeOperation = invokeOperation;
- }
- public void setTargetExpression(String expression) {
- this.targetExpression = expression;
- }
- public void setTargetLanguage(String language) {
- this.targetLanguage = language;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import java.util.List;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JavaBinding extends JpdlBinding {
-
- public static final String TAG = "java";
-
- public JavaBinding() {
- super(TAG);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- JavaActivity javaActivity = new JavaActivity();
-
- String methodName = XmlUtil.attribute(element, "method", true, parse, null);
- javaActivity.setMethodName(methodName);
-
- String variableName = XmlUtil.attribute(element, "var");
- javaActivity.setVariableName(variableName);
-
- List<Element> argElements = XmlUtil.elements(element, "arg");
- if (!argElements.isEmpty()) {
- List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
- InvokeOperation invokeOperation = new InvokeOperation();
- invokeOperation.setArgDescriptors(argDescriptors);
- javaActivity.setInvokeOperation(invokeOperation);
- }
-
- if (element.hasAttribute("class")) {
- ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
- Object target = WireContext.create(objectDescriptor);
- javaActivity.setTarget(target);
-
- } else if (element.hasAttribute("expr")) {
- String expression = element.getAttribute("expr");
- javaActivity.setTargetExpression(expression);
- javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
-
- } else {
- // parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
- }
-
- return javaActivity;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -22,6 +22,7 @@
package org.jbpm.jpdl.internal.activity;
import org.hibernate.LockMode;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-
-import java.util.List;
-
-import org.jbpm.api.model.Event;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.util.TagBinding;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JpdlBinding extends TagBinding {
-
- protected static final WireParser wireParser = JpdlParser.wireParser;
-
- public JpdlBinding(String tagName) {
- super(tagName, JpdlParser.JPDL_NAMESPACE, null);
- }
-
- public void parseName(Element element, ActivityImpl activity, Parse parse) {
- String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
-
- if (name!=null) {
- // basic name validation
- if ("".equals(name)) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
- } else if (name.indexOf('/')!=-1) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
- }
- activity.setName(name);
- }
- }
-
- public boolean isNameRequired() {
- return true;
- }
-
- public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
- for (Element transitionElement: transitionElements) {
- String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-
- Element timerElement = XmlUtil.element(transitionElement, "timer");
- if (timerElement!=null) {
- if (transitionName!=null) {
- TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
- timerDefinitionImpl.setSignalName(transitionName);
- } else {
- parse.addProblem("a transition name is required when a timer is placed on a transition", element);
- }
- }
-
- TransitionImpl transition = activity.createOutgoingTransition();
- transition.setName(transitionName);
-
- unresolvedTransitions.add(transition, transitionElement);
-
- jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
- }
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.w3c.dom.Element;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-
-/**
- * @author Alejandro Guizar
- */
-public class MailBinding extends JpdlBinding {
-
- public MailBinding() {
- super("mail");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- MailActivity activity = new MailActivity();
- activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
- return activity;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.XmlUtil;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -22,6 +22,7 @@
package org.jbpm.jpdl.internal.activity;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.model.ScopeElementImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class TaskBinding extends JpdlBinding {
-
- private static final String TAG = "task";
-
- public TaskBinding() {
- super(TAG);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- TaskActivity taskActivity = new TaskActivity();
-
- ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
- TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
- taskActivity.setTaskDefinition(taskDefinition);
-
- return taskActivity;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -46,6 +46,7 @@
public SwimlaneDefinitionImpl createSwimlaneDefinition(String name) {
SwimlaneDefinitionImpl swimlaneDefinition = new SwimlaneDefinitionImpl();
swimlaneDefinition.setName(name);
+ swimlaneDefinition.setProcessDefinition(this);
swimlaneDefinitions.put(name, swimlaneDefinition);
return swimlaneDefinition;
}
@@ -56,6 +57,7 @@
public TaskDefinitionImpl createTaskDefinition(String name) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinition.setProcessDefinition(this);
taskDefinitions.put(name, taskDefinition);
return taskDefinition;
}
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+
+import org.jbpm.pvm.internal.util.TagBinding;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlBinding extends TagBinding {
+
+ public JpdlBinding(String tagName) {
+ super(tagName, null, null);
+ }
+
+ public boolean isNameRequired() {
+ return true;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java (from rev 5669, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlBindingsParser.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.TagBinding;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Binding;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlBindingsParser extends Parser {
+
+ private static final Log log = Log.getLog(JpdlBindingsParser.class.getName());
+
+ public static final String CATEGORY_ACTIVITY = "activity";
+ public static final String CATEGORY_EVENT_LISTENER = "eventlistener";
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ List<Binding> bindings = new ArrayList<Binding>();
+ parse.setDocumentObject(bindings);
+
+ for (Element bindingElement : XmlUtil.elements(documentElement)) {
+ Binding binding = instantiateBinding(bindingElement, parse);
+ bindings.add(binding);
+ }
+
+ return bindings;
+ }
+
+ protected Binding instantiateBinding(Element bindingElement, Parse parse) {
+ String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
+
+ log.trace("adding jpdl binding "+bindingClassName);
+
+ if (bindingClassName!=null) {
+ try {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Class<?> bindingClass = Class.forName(bindingClassName, true, classLoader);
+ TagBinding binding = (TagBinding) bindingClass.newInstance();
+
+ String tagLocalName = XmlUtil.getTagLocalName(bindingElement);
+ if ("activity".equals(tagLocalName)) {
+ binding.setCategory(CATEGORY_ACTIVITY);
+ } else if ("event-listener".equals(tagLocalName)) {
+ binding.setCategory(CATEGORY_EVENT_LISTENER);
+ } else {
+ parse.addProblem("unrecognized binding tag: "+tagLocalName);
+ }
+
+ return binding;
+ } catch (Exception e) {
+ parse.addProblem("couldn't instantiate activity binding "+bindingClassName, e);
+ }
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlBindingsParser.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import org.jbpm.pvm.internal.repository.ProcessDeployer;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployer extends ProcessDeployer {
+
+ static JpdlParser JPDL_PARSER = new JpdlParser();
+ public static final String JPDL_EXTENSION = ".jpdl.xml";
+
+ public JpdlDeployer() {
+ super(JPDL_EXTENSION, JPDL_PARSER);
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployerBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployerBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployerBinding extends WireDescriptorBinding {
+
+ public JpdlDeployerBinding() {
+ super("jpdl-deployer");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(JpdlDeployer.class);
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlDeployerBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java (from rev 5671, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.v40.JpdlParserV40;
+import org.jbpm.jpdl.internal.v42.JpdlParserV42;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlParser extends Parser {
+
+ private static final Log log = Log.getLog(JpdlParser.class.getName());
+
+ public static final List<String> schemaResources = new ArrayList<String>();
+ public static final Map<String, JpdlParserVersion> jpdlParserVersions = new HashMap<String, JpdlParserVersion>();
+
+ public static final JpdlParserVersion LATEST_PARSER_VERSION = new JpdlParserV42();
+ static {
+ addJpdlParserVersion(new JpdlParserV40());
+ addJpdlParserVersion(LATEST_PARSER_VERSION);
+ }
+
+ static void addJpdlParserVersion(JpdlParserVersion jpdlParserVersion) {
+ jpdlParserVersions.put(jpdlParserVersion.getNamespaceUri(), jpdlParserVersion);
+ schemaResources.add(jpdlParserVersion.getXsdResource());
+ }
+
+
+ public JpdlParser() {
+ initialize();
+ initializeSchemaResources();
+ }
+
+ protected void initializeSchemaResources() {
+ setSchemaResources(schemaResources);
+ }
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ String namespace = documentElement.getNamespaceURI();
+ if (namespace==null) {
+
+ }
+ JpdlParserVersion jpdlParserVersion = jpdlParserVersions.get(namespace);
+ if (jpdlParserVersion==null) {
+ throw new JbpmException("no jPDL parser for namespace "+namespace);
+ }
+ return jpdlParserVersion.parseDocumentElement(documentElement, parse);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParserVersion.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParserVersion.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParserVersion.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import org.jbpm.pvm.internal.xml.Bindings;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlParserVersion {
+
+ protected Bindings bindings;
+
+ public abstract String getNamespaceUri();
+ public abstract String getXsdResource();
+ public abstract Object parseDocumentElement(Element documentElement, Parse parse);
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlParserVersion.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.Deployer;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlVersionDeployer implements Deployer {
+
+ private static Log log = Log.getLog(JpdlVersionDeployer.class.getName());
+
+ public void deploy(DeploymentImpl deployment) {
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+
+ for (String resourceName: deployment.getResourceNames()) {
+ if (resourceName.endsWith(JpdlDeployer.JPDL_EXTENSION)) {
+ try {
+ byte[] bytes = deployment.getBytes(resourceName);
+ InputStream xmlInputStream = new ByteArrayInputStream(bytes);
+
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ Document document = documentBuilder.parse(xmlInputStream);
+ try {
+ Element documentElement = document.getDocumentElement();
+ if (documentElement.getNamespaceURI()==null) {
+ String latestVersionNamespaceUri = JpdlParser.LATEST_PARSER_VERSION.getNamespaceUri();
+ log.debug("adding namespace "+latestVersionNamespaceUri+" to deployment resource "+resourceName);
+
+ String prefix = documentElement.getPrefix();
+ String oldNodeName = documentElement.getNodeName();
+ String newTagName = (prefix!=null ? prefix+":"+oldNodeName : oldNodeName);
+ document.renameNode(documentElement, latestVersionNamespaceUri, newTagName);
+
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ //initialize StreamResult with File object to save to file
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(document);
+ transformer.transform(source, result);
+
+ bytes = result.getWriter().toString().getBytes();
+ deployment.addResourceFromInputStream(resourceName, new ByteArrayInputStream(bytes));
+ }
+ } catch (Exception e) {
+ log.error("couldn't add namespace to resource "+resourceName+" in deployment "+deployment.getId(), e);
+ }
+ } catch (Exception e) {
+ log.error("couldn't parse resource "+resourceName+" in deployment "+deployment.getId()+" for checking the namespace", e);
+ }
+ }
+ }
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/JpdlVersionDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransition.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransition.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransition.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+public class UnresolvedTransition {
+ TransitionImpl transition;
+ Element transitionElement;
+ public UnresolvedTransition(TransitionImpl transition, Element transitionElement) {
+ this.transition = transition;
+ this.transitionElement = transitionElement;
+ }
+ public void resolve(ProcessDefinitionImpl processDefinition, Parse parse) {
+ String to = XmlUtil.attribute(transitionElement, "to", true, parse);
+ if (to!=null) {
+ ActivityImpl destination = (ActivityImpl) processDefinition.findActivity(to);
+ if (destination!=null) {
+ destination.addIncomingTransition(transition);
+ } else {
+ parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing activity name"), transitionElement);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransition.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransitions.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransitions.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransitions.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.parser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.w3c.dom.Element;
+
+public class UnresolvedTransitions {
+ public List<UnresolvedTransition> list = new ArrayList<UnresolvedTransition>();
+ public void add(TransitionImpl transition, Element transitionElement) {
+ list.add(new UnresolvedTransition(transition, transitionElement));
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/parser/UnresolvedTransitions.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.repository;
-
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.repository.ProcessDeployer;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlDeployer extends ProcessDeployer {
-
- static JpdlParser jpdlParser = new JpdlParser();
- static final String jpdlExtension = ".jpdl.xml";
-
- public JpdlDeployer() {
- super(jpdlExtension, jpdlParser);
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,695 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40;
+
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.model.Event;
+import org.jbpm.api.task.AssignmentHandler;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.activity.MailListener;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlBindingsParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParserVersion;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransition;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.jpdl.internal.xml.BindingsParser;
+import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
+import org.jbpm.pvm.internal.email.impl.MailTemplate;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ActivityCoordinatesImpl;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
+import org.jbpm.pvm.internal.model.Continuation;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
+import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
+import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.Operation;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Bindings;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.ProblemImpl;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlParserV40 extends JpdlParserVersion {
+
+ private static final Log log = Log.getLog(JpdlParserV40.class.getName());
+
+ public static final String NAMESPACE = "http://jbpm.org/4.0/jpdl";
+ public static final String XSD_RESOURCE = "jpdl-4.0.xsd";
+
+ public static final WireParser wireParser = WireParser.getInstance();
+
+ protected Bindings bindings = new Bindings();
+
+ // array elements are mutable, even when final
+ // never make a static array public
+ static final String[] DEFAULT_BINDING_RESOURCES = {
+ "jbpm.jpdl.bindings.xml",
+ "jbpm.user.bindings.xml"
+ };
+
+ static JpdlBindingsParser bindingsParser = new JpdlBindingsParser();
+
+ public JpdlParserV40() {
+ parseBindings();
+ }
+
+ public String getNamespaceUri() {
+ return NAMESPACE;
+ }
+
+ public String getXsdResource() {
+ return XSD_RESOURCE;
+ }
+
+ protected void parseBindings() {
+ for (String bindingResource: DEFAULT_BINDING_RESOURCES) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Enumeration<URL> resourceUrls = classLoader.getResources(bindingResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading jpdl bindings from resource: "+resourceUrl);
+ List<JpdlBinding> activityBindings = (List<JpdlBinding>) bindingsParser.createParse()
+ .pushObject(bindings)
+ .setUrl(resourceUrl)
+ .execute()
+ .checkErrors("jpdl bindings from "+resourceUrl.toString())
+ .getDocumentObject();
+ }
+ } else {
+ log.trace("skipping unavailable jpdl bindings resource: "+bindingResource);
+ }
+ }
+ }
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
+
+ JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
+ if (processDefinition==null) {
+ processDefinition = new JpdlProcessDefinition();
+ parse.setDocumentObject(processDefinition);
+ }
+
+ processDefinitions.add(processDefinition);
+
+ parse.pushObject(processDefinition);
+ try {
+ // process attribues
+ String name = XmlUtil.attribute(documentElement, "name", true, parse);
+ processDefinition.setName(name);
+
+ String packageName = XmlUtil.attribute(documentElement, "package");
+ processDefinition.setPackageName(packageName);
+
+ Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
+ if (version!=null) {
+ processDefinition.setVersion(version);
+ }
+
+ String key = XmlUtil.attribute(documentElement, "key", false, parse);
+ if (key!=null) {
+ processDefinition.setKey(key);
+ }
+
+ Element descriptionElement = XmlUtil.element(documentElement, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ processDefinition.setDescription(description);
+ }
+
+ UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
+ parse.pushObject(unresolvedTransitions);
+
+ // swimlanes
+ List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
+ for (Element swimlaneElement: swimlaneElements) {
+ String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
+ if (swimlaneName!=null) {
+ SwimlaneDefinitionImpl swimlaneDefinition =
+ processDefinition.createSwimlaneDefinition(swimlaneName);
+ parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
+ }
+ }
+
+ // on events
+ parseOnEvents(documentElement, parse, processDefinition);
+
+ // activities
+ parseActivities(documentElement, parse, processDefinition);
+
+ // bind activities to their destinations
+ resolveTransitionDestinations(parse, processDefinition, unresolvedTransitions);
+
+ } finally {
+ parse.popObject();
+ }
+
+ if (processDefinition.getInitial()==null) {
+ parse.addProblem("no start activity in process", documentElement);
+ }
+
+ return processDefinitions;
+ }
+
+ public void parseActivityName(Element element, ActivityImpl activity, Parse parse, boolean isRequired) {
+ String name = XmlUtil.attribute(element, "name", isRequired, parse);
+
+ if (name!=null) {
+ // basic name validation
+ if ("".equals(name)) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
+ } else if (name.indexOf('/')!=-1) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
+ }
+ activity.setName(name);
+ }
+ }
+
+ public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+ for (Element transitionElement: transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+ Element timerElement = XmlUtil.element(transitionElement, "timer");
+ if (timerElement!=null) {
+ if (transitionName!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+ timerDefinitionImpl.setSignalName(transitionName);
+ } else {
+ parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+ }
+ }
+
+ TransitionImpl transition = activity.createOutgoingTransition();
+ transition.setName(transitionName);
+
+ unresolvedTransitions.add(transition, transitionElement);
+
+ parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+ }
+ }
+
+ protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
+ for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
+ unresolvedTransition.resolve(processDefinition, parse);
+ }
+ }
+
+ public void parseActivities(Element documentElement, Parse parse, CompositeElementImpl compositeElement) {
+ List<Element> elements = XmlUtil.elements(documentElement);
+ for (Element nestedElement : elements) {
+ String tagName = XmlUtil.getTagLocalName(nestedElement);
+ if ("on".equals(tagName)
+ || "timer".equals(tagName)
+ || "swimlane".equals(tagName)) continue;
+
+ JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement, JpdlBindingsParser.CATEGORY_ACTIVITY);
+ if (activityBinding == null) {
+ log.debug("unrecognized activity: " + tagName);
+ continue;
+ }
+
+ ActivityImpl activity = compositeElement.createActivity();
+ parse.pushObject(activity);
+ try {
+ activity.setType(activityBinding.getTagName());
+ parseName(nestedElement, activity, parse);
+ parseTransitions(nestedElement, activity, parse);
+
+ Element descriptionElement = XmlUtil.element(documentElement, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ activity.setDescription(description);
+ }
+
+ String continuationText = XmlUtil.attribute(nestedElement, "continue");
+ if (continuationText!=null) {
+ if ("async".equals(continuationText)) {
+ activity.setContinuation(Continuation.ASYNCHRONOUS);
+ } else if ("exclusive".equals(continuationText)) {
+ activity.setContinuation(Continuation.EXCLUSIVE);
+ }
+ }
+
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, this);
+ activity.setBehaviour(activityBehaviour);
+
+ parseOnEvents(nestedElement, parse, activity);
+
+ String g = XmlUtil.attribute(nestedElement, "g");
+ if (g == null) continue;
+
+ StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
+ ActivityCoordinatesImpl coordinates = null;
+ if (stringTokenizer.countTokens() == 4) {
+ try {
+ int x = Integer.parseInt(stringTokenizer.nextToken());
+ int y = Integer.parseInt(stringTokenizer.nextToken());
+ int width = Integer.parseInt(stringTokenizer.nextToken());
+ int height = Integer.parseInt(stringTokenizer.nextToken());
+ coordinates = new ActivityCoordinatesImpl(x, y, width, height);
+ } catch (NumberFormatException e) {
+ coordinates = null;
+ }
+ }
+ if (coordinates != null) {
+ activity.setCoordinates(coordinates);
+ } else {
+ parse.addProblem("invalid coordinates g=\"" + g + "\" in " + activity, nestedElement);
+ }
+ } finally {
+ parse.popObject();
+ }
+ }
+ }
+
+ public static TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
+ TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
+
+ String duedate = XmlUtil.attribute(timerElement, "duedate");
+ String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
+
+ if (duedate!=null) {
+ timerDefinition.setDueDateDescription(duedate);
+
+ } else if (duedatetime!=null) {
+ String dueDateTimeFormatText = (String) EnvironmentImpl.getFromCurrent("jbpm.duedatetime.format");
+ if (dueDateTimeFormatText==null) {
+ dueDateTimeFormatText = "HH:mm dd/MM/yyyy";
+ }
+ SimpleDateFormat dateFormat = new SimpleDateFormat(dueDateTimeFormatText);
+ try {
+ Date duedatetimeDate = dateFormat.parse(duedatetime);
+ timerDefinition.setDueDate(duedatetimeDate);
+ } catch (ParseException e) {
+ parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
+ }
+ } else {
+ parse.addProblem("either duedate or duedatetime is required in timer", timerElement);
+ }
+
+ String repeat = XmlUtil.attribute(timerElement, "repeat");
+ timerDefinition.setRepeat(repeat);
+
+ return timerDefinition;
+ }
+
+ public void parseOnEvents(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ // event listeners
+ List<Element> onElements = XmlUtil.elements(element, "on");
+ for (Element onElement: onElements) {
+ String eventName = XmlUtil.attribute(onElement, "event", true, parse);
+ parseOnEvent(onElement, parse, scopeElement, eventName);
+
+ Element timerElement = XmlUtil.element(onElement, "timer");
+ if (timerElement!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, scopeElement);
+ timerDefinitionImpl.setEventName(eventName);
+ }
+ }
+ }
+
+ public void parseOnEvent(Element element, Parse parse, ObservableElementImpl observableElement, String eventName) {
+ if (eventName!=null) {
+ EventImpl event = observableElement.getEvent(eventName);
+ if (event==null) {
+ event = observableElement.createEvent(eventName);
+ }
+
+ String continuationText = XmlUtil.attribute(element, "continue");
+ if (continuationText!=null) {
+ if ("async".equals(continuationText)) {
+ event.setContinuation(Continuation.ASYNCHRONOUS);
+ } else if ("exclusive".equals(continuationText)) {
+ event.setContinuation(Continuation.EXCLUSIVE);
+ }
+ }
+
+ for (Element eventListenerElement: XmlUtil.elements(element)) {
+ JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, JpdlBindingsParser.CATEGORY_EVENT_LISTENER);
+ if (eventBinding!=null) {
+ EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, this);
+ EventListenerReference eventListenerReference = event.createEventListenerReference(eventListener);
+
+ if (XmlUtil.attributeBoolean(eventListenerElement, "propagation", false, parse, false)) {
+ eventListenerReference.setPropagationEnabled(true);
+ }
+
+ continuationText = XmlUtil.attribute(eventListenerElement, "continue");
+ if (continuationText!=null) {
+ if (observableElement instanceof ActivityImpl) {
+ if (observableElement.getName()==null) {
+ parse.addProblem("async continuation on event listener requires activity name", eventListenerElement);
+ }
+ } else if (observableElement instanceof TransitionImpl) {
+ TransitionImpl transition = (TransitionImpl) observableElement;
+ if (transition.getSource().getName()==null) {
+ parse.addProblem("async continuation on event listener requires name in the transition source activity", eventListenerElement);
+ }
+ }
+ if ("async".equals(continuationText)) {
+ eventListenerReference.setContinuation(Continuation.ASYNCHRONOUS);
+ } else if ("exclusive".equals(continuationText)) {
+ eventListenerReference.setContinuation(Continuation.EXCLUSIVE);
+ }
+ }
+
+ } else {
+ String tagName = XmlUtil.getTagLocalName(eventListenerElement);
+ if ( ! ( (observableElement instanceof TransitionImpl)
+ && ( "condition".equals(tagName)
+ || "timer".equals(tagName)
+ )
+ )
+ ) {
+ parse.addProblem("unrecognized event listener: "+tagName, null, ProblemImpl.TYPE_WARNING, eventListenerElement);
+ }
+ }
+ }
+ }
+ }
+
+ public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+ for (Element transitionElement: transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+ Element timerElement = XmlUtil.element(transitionElement, "timer");
+ if (timerElement!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+ timerDefinitionImpl.setSignalName(transitionName);
+ }
+
+ TransitionImpl transition = activity.createOutgoingTransition();
+ transition.setName(transitionName);
+
+ unresolvedTransitions.add(transition, transitionElement);
+
+ parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+ }
+ }
+
+ public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
+ Element descriptionElement = XmlUtil.element(element, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ assignableDefinition.setDescription(description);
+ }
+
+ Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
+ if (assignmentHandlerElement!=null) {
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
+ AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
+ assignableDefinition.setAssignmentHandler(assignmentHandler);
+ }
+
+ String assigneeExpression = XmlUtil.attribute(element, "assignee");
+ assignableDefinition.setAssigneeExpression(assigneeExpression);
+
+ String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
+ assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+
+ String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
+ assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
+
+ String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
+ assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+
+ String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
+ assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+
+ String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
+ assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
+ }
+
+ public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+
+ String taskName = XmlUtil.attribute(element, "name");
+ taskDefinition.setName(taskName);
+
+ String form = XmlUtil.attribute(element, "form");
+ taskDefinition.setFormResourceName(form);
+
+ ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
+ if (processDefinition.getTaskDefinition(taskName)!=null) {
+ parse.addProblem("duplicate task name "+taskName, element);
+ } else {
+ processDefinition.addTaskDefinitionImpl(taskDefinition);
+ }
+
+ String swimlaneName = XmlUtil.attribute(element, "swimlane");
+ if (swimlaneName!=null) {
+ JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
+ SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+ if (swimlaneDefinition!=null) {
+ taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
+ } else {
+ parse.addProblem("swimlane "+swimlaneName+" not declared", element);
+ }
+ }
+
+ JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
+
+ // parse notification mail producer
+ Element notificationElement = XmlUtil.element(element, "notification");
+ if (notificationElement != null) {
+ parseMailEvent(notificationElement, parse, scopeElement, Event.ASSIGN);
+ }
+
+ Element reminderElement = XmlUtil.element(element, "reminder");
+ if (reminderElement != null) {
+ parseMailEvent(reminderElement, parse, scopeElement, Event.REMIND);
+ // associate timer to event
+ TimerDefinitionImpl timerDefinition = parseTimerDefinition(reminderElement, parse, scopeElement);
+ timerDefinition.setEventName(Event.REMIND);
+ }
+
+ return taskDefinition;
+ }
+
+ public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+
+ String className = XmlUtil.attribute(element, "class");
+ if (className!=null) {
+ objectDescriptor.setClassName(className);
+
+ // read the operations elements
+ List<Operation> operations = null;
+ List<Element> elements = XmlUtil.elements(element);
+
+ Set<String> operationTagNames = wireParser.getBindings().getTagNames(WireParser.CATEGORY_OPERATION);
+ for (Element childElement: elements) {
+ if (operationTagNames.contains(childElement.getTagName())) {
+ Operation operation = (Operation) wireParser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
+ if (operations==null) {
+ operations = new ArrayList<Operation>();
+ }
+ operations.add(operation);
+ }
+ }
+ objectDescriptor.setOperations(operations);
+
+ // autowiring
+ Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
+ if (isAutoWireEnabled!=null) {
+ objectDescriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
+ }
+ }
+ return objectDescriptor;
+ }
+
+
+ public static List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
+ List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
+
+ for (Element inElement: XmlUtil.elements(element, "variable")) {
+ VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
+
+ String name = XmlUtil.attribute(inElement, "name", true, parse);
+ variableDefinition.setName(name);
+
+ int sources = 0;
+
+ String initExpr = XmlUtil.attribute(inElement, "init");
+ if (initExpr!=null) {
+ variableDefinition.setInitExpression(initExpr);
+ sources++;
+ }
+
+ Element valueElement = XmlUtil.element(inElement);
+ if (valueElement!=null) {
+ Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+ variableDefinition.setInitDescriptor(initValueDescriptor);
+ sources++;
+ }
+
+ if (initRequired && sources==0) {
+ parse.addProblem("no init specified", inElement);
+ }
+ if (sources>1) {
+ parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
+ }
+
+ variableDefinitions.add(variableDefinition);
+ }
+
+ return variableDefinitions;
+ }
+
+ public static VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
+ VariableOutDefinitionSet variableOutDefinitionSet = new VariableOutDefinitionSet();
+
+ for (Element inElement: XmlUtil.elements(element, "out-variable")) {
+ VariableOutDefinitionImpl variableOutDefinition = variableOutDefinitionSet.createVariableOutDefinition();
+
+ String name = XmlUtil.attribute(inElement, "name", true, parse);
+ variableOutDefinition.setName(name);
+
+ String expression = XmlUtil.attribute(inElement, "init");
+ if (expression!=null) {
+ variableOutDefinition.setExpression(expression);
+ }
+ }
+
+ return variableOutDefinitionSet;
+ }
+
+ public static void parseMailEvent(Element element, Parse parse,
+ ObservableElementImpl observableElement, String eventName) {
+ // obtain assign event
+ EventImpl event = observableElement.getEvent(eventName);
+ if (event == null) {
+ event = observableElement.createEvent(eventName);
+ }
+ // register event listener
+ MailListener eventListener = new MailListener();
+ EventListenerReference eventListenerRef = event.createEventListenerReference(eventListener);
+ // set continuation mode
+ String continuationText = XmlUtil.attribute(element, "continue");
+ if ("async".equals(continuationText)) {
+ eventListenerRef.setContinuation(Continuation.ASYNCHRONOUS);
+ }
+ else if ("exclusive".equals(continuationText)) {
+ eventListenerRef.setContinuation(Continuation.EXCLUSIVE);
+ }
+
+ //https://jira.jboss.org/jira/browse/JBPM-2466
+ String mailTemplateName = eventName;
+ if (Event.ASSIGN.equals(eventName)) {
+ mailTemplateName = "task-notification";
+ } else if (Event.REMIND.equals(eventName)) {
+ mailTemplateName = "task-reminder";
+ }
+
+ // associate mail producer to event listener
+ MailProducer mailProducer = parseMailProducer(element, parse, mailTemplateName);
+ eventListener.setMailProducer(mailProducer);
+ }
+
+ public static MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
+ // check whether the element is a generic object descriptor
+ if (ObjectBinding.isObjectDescriptor(element)) {
+ // TODO test custom mail producer
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(element, parse);
+ return (MailProducer) WireContext.create(objectDescriptor);
+ }
+
+ // parse the default producer
+ MailProducerImpl mailProducer = new MailProducerImpl();
+ mailProducer.setTemplate(parseMailTemplate(element, parse, defaultTemplateName));
+ return mailProducer;
+ }
+
+ private static MailTemplate parseMailTemplate(Element element, Parse parse,
+ String defaultTemplateName) {
+ if (element.hasAttribute("template")) {
+ // fetch template from configuration
+ return findTemplate(element, parse, element.getAttribute("template"));
+ }
+ if (!XmlUtil.isTextOnly(element)) {
+ // parse inline template
+ return MailTemplateBinding.parseMailTemplate(element, parse);
+ }
+ if (defaultTemplateName != null) {
+ // fetch default template
+ return findTemplate(element, parse, defaultTemplateName);
+ }
+ parse.addProblem("mail template must be referenced in the 'template' attribute "
+ + "or specified inline", element);
+ return null;
+ }
+
+ private static MailTemplate findTemplate(Element element, Parse parse, String templateName) {
+ MailTemplateRegistry templateRegistry = EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
+ if (templateRegistry != null) {
+ MailTemplate template = templateRegistry.getTemplate(templateName);
+ if (template != null) return template;
+ }
+ parse.addProblem("mail template not found: " + templateName, element);
+ return null;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/JpdlParserV40.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected ActivityBehaviour customBehaviour;
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)customBehaviour;
+ externalActivityBehaviour.signal(execution, signalName, parameters);
+ }
+
+ public void execute(ActivityExecution execution) throws Exception {
+ customBehaviour.execute(execution);
+ }
+
+ public ActivityBehaviour getCustomBehaviour() {
+ return customBehaviour;
+ }
+ public void setCustomBehaviour(ActivityBehaviour customBehaviour) {
+ this.customBehaviour = customBehaviour;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/CustomActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionConditionActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Transition transition = findTransition(execution);
+ if (transition==null) {
+ throw new JbpmException("no outgoing transition condition evaluated to true for decision "+execution.getActivity());
+ }
+ if (transition.getName()!=null) {
+ execution.historyDecision(transition.getName());
+ }
+ execution.take(transition);
+ }
+
+ private Transition findTransition(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition : outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ return transition;
+ }
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionConditionActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionExpressionActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expr;
+ protected String lang;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ String transitionName = null;
+
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ Object result = scriptManager.evaluateExpression(expr, lang);
+ if ( (result!=null)
+ && (! (result instanceof String))
+ ) {
+ throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
+ }
+ transitionName = (String) result;
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setExpr(String expr) {
+ this.expr = expr;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionExpressionActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionHandlerActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String decisionHandlerName;
+ protected DecisionHandler decisionHandler;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ String transitionName = null;
+
+ DecisionHandler usedDecisionHandler = null;
+ if (decisionHandler!=null) {
+ usedDecisionHandler = decisionHandler;
+
+ } else if (decisionHandlerName!=null) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ Object object = environment.get(decisionHandlerName);
+ if (object==null) {
+ throw new JbpmException("decision handler for "+activity+" is null");
+ }
+ if (! (object instanceof DecisionHandler)) {
+ throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
+ }
+ usedDecisionHandler = (DecisionHandler) object;
+ } else {
+ throw new JbpmException("no decision handler specified");
+ }
+
+ transitionName = usedDecisionHandler.decide(execution);
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setDecisionHandlerName(String decisionHandlerName) {
+ this.decisionHandlerName = decisionHandlerName;
+ }
+ public void setDecisionHandler(DecisionHandler decisionHandler) {
+ this.decisionHandler = decisionHandler;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/DecisionHandlerActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.List;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean endProcessInstance = true;
+ protected String state = null;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
+
+ if ( (parentActivity!=null)
+ && ("group".equals(parentActivity.getType()))
+ ) {
+ // if the end activity itself has an outgoing transition
+ // (such end activities should be drawn on the border of the group)
+ if ( (outgoingTransitions!=null)
+ && (outgoingTransitions.size()==1)
+ ) {
+ Transition outgoingTransition = outgoingTransitions.get(0);
+ // taking the transition that goes over the group boundaries will
+ // destroy the scope automatically (see atomic operation TakeTransition)
+ execution.take(outgoingTransition);
+
+ } else {
+ execution.setActivity(parentActivity);
+ execution.signal();
+ }
+
+ } else {
+ ExecutionImpl executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ executionToEnd.end();
+ } else {
+ executionToEnd.end(state);
+ }
+ }
+ }
+
+ public void setEndProcessInstance(boolean endProcessInstance) {
+ this.endProcessInstance = endProcessInstance;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/EndActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ForkActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ // evaluate the conditions and find the transitions that should be forked
+ List<Transition> forkingTransitions = new ArrayList<Transition>();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition: outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ forkingTransitions.add(transition);
+ }
+ }
+
+ // if no outgoing transitions should be forked,
+ if (forkingTransitions.size()==0) {
+ // end this execution
+ execution.end();
+
+ // if there is exactly 1 transition to be taken, just use the incoming execution
+ } else if (forkingTransitions.size()==1) {
+ execution.take(forkingTransitions.get(0));
+
+ // if there are more transitions
+ } else {
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
+ execution.setActivity(null);
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+ }
+
+ for (Transition transition: forkingTransitions) {
+ // launch a concurrent path of execution
+ String childExecutionName = transition.getName();
+ ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
+ concurrentExecution.setActivity(activity);
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.take(transition);
+
+ if (concurrentRoot.isEnded()) {
+ break;
+ }
+ }
+ }
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ForkActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ // find the start activity
+ Activity activity = execution.getActivity();
+ List<Activity> startActivities = findStartActivities(activity);
+ if (startActivities.size()==1) {
+ execution.execute(startActivities.get(0));
+ } else {
+
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ } else if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+
+ } else {
+ throw new JbpmException("illegal state");
+ }
+
+ for (Activity startActivity: startActivities) {
+ ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.execute(startActivity);
+ }
+ }
+ }
+
+ private List<Activity> findStartActivities(Activity activity) {
+ List<Activity> startActivities = new ArrayList<Activity>();
+ List nestedActivities = activity.getActivities();
+ for (ActivityImpl nestedActivity : (List<ActivityImpl>) nestedActivities) {
+ if ( (nestedActivity.getIncomingTransitions()==null)
+ || (nestedActivity.getIncomingTransitions().isEmpty())
+ ) {
+ startActivities.add(nestedActivity);
+ }
+ }
+ return startActivities;
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+ signal((ExecutionImpl)execution, signalName, parameters);
+ }
+
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ Transition transition = null;
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+
+ int nbrOfOutgoingTransitions = (outgoingTransitions!=null ? outgoingTransitions.size() : 0);
+ if ( (signalName==null)
+ && (nbrOfOutgoingTransitions==1)
+ ) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.getOutgoingTransition(signalName);
+ }
+
+ execution.take(transition);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/GroupActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlActivity extends JpdlAutomaticActivity {
+
+ private static final Log log = Log.getLog(HqlActivity.class.getName());
+
+ private static final long serialVersionUID = 1L;
+
+ protected String query;
+ protected ListDescriptor parametersDescriptor;
+ protected String resultVariableName;
+ protected boolean isResultUnique;
+
+ public void perform(OpenExecution execution) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ if (environment==null) {
+ throw new JbpmException("no environment for jpdl activity "+HqlBinding.TAG);
+ }
+ Session session = environment.get(Session.class);
+
+ Query q = createQuery(session);
+
+ if (parametersDescriptor!=null) {
+ for (Descriptor valueDescriptor: parametersDescriptor.getValueDescriptors()) {
+ String parameterName = valueDescriptor.getName();
+ Object value = WireContext.create(valueDescriptor);
+ applyParameter(q, parameterName, value);
+ }
+ }
+
+ Object result = null;
+ if (isResultUnique) {
+ result = q.uniqueResult();
+ } else {
+ result = q.list();
+ }
+
+ execution.setVariable(resultVariableName, result);
+ }
+
+ protected Query createQuery(Session session) {
+ return session.createQuery(query);
+ }
+
+ public void applyParameter(Query q, String parameterName, Object value) {
+ if (value instanceof String) {
+ q.setString(parameterName, (String) value);
+ } else if (value instanceof Long) {
+ q.setLong(parameterName, (Long) value);
+ } else {
+ log.error("unknown hql parameter type: "+value.getClass().getName());
+ }
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+ public void setParametersDescriptor(ListDescriptor parametersDescriptor) {
+ this.parametersDescriptor = parametersDescriptor;
+ }
+ public void setResultUnique(boolean isResultUnique) {
+ this.isResultUnique = isResultUnique;
+ }
+ public void setResultVariableName(String resultVariableName) {
+ this.resultVariableName = resultVariableName;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/HqlActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String targetExpression;
+ protected String targetLanguage;
+ protected Object target;
+
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void perform(OpenExecution execution) throws Exception {
+
+ Object invocationTarget = null;
+
+ WireContext wireContext = new WireContext();
+
+ if (target!=null) {
+ invocationTarget = target;
+
+ } else if (targetExpression!=null) {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
+
+ } else {
+ throw new JbpmException("no target specified");
+ }
+
+ try {
+ List<ArgDescriptor> argDescriptors = null;
+ Object[] args = null;
+ if (invokeOperation!=null) {
+ argDescriptors = invokeOperation.getArgDescriptors();
+ args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ }
+
+ Class<?> clazz = invocationTarget.getClass();
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
+ }
+
+ Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+ public void setTargetExpression(String expression) {
+ this.targetExpression = expression;
+ }
+ public void setTargetLanguage(String language) {
+ this.targetLanguage = language;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JavaActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ int multiplicity = -1;
+ LockMode lockMode = LockMode.UPGRADE;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+
+ // if this is a single, non concurrent root
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ // just pass through
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ execution.take(transition);
+
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+
+ // force version increment in the parent execution
+ Session session = EnvironmentImpl.getFromCurrent(Session.class);
+ session.lock(execution.getParent(), lockMode);
+
+ execution.setState(Execution.STATE_INACTIVE_JOIN);
+ execution.waitForSignal();
+
+ ExecutionImpl concurrentRoot = execution.getParent();
+ List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot, activity);
+
+ if (isComplete(joinedExecutions, activity)) {
+ endJoinedExecutions(joinedExecutions);
+
+ ExecutionImpl outgoingExecution = null;
+ if (concurrentRoot.getExecutions().size()==0) {
+ outgoingExecution = concurrentRoot;
+ outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
+ } else {
+ outgoingExecution = concurrentRoot.createExecution();
+ outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ }
+
+ execution.setActivity(activity, outgoingExecution);
+ Transition transition = activity.getDefaultOutgoingTransition();
+ if (transition==null) {
+ throw new JbpmException("join must have an outgoing transition");
+ }
+ outgoingExecution.take(transition);
+ }
+
+ } else {
+ throw new JbpmException("invalid execution state");
+ }
+ }
+
+ protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity activity) {
+ int nbrOfExecutionsToJoin = multiplicity;
+ if (multiplicity==-1) {
+ nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
+ }
+ return joinedExecutions.size()==nbrOfExecutionsToJoin;
+ }
+
+ protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot, Activity activity) {
+ List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
+ List concurrentExecutions = (List)concurrentRoot.getExecutions();
+ for (ExecutionImpl concurrentExecution: (List<ExecutionImpl>)concurrentExecutions) {
+ if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
+ && (concurrentExecution.getActivity()==activity)
+ ) {
+ joinedExecutions.add(concurrentExecution);
+ }
+ }
+ return joinedExecutions;
+ }
+
+ protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
+ for (ExecutionImpl joinedExecution: joinedExecutions) {
+ joinedExecution.end();
+ }
+ }
+
+ public void setMultiplicity(int multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+ public void setLockMode(LockMode lockMode) {
+ this.lockMode = lockMode;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JoinActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlActivity implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,24 @@
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+public abstract class JpdlAutomaticActivity extends JpdlActivity implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ perform(execution);
+ ((ExecutionImpl)execution).historyAutomatic();
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ perform(execution);
+ }
+
+ abstract void perform(OpenExecution execution) throws Exception;
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlAutomaticActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlExternalActivity extends JpdlActivity implements ExternalActivityBehaviour {
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/JpdlExternalActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.Collection;
+
+import javax.mail.Message;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.email.spi.MailSession;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailActivity extends JpdlAutomaticActivity {
+
+ protected MailProducer mailProducer;
+
+ private static final long serialVersionUID = 1L;
+
+ void perform(OpenExecution execution) throws Exception {
+ Collection<Message> messages = mailProducer.produce(execution);
+ EnvironmentImpl.getFromCurrent(MailSession.class).send(messages);
+ }
+
+ public void setMailProducer(MailProducer mailProducer) {
+ this.mailProducer = mailProducer;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.Collection;
+
+import javax.mail.Message;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.email.spi.MailProducer;
+import org.jbpm.pvm.internal.email.spi.MailSession;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.TaskContext;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailListener implements EventListener {
+
+ protected transient MailProducer mailProducer;
+
+ private static final long serialVersionUID = 1L;
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ // find current task
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ DbSession dbSession = environment.get(DbSession.class);
+ TaskImpl task = dbSession.findTaskByExecution(execution);
+
+ // make task available to mail templates through task context
+ TaskContext taskContext = new TaskContext(task);
+ environment.setContext(taskContext);
+ try {
+ Collection<Message> messages = mailProducer.produce(execution);
+ environment.get(MailSession.class).send(messages);
+ } finally {
+ environment.removeContext(taskContext);
+ }
+ }
+
+ public void setMailProducer(MailProducer mailProducer) {
+ this.mailProducer = mailProducer;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/MailListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String script;
+ protected String language;
+ protected String variableName;
+
+ public void perform(OpenExecution execution) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ Object returnValue = scriptManager.evaluateScript(script, language);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/ScriptActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlActivity extends HqlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Query createQuery(Session session) {
+ return session.createSQLQuery(query);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SqlActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.task.FormBehaviour;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartActivity extends JpdlActivity implements FormBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ String formResourceName;
+
+ public void execute(ActivityExecution execution) {
+ }
+
+ public String getFormResourceName() {
+ return formResourceName;
+ }
+ public void setFormResourceName(String formResourceName) {
+ this.formResourceName = formResourceName;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StartActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ execution.historyActivityStart();
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+ signal((ExecutionImpl)execution, signalName, parameters);
+ }
+
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ Transition transition = null;
+ if ( (signalName==null)
+ && (activity.getOutgoingTransitions()!=null)
+ && (activity.getOutgoingTransitions().size()==1)
+ ) {
+ transition = activity.getOutgoingTransitions().get(0);
+ } else {
+ transition = activity.findOutgoingTransition(signalName);
+ }
+
+ if (transition!=null) {
+ execution.historyActivityEnd(signalName);
+ execution.take(transition);
+ } else {
+ execution.waitForSignal();
+ }
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/StateActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.pvm.internal.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.env.Context;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.ExecutionContext;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.session.RepositorySession;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String subProcessKey;
+ protected String subProcessId;
+ protected Map<String, String> swimlaneMappings;
+
+ protected List<SubProcessInParameterImpl> inParameters;
+ protected List<SubProcessOutParameterImpl> outParameters;
+
+ protected String outcomeExpression;
+ protected Map<Object, String> outcomeVariableMappings;
+
+ public void execute(ActivityExecution execution) {
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+
+ RepositorySession repositorySession = EnvironmentImpl.getFromCurrent(RepositorySession.class);
+
+ ClientProcessDefinition processDefinition = null;
+
+ if (subProcessId!=null) {
+ processDefinition = repositorySession.findProcessDefinitionById(subProcessId);
+ } else {
+ processDefinition = repositorySession.findProcessDefinitionByKey(subProcessKey);
+ }
+
+ ExecutionImpl subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(null, execution);
+
+ for (String swimlaneName: swimlaneMappings.keySet()) {
+ String subSwimlaneName = swimlaneMappings.get(swimlaneName);
+ SwimlaneImpl subSwimlane = subProcessInstance.createSwimlane(subSwimlaneName);
+ SwimlaneImpl swimlane = executionImpl.getSwimlane(swimlaneName);
+ if (swimlane!=null) {
+ subSwimlane.initialize(swimlane);
+ }
+ }
+
+ for (SubProcessInParameterImpl inParameter: inParameters) {
+ inParameter.produce(executionImpl, subProcessInstance);
+ }
+
+ executionImpl.historyActivityStart();
+
+ subProcessInstance.start();
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+ signal((ExecutionImpl)execution, signalName, parameters);
+ }
+
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+
+ ExecutionImpl subProcessInstance = executionImpl.getSubProcessInstance();
+
+ String transitionName = null;
+
+ ExecutionContext originalExecutionContext = null;
+ ExecutionContext subProcessExecutionContext = null;
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ if (environment!=null) {
+ originalExecutionContext = (ExecutionContext) environment.removeContext(Context.CONTEXTNAME_EXECUTION);
+ subProcessExecutionContext = new ExecutionContext((ExecutionImpl) subProcessInstance);
+ environment.setContext(subProcessExecutionContext);
+ }
+
+ try {
+ subProcessInstance.setSuperProcessExecution(null);
+ executionImpl.setSubProcessInstance(null);
+
+
+ for (SubProcessOutParameterImpl outParameter: outParameters) {
+ outParameter.consume(executionImpl, subProcessInstance);
+ }
+
+ Activity activity = execution.getActivity();
+ String subProcessActivityName = subProcessInstance.getActivityName();
+
+ if (outcomeExpression!=null) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ Object value = scriptManager.evaluateExpression(outcomeExpression, null);
+ // if the value is a String and matches the name of an outgoing transition
+ if ( (value instanceof String)
+ && (activity.hasOutgoingTransition(((String) value)))
+ ) {
+ // then take that one
+ transitionName = (String) value;
+ } else {
+ // else see if there is a value mapping
+ transitionName = outcomeVariableMappings.get(value);
+ }
+
+ } else if (activity.hasOutgoingTransition(subProcessActivityName)) {
+ transitionName = subProcessActivityName;
+ }
+
+ } finally {
+ if (subProcessExecutionContext!=null) {
+ environment.removeContext(subProcessExecutionContext);
+ }
+ if (originalExecutionContext!=null) {
+ environment.setContext(originalExecutionContext);
+ }
+ }
+
+ executionImpl.historyActivityEnd();
+
+ if (transitionName!=null) {
+ execution.take(transitionName);
+ } else {
+ execution.takeDefaultTransition();
+ }
+ }
+
+ public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
+ this.swimlaneMappings = swimlaneMappings;
+ }
+ public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
+ this.outcomeVariableMappings = outcomeVariableMappings;
+ }
+ public void setSubProcessKey(String subProcessKey) {
+ this.subProcessKey = subProcessKey;
+ }
+ public void setSubProcessId(String subProcessId) {
+ this.subProcessId = subProcessId;
+ }
+ public void setOutcomeExpression(String outcomeExpression) {
+ this.outcomeExpression = outcomeExpression;
+ }
+ public List<SubProcessInParameterImpl> getInParameters() {
+ return inParameters;
+ }
+ public void setInParameters(List<SubProcessInParameterImpl> inParameters) {
+ this.inParameters = inParameters;
+ }
+ public List<SubProcessOutParameterImpl> getOutParameters() {
+ return outParameters;
+ }
+ public void setOutParameters(List<SubProcessOutParameterImpl> outParameters) {
+ this.outParameters = outParameters;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/SubProcessActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.activities;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.task.Task;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = Log.getLog(TaskActivity.class.getName());
+
+ protected TaskDefinitionImpl taskDefinition;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
+ TaskImpl task = (TaskImpl) dbSession.createTask();
+ task.setTaskDefinition(taskDefinition);
+ task.setExecution(execution);
+ task.setProcessInstance(execution.getProcessInstance());
+ task.setSignalling(true);
+
+ // initialize the name
+ if (taskDefinition.getName()!=null) {
+ task.setName(taskDefinition.getName());
+ } else {
+ task.setName(execution.getActivityName());
+ }
+
+ task.setDescription(taskDefinition.getDescription());
+ task.setPriority(taskDefinition.getPriority());
+ task.setFormResourceName(taskDefinition.getFormResourceName());
+
+ // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
+ dbSession.save(task);
+
+ SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+ if (swimlaneDefinition!=null) {
+ SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
+ task.setSwimlane(swimlane);
+
+ // copy the swimlane assignments to the task
+ task.setAssignee(swimlane.getAssignee());
+ for (ParticipationImpl participant: swimlane.getParticipations()) {
+ task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
+ }
+ }
+
+ execution.initializeAssignments(taskDefinition, task);
+
+ HistoryEvent.fire(new TaskActivityStart(task), execution);
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+ signal((ExecutionImpl)execution, signalName, parameters);
+ }
+
+ public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ DbSession taskDbSession = EnvironmentImpl
+ .getFromCurrent(DbSession.class);
+ TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
+ task.setSignalling(false);
+
+ Transition transition = null;
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ if ( (outgoingTransitions!=null)
+ && (!outgoingTransitions.isEmpty())
+ ) {
+ transition = activity.findOutgoingTransition(signalName);
+ if (transition==null) {
+ if (Task.STATE_COMPLETED.equals(signalName)) {
+ if (outgoingTransitions.size()==1) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.getDefaultOutgoingTransition();
+ }
+ } else {
+ // if a user specified outcome was provided and it doesn't
+ // match with an outgoing transition name, then an exception is
+ // thrown since this is likely a programmatic error.
+ throw new JbpmException("No outcome named '" + signalName + "' was found.");
+ }
+ }
+ if (transition!=null) {
+ execution.take(transition);
+ }
+ }
+ }
+
+ public TaskDefinitionImpl getTaskDefinition() {
+ return taskDefinition;
+ }
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ this.taskDefinition = taskDefinition;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/activities/TaskActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBinding extends JpdlBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+
+ public CustomBinding() {
+ super("custom");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CustomActivity customActivity = new CustomActivity();
+ ObjectDescriptor descriptor = (ObjectDescriptor)
+ objectBinding.parse(element, parse, wireParser);
+ ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
+ customActivity.setCustomBehaviour(customActivityBehaviour);
+ return customActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/CustomBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import java.util.List;
+
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionBinding extends JpdlBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public DecisionBinding() {
+ super("decision");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ if (element.hasAttribute("expr")) {
+ DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
+ String expr = element.getAttribute("expr");
+ decisionExpressionActivity.setExpr(expr);
+ return decisionExpressionActivity;
+ }
+
+ if (element.hasAttribute("handler-ref")) {
+ String decisionHandlerName = element.getAttribute("handler-ref");
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
+ return decisionHandlerActivity;
+ }
+
+ Element handlerElement = XmlUtil.element(element, "handler");
+ if (handlerElement!=null) {
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
+ objectBinding.parse(handlerElement, parse, wireParser);
+ DecisionHandler decisionHandler = (DecisionHandler) WireContext.create(decisionHandlerDescriptor);
+ decisionHandlerActivity.setDecisionHandler(decisionHandler);
+ return decisionHandlerActivity;
+ }
+
+ boolean hasConditions = false;
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+ List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
+
+ for (int i=0; i<transitionElements.size(); i++) {
+ TransitionImpl transition = transitions.get(i);
+ Element transitionElement = transitionElements.get(i);
+
+ Element conditionElement = XmlUtil.element(transitionElement, "condition");
+ if (conditionElement!=null) {
+ hasConditions = true;
+
+ if (conditionElement.hasAttribute("expr")) {
+ String expr = conditionElement.getAttribute("expr");
+ String lang = XmlUtil.attribute(conditionElement, "expr-lang");
+ ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
+ transition.setConditionDescriptor(expressionDescriptor);
+
+ } else if (conditionElement.hasAttribute("ref")) {
+ String expr = conditionElement.getAttribute("ref");
+ ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
+ transition.setConditionDescriptor(refDescriptor);
+
+ } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
+ ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
+ transition.setConditionDescriptor(conditionDescriptor);
+ }
+ }
+ }
+
+ if (hasConditions) {
+ return new DecisionConditionActivity();
+ } else {
+ parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
+ }
+
+ return null;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/DecisionBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndBinding extends JpdlBinding {
+
+ public EndBinding() {
+ super("end");
+ }
+
+ protected EndBinding(String tag) {
+ super(tag);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ boolean endProcessInstance = true;
+ String ends = XmlUtil.attribute(element, "ends", false, parse);
+ if ("execution".equalsIgnoreCase(ends)) {
+ endProcessInstance = false;
+ }
+
+ String state = XmlUtil.attribute(element, "state", false, parse);
+
+ EndActivity endActivity = new EndActivity();
+ endActivity.setEndProcessInstance(endProcessInstance);
+ endActivity.setState(state);
+
+ return endActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndCancelBinding extends EndBinding {
+
+ public EndCancelBinding() {
+ super("end-cancel");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("cancel");
+ return endActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndCancelBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndErrorBinding extends EndBinding {
+
+ public EndErrorBinding() {
+ super("end-error");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("error");
+ return endActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EndErrorBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EventListenerBinding extends JpdlBinding {
+
+ public EventListenerBinding() {
+ super("event-listener");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ Descriptor descriptor = JpdlParser.parseObjectDescriptor(element, parse);
+ EventListener eventListener = (EventListener) WireContext.create(descriptor);
+ return eventListener;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/EventListenerBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ForkBinding extends JpdlBinding {
+
+ public ForkBinding() {
+ super("fork");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ForkActivity();
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ForkBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupBinding extends JpdlBinding {
+
+ public GroupBinding() {
+ super("group");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ GroupActivity groupActivity = new GroupActivity();
+
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+
+ JpdlParser jpdlParser = (JpdlParser) parser;
+ jpdlParser.parseActivities(element, parse, activity);
+
+ return groupActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/GroupBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlBinding extends JpdlBinding {
+
+ public static final String TAG = "hql";
+
+ public HqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlBinding(String tagName) {
+ super(tagName);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ HqlActivity hqlActivity = createHqlActivity();
+
+ Element queryElement = XmlUtil.element(element, "query", true, parse);
+ if (queryElement!=null) {
+ String query = XmlUtil.getContentText(queryElement);
+ hqlActivity.setQuery(query);
+ }
+
+ if (XmlUtil.attributeBoolean(element, "unique", false, parse, Boolean.FALSE)) {
+ hqlActivity.setResultUnique(true);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var", true, parse);
+ hqlActivity.setResultVariableName(variableName);
+
+ Element parametersElement = XmlUtil.element(element, "parameters");
+ List<Element> paramElements = XmlUtil.elements(parametersElement);
+ if (!paramElements.isEmpty()) {
+ List<Descriptor> parametersDescriptor = new ArrayList<Descriptor>();
+ for (Element paramElement: paramElements) {
+ WireParser wireParser = WireParser.getInstance();
+ Descriptor paramDescriptor = (Descriptor) wireParser.parseElement(paramElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ parametersDescriptor.add(paramDescriptor);
+ }
+
+ ListDescriptor parametersListDescriptor = new ListDescriptor();
+ parametersListDescriptor.setValueDescriptors(parametersDescriptor);
+ hqlActivity.setParametersDescriptor(parametersListDescriptor);
+ }
+
+ return hqlActivity;
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new HqlActivity();
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/HqlBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import java.util.List;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaBinding extends JpdlBinding {
+
+ public static final String TAG = "java";
+
+ public JavaBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JavaActivity javaActivity = new JavaActivity();
+
+ String methodName = XmlUtil.attribute(element, "method", true, parse, null);
+ javaActivity.setMethodName(methodName);
+
+ String variableName = XmlUtil.attribute(element, "var");
+ javaActivity.setVariableName(variableName);
+
+ List<Element> argElements = XmlUtil.elements(element, "arg");
+ if (!argElements.isEmpty()) {
+ List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
+ InvokeOperation invokeOperation = new InvokeOperation();
+ invokeOperation.setArgDescriptors(argDescriptors);
+ javaActivity.setInvokeOperation(invokeOperation);
+ }
+
+ if (element.hasAttribute("class")) {
+ ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
+ Object target = WireContext.create(objectDescriptor);
+ javaActivity.setTarget(target);
+
+ } else if (element.hasAttribute("expr")) {
+ String expression = element.getAttribute("expr");
+ javaActivity.setTargetExpression(expression);
+ javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
+
+ } else {
+ // parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
+ }
+
+ return javaActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JavaBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.hibernate.LockMode;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinBinding extends JpdlBinding {
+
+ private static final String MULTIPLICITY = "multiplicity";
+
+ private static final String LOCKMODE = "lockmode";
+
+ public JoinBinding() {
+ super("join");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JoinActivity joinActivity = new JoinActivity();
+
+ if (element.hasAttribute(MULTIPLICITY)) {
+ String multiplicictyText = element.getAttribute(MULTIPLICITY);
+ try {
+ int multiplicity = Integer.parseInt(multiplicictyText);
+ joinActivity.setMultiplicity(multiplicity);
+ } catch (NumberFormatException e) {
+ parse.addProblem(MULTIPLICITY + " " + multiplicictyText + " is not a valid integer", element);
+ }
+ }
+
+ if (element.hasAttribute(LOCKMODE)) {
+ String lockModeText = element.getAttribute(LOCKMODE);
+ LockMode lockMode = LockMode.parse(lockModeText.toUpperCase());
+ if (lockMode==null) {
+ parse.addProblem(LOCKMODE + " " + lockModeText + " is not a valid lock mode", element);
+ } else {
+ joinActivity.setLockMode(lockMode);
+ }
+ }
+
+ return joinActivity;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JoinBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+
+import java.util.List;
+
+import org.jbpm.api.model.Event;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.TagBinding;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlBinding extends TagBinding {
+
+ protected static final WireParser wireParser = JpdlParser.wireParser;
+
+ public JpdlBinding(String tagName) {
+ super(tagName, JpdlParser.JPDL_NAMESPACE, null);
+ }
+
+ public void parseName(Element element, ActivityImpl activity, Parse parse) {
+ String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
+
+ if (name!=null) {
+ // basic name validation
+ if ("".equals(name)) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
+ } else if (name.indexOf('/')!=-1) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
+ }
+ activity.setName(name);
+ }
+ }
+
+ public boolean isNameRequired() {
+ return true;
+ }
+
+ public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+ for (Element transitionElement: transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+ Element timerElement = XmlUtil.element(transitionElement, "timer");
+ if (timerElement!=null) {
+ if (transitionName!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
+ timerDefinitionImpl.setSignalName(transitionName);
+ } else {
+ parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+ }
+ }
+
+ TransitionImpl transition = activity.createOutgoingTransition();
+ transition.setName(transitionName);
+
+ unresolvedTransitions.add(transition, transitionElement);
+
+ jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+ }
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/JpdlBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.w3c.dom.Element;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailBinding extends JpdlBinding {
+
+ public MailBinding() {
+ super("mail");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ MailActivity activity = new MailActivity();
+ activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
+ return activity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/MailBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptBinding extends JpdlBinding {
+
+ private static final String TAG = "script";
+
+ public ScriptBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ String language = null;
+
+ String script = XmlUtil.attribute(element, "expr");
+ Element textElement = XmlUtil.element(element, "text");
+ if(script!=null) {
+ ScriptManager scriptManager = EnvironmentImpl.getFromCurrent(ScriptManager.class);
+ language = scriptManager.getDefaultExpressionLanguage();
+ if (textElement!=null) {
+ parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
+ }
+ } else {
+ language = XmlUtil.attribute(element, "lang");
+ script = XmlUtil.getContentText(textElement);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var");
+
+ ScriptActivity scriptActivity = new ScriptActivity();
+ scriptActivity.setScript(script);
+ scriptActivity.setLanguage(language);
+ scriptActivity.setVariableName(variableName);
+
+ return scriptActivity;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/ScriptBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlBinding extends HqlBinding {
+
+ public static final String TAG = "sql";
+
+ public SqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new SqlActivity();
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SqlBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartBinding extends JpdlBinding {
+
+ public StartBinding() {
+ super("start");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
+ JpdlProcessDefinition processDefinition = parse.findObject(JpdlProcessDefinition.class);
+
+ if (processDefinition.getInitial()==null) {
+ processDefinition.setInitial(startActivity);
+
+ } else if (startActivity.getParentActivity()==null) {
+ parse.addProblem("multiple start events not yet supported", element);
+ }
+
+ StartActivity startActivityBehaviour = new StartActivity();
+
+ startActivityBehaviour.setFormResourceName(XmlUtil.attribute(element, "form"));
+
+ return startActivityBehaviour;
+ }
+
+ public boolean isNameRequired() {
+ return false;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StartBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateBinding extends JpdlBinding {
+
+ public StateBinding() {
+ super("state");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new StateActivity();
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/StateBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessBinding extends JpdlBinding {
+
+ public SubProcessBinding() {
+ super("sub-process");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ SubProcessActivity subProcessActivity = new SubProcessActivity();
+
+ String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
+ subProcessActivity.setSubProcessKey(subProcessKey);
+
+ String subProcessId = XmlUtil.attribute(element, "sub-process-id");
+ subProcessActivity.setSubProcessId(subProcessId);
+
+ List<SubProcessInParameterImpl> inParameters = new ArrayList<SubProcessInParameterImpl>();
+ for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
+ SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
+ parseParameter(inElement, inParameter);
+ inParameters.add(inParameter);
+
+ if (inParameter.getSubVariableName()==null) {
+ parse.addProblem("no 'subvar' specified for parameter-in", element);
+ }
+ if ( (inParameter.getExpression()==null)
+ && (inParameter.getVariableName()==null)
+ ) {
+ parse.addProblem("no 'expr' or 'variable' specified for parameter-in '"+inParameter.getSubVariableName()+"'", element);
+ }
+ if ( (inParameter.getExpression()!=null)
+ && (inParameter.getVariableName()!=null)
+ ) {
+ parse.addProblem("attributes 'expr' and 'variable' are mutually exclusive on parameter-in", element);
+ }
+ }
+ subProcessActivity.setInParameters(inParameters);
+
+ List<SubProcessOutParameterImpl> outParameters = new ArrayList<SubProcessOutParameterImpl>();
+ for (Element outElement: XmlUtil.elements(element, "parameter-out")) {
+ SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
+ parseParameter(outElement, outParameter);
+ outParameters.add(outParameter);
+
+ if (outParameter.getVariableName()==null) {
+ parse.addProblem("no 'variable' specified for parameter-in", element);
+ }
+ if ( (outParameter.getExpression()==null)
+ && (outParameter.getSubVariableName()==null)
+ ) {
+ parse.addProblem("no 'expr' or 'subvar' specified for parameter-out '"+outParameter.getVariableName()+"'", element);
+ }
+ if ( (outParameter.getExpression()!=null)
+ && (outParameter.getSubVariableName()!=null)
+ ) {
+ parse.addProblem("attributes 'expr' and 'subvar' are mutually exclusive on parameter-out '"+outParameter.getVariableName()+"'", element);
+ }
+ }
+ subProcessActivity.setOutParameters(outParameters);
+
+ Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
+ subProcessActivity.setSwimlaneMappings(swimlaneMappings);
+
+ Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
+
+ String outcomeExpression = XmlUtil.attribute(element, "outcome");
+ if (outcomeExpression!=null) {
+ subProcessActivity.setOutcomeExpression(outcomeExpression);
+
+ for (Element transitionElement: XmlUtil.elements(element, "transition")) {
+ Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
+ if (outcomeValueElement!=null) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name");
+ if (transitionName==null) {
+ parse.addProblem("transitions with an outcome-value must have a name", transitionElement);
+ }
+ Element valueElement = XmlUtil.element(outcomeValueElement);
+ if (valueElement!=null) {
+ Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
+ Object value = WireContext.create(descriptor);
+ outcomeVariableMappings.put(value, transitionName);
+ } else {
+ parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
+ }
+ }
+ }
+
+ }
+
+ return subProcessActivity;
+ }
+
+ void parseParameter(Element element, SubProcessParameterImpl parameter) {
+ String name = XmlUtil.attribute(element, "subvar");
+ parameter.setSubVariableName(name);
+
+ String expr = XmlUtil.attribute(element, "expr");
+ if (expr!=null) {
+ parameter.setExpression(expr);
+ }
+
+ String language = XmlUtil.attribute(element, "lang");
+ if (language!=null) {
+ parameter.setLanguage(language);
+ }
+
+ String variable = XmlUtil.attribute(element, "var");
+ if (variable!=null) {
+ parameter.setVariableName(variable);
+ }
+ }
+
+ public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
+ Map<String, String> swimlaneMappings = new HashMap<String, String>();
+
+ for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
+ String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
+ String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
+
+ swimlaneMappings.put(swimlane, subSwimlane);
+ }
+
+ return swimlaneMappings;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/SubProcessBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v40.bindings;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskBinding extends JpdlBinding {
+
+ private static final String TAG = "task";
+
+ public TaskBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ TaskActivity taskActivity = new TaskActivity();
+
+ ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
+ TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
+ taskActivity.setTaskDefinition(taskDefinition);
+
+ return taskActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v40/bindings/TaskBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42;
+
+import java.util.List;
+
+import org.jbpm.api.model.Event;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParserVersion;
+import org.jbpm.jpdl.internal.parser.UnresolvedTransitions;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlParserV42 extends JpdlParserVersion {
+
+ public static final String NAMESPACE = "http://jbpm.org/4.2/jpdl";
+
+ public String getNamespaceUri() {
+ return NAMESPACE;
+ }
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ return null;
+ }
+
+ public void parseActivityName(Element element, ActivityImpl activity, Parse parse, boolean isRequired) {
+ String name = XmlUtil.attribute(element, "name", isRequired, parse);
+
+ if (name!=null) {
+ // basic name validation
+ if ("".equals(name)) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
+ } else if (name.indexOf('/')!=-1) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
+ }
+ activity.setName(name);
+ }
+ }
+
+ public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+ for (Element transitionElement: transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+
+ Element timerElement = XmlUtil.element(transitionElement, "timer");
+ if (timerElement!=null) {
+ if (transitionName!=null) {
+ TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
+ timerDefinitionImpl.setSignalName(transitionName);
+ } else {
+ parse.addProblem("a transition name is required when a timer is placed on a transition", element);
+ }
+ }
+
+ TransitionImpl transition = activity.createOutgoingTransition();
+ transition.setName(transitionName);
+
+ unresolvedTransitions.add(transition, transitionElement);
+
+ parseOnEvent(transitionElement, parse, transition, Event.TAKE);
+ }
+ }
+
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/JpdlParserV42.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/CustomActivity.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/CustomActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/CustomActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.activities;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomActivity implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference customActivityReference;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference.getObject(execution);
+ activityBehaviour.execute(execution);
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference.getObject(execution);
+ externalActivityBehaviour.execute(execution);
+ }
+
+ public void setCustomActivityReference(UserCodeReference customActivityReference) {
+ this.customActivityReference = customActivityReference;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/CustomActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java (from rev 5671, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.activities;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.jpdl.internal.activity.JpdlActivity;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionHandlerActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String decisionHandlerName;
+ protected UserCodeReference decisionHandlerReference;
+
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl) execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ ActivityImpl activity = execution.getActivity();
+
+ String transitionName = null;
+
+ DecisionHandler usedDecisionHandler = null;
+ if (decisionHandlerReference!=null) {
+ usedDecisionHandler = (DecisionHandler) decisionHandlerReference.getObject(execution);
+
+ } else if (decisionHandlerName!=null) {
+ EnvironmentImpl environment = EnvironmentImpl.getCurrent();
+ Object object = environment.get(decisionHandlerName);
+ if (object==null) {
+ throw new JbpmException("decision handler for "+activity+" is null");
+ }
+ if (! (object instanceof DecisionHandler)) {
+ throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
+ }
+ usedDecisionHandler = (DecisionHandler) object;
+ } else {
+ throw new JbpmException("no decision handler specified");
+ }
+
+ transitionName = usedDecisionHandler.decide(execution);
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("handler in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyDecision(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setDecisionHandlerName(String decisionHandlerName) {
+ this.decisionHandlerName = decisionHandlerName;
+ }
+ public UserCodeReference getDecisionHandlerReference() {
+ return decisionHandlerReference;
+ }
+ public void setDecisionHandlerReference(UserCodeReference decisionHandlerReference) {
+ this.decisionHandlerReference = decisionHandlerReference;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/DecisionHandlerActivity.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.activities;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.jpdl.internal.activity.JpdlAutomaticActivity;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlAutomaticActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference targetReference;
+
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void perform(OpenExecution execution) throws Exception {
+
+ Object invocationTarget = null;
+
+ WireContext wireContext = new WireContext();
+
+ if (targetReference!=null) {
+ invocationTarget = targetReference.getObject(execution);
+
+ } else {
+ throw new JbpmException("no target specified");
+ }
+
+ try {
+ List<ArgDescriptor> argDescriptors = null;
+ Object[] args = null;
+ if (invokeOperation!=null) {
+ argDescriptors = invokeOperation.getArgDescriptors();
+ args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ }
+
+ Class<?> clazz = invocationTarget.getClass();
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
+ }
+
+ Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public UserCodeReference getTargetReference() {
+ return targetReference;
+ }
+ public void setTargetReference(UserCodeReference targetReference) {
+ this.targetReference = targetReference;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/JavaActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/UserCodeEventListener.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/UserCodeEventListener.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/UserCodeEventListener.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.activities;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeEventListener implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ UserCodeReference eventListenerReference;
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ EventListener eventListener = (EventListener) eventListenerReference.getObject(execution);
+ eventListener.notify(execution);
+ }
+
+ public void setEventListenerReference(UserCodeReference eventListenerReference) {
+ this.eventListenerReference = eventListenerReference;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/activities/UserCodeEventListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java (from rev 5669, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.activities.CustomActivity;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBinding extends JpdlBinding {
+
+ public CustomBinding() {
+ super("custom");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CustomActivity customActivity = new CustomActivity();
+
+ UserCodeReference customActivityReference = JpdlParser.parseUserCodeReference(element, parse);
+ customActivity.setCustomActivityReference(customActivityReference);
+
+ return customActivity;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/CustomBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java (from rev 5671, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import java.util.List;
+
+import org.jbpm.jpdl.internal.activity.DecisionConditionActivity;
+import org.jbpm.jpdl.internal.activity.DecisionExpressionActivity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.activities.DecisionHandlerActivity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionConditionDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionBinding extends JpdlBinding {
+
+ static WireParser wireParser = WireParser.getInstance();
+
+ public DecisionBinding() {
+ super("decision");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ if (element.hasAttribute("expr")) {
+ DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
+ decisionExpressionActivity.setExpr(element.getAttribute("expr"));
+ decisionExpressionActivity.setLang(XmlUtil.attribute(element, "lang"));
+ return decisionExpressionActivity;
+ }
+
+ if (element.hasAttribute("handler-ref")) {
+ String decisionHandlerName = element.getAttribute("handler-ref");
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
+ return decisionHandlerActivity;
+ }
+
+ Element handlerElement = XmlUtil.element(element, "handler");
+ if (handlerElement!=null) {
+ DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
+ UserCodeReference decisionHandlerReference = JpdlParser.parseUserCodeReference(handlerElement, parse);
+ decisionHandlerActivity.setDecisionHandlerReference(decisionHandlerReference);
+ return decisionHandlerActivity;
+ }
+
+ boolean hasConditions = false;
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+ List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
+
+ for (int i=0; i<transitionElements.size(); i++) {
+ TransitionImpl transition = transitions.get(i);
+ Element transitionElement = transitionElements.get(i);
+
+ Element conditionElement = XmlUtil.element(transitionElement, "condition");
+ if (conditionElement!=null) {
+ hasConditions = true;
+
+ if (conditionElement.hasAttribute("expr")) {
+ String expr = conditionElement.getAttribute("expr");
+ String lang = XmlUtil.attribute(conditionElement, "lang");
+ Descriptor descriptor = new ExpressionConditionDescriptor(expr, lang);
+ UserCodeReference conditionReference = new UserCodeReference();
+ conditionReference.setDescriptor(descriptor);
+ conditionReference.setCached(false);
+ transition.setConditionReference(conditionReference);
+
+ } else if (conditionElement.hasAttribute("ref")) {
+ String objectName = conditionElement.getAttribute("ref");
+ ReferenceDescriptor refDescriptor = new ReferenceDescriptor(objectName);
+ UserCodeReference conditionReference = new UserCodeReference();
+ conditionReference.setDescriptor(refDescriptor);
+ conditionReference.setCached(false);
+ transition.setConditionReference(conditionReference);
+
+ } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
+ UserCodeReference decisionHandlerReference = JpdlParser.parseUserCodeReference(conditionElement, parse);
+ transition.setConditionReference(decisionHandlerReference);
+
+ }
+ }
+ }
+
+ if (hasConditions) {
+ return new DecisionConditionActivity();
+ } else {
+ parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
+ }
+
+ return null;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/DecisionBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java (from rev 5671, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.activities.UserCodeEventListener;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EventListenerBinding extends JpdlBinding {
+
+ public EventListenerBinding() {
+ super("event-listener");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ UserCodeEventListener userCodeEventListener = new UserCodeEventListener();
+ UserCodeReference eventListenerReference = JpdlParser.parseUserCodeReference(element, parse);
+ userCodeEventListener.setEventListenerReference(eventListenerReference);
+ return userCodeEventListener;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/EventListenerBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import org.jbpm.jpdl.internal.activity.GroupActivity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupBinding extends JpdlBinding {
+
+ public GroupBinding() {
+ super("group");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ GroupActivity groupActivity = new GroupActivity();
+
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+
+ JpdlParser jpdlParser = (JpdlParser) parser;
+ jpdlParser.parseActivities(element, parse, activity);
+
+ return groupActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/GroupBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import java.util.List;
+
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.jpdl.internal.v42.activities.JavaActivity;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaBinding extends JpdlBinding {
+
+ public static final String TAG = "java";
+
+ public JavaBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JavaActivity javaActivity = new JavaActivity();
+
+ String methodName = XmlUtil.attribute(element, "method", true, parse, null);
+ javaActivity.setMethodName(methodName);
+
+ String variableName = XmlUtil.attribute(element, "var");
+ javaActivity.setVariableName(variableName);
+
+ List<Element> argElements = XmlUtil.elements(element, "arg");
+ if (!argElements.isEmpty()) {
+ List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
+ InvokeOperation invokeOperation = new InvokeOperation();
+ invokeOperation.setArgDescriptors(argDescriptors);
+ javaActivity.setInvokeOperation(invokeOperation);
+ }
+
+ if (ObjectBinding.isObjectDescriptor(element)) {
+ UserCodeReference targetReference = JpdlParser.parseUserCodeReference(element, parse);
+ javaActivity.setTargetReference(targetReference);
+ }
+
+ return javaActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/JavaBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/MailBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import org.w3c.dom.Element;
+
+import org.jbpm.jpdl.internal.activity.MailActivity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailBinding extends JpdlBinding {
+
+ public MailBinding() {
+ super("mail");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ MailActivity activity = new MailActivity();
+ activity.setMailProducer(((JpdlParser)parser).parseMailProducer(element, parse, null));
+ return activity;
+ }
+}
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.v42.binding;
+
+import org.jbpm.jpdl.internal.activity.TaskActivity;
+import org.jbpm.jpdl.internal.parser.JpdlBinding;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskBinding extends JpdlBinding {
+
+ private static final String TAG = "task";
+
+ public TaskBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ TaskActivity taskActivity = new TaskActivity();
+
+ ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
+ TaskDefinitionImpl taskDefinition = ((JpdlParser)parser).parseTaskDefinition(element, parse, scopeElement);
+ taskActivity.setTaskDefinition(taskDefinition);
+
+ return taskActivity;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/v42/binding/TaskBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlBindingsParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlBindingsParser.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlBindingsParser.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Binding;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlBindingsParser extends Parser {
-
- private static final Log log = Log.getLog(JpdlBindingsParser.class.getName());
-
- public Object parseDocumentElement(Element documentElement, Parse parse) {
- List<Binding> bindings = new ArrayList<Binding>();
- parse.setDocumentObject(bindings);
-
- for (Element bindingElement : XmlUtil.elements(documentElement)) {
- Binding binding = instantiateBinding(bindingElement, parse);
- bindings.add(binding);
- }
-
- return bindings;
- }
-
- protected Binding instantiateBinding(Element bindingElement, Parse parse) {
- String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
-
- log.trace("adding jpdl binding "+bindingClassName);
-
- if (bindingClassName!=null) {
- try {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Class<?> bindingClass = Class.forName(bindingClassName, true, classLoader);
- return (Binding) bindingClass.newInstance();
- } catch (Exception e) {
- parse.addProblem("couldn't instantiate activity binding "+bindingClassName, e);
- }
- }
- return null;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import org.jbpm.jpdl.internal.repository.JpdlDeployer;
-import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlDeployerBinding extends WireDescriptorBinding {
-
- public JpdlDeployerBinding() {
- super("jpdl-deployer");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- return new ObjectDescriptor(JpdlDeployer.class);
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,702 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import java.net.URL;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.model.Event;
-import org.jbpm.api.task.AssignmentHandler;
-import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.activity.JpdlBinding;
-import org.jbpm.jpdl.internal.activity.MailListener;
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
-import org.jbpm.pvm.internal.email.impl.MailTemplate;
-import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
-import org.jbpm.pvm.internal.email.spi.MailProducer;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ActivityCoordinatesImpl;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.CompositeElementImpl;
-import org.jbpm.pvm.internal.model.Continuation;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.EventListenerReference;
-import org.jbpm.pvm.internal.model.ObservableElementImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.ScopeElementImpl;
-import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableOutDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableOutDefinitionSet;
-import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.Operation;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
-import org.jbpm.pvm.internal.xml.Bindings;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.jbpm.pvm.internal.xml.ProblemImpl;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlParser extends Parser {
-
- private static final Log log = Log.getLog(JpdlParser.class.getName());
-
- public static final String JPDL_NAMESPACE = "http://jbpm.org/4.0/jpdl";
-
- public static final WireParser wireParser = WireParser.getInstance();
-
- // array elements are mutable, even when final
- // never make a static array public
- static final String[] DEFAULT_ACTIVITIES_RESOURCES = {
- "jbpm.jpdl.activities.xml",
- "jbpm.user.activities.xml"
- };
-
- static final String[] DEFAULT_EVENTLISTENERS_RESOURCES = {
- "jbpm.jpdl.eventlisteners.xml",
- "jbpm.user.eventlisteners.xml"
- };
-
- static JpdlBindingsParser jpdlBindingsParser = new JpdlBindingsParser();
- static final String CATEGORY_ACTIVITY = "activity";
- static final String CATEGORY_EVENT_LISTENER = "eventlistener";
-
- public JpdlParser() {
- initialize();
-
- parseBindings();
-
- List<String> schemaResources = new ArrayList<String>();
- schemaResources.add("jpdl-4.0.xsd");
- setSchemaResources(schemaResources);
- }
-
- protected void parseBindings() {
- Bindings bindings = new Bindings();
- setBindings(bindings);
-
- for (String activityResource: DEFAULT_ACTIVITIES_RESOURCES) {
- Enumeration<URL> resourceUrls = getResources(activityResource);
- if (resourceUrls.hasMoreElements()) {
- while (resourceUrls.hasMoreElements()) {
- URL resourceUrl = resourceUrls.nextElement();
- log.trace("loading jpdl activities from resource: "+resourceUrl);
- List<JpdlBinding> activityBindings = (List<JpdlBinding>) jpdlBindingsParser.createParse()
- .setUrl(resourceUrl)
- .execute()
- .checkErrors("jpdl activities from "+resourceUrl.toString())
- .getDocumentObject();
-
- for (JpdlBinding binding: activityBindings) {
- binding.setCategory(CATEGORY_ACTIVITY);
- bindings.addBinding(binding);
- }
- }
- } else {
- log.trace("skipping unavailable jpdl activities resource: "+activityResource);
- }
- }
-
- for (String eventListenerResource: DEFAULT_EVENTLISTENERS_RESOURCES) {
- Enumeration<URL> resourceUrls = getResources(eventListenerResource);
- if (resourceUrls.hasMoreElements()) {
- while (resourceUrls.hasMoreElements()) {
- URL resourceUrl = resourceUrls.nextElement();
- log.trace("loading jpdl eventlisteners from resource: "+resourceUrl);
- List<JpdlBinding> activityBindings = (List<JpdlBinding>) jpdlBindingsParser.createParse()
- .setUrl(resourceUrl)
- .execute()
- .checkErrors("jpdl eventlisteners from "+resourceUrl.toString())
- .getDocumentObject();
-
- for (JpdlBinding binding: activityBindings) {
- binding.setCategory(CATEGORY_EVENT_LISTENER);
- bindings.addBinding(binding);
- }
- }
- } else {
- log.trace("skipping unavailable jpdl eventlistener resource: "+eventListenerResource);
- }
- }
- }
-
- protected Enumeration<URL> getResources(String resourceName) {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Enumeration<URL> resourceUrls;
- try {
- resourceUrls = classLoader.getResources(resourceName);
- } catch (Exception e) {
- throw new JbpmException("couldn't get resource urls for "+resourceName, e);
- }
- return resourceUrls;
- }
-
- public Object parseDocumentElement(Element documentElement, Parse parse) {
- List<ProcessDefinitionImpl> processDefinitions = new ArrayList<ProcessDefinitionImpl>();
-
- JpdlProcessDefinition processDefinition = instantiateNewJpdlProcessDefinition();
-
- processDefinitions.add(processDefinition);
-
- parse.pushObject(processDefinition);
- try {
- // process attribues
- String name = XmlUtil.attribute(documentElement, "name", true, parse);
- processDefinition.setName(name);
-
- String packageName = XmlUtil.attribute(documentElement, "package");
- processDefinition.setPackageName(packageName);
-
- Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
- if (version!=null) {
- processDefinition.setVersion(version);
- }
-
- String key = XmlUtil.attribute(documentElement, "key", false, parse);
- if (key!=null) {
- processDefinition.setKey(key);
- }
-
- Element descriptionElement = XmlUtil.element(documentElement, "description");
- if (descriptionElement!=null) {
- String description = XmlUtil.getContentText(descriptionElement);
- processDefinition.setDescription(description);
- }
-
- UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
- parse.pushObject(unresolvedTransitions);
-
- // swimlanes
- List<Element> swimlaneElements = XmlUtil.elements(documentElement, "swimlane");
- for (Element swimlaneElement: swimlaneElements) {
- String swimlaneName = XmlUtil.attribute(swimlaneElement, "name", true, parse);
- if (swimlaneName!=null) {
- SwimlaneDefinitionImpl swimlaneDefinition =
- processDefinition.createSwimlaneDefinition(swimlaneName);
- JpdlParser.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
- }
- }
-
- // on events
- parseOnEvents(documentElement, parse, processDefinition);
-
- // activities
- parseActivities(documentElement, parse, processDefinition);
-
- // bind activities to their destinations
- resolveTransitionDestinations(parse, processDefinition, unresolvedTransitions);
-
- } finally {
- parse.popObject();
- }
-
- if (processDefinition.getInitial()==null) {
- parse.addProblem("no start activity in process", documentElement);
- }
-
- return processDefinitions;
- }
-
- protected JpdlProcessDefinition instantiateNewJpdlProcessDefinition() {
- return new JpdlProcessDefinition();
- }
-
- protected void resolveTransitionDestinations(Parse parse, JpdlProcessDefinition processDefinition, UnresolvedTransitions unresolvedTransitions) {
- for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
- unresolvedTransition.resolve(processDefinition, parse);
- }
- }
-
- public void parseActivities(Element documentElement, Parse parse, CompositeElementImpl compositeElement) {
- List<Element> elements = XmlUtil.elements(documentElement);
- for (Element nestedElement : elements) {
- String tagName = XmlUtil.getTagLocalName(nestedElement);
- if ("on".equals(tagName)
- || "timer".equals(tagName)
- || "swimlane".equals(tagName)) continue;
-
- JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement, CATEGORY_ACTIVITY);
- if (activityBinding == null) {
- log.debug("unrecognized activity: " + tagName);
- continue;
- }
-
- ActivityImpl activity = compositeElement.createActivity();
- parse.pushObject(activity);
- try {
- activity.setType(activityBinding.getTagName());
- activityBinding.parseName(nestedElement, activity, parse);
- parseTransitions(nestedElement, activity, parse);
-
- Element descriptionElement = XmlUtil.element(documentElement, "description");
- if (descriptionElement!=null) {
- String description = XmlUtil.getContentText(descriptionElement);
- activity.setDescription(description);
- }
-
- String continuationText = XmlUtil.attribute(nestedElement, "continue");
- if (continuationText!=null) {
- if ("async".equals(continuationText)) {
- activity.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
- activity.setContinuation(Continuation.EXCLUSIVE);
- }
- }
-
- Object parseResult = activityBinding.parse(nestedElement, parse, this);
- if (parseResult instanceof ActivityBehaviour) {
- ActivityBehaviour activityBehaviour = (ActivityBehaviour) parseResult;
- activity.setActivityBehaviour(activityBehaviour);
- } else {
- Descriptor activityBehaviourDescriptor = (Descriptor) parseResult;
- activity.setActivityBehaviourDescriptor(activityBehaviourDescriptor);
- }
-
- parseOnEvents(nestedElement, parse, activity);
-
- String g = XmlUtil.attribute(nestedElement, "g");
- if (g == null) continue;
-
- StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
- ActivityCoordinatesImpl coordinates = null;
- if (stringTokenizer.countTokens() == 4) {
- try {
- int x = Integer.parseInt(stringTokenizer.nextToken());
- int y = Integer.parseInt(stringTokenizer.nextToken());
- int width = Integer.parseInt(stringTokenizer.nextToken());
- int height = Integer.parseInt(stringTokenizer.nextToken());
- coordinates = new ActivityCoordinatesImpl(x, y, width, height);
- } catch (NumberFormatException e) {
- coordinates = null;
- }
- }
- if (coordinates != null) {
- activity.setCoordinates(coordinates);
- } else {
- parse.addProblem("invalid coordinates g=\"" + g + "\" in " + activity, nestedElement);
- }
- } finally {
- parse.popObject();
- }
- }
- }
-
- public static TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
- TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
-
- String duedate = XmlUtil.attribute(timerElement, "duedate");
- String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
-
- if (duedate!=null) {
- timerDefinition.setDueDateDescription(duedate);
-
- } else if (duedatetime!=null) {
- String dueDateTimeFormatText = (String) EnvironmentImpl.getFromCurrent("jbpm.duedatetime.format");
- if (dueDateTimeFormatText==null) {
- dueDateTimeFormatText = "HH:mm dd/MM/yyyy";
- }
- SimpleDateFormat dateFormat = new SimpleDateFormat(dueDateTimeFormatText);
- try {
- Date duedatetimeDate = dateFormat.parse(duedatetime);
- timerDefinition.setDueDate(duedatetimeDate);
- } catch (ParseException e) {
- parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
- }
- } else {
- parse.addProblem("either duedate or duedatetime is required in timer", timerElement);
- }
-
- String repeat = XmlUtil.attribute(timerElement, "repeat");
- timerDefinition.setRepeat(repeat);
-
- return timerDefinition;
- }
-
- public void parseOnEvents(Element element, Parse parse, ScopeElementImpl scopeElement) {
- // event listeners
- List<Element> onElements = XmlUtil.elements(element, "on");
- for (Element onElement: onElements) {
- String eventName = XmlUtil.attribute(onElement, "event", true, parse);
- parseOnEvent(onElement, parse, scopeElement, eventName);
-
- Element timerElement = XmlUtil.element(onElement, "timer");
- if (timerElement!=null) {
- TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, scopeElement);
- timerDefinitionImpl.setEventName(eventName);
- }
- }
- }
-
- public void parseOnEvent(Element element, Parse parse, ObservableElementImpl observableElement, String eventName) {
- if (eventName!=null) {
- EventImpl event = observableElement.getEvent(eventName);
- if (event==null) {
- event = observableElement.createEvent(eventName);
- }
-
- String continuationText = XmlUtil.attribute(element, "continue");
- if (continuationText!=null) {
- if ("async".equals(continuationText)) {
- event.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
- event.setContinuation(Continuation.EXCLUSIVE);
- }
- }
-
- for (Element eventListenerElement: XmlUtil.elements(element)) {
- JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, CATEGORY_EVENT_LISTENER);
- if (eventBinding!=null) {
- EventListenerReference eventListenerReference = null;
- Object parseResult = eventBinding.parse(eventListenerElement, parse, this);
- if (parseResult instanceof EventListener) {
- EventListener eventListener = (EventListener) parseResult;
- eventListenerReference = event.createEventListenerReference(eventListener);
- } else {
- Descriptor eventListenerDescriptor = (Descriptor) parseResult;
- eventListenerReference = event.createEventListenerReference(eventListenerDescriptor);
- }
-
- if (XmlUtil.attributeBoolean(eventListenerElement, "propagation", false, parse, false)) {
- eventListenerReference.setPropagationEnabled(true);
- }
-
- continuationText = XmlUtil.attribute(eventListenerElement, "continue");
- if (continuationText!=null) {
- if (observableElement instanceof ActivityImpl) {
- if (observableElement.getName()==null) {
- parse.addProblem("async continuation on event listener requires activity name", eventListenerElement);
- }
- } else if (observableElement instanceof TransitionImpl) {
- TransitionImpl transition = (TransitionImpl) observableElement;
- if (transition.getSource().getName()==null) {
- parse.addProblem("async continuation on event listener requires name in the transition source activity", eventListenerElement);
- }
- }
- if ("async".equals(continuationText)) {
- eventListenerReference.setContinuation(Continuation.ASYNCHRONOUS);
- } else if ("exclusive".equals(continuationText)) {
- eventListenerReference.setContinuation(Continuation.EXCLUSIVE);
- }
- }
-
- } else {
- String tagName = XmlUtil.getTagLocalName(eventListenerElement);
- if ( ! ( (observableElement instanceof TransitionImpl)
- && ( "condition".equals(tagName)
- || "timer".equals(tagName)
- )
- )
- ) {
- parse.addProblem("unrecognized event listener: "+tagName, null, ProblemImpl.TYPE_WARNING, eventListenerElement);
- }
- }
- }
- }
- }
-
- public void parseTransitions(Element element, ActivityImpl activity, Parse parse) {
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
- for (Element transitionElement: transitionElements) {
- String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-
- Element timerElement = XmlUtil.element(transitionElement, "timer");
- if (timerElement!=null) {
- TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement, parse, activity);
- timerDefinitionImpl.setSignalName(transitionName);
- }
-
- TransitionImpl transition = activity.createOutgoingTransition();
- transition.setName(transitionName);
-
- unresolvedTransitions.add(transition, transitionElement);
-
- parseOnEvent(transitionElement, parse, transition, Event.TAKE);
- }
- }
-
- public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
- Element descriptionElement = XmlUtil.element(element, "description");
- if (descriptionElement!=null) {
- String description = XmlUtil.getContentText(descriptionElement);
- assignableDefinition.setDescription(description);
- }
-
- Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
- if (assignmentHandlerElement!=null) {
- ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
- AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
- assignableDefinition.setAssignmentHandler(assignmentHandler);
- }
-
- String assigneeExpression = XmlUtil.attribute(element, "assignee");
- assignableDefinition.setAssigneeExpression(assigneeExpression);
-
- String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
- assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
-
- String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
- assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
-
- String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
- assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
-
- String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
- assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
-
- String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
- assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
- }
-
- public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
- TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
-
- String taskName = XmlUtil.attribute(element, "name");
- taskDefinition.setName(taskName);
-
- String form = XmlUtil.attribute(element, "form");
- taskDefinition.setFormResourceName(form);
-
- ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
- if (processDefinition.getTaskDefinition(taskName)!=null) {
- parse.addProblem("duplicate task name "+taskName, element);
- } else {
- processDefinition.addTaskDefinitionImpl(taskDefinition);
- }
-
- String swimlaneName = XmlUtil.attribute(element, "swimlane");
- if (swimlaneName!=null) {
- JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
- SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
- if (swimlaneDefinition!=null) {
- taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
- } else {
- parse.addProblem("swimlane "+swimlaneName+" not declared", element);
- }
- }
-
- JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
-
- // parse notification mail producer
- Element notificationElement = XmlUtil.element(element, "notification");
- if (notificationElement != null) {
- parseMailEvent(notificationElement, parse, scopeElement, Event.ASSIGN);
- }
-
- Element reminderElement = XmlUtil.element(element, "reminder");
- if (reminderElement != null) {
- parseMailEvent(reminderElement, parse, scopeElement, Event.REMIND);
- // associate timer to event
- TimerDefinitionImpl timerDefinition = parseTimerDefinition(reminderElement, parse, scopeElement);
- timerDefinition.setEventName(Event.REMIND);
- }
-
- return taskDefinition;
- }
-
- public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
- ObjectDescriptor objectDescriptor = new ObjectDescriptor();
-
- String className = XmlUtil.attribute(element, "class");
- if (className!=null) {
- objectDescriptor.setClassName(className);
-
- // read the operations elements
- List<Operation> operations = null;
- List<Element> elements = XmlUtil.elements(element);
-
- Set<String> operationTagNames = wireParser.getBindings().getTagNames(WireParser.CATEGORY_OPERATION);
- for (Element childElement: elements) {
- if (operationTagNames.contains(childElement.getTagName())) {
- Operation operation = (Operation) wireParser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
- if (operations==null) {
- operations = new ArrayList<Operation>();
- }
- operations.add(operation);
- }
- }
- objectDescriptor.setOperations(operations);
-
- // autowiring
- Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
- if (isAutoWireEnabled!=null) {
- objectDescriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
- }
- }
- return objectDescriptor;
- }
-
-
- public static List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
- List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
-
- for (Element inElement: XmlUtil.elements(element, "variable")) {
- VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
-
- String name = XmlUtil.attribute(inElement, "name", true, parse);
- variableDefinition.setName(name);
-
- int sources = 0;
-
- String initExpr = XmlUtil.attribute(inElement, "init");
- if (initExpr!=null) {
- variableDefinition.setInitExpression(initExpr);
- sources++;
- }
-
- Element valueElement = XmlUtil.element(inElement);
- if (valueElement!=null) {
- Descriptor initValueDescriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
- variableDefinition.setInitDescriptor(initValueDescriptor);
- sources++;
- }
-
- if (initRequired && sources==0) {
- parse.addProblem("no init specified", inElement);
- }
- if (sources>1) {
- parse.addProblem("init attribute and init element are mutually exclusive on element variable", inElement);
- }
-
- variableDefinitions.add(variableDefinition);
- }
-
- return variableDefinitions;
- }
-
- public static VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
- VariableOutDefinitionSet variableOutDefinitionSet = new VariableOutDefinitionSet();
-
- for (Element inElement: XmlUtil.elements(element, "out-variable")) {
- VariableOutDefinitionImpl variableOutDefinition = variableOutDefinitionSet.createVariableOutDefinition();
-
- String name = XmlUtil.attribute(inElement, "name", true, parse);
- variableOutDefinition.setName(name);
-
- String expression = XmlUtil.attribute(inElement, "init");
- if (expression!=null) {
- variableOutDefinition.setExpression(expression);
- }
- }
-
- return variableOutDefinitionSet;
- }
-
- public static void parseMailEvent(Element element, Parse parse,
- ObservableElementImpl observableElement, String eventName) {
- // obtain assign event
- EventImpl event = observableElement.getEvent(eventName);
- if (event == null) {
- event = observableElement.createEvent(eventName);
- }
- // register event listener
- MailListener eventListener = new MailListener();
- EventListenerReference eventListenerRef = event.createEventListenerReference(eventListener);
- // set continuation mode
- String continuationText = XmlUtil.attribute(element, "continue");
- if ("async".equals(continuationText)) {
- eventListenerRef.setContinuation(Continuation.ASYNCHRONOUS);
- }
- else if ("exclusive".equals(continuationText)) {
- eventListenerRef.setContinuation(Continuation.EXCLUSIVE);
- }
-
- //https://jira.jboss.org/jira/browse/JBPM-2466
- String mailTemplateName = eventName;
- if (Event.ASSIGN.equals(eventName)) {
- mailTemplateName = "task-notification";
- } else if (Event.REMIND.equals(eventName)) {
- mailTemplateName = "task-reminder";
- }
-
- // associate mail producer to event listener
- MailProducer mailProducer = parseMailProducer(element, parse, mailTemplateName);
- eventListener.setMailProducer(mailProducer);
- }
-
- public static MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
- // check whether the element is a generic object descriptor
- if (ObjectBinding.isObjectDescriptor(element)) {
- // TODO test custom mail producer
- ObjectDescriptor objectDescriptor = parseObjectDescriptor(element, parse);
- return (MailProducer) WireContext.create(objectDescriptor);
- }
-
- // parse the default producer
- MailProducerImpl mailProducer = new MailProducerImpl();
- mailProducer.setTemplate(parseMailTemplate(element, parse, defaultTemplateName));
- return mailProducer;
- }
-
- private static MailTemplate parseMailTemplate(Element element, Parse parse,
- String defaultTemplateName) {
- if (element.hasAttribute("template")) {
- // fetch template from configuration
- return findTemplate(element, parse, element.getAttribute("template"));
- }
- if (!XmlUtil.isTextOnly(element)) {
- // parse inline template
- return MailTemplateBinding.parseMailTemplate(element, parse);
- }
- if (defaultTemplateName != null) {
- // fetch default template
- return findTemplate(element, parse, defaultTemplateName);
- }
- parse.addProblem("mail template must be referenced in the 'template' attribute "
- + "or specified inline", element);
- return null;
- }
-
- private static MailTemplate findTemplate(Element element, Parse parse, String templateName) {
- MailTemplateRegistry templateRegistry = EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
- if (templateRegistry != null) {
- MailTemplate template = templateRegistry.getTemplate(templateName);
- if (template != null) return template;
- }
- parse.addProblem("mail template not found: " + templateName, element);
- return null;
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.w3c.dom.Element;
-
-public class UnresolvedTransition {
- TransitionImpl transition;
- Element transitionElement;
- public UnresolvedTransition(TransitionImpl transition, Element transitionElement) {
- this.transition = transition;
- this.transitionElement = transitionElement;
- }
- public void resolve(ProcessDefinitionImpl processDefinition, Parse parse) {
- String to = XmlUtil.attribute(transitionElement, "to", true, parse);
- if (to!=null) {
- ActivityImpl destination = (ActivityImpl) processDefinition.findActivity(to);
- if (destination!=null) {
- destination.addIncomingTransition(transition);
- } else {
- parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing activity name"), transitionElement);
- }
- }
- }
-}
\ No newline at end of file
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.w3c.dom.Element;
-
-public class UnresolvedTransitions {
- List<UnresolvedTransition> list = new ArrayList<UnresolvedTransition>();
- public void add(TransitionImpl transition, Element transitionElement) {
- list.add(new UnresolvedTransition(transition, transitionElement));
- }
-}
\ No newline at end of file
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,19 +0,0 @@
-<activities>
- <activity binding="org.jbpm.jpdl.internal.activity.StartBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.StateBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.DecisionBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.EndBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.EndCancelBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.EndErrorBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.ForkBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.JoinBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.MailBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.GroupBinding" />
- <activity binding="org.jbpm.jpdl.internal.activity.CustomBinding" />
-</activities>
Copied: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml (from rev 5660, jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml)
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,28 @@
+<bindings>
+
+ <activity binding="org.jbpm.jpdl.internal.activity.StartBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.StateBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.DecisionBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndCancelBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndErrorBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.ForkBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.JoinBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.MailBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.GroupBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.CustomBinding" />
+
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.EventListenerBinding" />
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
+ <eventlistener binding="org.jbpm.jpdl.internal.activity.MailBinding" />
+
+</bindings>
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.bindings.v40.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.eventlisteners.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.eventlisteners.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.eventlisteners.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,8 +0,0 @@
-<eventlisteners>
- <eventlistener binding="org.jbpm.jpdl.internal.activity.EventListenerBinding" />
- <eventlistener binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
- <eventlistener binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
- <eventlistener binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
- <eventlistener binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
- <eventlistener binding="org.jbpm.jpdl.internal.activity.MailBinding" />
-</eventlisteners>
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping default-access="field">
-
- <subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
- extends="org.jbpm.pvm.internal.model.ExecutionImpl"
- discriminator-value="jpdl">
-
- <map name="swimlanes"
- cascade="all-delete-orphan">
- <key foreign-key="FK_SWIMLANE_EXEC">
- <column name="EXECUTION_" index="IDX_SWIMLANE_EXEC"/>
- </key>
- <map-key type="string" column="NAME_" />
- <one-to-many class="org.jbpm.pvm.internal.task.SwimlaneImpl" />
- </map>
- </subclass>
-
-</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -22,7 +22,7 @@
package org.jbpm.jpdl;
import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.xml.Problem;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.pvm.internal.xml.Problem;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.pvm.internal.xml.Problem;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/branches/tbaeyens/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -26,7 +26,7 @@
import org.dom4j.Document;
import org.dom4j.Element;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.xml.Problem;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -75,6 +75,7 @@
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
/**
* @author Tom Baeyens
@@ -752,9 +753,10 @@
}
}
- AssignmentHandler assignmentHandler = assignableDefinition.getAssignmentHandler();
- if (assignmentHandler!=null) {
+ UserCodeReference assignmentHandlerReference = assignableDefinition.getAssignmentHandlerReference();
+ if (assignmentHandlerReference!=null) {
try {
+ AssignmentHandler assignmentHandler = (AssignmentHandler) assignmentHandlerReference.getObject(this);
assignmentHandler.assign(assignable, this);
} catch (Exception e) {
throw new JbpmException("assignment handler threw exception: " + e, e);
Copied: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java (from rev 5660, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionCondition implements Condition {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+ protected String expr;
+ protected String lang;
+
+ public ExpressionCondition(String name, String expr, String lang) {
+ this.name = name;
+ this.expr = expr;
+ this.lang = lang;
+ }
+
+ public boolean evaluate(OpenExecution execution) {
+ return (Boolean) evaluateExpression(execution);
+ }
+
+ public Object evaluateExpression(OpenExecution execution) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ return scriptManager.evaluateExpression(expr, lang);
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-/**
- * @author Tom Baeyens
- */
-public class ExpressionEvaluator implements Condition {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected String expr;
- protected String lang;
-
- public ExpressionEvaluator(String name, String expr, String lang) {
- this.name = name;
- this.expr = expr;
- this.lang = lang;
- }
-
- public boolean evaluate(OpenExecution execution) {
- return (Boolean) evaluateExpression(execution);
- }
-
- public Object evaluateExpression(OpenExecution execution) {
- ScriptManager scriptManager = ScriptManager.getScriptManager();
- return scriptManager.evaluateExpression(expr, lang);
- }
-
- public String getName() {
- return name;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -24,8 +24,7 @@
import java.util.List;
import org.jbpm.api.model.Event;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
/**
@@ -38,8 +37,7 @@
protected ActivityImpl source;
protected Integer sourceIndex;
protected ActivityImpl destination;
- protected Descriptor conditionDescriptor;
- protected Descriptor waitConditionDescriptor;
+ protected UserCodeReference conditionReference;
/* Use one of the ActivityImpl.createOutgoingTransition methods instead. */
TransitionImpl() {
@@ -101,9 +99,8 @@
return null;
}
+ // customized getters and setters ///////////////////////////////////////////
- // getters and setters //////////////////////////////////////////////////////
-
public void setName(String name) {
this.name = name;
if (source!=null) {
@@ -112,19 +109,16 @@
}
public Condition getCondition() {
- if (conditionDescriptor==null) {
+ if (conditionReference==null) {
return null;
}
- return (Condition) WireContext.create(conditionDescriptor);
+ return (Condition) conditionReference.getObject(processDefinition);
}
- public Condition getWaitCondition() {
- if (waitConditionDescriptor==null) {
- return null;
- }
- return (Condition) WireContext.create(waitConditionDescriptor);
- }
-
+ // getters and setters //////////////////////////////////////////////////////
+
+
+
public ActivityImpl getSource() {
return source;
}
@@ -137,26 +131,16 @@
public void setDestination(ActivityImpl destination) {
this.destination = destination;
}
- /** see <a href="#conditions">Conditions</a> */
- public Descriptor getConditionDescriptor() {
- return conditionDescriptor;
- }
- /** see <a href="#conditions">Conditions</a> */
- public void setConditionDescriptor(Descriptor conditionDescriptor) {
- this.conditionDescriptor = conditionDescriptor;
- }
- /** see <a href="#waitconditions">Wait conditions</a> */
- public Descriptor getWaitConditionDescriptor() {
- return waitConditionDescriptor;
- }
- /** see <a href="#waitconditions">Wait conditions</a> */
- public void setWaitConditionDescriptor(Descriptor waitConditionDescriptor) {
- this.waitConditionDescriptor = waitConditionDescriptor;
- }
public Integer getSourceIndex() {
return sourceIndex;
}
public void setSourceIndex(Integer sourceIndex) {
this.sourceIndex = sourceIndex;
}
+ public UserCodeReference getConditionReference() {
+ return conditionReference;
+ }
+ public void setConditionReference(UserCodeReference conditionReference) {
+ this.conditionReference = conditionReference;
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -22,8 +22,11 @@
package org.jbpm.pvm.internal.task;
import org.jbpm.api.task.AssignmentHandler;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
-import org.jbpm.pvm.internal.util.EqualsUtil;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
/**
* @author Tom Baeyens
@@ -41,20 +44,19 @@
protected String candidateUsersExpressionLanguage;
protected String candidateGroupsExpression;
protected String candidateGroupsExpressionLanguage;
- protected AssignmentHandler assignmentHandler;
+ protected UserCodeReference assignmentHandlerReference;
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
// getters and setters //////////////////////////////////////////////////////
public String getAssigneeExpression() {
return assigneeExpression;
}
+ public UserCodeReference getAssignmentHandlerReference() {
+ return assignmentHandlerReference;
+ }
+ public void setAssignmentHandlerReference(UserCodeReference assignmentHandlerReference) {
+ this.assignmentHandlerReference = assignmentHandlerReference;
+ }
public String getName() {
return name;
}
@@ -70,12 +72,6 @@
public void setAssigneeExpression(String assigneeExpression) {
this.assigneeExpression = assigneeExpression;
}
- public AssignmentHandler getAssignmentHandler() {
- return assignmentHandler;
- }
- public void setAssignmentHandler(AssignmentHandler assignmentHandler) {
- this.assignmentHandler = assignmentHandler;
- }
public String getAssigneeExpressionLanguage() {
return assigneeExpressionLanguage;
}
@@ -106,5 +102,4 @@
public void setCandidateGroupsExpressionLanguage(String candidateGroupsExpressionLanguage) {
this.candidateGroupsExpressionLanguage = candidateGroupsExpressionLanguage;
}
-
}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire;
+
+import java.io.Serializable;
+
+import org.jbpm.api.Execution;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean isCached;
+ protected Object cachedObject;
+ protected Descriptor descriptor;
+
+ public Object getObject(Execution execution) {
+ return getObject(null, execution);
+ }
+
+ public Object getObject(ProcessDefinitionImpl processDefinition) {
+ return getObject(processDefinition, null);
+ }
+
+ protected Object getObject(ProcessDefinitionImpl processDefinition, Execution execution) {
+ if (cachedObject!=null) {
+ return cachedObject;
+ }
+ if (descriptor!=null) {
+ if (processDefinition==null) {
+ processDefinition = getProcessDefinition(execution);
+ }
+
+ Object usedObject = ReflectUtil.instantiateUserCode(descriptor, processDefinition);
+ if (isCached) {
+ cachedObject = usedObject;
+ }
+ return usedObject;
+ }
+ return null;
+ }
+
+ protected ProcessDefinitionImpl getProcessDefinition(Execution execution) {
+ ProcessDefinitionImpl processDefinition = null;
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+ ActivityImpl activity = executionImpl.getActivity();
+ TransitionImpl transition = executionImpl.getTransition();
+ if (activity!=null) {
+ processDefinition = activity.getProcessDefinition();
+ }
+ if ( (processDefinition==null)
+ && (transition!=null)
+ ) {
+ processDefinition = transition.getProcessDefinition();
+ }
+ return processDefinition;
+ }
+
+ public void setCached(boolean isCached) {
+ this.isCached = isCached;
+ }
+ public void setDescriptor(Descriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -53,15 +53,14 @@
}
public static boolean isObjectDescriptor(Element element) {
- if (XmlUtil.attribute(element, "class")!=null) {
+ if ( (element.hasAttribute("class"))
+ || (element.hasAttribute("factory"))
+ || (element.hasAttribute("expr")) // for backwards compatibility
+ || (element.hasAttribute("object-expr"))
+ || (XmlUtil.element(element, "factory")!=null)
+ ) {
return true;
}
- if (XmlUtil.attribute(element, "factory")!=null) {
- return true;
- }
- if (XmlUtil.element(element, "factory")!=null) {
- return true;
- }
return false;
}
@@ -70,7 +69,17 @@
Parser wireParser = (Parser) parser;
String className = XmlUtil.attribute(element, "class");
- String expr = XmlUtil.attribute(element, "expr");
+ String objectExpr = XmlUtil.attribute(element, "object-expr");
+ String objectExprLang = XmlUtil.attribute(element, "object-expr-lang");
+
+ // for backwards compatibility
+ if ( (objectExpr==null)
+ && (element.hasAttribute("expr"))
+ ) {
+ objectExpr = element.getAttribute("expr");
+ objectExprLang = XmlUtil.attribute(element, "lang");
+ }
+
String factoryObjectName = XmlUtil.attribute(element, "factory");
Element factoryElement = XmlUtil.element(element, "factory");
@@ -105,11 +114,10 @@
Descriptor factoryDescriptor = (Descriptor) parser.parseElement(factoryDescriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
descriptor.setFactoryDescriptor(factoryDescriptor);
- } else if (expr!=null) {
- descriptor.setExpr(expr);
- String lang = XmlUtil.attribute(element, "lang");
- descriptor.setLang(lang);
-
+ } else if (objectExpr!=null) {
+ descriptor.setObjectExpr(objectExpr);
+ descriptor.setObjectExprLang(objectExprLang);
+
} else {
parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element), element);
}
Copied: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionConditionDescriptor.java (from rev 5660, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java)
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionConditionDescriptor.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionConditionDescriptor.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.descriptor;
+
+import org.jbpm.pvm.internal.model.ExpressionCondition;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionConditionDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expr;
+ protected String lang;
+
+ public ExpressionConditionDescriptor() {
+ }
+
+ public ExpressionConditionDescriptor(String expr, String lang) {
+ this.expr = expr;
+ this.lang = lang;
+ }
+
+ public Object construct(WireContext wireContext) {
+ return new ExpressionCondition(getName(), expr, lang);
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionConditionDescriptor.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.descriptor;
-
-import org.jbpm.pvm.internal.model.ExpressionEvaluator;
-import org.jbpm.pvm.internal.wire.WireContext;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExpressionEvaluatorDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- protected String expr;
- protected String lang;
-
- public ExpressionEvaluatorDescriptor() {
- }
-
- public ExpressionEvaluatorDescriptor(String expr, String lang) {
- this.expr = expr;
- this.lang = lang;
- }
-
- public Object construct(WireContext wireContext) {
- return new ExpressionEvaluator(getName(), expr, lang);
- }
-
-}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -89,17 +89,13 @@
protected String className = null;
/** specifies the object reference on which the method will be invoked.
- * Either className, objectName or a descriptor has to be specified.
- *
- * TODO check if this member can be replaced by a RefDescriptor in the factoryDescriptor member.
- *
- * */
+ * Either className, objectName or a descriptor has to be specified. */
+ // TODO check if this member can be replaced by a RefDescriptor in the factoryDescriptor member.
String factoryObjectName = null;
- protected String expr;
+ protected String objectExpr;
+ protected String objectExprLang;
- protected String lang;
-
/** specifies the object on which to invoke the method.
* Either className, objectName or a descriptor has to be specified. */
protected Descriptor factoryDescriptor = null;
@@ -175,9 +171,9 @@
if (object==null) {
throw new WireException("created factory object is null, can't invoke method '"+methodName+"' on it");
}
- } else if (expr!=null) {
+ } else if (objectExpr!=null) {
ScriptManager scriptManager = ScriptManager.getScriptManager();
- object = scriptManager.evaluateExpression(expr, lang);
+ object = scriptManager.evaluateExpression(objectExpr, objectExprLang);
}
if (methodName!=null) {
@@ -442,16 +438,16 @@
public void setAutoWireEnabled(boolean isAutoWireEnabled) {
this.isAutoWireEnabled = isAutoWireEnabled;
}
- public String getExpr() {
- return expr;
+ public String getObjectExpr() {
+ return objectExpr;
}
- public void setExpr(String expr) {
- this.expr = expr;
+ public void setObjectExpr(String objectExpr) {
+ this.objectExpr = objectExpr;
}
- public String getLang() {
- return lang;
+ public String getObjectExprLang() {
+ return objectExprLang;
}
- public void setLang(String lang) {
- this.lang = lang;
+ public void setObjectExprLang(String objectExprLang) {
+ this.objectExprLang = objectExprLang;
}
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -22,7 +22,7 @@
package org.jbpm.test.process;
import org.jbpm.api.ProcessDefinition;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.test.JbpmTestCase;
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java 2009-10-01 16:13:41 UTC (rev 5676)
@@ -26,7 +26,7 @@
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.api.task.Task;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.jpdl.internal.parser.JpdlParser;
import org.jbpm.test.JbpmTestCase;
/**
Modified: jbpm4/branches/tbaeyens/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -2898,98 +2898,117 @@
<listitem><literal>java</literal></listitem>
<listitem><literal>assignment-handler</literal> in task</listitem>
<listitem><literal>handler</literal> in decision</listitem>
+ <listitem><literal>condition</literal> in transition</listitem>
</itemizedlist>
- <para>For all objects that are referenced by a class name, will be
- instantiated during parsing time. Which implies that the objects aren't
- allowed to store non-stateless data (ie which can change).
- This is typically OK since those objects are in practice almost always immutable.
- If you do need to use 'dynamic' data in your user code, you can always
- fall back to process variables (or Environment.get(xxx) calls).
- </para>
- <para>Objects that are referenced by an expression are calculated
- dynamically.
- </para>
- <table><title>attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>class</literal></entry>
- <entry>classname</entry>
- <entry></entry>
- <entry>one of {class|expr} is required</entry>
- <entry>The fully qualified classname.</entry>
- </row>
- <row>
- <entry><literal>expr</literal></entry>
- <entry>expression</entry>
- <entry></entry>
- <entry>one of {class|expr} is required</entry>
- <entry>Expression for which the resulting value will be taken as the target object.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title>sub elements:</title>
- <tgroup cols="3" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Element</entry>
- <entry>Multiplicity</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>field</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to be injected directly in
- a memberfield before this user class is used.</entry>
- </row>
- <row>
- <entry><literal>property</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to injected through a setter
- method before this user object is used.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title><literal>field</literal> attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>name</literal></entry>
- <entry>string</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>the name of the field</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>Inside <literal>field</literal> or <literal>property</literal> injections,
- a lot of different value types can be specified, like <literal>string</literal>,
- <literal>object</literal>, <literal>map</literal>, <literal>list</literal>
- <literal>ref</literal> and so on. See jpdl schema docs for more options
- </para>
+ <section id="usercodeconfiguration">
+ <title>User code configuration</title>
+ <table><title>attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>class</literal></entry>
+ <entry>classname</entry>
+ <entry></entry>
+ <entry>one of {class|expr} is required</entry>
+ <entry>The fully qualified classname.</entry>
+ </row>
+ <row>
+ <entry><literal>expr</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>one of {class|expr} is required</entry>
+ <entry>Expression for which the resulting value will be taken as the target object.</entry>
+ </row>
+ <row>
+ <entry>cache</entry>
+ <entry>{enabled | disabled | true | false | on | off}</entry>
+ <entry>true</entry>
+ <entry>optional</entry>
+ <entry>Indicates if the instantiated object can be cached. For expressions,
+ the cache property will automatically be set to false.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>sub elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>field</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to be injected directly in
+ a memberfield before this user class is used.</entry>
+ </row>
+ <row>
+ <entry><literal>property</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to injected through a setter
+ method before this user object is used.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>field</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>name</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the name of the field</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Inside <literal>field</literal> or <literal>property</literal> injections,
+ a lot of different value types can be specified, like <literal>string</literal>,
+ <literal>object</literal>, <literal>map</literal>, <literal>list</literal>
+ <literal>ref</literal> and so on. See jpdl schema docs for more options
+ </para>
+ </section>
+ <section id="usercodeclassloading">
+ <title>User code classloading</title>
+ <para>Process definitions are cached. By default, all user code objects are
+ cached as part of those process definitions.
+
+ For all objects that are referenced by a class name, will be
+ instantiated during parsing time. Which implies that the objects aren't
+ allowed to store non-stateless data (ie which can change).
+ This is typically OK since those objects are in practice almost always immutable.
+ If you do need to use 'dynamic' data in your user code, you can always
+ fall back to process variables (or Environment.get(xxx) calls).
+ </para>
+ <para>Objects that are referenced by an expression are calculated
+ dynamically.
+ </para>
+ </section>
</section>
</chapter>
Modified: jbpm4/branches/tbaeyens/qa/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/qa/build.xml 2009-10-01 15:58:47 UTC (rev 5675)
+++ jbpm4/branches/tbaeyens/qa/build.xml 2009-10-01 16:13:41 UTC (rev 5676)
@@ -75,9 +75,10 @@
</copy>
<!-- add examples.jar -->
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <copy file="${jbpm.home}/examples/target/examples.jar" todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
-
+ <!-- make examples usercode classes available in the test webapp -->
+ <property name="usercode.webapp.lib.dir" value="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
+ <antcall target="internal.add.usercode.to.test.webapp" />
+
<!-- add junit.jar -->
<copy file="${jbpm.home}/lib/junit.jar" todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
@@ -108,11 +109,6 @@
<ant antfile="${jbpm.home}/install/build.xml" target="internal.install.and.start.hsqldb.if.needed" />
<ant antfile="${jbpm.home}/install/build.xml" target="create.jbpm.schema" />
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
- <copy file="${jbpm.home}/examples/target/examples.jar"
- todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
-
<!-- to build the jbpm test webapp we start by copying the user webapp -->
<mkdir dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war" />
<copy todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war">
@@ -133,10 +129,10 @@
<delete dir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/classes" />
<delete file="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib/jta.jar" />
- <!-- add examples.jar -->
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <copy file="${jbpm.home}/examples/target/examples.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
-
+ <!-- make examples usercode classes available in the test webapp -->
+ <property name="usercode.webapp.lib.dir" value="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
+ <antcall target="internal.add.usercode.to.test.webapp" />
+
<!-- add junit.jar -->
<copy file="${jbpm.home}/lib/junit.jar" todir="${jboss.home}/server/default/deploy/jbpm-test-webapp.war/WEB-INF/lib" />
@@ -183,36 +179,23 @@
todir="${jbpm.home}/lib"/>
</target>
- <!-- ############################ -->
- <!-- ### OLD IDENTITY TARGETS ### -->
- <!-- ############################
-
- <target name="internal.install.idm.into.jboss.integrationtestspecifics" if="jbpm.identity.idm">
- <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
- <fileset dir="jbpm.cfg.jboss.testsuite/jboss.idm" />
- </copy>
+ <target name="internal.add.usercode.to.test.webapp">
+ <path id="examples.compile.classpath">
+ <fileset dir="${jbpm.home}">
+ <include name="jbpm.jar" />
+ </fileset>
+ <fileset dir="${jbpm.home}/lib" />
+ </path>
+ <mkdir dir="${jbpm.home}/examples/target/classes" />
+ <javac srcdir="${jbpm.home}/examples/src"
+ destdir="${jbpm.home}/examples/target/classes"
+ classpathref="examples.compile.classpath" />
+ <jar destfile="${usercode.webapp.lib.dir}/examples-usercode.jar">
+ <fileset dir="${jbpm.home}/examples/target/classes">
+ <!-- PrintDots is included in the test in the business archive to test user classloading from the business archive -->
+ <exclude name="org/jbpm/examples/custom/PrintDots.class" />
+ </fileset>
+ </jar>
</target>
- <condition property="identity.component.idm">
- <equals arg1="${identity.component}" arg2="jboss.idm"/>
- </condition>
-
- <target name="copy.jbossidm.jdbc.configuration" if="identity.component.idm">
- <copy file="../modules/distro/target/libs/ojdbc14.jar"
- todir="${jbossidm.home}/lib" />
- <copy file="jdbc/${database}.properties"
- todir="${jbossidm.home}/db/jdbc"
- overwrite="true"
- failonerror="false" />
- </target>
-
- <target name="drop.jbossidm.schema" if="identity.component.idm">
- <ant antfile="${jbossidm.home}/db/build.xml" target="drop.jbossidm.schema" />
- </target>
-
- <target name="create.jbossidm.schema" if="identity.component.idm">
- <ant antfile="${jbossidm.home}/db/build.xml" target="create.jbossidm.schema" />
- </target>
- -->
-
</project>
More information about the jbpm-commits
mailing list