JBoss JBPM SVN: r2285 - jbpm3/branches/jbpm-3.3.0.CR1.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-19 06:18:23 -0400 (Fri, 19 Sep 2008)
New Revision: 2285
Modified:
jbpm3/branches/jbpm-3.3.0.CR1/profiles.xml.example
Log:
update version to 3.3.0.CR1
Modified: jbpm3/branches/jbpm-3.3.0.CR1/profiles.xml.example
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/profiles.xml.example 2008-09-19 09:39:19 UTC (rev 2284)
+++ jbpm3/branches/jbpm-3.3.0.CR1/profiles.xml.example 2008-09-19 10:18:23 UTC (rev 2285)
@@ -13,7 +13,7 @@
<properties>
<jboss422.home>/home/tdiesler/svn/jbossas/tags/JBoss_4_2_2_GA/build/output/jboss-4.2.2.GA</jboss422.home>
<jboss423.home>/home/tdiesler/svn/jbossas/tags/JBoss_4_2_3_GA/build/output/jboss-4.2.3.GA</jboss423.home>
- <jboss500.home>/home/tdiesler/svn/jbossas/tags/JBoss_5_0_0_CR1/build/output/jboss-5.0.0.CR1</jboss500.home>
+ <jboss500.home>/home/tdiesler/svn/jbossas/tags/JBoss_5_0_0_CR2/build/output/jboss-5.0.0.CR2</jboss500.home>
</properties>
</profile>
17 years, 7 months
JBoss JBPM SVN: r2284 - in jbpm3/branches/jbpm-3.3.0.CR1: hudson and 18 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-19 05:39:19 -0400 (Fri, 19 Sep 2008)
New Revision: 2284
Modified:
jbpm3/branches/jbpm-3.3.0.CR1/hudson/ant.properties.example
jbpm3/branches/jbpm-3.3.0.CR1/hudson/build.xml
jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/command.sh
jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/config.xml
jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM-Matrix/config.xml
jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.5/config.xml
jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.6/config.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/console/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/core/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/core/src/main/resources/hibernate.properties.sybase.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/db/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/distribution/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/ear/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/jar/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/examples/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/identity/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/integration/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/jbpm4jsf/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/simulation/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/modules/userguide/pom.xml
jbpm3/branches/jbpm-3.3.0.CR1/pom.xml
Log:
update version to 3.3.0.CR1
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/ant.properties.example
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/ant.properties.example 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/ant.properties.example 2008-09-19 09:39:19 UTC (rev 2284)
@@ -25,13 +25,13 @@
hudson.admin.port=8150
hudson.http.port=8180
-hudson.jboss422.zip=/home/tdiesler/Download/Java/jboss/jboss-4.2.2.GA.zip
-hudson.jboss423.zip=/home/tdiesler/Download/Java/jboss/jboss-4.2.3.GA.zip
-hudson.jboss500.zip=/home/tdiesler/Download/Java/jboss/jboss-5.0.0.CR1.zip
+hudson.jboss422.zip=file:///home/tdiesler/Download/Java/jboss/jboss-4.2.2.GA.zip
+hudson.jboss423.zip=file:///home/tdiesler/Download/Java/jboss/jboss-4.2.3.GA.zip
+hudson.jboss500.zip=file:///home/tdiesler/Download/Java/jboss/jboss-5.0.0.CR2.zip
hudson.mail.recipients=
hudson.smtp.host=localhost
-# Hudson (1.251)
+# Hudson (1.252)
apache-tomcat=5.5.20
-sun-hudson=2402/108356
+sun-hudson=2402/109746
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/build.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/build.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/build.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -21,7 +21,6 @@
<!-- ================================================================== -->
<target name="init">
-
<!-- Check if ant.properties is available -->
<available property="ant.properties.available" file="${basedir}/ant.properties"/>
<fail message="Cannot find ant.properties. Did you copy/edit ant.properties.example?" unless="ant.properties.available"/>
@@ -37,7 +36,6 @@
</target>
<target name="init-hudson" depends="init">
-
<property name="hudson.base" value="${hudson.root}/jbpm-hudson-${version.id}"/>
<property name="hudson.tomcat" value="${hudson.base}/apache-tomcat"/>
<property name="hudson.home" value="${hudson.base}/hudson-home"/>
@@ -56,19 +54,49 @@
<fail message="Cannot use default hudson username: ${hudson.username}" if="hudson.username.changeme"/>
<property name="hudson.password.${hudson.password}" value="true"/>
<fail message="Cannot use default hudson password: ${hudson.password}" if="hudson.password.changeme"/>
-
+ </target>
+
+ <target name="init-thirdparty" depends="init-hudson">
<property name="thirdparty.dir" value="${hudson.target.dir}/thirdparty"/>
<mkdir dir="${thirdparty.dir}"/>
-
+ <available property="apache.tomcat.available" file="${thirdparty.dir}/apache-tomcat.zip"/>
+ <available property="sun.hudson.available" file="${thirdparty.dir}/hudson.war"/>
+ <available property="jboss422.available" file="${thirdparty.dir}/jboss-4.2.2.GA.zip"/>
+ <available property="jboss423.available" file="${thirdparty.dir}/jboss-4.2.3.GA.zip"/>
+ <available property="jboss500.available" file="${thirdparty.dir}/jboss-5.0.0.CR2.zip"/>
</target>
<!--
- Setup the Hudson Tomcat instance
+ Get thirdparty dependencies
-->
- <target name="hudson-tomcat-setup" depends="init-hudson" unless="hudson.tomcat.available">
-
+ <target name="thirdparty" depends="init-thirdparty,get-tomcat,get-hudson,get-jboss422,get-jboss423,get-jboss500">
+ </target>
+ <target name="get-tomcat" depends="init-thirdparty" unless="apache.tomcat.available">
<get src="${jboss.repository}/apache-tomcat/${apache-tomcat}/lib/apache-tomcat.zip" dest="${thirdparty.dir}/apache-tomcat.zip" usetimestamp="true" verbose="true"/>
+ </target>
+ <target name="get-hudson" depends="init-thirdparty" unless="sun.hudson.available">
<get src="https://hudson.dev.java.net/files/documents/${sun-hudson}/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="true" verbose="true"/>
+ </target>
+ <target name="get-jboss422" depends="init-thirdparty" unless="jboss422.available">
+ <property name="hudson.jboss422.zip" value="http://downloads.sourceforge.net/jboss/jboss-4.2.2.GA.zip"/>
+ <get src="${hudson.jboss422.zip}" dest="${thirdparty.dir}/jboss-4.2.2.GA.zip" usetimestamp="true" verbose="true"/>
+ <copy todir="${hudson.base}/jboss" file="${thirdparty.dir}/jboss-4.2.2.GA.zip" overwrite="true"/>
+ </target>
+ <target name="get-jboss423" depends="init-thirdparty" unless="jboss423.available">
+ <property name="hudson.jboss423.zip" value="http://downloads.sourceforge.net/jboss/jboss-4.2.3.GA.zip"/>
+ <get src="${hudson.jboss423.zip}" dest="${thirdparty.dir}/jboss-4.2.3.GA.zip" usetimestamp="true" verbose="true"/>
+ <copy todir="${hudson.base}/jboss" file="${thirdparty.dir}/jboss-4.2.3.GA.zip" overwrite="true"/>
+ </target>
+ <target name="get-jboss500" depends="init-thirdparty" unless="jboss500.available">
+ <property name="hudson.jboss500.zip" value="http://downloads.sourceforge.net/jboss/jboss-5.0.0.CR2.zip"/>
+ <get src="${hudson.jboss500.zip}" dest="${thirdparty.dir}/jboss-5.0.0.CR2.zip" usetimestamp="true" verbose="true"/>
+ <copy todir="${hudson.base}/jboss" file="${thirdparty.dir}/jboss-5.0.0.CR2.zip" overwrite="true"/>
+ </target>
+
+ <!--
+ Setup the Hudson Tomcat instance
+ -->
+ <target name="hudson-tomcat-setup" depends="thirdparty" unless="hudson.tomcat.available">
<!-- Install Tomcat -->
<mkdir dir="${hudson.root}"/>
@@ -80,37 +108,16 @@
</fileset>
</chmod>
- <!-- Configure Tomcat -->
+ <!-- Install Hudson -->
<copy todir="${hudson.tomcat}/webapps" file="${thirdparty.dir}/hudson.war"/>
- <copy todir="${hudson.tomcat}" overwrite="true">
- <fileset dir="${hudson.dir}/apache-tomcat">
- <include name="**/*.xml"/>
- </fileset>
- <filterset>
- <filtersfile file="${hudson.dir}/ant.properties"/>
- <filter token="hudson.home" value="${hudson.home}"/>
- </filterset>
- </copy>
- <!-- Get/Copy Target Container -->
- <get src="http://downloads.sourceforge.net/jboss/jboss-4.2.2.GA.zip" dest="${thirdparty.dir}/jboss-4.2.2.GA.zip" usetimestamp="true" verbose="true"/>
- <get src="http://downloads.sourceforge.net/jboss/jboss-4.2.3.GA.zip" dest="${thirdparty.dir}/jboss-4.2.3.GA.zip" usetimestamp="true" verbose="true"/>
- <get src="http://downloads.sourceforge.net/jboss/jboss-5.0.0.CR1.zip" dest="${thirdparty.dir}/jboss-5.0.0.CR1.zip" usetimestamp="true" verbose="true"/>
- <copy todir="${hudson.base}/jboss" overwrite="true">
- <fileset dir="${thirdparty.dir}">
- <include name="jboss-*.zip"/>
- </fileset>
- </copy>
-
</target>
<!--
Update the Hudson version
-->
<target name="hudson-update" depends="init-hudson">
-
<get src="${jboss.repository}/sun-hudson/${sun-hudson}/lib/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="false" verbose="true"/>
-
<delete dir="${hudson.tomcat}/webapps/hudson"/>
<copy todir="${hudson.tomcat}/webapps" file="${thirdparty.dir}/hudson.war"/>
</target>
@@ -118,8 +125,7 @@
<!--
Setup the Hudson QA environment
-->
- <target name="hudson-setup" depends="init-hudson,hudson-tomcat-setup"
- description="Setup the Hudson QA environment">
+ <target name="hudson-setup" depends="init-hudson,hudson-tomcat-setup" description="Setup the Hudson QA environment">
<!-- get the svn url -->
<exec dir="${hudson.dir}/.." executable="svn" failonerror="true" output="${hudson.target.dir}/svn-info.xml">
@@ -129,6 +135,17 @@
<xmlproperty file="${hudson.target.dir}/svn-info.xml"/>
<property name="hudson.jbpm.url" value="${info.entry.url}"/>
+ <!-- Configure Tomcat -->
+ <copy todir="${hudson.tomcat}" overwrite="true">
+ <fileset dir="${hudson.dir}/apache-tomcat">
+ <include name="**/*.xml"/>
+ </fileset>
+ <filterset>
+ <filtersfile file="${hudson.dir}/ant.properties"/>
+ <filter token="hudson.home" value="${hudson.home}"/>
+ </filterset>
+ </copy>
+
<!-- Configure Hudson -->
<copy todir="${hudson.home}" overwrite="true">
<fileset dir="${hudson.dir}/hudson-home">
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/command.sh 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/command.sh 2008-09-19 09:39:19 UTC (rev 2284)
@@ -19,7 +19,7 @@
;;
jboss500*)
- JBOSS_BUILD=jboss-5.0.0.CR1
+ JBOSS_BUILD=jboss-5.0.0.CR2
;;
esac
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/config.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/config.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -5,6 +5,11 @@
<systemMessage>
<![CDATA[
<h2>jBPM-(a)version.id@ QA Environment</h2>
+
+ <table>
+ <tr align="left"><th>SVN</th><td>@hudson.jbpm.url@</td></tr>
+ <tr align="left"><th>Bind Addr</th><td>@jboss.bind.address@</td></tr>
+ </table>
]]>
</systemMessage>
<jdks>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM-Matrix/config.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM-Matrix/config.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -13,7 +13,7 @@
<scm class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
- <remote>https://svn.jboss.org/repos/jbpm/jbpm3/trunk</remote>
+ <remote>@hudson.jbpm.url@</remote>
<local>jbpm</local>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.5/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.5/config.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.5/config.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -27,7 +27,7 @@
<scm class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
- <remote>https://svn.jboss.org/repos/jbpm/jbpm3/trunk</remote>
+ <remote>@hudson.jbpm.url@</remote>
<local>jbpm</local>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.6/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.6/config.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/hudson/hudson-home/jobs/jBPM3-JDK1.6/config.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -27,7 +27,7 @@
<scm class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
- <remote>https://svn.jboss.org/repos/jbpm/jbpm3/trunk</remote>
+ <remote>@hudson.jbpm.url@</remote>
<local>jbpm</local>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/console/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/console/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/console/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/core/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/core/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -198,6 +198,8 @@
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
<exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
+ <exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -237,6 +239,8 @@
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
<exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
+ <exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -276,6 +280,8 @@
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
<exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
+ <exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -315,6 +321,8 @@
<exclude>org/jbpm/perf/StateUpdateTest.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1724 -->
<exclude>org/jbpm/seam/SeamPageFlowTest.java</exclude>
+ <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
+ <exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude>
<!-- https://jira.jboss.org/jira/browse/JBPM-1718 -->
<exclude>org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java</exclude>
<exclude>org/jbpm/job/executor/JobExecutorDbTest.java</exclude>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/core/src/main/resources/hibernate.properties.sybase.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/core/src/main/resources/hibernate.properties.sybase.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/core/src/main/resources/hibernate.properties.sybase.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -1,3 +1,10 @@
+ <!--
+ Out-of-the-box compatibility with Sybase
+ https://jira.jboss.org/jira/browse/JBPM-700
+
+ System Service QA Database Sybase
+ https://wiki.corp.jboss.com/bin/view/IT/SystemServiceQaDatabaseSybase
+ -->
<!-- hibernate dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
@@ -8,4 +15,4 @@
<property name="hibernate.connection.username">jbpmteam</property>
<property name="hibernate.connection.password">jbpmteam</property>
<!-- JDBC connection properties (end) -->
-
\ No newline at end of file
+
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/db/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/db/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/db/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/distribution/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/distribution/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/ear/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/ear/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/ear/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-enterprise</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
</parent>
<!-- Dependencies -->
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/jar/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/jar/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/jar/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-enterprise</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
</parent>
<!-- Dependencies -->
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/enterprise/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/examples/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/examples/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/identity/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/identity/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/identity/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/integration/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/integration/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/integration/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/jbpm4jsf/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/jbpm4jsf/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/jbpm4jsf/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/simulation/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/simulation/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/simulation/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -21,7 +21,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/modules/userguide/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/modules/userguide/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/modules/userguide/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Modified: jbpm3/branches/jbpm-3.3.0.CR1/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.3.0.CR1/pom.xml 2008-09-19 08:18:15 UTC (rev 2283)
+++ jbpm3/branches/jbpm-3.3.0.CR1/pom.xml 2008-09-19 09:39:19 UTC (rev 2284)
@@ -17,7 +17,7 @@
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
<packaging>pom</packaging>
- <version>3.3.0-SNAPSHOT</version>
+ <version>3.3.0.CR1</version>
<!-- Parent -->
<parent>
17 years, 7 months
JBoss JBPM SVN: r2283 - jbpm3/branches.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-19 04:18:15 -0400 (Fri, 19 Sep 2008)
New Revision: 2283
Added:
jbpm3/branches/jbpm-3.3.0.CR1/
Log:
Create jbpm-3.3.0.CR1 QA branch
Copied: jbpm3/branches/jbpm-3.3.0.CR1 (from rev 2282, jbpm3/trunk)
17 years, 7 months
JBoss JBPM SVN: r2282 - in jbpm4/pvm/trunk: modules/core/src/main/java/org/jbpm/pvm/internal/model and 7 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-18 15:11:04 -0400 (Thu, 18 Sep 2008)
New Revision: 2282
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/EventListenerTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/PrintLn.java
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.anatomy.classes.png
Modified:
jbpm4/pvm/trunk/assembly.xml
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Event.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java
jbpm4/pvm/trunk/modules/manual/src/main/diagrams/diagrams.mdzip
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
Log:
docs
Modified: jbpm4/pvm/trunk/assembly.xml
===================================================================
--- jbpm4/pvm/trunk/assembly.xml 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/assembly.xml 2008-09-18 19:11:04 UTC (rev 2282)
@@ -6,6 +6,7 @@
<format>tar.gz</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>jbpm-pvm-${version}</baseDirectory>
<moduleSets>
<moduleSet>
<includes>
@@ -54,7 +55,7 @@
<fileSet>
<directory>modules/core/src/test/java</directory>
<includes>
- <include>org/jbpm/pvm/samples/**/*.*</include>
+ <include>org/jbpm/pvm/example*/**/*.*</include>
</includes>
<outputDirectory>examples</outputDirectory>
</fileSet>
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2008-09-18 19:11:04 UTC (rev 2282)
@@ -66,6 +66,10 @@
addEvent(event);
return event;
}
+
+ public EventImpl getEvent() {
+ return getEvent(Event.TRANSITION_TAKE);
+ }
// get parent ///////////////////////////////////////////////////////////////
@@ -134,9 +138,6 @@
return (Condition) WireContext.create(waitConditionDescriptor);
}
- public EventImpl getEvent() {
- return getEvent(Event.TRANSITION_TAKE);
- }
public NodeImpl getSource() {
return source;
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Event.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Event.java 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Event.java 2008-09-18 19:11:04 UTC (rev 2282)
@@ -24,14 +24,26 @@
/** event constants.
*
+ * <b>WARNING: these event names will be subject to change in the next release.
+ * See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ *
* @author Tom Baeyens
*/
public interface Event {
+ /** <b>WARNING: this event name will be subject to change in the next release. See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ * @deprecated */
String TRANSITION_TAKE = "transition-take";
+ /** <b>WARNING: this event name will be subject to change in the next release. See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ * @deprecated */
String PROCESS_BEGIN = "process-begin";
+ /** <b>WARNING: this event name will be subject to change in the next release. See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ * @deprecated */
String PROCESS_END = "process-end";
+ /** <b>WARNING: this event name will be subject to change in the next release. See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ * @deprecated */
String NODE_BEGIN = "node-begin";
+ /** <b>WARNING: this event name will be subject to change in the next release. See <a href="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</a></b>
+ * @deprecated */
String NODE_END = "node-end";
-
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java 2008-09-18 19:11:04 UTC (rev 2282)
@@ -8,7 +8,7 @@
* so that those can be asserted */
public class TestConsole extends PrintStream {
- List<String> lines = new ArrayList<String>();
+ public List<String> lines = new ArrayList<String>();
public TestConsole() {
super(System.out);
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/EventListenerTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/EventListenerTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/EventListenerTest.java 2008-09-18 19:11:04 UTC (rev 2282)
@@ -0,0 +1,49 @@
+package org.jbpm.pvm.example07;
+
+import javax.enterprise.deploy.spi.exceptions.ClientExecuteException;
+
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.example01.AutomaticActivity;
+import org.jbpm.pvm.example01.WaitState;
+import org.jbpm.pvm.example04.Display;
+import org.jbpm.pvm.example04.TestConsole;
+import org.jbpm.pvm.model.Event;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+public class EventListenerTest extends JbpmTestCase {
+
+ TestConsole testConsole;
+
+ public void setUp() {
+ testConsole = TestConsole.install();
+ }
+
+ public void tearDown() {
+ TestConsole.uninstall();
+ testConsole = null;
+ }
+
+ public void testEventListener() {
+ ClientProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new AutomaticActivity())
+ .event(Event.NODE_END)
+ .listener(new PrintLn("leaving a"))
+ .listener(new PrintLn("second message while leaving a"))
+ .transition().to("b")
+ .listener(new PrintLn("taking transition"))
+ .node("b").behaviour(new WaitState())
+ .event(Event.NODE_BEGIN)
+ .listener(new PrintLn("entering b"))
+ .done();
+
+ ClientExecution execution = processDefinition.startProcessInstance();
+
+ assertEquals("leaving a", testConsole.getLine(0));
+ assertEquals("second message while leaving a", testConsole.getLine(1));
+ assertEquals("taking transition", testConsole.getLine(2));
+ assertEquals("entering b", testConsole.getLine(3));
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/PrintLn.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/PrintLn.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example07/PrintLn.java 2008-09-18 19:11:04 UTC (rev 2282)
@@ -0,0 +1,20 @@
+package org.jbpm.pvm.example07;
+
+import org.jbpm.pvm.listener.EventListener;
+import org.jbpm.pvm.listener.EventListenerExecution;
+
+
+public class PrintLn implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ String message;
+
+ public PrintLn(String message) {
+ this.message = message;
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ System.out.println(message);
+ }
+}
Modified: jbpm4/pvm/trunk/modules/manual/src/main/diagrams/diagrams.mdzip
===================================================================
(Binary files differ)
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.anatomy.classes.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.anatomy.classes.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml 2008-09-18 19:11:04 UTC (rev 2282)
@@ -288,29 +288,21 @@
</figure>
</section>
- <!-- ### MOTIVATION ##################################################### -->
- <section id="motivation">
- <title>Motivation</title>
- <para>There are basically two forms of process languages: graph based and composite
- process languages. First of all, this design supports both. Even graph based execution
- and node composition can be used in combination to implement something like UML super states.
- </para>
- <para>In this design, control flow activity implementations will have to be
- aware of whether they are dependent on transitions (graph based) or whether they are
- using the composite node structure. The goal of this design is that all non-control
- flow activities can be implemented in the same way so that you can use them in graph
- based process languages as well as in composite process languages.
- </para>
- </section>
-
<!-- ### EVENTS ######################################################### -->
<section id="events">
<title>Events</title>
<para>Events are points in the process definition to which a list of
- activities can be subscribed as listeners. The motivation for events is to allow for
+ <literal>EventListener</literal>s can be subscribed.
+ </para>
+ <programlisting>public interface EventListener extends Serializable {
+
+ void notify(EventListenerExecution execution) throws Exception;
+
+}</programlisting>
+ <para>The motivation for events is to allow for
developers to add programming logic to a process without changing the process diagram.
- This is a very valuable instrument in
- facilitating the collaboration between business analysts and developers. Business analysts
+ This is a very valuable instrument in facilitating the collaboration between business analysts
+ and developers. Business analysts
are responsible for expressing the requirements. When they use a process graph to document
those requirements, developers can take this diagram and make it executable. Events can
be a very handy to insert technical details into a process (like e.g. some database insert)
@@ -318,24 +310,28 @@
</para>
<para>Most common events are fired by the execution automatically:
</para>
+ <para><emphasis role="bold">WARNING: the following event names will be
+ subject to change in the next release: see
+ <ulink url="https://jira.jboss.org/jira/browse/JBPM-1753">JBPM-1753</ulink></emphasis>
+ </para>
<itemizedlist>
- <listitem><literal>Transition.EVENT_TRANSITION_TAKE = "transition-take"</literal> :
+ <listitem><literal><emphasis role="bold">Event.TRANSITION_TAKE</emphasis> = "transition-take"</literal> :
fired on transitions when transitions are taken.
</listitem>
- <listitem><literal>Node.EVENT_NODE_ENTER = "node-enter"</literal> : fired on the node
+ <listitem><literal><emphasis role="bold">Event.NODE_BEGIN</emphasis> = "node-begin"</literal> : fired on the node
when execution enters that node. This happens when execution takes a transition
to that node, when a child node is being executed with <literal>execution.execute(Node)</literal>
or when a transition is taken from a node outside that node to a contained node.
The latter refers to super states in state machines.
</listitem>
- <listitem><literal>Node.EVENT_NODE_LEAVE = "node-leave"</literal> : fired on the node
+ <listitem><literal><emphasis role="bold">Event.NODE_END</emphasis> = "node-end"</literal> : fired on the node
when a transition is taken out of that node or when a child node execution is
finished and the execution is propagated to the parent node.
</listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_START = "process-start"</literal> : fired on a process
+ <listitem><literal><emphasis role="bold">Event.PROCESS_BEGIN</emphasis> = "process-begin"</literal> : fired on a process
when a new process is started.
</listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_END = "process-end"</literal> : fired on a process
+ <listitem><literal><emphasis role="bold">Event.PROCESS_END</emphasis> = "process-end"</literal> : fired on a process
when a new process is ended. This might include a executions that are ended
with a cancelled or error state.
</listitem>
@@ -350,38 +346,43 @@
...
}</programlisting>
- <para>A list of <link linkend="activity"><literal>Activity</literal>s</link> can be associated to an
- event. But activities on events can not influence the control flow of the execution since
- they are merely listeners to an execution wich is already in progress. This is different from
+ <para>A list of <literal>EventListeners</literal> can be associated to an
+ event. But event listeners can not influence the control flow of the execution since
+ they are merely listeners to an execution which is already in progress. This is different from
activities that serve as the behaviour for nodes. Node behaviour activities are responsible
- for propagating the execution. So if an activity in an event invokes any of the
- following methods, then it will result in an exception.
+ for propagating the execution.
</para>
-
- <itemizedlist>
- <listitem><literal>waitForSignal()</literal></listitem>
- <listitem><literal>take(Transition)</literal></listitem>
- <listitem><literal>end(*)</literal></listitem>
- <listitem><literal>execute(Node)</literal></listitem>
- </itemizedlist>
-
- <para>We'll reuse the <literal><link linkend="activity">Display</link></literal>
- activity from above in a simple process: two nodes connected by a
- transition. The Display listener will be subscribed to the transition event.</para>
+ <para>We'll create a <literal>PrintLn</literal> event listener which is
+ very similar to the <literal>Display</literal> activity from above.
+ </para>
+ <programlisting>public class PrintLn implements EventListener {
+
+ String message;
+
+ public PrintLn(String message) {
+ this.message = message;
+ }
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ System.out.println("message");
+ }
+}</programlisting>
+ <para>Several <literal>PrintLn</literal> listeners will be subscribed to events in
+ the process.</para>
<figure id="action.process">
- <title>The process to which a listener activity will be associated</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
+ <title>The PrintLn listener process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.ab.png"/></imageobject></mediaobject>
</figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new WaitState())
- <emphasis role="bold">.event("node-leave")
- .listener(new Display("leaving a"))
- .listener(new Display("second message while leaving a"))</emphasis>
- .transition().to("b")
- <emphasis role="bold">.listener(new Display("taking transition"))</emphasis>
- .node("b").behaviour(new WaitState())
- <emphasis role="bold">.event("node-enter")
- .listener(new Display("entering b"))</emphasis>
+ <programlisting>ClientProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new AutomaticActivity())
+ <emphasis role="bold">.event("node-end")
+ .listener(new PrintLn("leaving a"))
+ .listener(new PrintLn("second message while leaving a"))</emphasis>
+ .transition().to("b")
+ <emphasis role="bold">.listener(new PrintLn("taking transition"))</emphasis>
+ .node("b").behaviour(new WaitState())
+ .event("node-begin")
+ <emphasis role="bold">.listener(new PrintLn("entering b"))</emphasis>
.done();</programlisting>
<para>The first event shows how to register multiple listeners to the same
event. They will be notified in the order as they are specified.
@@ -396,7 +397,7 @@
control the propagation of execution.
</para>
</section>
-
+
<!-- ### EVENT PROPAGATION ############################################## -->
<section>
<title>Event propagation</title>
@@ -521,56 +522,4 @@
<programlisting>leaving node(composite)</programlisting>
</section>
- <!-- ### PROCESS STRUCTURE ############################################## -->
- <section>
- <title>Process structure</title>
- <para>Above we already touched briefly on the two main process constructs:
- Nodes, transitions and node composition. This section will elaborate
- on all the basic combination possibilities.
- </para>
- <figure id="process.structure">
- <title>UML class diagram of the basic process structure</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.structure.classes.png"/></imageobject></mediaobject>
- </figure>
- <para>Next is a series of example diagram structures that can be formed
- with the PVM process model.
- </para>
- <figure id="transition">
- <title>Any two nodes can be connected with a transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="self.transition">
- <title>A self transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="composite.node">
- <title>Composite node is a list of nested nodes.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.into.composite">
- <title>Transition to a node inside a composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.out.of.composite">
- <title>Transition from a node inside a composite to a node outside the composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.inheritence">
- <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.outer">
- <title>Transition from a node to an outer composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.inner">
- <title>Transition from a composite node to an inner composed node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
- </figure>
- <figure id="initial.in.composite">
- <title>An initial node inside a composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
- </figure>
- </section>
-
</chapter>
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml 2008-09-18 19:11:01 UTC (rev 2281)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml 2008-09-18 19:11:04 UTC (rev 2282)
@@ -1,4 +1,62 @@
<chapter id="processanatomy">
<title>Process anatomy</title>
- <para>TODO</para>
+
+ <para>Above we already touched briefly on the two main process constructs:
+ Nodes, transitions and node composition. This chapter explores in full
+ all the possibilities of the process definition structures.
+ </para>
+
+ <para>There are basically two forms of process languages: graph based and composite
+ process languages. First of all, the process supports both. Even graph based execution
+ and node composition can be used in combination to implement something like UML super states.
+ Furthermore, automatic functional activities can be implemented so that they can be
+ used with transitions as well as with node composition.
+ </para>
+
+ <figure id="process.anatomy">
+ <title>UML class diagram of the logical process structure</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.anatomy.classes.png"/></imageobject></mediaobject>
+ </figure>
+
+ <para>Next we'll describe a series of example diagram structures that can be formed
+ with the PVM process model.
+ </para>
+
+ <figure id="transition">
+ <title>Any two nodes can be connected with a transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
+ </figure>
+
+ <figure id="self.transition">
+ <title>A self transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="composite.node">
+ <title>Composite node is a list of nested nodes.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.into.composite">
+ <title>Transition to a node inside a composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.out.of.composite">
+ <title>Transition from a node inside a composite to a node outside the composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.inheritence">
+ <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.outer">
+ <title>Transition from a node to an outer composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.inner">
+ <title>Transition from a composite node to an inner composed node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="initial.in.composite">
+ <title>An initial node inside a composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
+ </figure>
</chapter>
\ No newline at end of file
17 years, 7 months
JBoss JBPM SVN: r2281 - in projects/jbpm-spec/trunk: modules/api/src/main/java/org/jboss/bpm/client and 5 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-18 15:11:01 -0400 (Thu, 18 Sep 2008)
New Revision: 2281
Added:
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NoneTask.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/InvalidProcessTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessMarshallerTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessStorageTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessTest.java
Removed:
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java
Modified:
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
projects/jbpm-spec/trunk/modules/ri/pom.xml
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/ProcessManagerImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/GatewayImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/IntermediateEventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SubProcessImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java
projects/jbpm-spec/trunk/pom.xml
Log:
More Persistence
Modified: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -35,7 +35,7 @@
*/
public interface PersistenceService
{
- void saveProcess(Process proc);
+ ObjectName saveProcess(Process proc);
Process loadProcess(ObjectName procID);
Added: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NoneTask.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NoneTask.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NoneTask.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -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.jboss.bpm.model;
+
+//$Id$
+
+
+/**
+ * Task that corresponds to the TaskType.None
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public interface NoneTask extends Task
+{
+}
\ No newline at end of file
Property changes on: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NoneTask.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -23,8 +23,9 @@
-//$Id$
+//$Id: $
+
/**
* A Sequence Flow is used to show the order that activities will be performed in a Process. Each Flow has only one
* source and only one target. The source and target must be from the set of the following Flow Objects: Events (Start,
Copied: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/InvalidProcessTest.java (from rev 2278, projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java)
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/InvalidProcessTest.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/InvalidProcessTest.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -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.jboss.bpm.cts.model.process;
+
+// $Id$
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the intergety of various process definitions
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class InvalidProcessTest extends DefaultEngineTestCase
+{
+ public void testNoStartEvent() throws Exception
+ {
+ try
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ builder.addProcess("NoStartState").addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start event") > 0);
+ }
+ }
+
+ public void testNoEndEvent() throws Exception
+ {
+ try
+ {
+ // Create a Process through the ProcessBuilder
+ ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ builder.addProcess("NoEndState").addStartEvent("Start").addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
+ addTask("end").getProcess();
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end event") > 0);
+ }
+ }
+}
Deleted: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -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.jboss.bpm.cts.model.process;
-
-// $Id$
-
-import org.jboss.bpm.InvalidProcessException;
-import org.jboss.bpm.model.ProcessBuilder;
-import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.test.DefaultEngineTestCase;
-
-/**
- * Test the intergety of various process definitions
- *
- * @author thomas.diesler(a)jboss.com
- * @since 08-Jul-2008
- */
-public class ProcessIntegrityTest extends DefaultEngineTestCase
-{
- public void testNoStartEvent() throws Exception
- {
- try
- {
- // Create a Process through the ProcessBuilder
- ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess("NoStartState").addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
- fail("InvalidProcessException expected");
- }
- catch (InvalidProcessException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start event") > 0);
- }
- }
-
- public void testNoEndEvent() throws Exception
- {
- try
- {
- // Create a Process through the ProcessBuilder
- ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess("NoEndState").addStartEvent("Start").addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
- addTask("end").getProcess();
- fail("InvalidProcessException expected");
- }
- catch (InvalidProcessException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end event") > 0);
- }
- }
-}
Added: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessMarshallerTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessMarshallerTest.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessMarshallerTest.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -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.jboss.bpm.cts.model.process;
+
+// $Id$
+
+import java.io.IOException;
+
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.Process;
+
+/**
+ * Test Process integrity.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Sep-2008
+ */
+public class ProcessMarshallerTest extends ProcessTest
+{
+ protected Process getSimpleProcess() throws IOException
+ {
+ // Marshall the process to a string
+ Process proc = super.getSimpleProcess();
+ String procXML = marshallProcess(proc);
+
+ // Recreate the process from the marshalled process
+ ProcessManager procManager = ProcessManager.locateProcessManager();
+ return procManager.createProcess(procXML);
+ }
+}
Property changes on: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessMarshallerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessStorageTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessStorageTest.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessStorageTest.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -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.jboss.bpm.cts.model.process;
+
+// $Id$
+
+import java.io.IOException;
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.Process;
+
+/**
+ * Test Process integrity.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Sep-2008
+ */
+public class ProcessStorageTest extends ProcessTest
+{
+ protected Process getSimpleProcess() throws IOException
+ {
+ // Save and reload the process
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ ObjectName procID = pm.saveProcess(super.getSimpleProcess());
+ return pm.loadProcess(procID);
+ }
+}
Property changes on: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessStorageTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessTest.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessTest.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -0,0 +1,90 @@
+/*
+ * 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.jboss.bpm.cts.model.process;
+
+// $Id$
+
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.NoneTask;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.SequenceFlow;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.model.Process.ProcessStatus;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test Process integrity.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Sep-2008
+ */
+public class ProcessTest extends DefaultEngineTestCase
+{
+ public void testSimpleProcess() throws Exception
+ {
+ Process proc = getSimpleProcess();
+ assertEquals("SimpleProcess", proc.getName());
+ assertEquals(ProcessStatus.Ready, proc.getProcessStatus());
+
+ List<StartEvent> startEvents = proc.getFlowObjects(StartEvent.class);
+ assertEquals("One StartEvent", 1, startEvents.size());
+ StartEvent startEvent = startEvents.get(0);
+
+ List<Task> tasks = proc.getFlowObjects(Task.class);
+ assertEquals("One Task", 1, tasks.size());
+ NoneTask task = (NoneTask)tasks.get(0);
+
+ List<EndEvent> endEvents = proc.getFlowObjects(EndEvent.class);
+ assertEquals("One EndEvent", 1, endEvents.size());
+ EndEvent endEvent = endEvents.get(0);
+
+ assertEquals("StartEvent name", "Start", startEvent.getName());
+ assertSame("Same Process", proc, startEvent.getProcess());
+ SequenceFlow outFlow = startEvent.getOutFlow();
+ assertNotNull("StartEvent outFlow", outFlow);
+ assertEquals("OutFlow target", "Task", outFlow.getTargetName());
+
+ assertEquals("Task name", "Task", task.getName());
+ assertSame("Same Process", proc, task.getProcess());
+ outFlow = task.getOutFlow();
+ assertNotNull("Task outFlow", outFlow);
+ assertEquals("OutFlow target", "End", outFlow.getTargetName());
+
+ assertEquals("EndEvent name", "End", endEvent.getName());
+ assertSame("Same Process", proc, endEvent.getProcess());
+ }
+
+ protected Process getSimpleProcess() throws IOException
+ {
+ ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
+ procBuilder.addProcess("SimpleProcess").addStartEvent("Start").addSequenceFlow("Task");
+ procBuilder.addTask("Task").addSequenceFlow("End").addEndEvent("End");
+ Process proc = procBuilder.getProcess();
+ return proc;
+ }
+}
Property changes on: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jbpm-spec/trunk/modules/ri/pom.xml
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/pom.xml 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/pom.xml 2008-09-18 19:11:01 UTC (rev 2281)
@@ -29,46 +29,8 @@
<!-- Properties -->
<properties>
- <hibernate.version>3.2.6.ga</hibernate.version>
- <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
- <hibernate.validator.version>3.0.0.ga</hibernate.validator.version>
- <hsqldb.version>1.8.0.7</hsqldb.version>
- <mysql.connector.version>5.1.6</mysql.connector.version>
</properties>
- <!-- DependencyManagement -->
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernate.annotations.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate.validator.version}</version>
- </dependency>
-
- <!-- Database Driver Versions -->
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<!-- Dependencies -->
<dependencies>
<dependency>
@@ -97,71 +59,6 @@
<!-- Profiles -->
<profiles>
-
- <!--
- Name: no-database
- Descr: Setup the default database
- -->
- <profile>
- <id>no-database</id>
- <activation>
- <property>
- <name>!database</name>
- </property>
- </activation>
- <properties>
- <database>hsqldb</database>
- </properties>
- <dependencies>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <!--
- Name: hsqldb
- Descr: Hypersonic Database Setup
- -->
- <profile>
- <id>hsqldb</id>
- <activation>
- <property>
- <name>database</name>
- <value>hsqldb</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <!--
- Name: mysql
- Descr: MySQL Database Setup
- -->
- <profile>
- <id>mysql</id>
- <activation>
- <property>
- <name>database</name>
- <value>mysql</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-
</profiles>
+
</project>
\ No newline at end of file
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -35,10 +35,13 @@
import org.jboss.bpm.client.PersistenceService;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.ri.model.impl.AbstractElementImpl;
+import org.jboss.bpm.ri.model.impl.ActivityImpl;
import org.jboss.bpm.ri.model.impl.EndEventImpl;
+import org.jboss.bpm.ri.model.impl.FlowImpl;
import org.jboss.bpm.ri.model.impl.FlowObjectImpl;
import org.jboss.bpm.ri.model.impl.NoneTaskImpl;
import org.jboss.bpm.ri.model.impl.ProcessImpl;
+import org.jboss.bpm.ri.model.impl.SequenceFlowImpl;
import org.jboss.bpm.ri.model.impl.StartEventImpl;
/**
@@ -57,7 +60,7 @@
this.hibernateConfig = hibernateConfig;
}
- public void saveProcess(Process proc)
+ public ObjectName saveProcess(Process proc)
{
Session session = getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
@@ -70,6 +73,7 @@
{
session.close();
}
+ return proc.getID();
}
public Process loadProcess(ObjectName procID)
@@ -123,10 +127,13 @@
{
AnnotationConfiguration anConfig = new AnnotationConfiguration();
anConfig.addAnnotatedClass(AbstractElementImpl.class);
+ anConfig.addAnnotatedClass(ActivityImpl.class);
anConfig.addAnnotatedClass(EndEventImpl.class);
+ anConfig.addAnnotatedClass(FlowImpl.class);
anConfig.addAnnotatedClass(FlowObjectImpl.class);
anConfig.addAnnotatedClass(NoneTaskImpl.class);
anConfig.addAnnotatedClass(ProcessImpl.class);
+ anConfig.addAnnotatedClass(SequenceFlowImpl.class);
anConfig.addAnnotatedClass(StartEventImpl.class);
sessionFactory = anConfig.configure(hibernateConfig).buildSessionFactory();
}
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/ProcessManagerImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/ProcessManagerImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/ProcessManagerImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -93,10 +93,10 @@
super.unregisterProcess(procImpl.getID());
}
- public void saveProcess(Process proc)
+ public ObjectName saveProcess(Process proc)
{
assertPersistenceService();
- persistenceService.saveProcess(proc);
+ return persistenceService.saveProcess(proc);
}
public Process loadProcess(ObjectName procID)
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -44,21 +44,20 @@
{
// provide serial version UID
private static final long serialVersionUID = 1L;
-
+
// The cached ID
protected transient ObjectName id;
// The persistent key
private transient String key;
-
- public AbstractElementImpl()
- {
- this.key = new UID().toString();
- }
@Id
@Column(name = "id")
public String getKey()
{
+ if (key == null)
+ {
+ key = new UID().toString();
+ }
return key;
}
@@ -72,7 +71,7 @@
*/
@Transient
public abstract ObjectName getID();
-
+
/**
* Called when the process is created
*/
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -27,6 +27,11 @@
import java.util.Collections;
import java.util.List;
+import javax.persistence.CascadeType;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.OneToOne;
import javax.persistence.Transient;
import org.apache.commons.logging.Log;
@@ -55,6 +60,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@MappedSuperclass
public abstract class ActivityImpl extends FlowObjectImpl implements Activity, MutablePropertySupport,
SingleInFlowSetterSupport, SingleOutFlowSetterSupport
{
@@ -192,7 +198,8 @@
this.inFlow = inFlow;
}
- @Transient
+ @OneToOne(cascade = CascadeType.ALL, fetch= FetchType.EAGER, targetEntity = SequenceFlowImpl.class)
+ @JoinColumn
public SequenceFlow getOutFlow()
{
return outFlow;
@@ -259,9 +266,7 @@
return inputSet;
}
- /**
- * Select the active outputSet
- */
+ @Transient
protected OutputSet getActiveOutputSet()
{
OutputSet outputSet = null;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -48,7 +48,6 @@
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
import org.jboss.bpm.runtime.TokenExecutor;
-import org.jboss.util.id.UID;
/**
* As the name implies, the End Event indicates where a Process will end.
@@ -88,7 +87,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=EndEvent,name=" + getName() + ",id=" + new UID());
+ str.append("type=EndEvent,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -23,6 +23,9 @@
//$Id$
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
import org.jboss.bpm.model.ConnectingObject;
import org.jboss.bpm.model.FlowObject;
@@ -33,6 +36,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@MappedSuperclass
public abstract class FlowImpl extends SupportingElementImpl implements ConnectingObject
{
// provide serial version UID
@@ -66,6 +70,7 @@
this.name = name;
}
+ @Transient
public FlowObject getSourceRef()
{
return source;
@@ -76,6 +81,7 @@
this.source = source;
}
+ @Transient
public FlowObject getTargetRef()
{
return target;
@@ -90,4 +96,10 @@
{
return targetName;
}
+
+ // Persistence method
+ protected void setTargetName(String targetName)
+ {
+ this.targetName = targetName;
+ }
}
\ No newline at end of file
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -25,8 +25,11 @@
import java.util.Collections;
import java.util.List;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
-import javax.persistence.MappedSuperclass;
+import javax.persistence.Table;
import javax.persistence.Transient;
import org.jboss.bpm.InvalidProcessException;
@@ -56,7 +59,9 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@MappedSuperclass
+@Entity
+@Table(name = "JBPM_FLOW_OBJECT")
+@Inheritance (strategy = InheritanceType.JOINED)
public abstract class FlowObjectImpl extends GraphicalElementImpl implements FlowObject, HandlerSetterSupport
{
// provide serial version UID
@@ -79,13 +84,18 @@
{
}
- //@ManyToOne(targetEntity = ProcessImpl.class)
- @Transient
+ @ManyToOne(targetEntity = ProcessImpl.class)
public Process getProcess()
{
return proc;
}
+ // Persistence method
+ protected void setProcess(Process proc)
+ {
+ this.proc = proc;
+ }
+
public String getName()
{
return name;
@@ -233,8 +243,10 @@
protected void create(Process proc)
{
super.create(proc);
- this.proc = proc;
+ // Set the associated process
+ setProcess(proc);
+
// Check required name
if (name == null)
throw new InvalidProcessException("Name is required for: " + this);
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/GatewayImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/GatewayImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/GatewayImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -43,7 +43,6 @@
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
-import org.jboss.util.id.UID;
/**
* Gateways are modelling elements that are used to control how Sequence Flow interact as they converge and diverge
@@ -77,7 +76,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=" + getGatewayType() + "Gateway,name=" + getName() + ",id=" + new UID());
+ str.append("type=" + getGatewayType() + "Gateway,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/IntermediateEventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/IntermediateEventImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/IntermediateEventImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -40,7 +40,6 @@
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
import org.jboss.bpm.runtime.TokenExecutor;
-import org.jboss.util.id.UID;
/**
* An Intermediate Event is an Event that occurs after a Process has been started. It will affect the Flow of the Process, but will not start or (directly) terminate
@@ -70,7 +69,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=IntermediateEvent,name=" + getName() + ",id=" + new UID());
+ str.append("type=IntermediateEvent,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -27,6 +27,8 @@
import javax.persistence.Table;
import javax.persistence.Transient;
+import org.jboss.bpm.model.NoneTask;
+
/**
* Task that corresponds to the TaskType.None
*
@@ -35,7 +37,7 @@
*/
@Entity
@Table(name = "JBPM_NONE_TASK")
-public class NoneTaskImpl extends TaskImpl
+public class NoneTaskImpl extends TaskImpl implements NoneTask
{
// provide serial version UID
private static final long serialVersionUID = 1L;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -34,6 +34,8 @@
import javax.management.ObjectName;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@@ -268,8 +270,7 @@
return em.waitForEnd(this, timeout);
}
- //@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "process", targetEntity = FlowObjectImpl.class)
- @Transient
+ @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "process", targetEntity = FlowObjectImpl.class)
public List<FlowObject> getFlowObjects()
{
if (status == ProcessStatus.None)
@@ -278,6 +279,12 @@
return Collections.unmodifiableList(flowObjects);
}
+ // Persistence method
+ protected void setFlowObjects(List<FlowObject> flowObjects)
+ {
+ this.flowObjects = flowObjects;
+ }
+
public FlowObject getFlowObject(String name)
{
if (name == null)
@@ -307,6 +314,7 @@
return retFlowObjects;
}
+ @Enumerated(EnumType.STRING)
public synchronized ProcessStatus getProcessStatus()
{
return status;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -24,15 +24,18 @@
//$Id$
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.Table;
+import javax.persistence.Transient;
import org.jboss.bpm.model.Expression;
import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.SequenceFlow;
/**
- * A Sequence Flow is a solid graphical line that is used to show the order that Activities will be performed in a Process.
- * Each Flow has only one source and only one target.
+ * A Sequence Flow is a solid graphical line that is used to show the order that Activities will be performed in a
+ * Process. Each Flow has only one source and only one target.
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
@@ -43,10 +46,10 @@
{
// provide serial version UID
private static final long serialVersionUID = 1L;
-
+
private ConditionType conditionType = ConditionType.None;
private Expression conditionExpression;
-
+
public SequenceFlowImpl(String targetName)
{
super(targetName);
@@ -64,29 +67,37 @@
{
}
+ @Enumerated(EnumType.STRING)
public ConditionType getConditionType()
{
return conditionType;
}
-
+
+ // Persistent method
+ protected void setConditionType(ConditionType conditionType)
+ {
+ this.conditionType = conditionType;
+ }
+
+ @Transient
public Expression getConditionExpression()
{
return conditionExpression;
}
-
+
public String toString()
{
FlowObject sourceRef = getSourceRef();
FlowObject targetRef = getTargetRef();
-
+
String srcName = null;
if (sourceRef != null)
srcName = (sourceRef.getName() != null ? sourceRef.getName() : sourceRef.getID().getCanonicalName());
-
+
String tarName = null;
if (targetRef != null)
tarName = (targetRef.getName() != null ? targetRef.getName() : targetRef.getID().getCanonicalName());
-
+
return "SequenceFlow[" + srcName + "->" + tarName + "]";
}
}
\ No newline at end of file
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -28,7 +28,11 @@
import java.util.List;
import javax.management.ObjectName;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -50,7 +54,6 @@
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
import org.jboss.bpm.runtime.TokenExecutor;
-import org.jboss.util.id.UID;
/**
* A Start Event indicates where a particular Process will start. In terms of Sequence Flow, the Start Event starts the
@@ -90,7 +93,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=StartEvent,name=" + getName() + ",id=" + new UID());
+ str.append("type=StartEvent,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
@@ -107,7 +110,8 @@
triggers.add(eventDetail);
}
- @Transient
+ @OneToOne(cascade = CascadeType.ALL, fetch= FetchType.EAGER, targetEntity = SequenceFlowImpl.class)
+ @JoinColumn
public SequenceFlow getOutFlow()
{
return outFlow;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SubProcessImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SubProcessImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SubProcessImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -32,7 +32,6 @@
import org.jboss.bpm.ri.model.spec.SubProcess;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
-import org.jboss.util.id.UID;
/**
* A Sub-Process is Process that is included within another Process.
@@ -61,7 +60,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=SubProcess,name=" + getName() + ",id=" + new UID());
+ str.append("type=SubProcess,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -29,11 +29,10 @@
import org.jboss.bpm.model.Constants;
import org.jboss.bpm.model.ObjectNameFactory;
import org.jboss.bpm.model.SupportingElement;
-import org.jboss.util.id.UID;
/**
* A supporting element
- *
+ *
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
@@ -41,7 +40,7 @@
{
// provide serial version UID
private static final long serialVersionUID = 1L;
-
+
@Override
@Transient
public ObjectName getID()
@@ -49,7 +48,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=SupportingElement,id=" + new UID());
+ str.append("type=SupportingElement,id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java 2008-09-18 19:11:01 UTC (rev 2281)
@@ -31,7 +31,6 @@
import org.jboss.bpm.model.Task;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
-import org.jboss.util.id.UID;
//$Id$
@@ -74,7 +73,7 @@
if (id == null)
{
StringBuilder str = new StringBuilder(Constants.ID_DOMAIN + ":");
- str.append("type=" + getTaskType() + "Task,name=" + getName() + ",id=" + new UID());
+ str.append("type=" + getTaskType() + "Task,name=" + getName() + ",id=" + getKey());
id = ObjectNameFactory.create(str.toString());
}
return id;
Modified: projects/jbpm-spec/trunk/pom.xml
===================================================================
--- projects/jbpm-spec/trunk/pom.xml 2008-09-18 13:56:28 UTC (rev 2280)
+++ projects/jbpm-spec/trunk/pom.xml 2008-09-18 19:11:01 UTC (rev 2281)
@@ -38,6 +38,11 @@
<properties>
<commons.logging.version>1.1.1</commons.logging.version>
<google.gwt.version>1.4.61</google.gwt.version>
+ <hibernate.version>3.2.6.ga</hibernate.version>
+ <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
+ <hibernate.validator.version>3.0.0.ga</hibernate.validator.version>
+ <hsqldb.version>1.8.0.7</hsqldb.version>
+ <mysql.connector.version>5.1.6</mysql.connector.version>
<jaxb.ri.version>2.1.7</jaxb.ri.version>
<javax.servlet.version>2.5</javax.servlet.version>
<jboss.microcontainer.version>2.0.0.Beta15</jboss.microcontainer.version>
@@ -106,6 +111,21 @@
<version>${commons.logging.version}</version>
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>${hibernate.annotations.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-kernel</artifactId>
<version>${jboss.microcontainer.version}</version>
@@ -120,6 +140,18 @@
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
</dependency>
+
+ <!-- Database Driver Versions -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -203,6 +235,71 @@
<!-- Profiles -->
<profiles>
+ <!--
+ Name: no-database
+ Descr: Setup the default database
+ -->
+ <profile>
+ <id>no-database</id>
+ <activation>
+ <property>
+ <name>!database</name>
+ </property>
+ </activation>
+ <properties>
+ <database>hsqldb</database>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <!--
+ Name: hsqldb
+ Descr: Hypersonic Database Setup
+ -->
+ <profile>
+ <id>hsqldb</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>hsqldb</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <!--
+ Name: mysql
+ Descr: MySQL Database Setup
+ -->
+ <profile>
+ <id>mysql</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>mysql</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!--
Name: skiptests
Desc: Skips the tests
17 years, 7 months
JBoss JBPM SVN: r2280 - jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-18 09:56:28 -0400 (Thu, 18 Sep 2008)
New Revision: 2280
Modified:
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
Log:
docs
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml 2008-09-18 13:55:29 UTC (rev 2279)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml 2008-09-18 13:56:28 UTC (rev 2280)
@@ -1,4 +1,4 @@
-<chapter id="timers">
- <title>Timers</title>
+<chapter id="processanatomy">
+ <title>Process anatomy</title>
<para>TODO</para>
</chapter>
\ No newline at end of file
17 years, 7 months
JBoss JBPM SVN: r2279 - in jbpm4/pvm/trunk/modules: core/src/test/java/org/jbpm/pvm/example04 and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-18 09:55:29 -0400 (Thu, 18 Sep 2008)
New Revision: 2279
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/Display.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/DisplayActivityTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/ExternalActivityExampleTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/WaitState.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example06/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example06/BasicProcessExecutionTest.java
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.archive.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.end.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.evaluate.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.ab.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.loan.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch06-ImplementingAdvancedActivities.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch07-Variables.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch08-Timers.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch09-AsynchronousContinuations.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch10-SoftwareLogging.xml
Removed:
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.accept.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.end.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.evaluation.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/loan.process.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AsynchronousContinuations.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Timers.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Variables.xml
Modified:
jbpm4/pvm/trunk/modules/manual/src/main/diagrams/diagrams.mdzip
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch01-Introduction.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml
Log:
docs
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/Display.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/Display.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/Display.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -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.pvm.example04;
+
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.activity.ActivityExecution;
+
+public class Display implements Activity {
+
+ private static final long serialVersionUID = 1L;
+
+ String message;
+
+ public Display(String message) {
+ this.message = message;
+ }
+
+ public void execute(ActivityExecution execution) {
+ System.out.println(message);
+ }
+}
\ No newline at end of file
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/DisplayActivityTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/DisplayActivityTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/DisplayActivityTest.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,34 @@
+package org.jbpm.pvm.example04;
+
+import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+public class DisplayActivityTest extends JbpmTestCase {
+
+ TestConsole testConsole;
+
+ public void setUp() {
+ testConsole = TestConsole.install();
+ }
+
+ public void tearDown() {
+ TestConsole.uninstall();
+ testConsole = null;
+ }
+
+ public void testHelloWorld() {
+ ClientProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new Display("hello"))
+ .transition().to("b")
+ .node("b").behaviour(new Display("world"))
+ .done();
+
+ Execution execution = processDefinition.startProcessInstance();
+
+ assertEquals("hello", testConsole.getLine(0));
+ assertEquals("world", testConsole.getLine(1));
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example04/TestConsole.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,38 @@
+package org.jbpm.pvm.example04;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/** wraps the System.out and buffers the println(String) invocations
+ * so that those can be asserted */
+public class TestConsole extends PrintStream {
+
+ List<String> lines = new ArrayList<String>();
+
+ public TestConsole() {
+ super(System.out);
+ }
+
+ public static TestConsole install() {
+ TestConsole testConsole = new TestConsole();
+ System.setOut(testConsole);
+ return testConsole;
+ }
+
+ public static void uninstall() {
+ if (System.out instanceof TestConsole) {
+ TestConsole testConsole = (TestConsole) System.out;
+ System.setOut((PrintStream) testConsole.out);
+ }
+ }
+
+ public void println(String x) {
+ lines.add(x);
+ super.println(x);
+ }
+
+ public String getLine(int i) {
+ return lines.get(i);
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/ExternalActivityExampleTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/ExternalActivityExampleTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/ExternalActivityExampleTest.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,27 @@
+package org.jbpm.pvm.example05;
+
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+public class ExternalActivityExampleTest extends JbpmTestCase {
+
+ public void testExternalActivityExample() {
+ ClientProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new WaitState())
+ .transition().to("b")
+ .node("b").behaviour(new WaitState())
+ .done();
+
+ ClientExecution execution = processDefinition.startProcessInstance();
+
+ assertEquals("a", execution.getNodeName());
+
+ execution.signal();
+
+ assertEquals("b", execution.getNodeName());
+ }
+
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/WaitState.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/WaitState.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example05/WaitState.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,21 @@
+package org.jbpm.pvm.example05;
+
+import java.util.Map;
+
+import org.jbpm.pvm.activity.ActivityExecution;
+import org.jbpm.pvm.activity.ExternalActivity;
+
+public class WaitState implements ExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, Object> parameters) {
+ execution.take(signalName);
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example06/BasicProcessExecutionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example06/BasicProcessExecutionTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example06/BasicProcessExecutionTest.java 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,32 @@
+package org.jbpm.pvm.example06;
+
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.example04.Display;
+import org.jbpm.pvm.example05.WaitState;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+
+public class BasicProcessExecutionTest extends JbpmTestCase {
+
+ public void testBasicProcessExecution() {
+ ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
+ .node("submit loan request").initial().behaviour(new Display("loan request submitted"))
+ .transition().to("evaluate")
+ .node("evaluate").behaviour(new WaitState())
+ .transition("approve").to("wire money")
+ .transition("reject").to("end")
+ .node("wire money").behaviour(new Display("wire the money"))
+ .transition().to("archive")
+ .node("archive").behaviour(new WaitState())
+ .transition().to("end")
+ .node("end").behaviour(new WaitState())
+ .done();
+
+ ClientExecution execution = processDefinition.startProcessInstance();
+
+
+
+ }
+}
Modified: jbpm4/pvm/trunk/modules/manual/src/main/diagrams/diagrams.mdzip
===================================================================
(Binary files differ)
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.archive.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.archive.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.end.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.end.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.evaluate.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.loan.evaluate.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.accept.png
===================================================================
(Binary files differ)
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.end.png
===================================================================
(Binary files differ)
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/execution.state.evaluation.png
===================================================================
(Binary files differ)
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/loan.process.png
===================================================================
(Binary files differ)
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.ab.png (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.png)
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.ab.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:mergeinfo
+
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.loan.png (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/loan.process.png)
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.loan.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:mergeinfo
+
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/process.png
===================================================================
(Binary files differ)
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -4,7 +4,13 @@
<!ENTITY ch01-Introduction SYSTEM "modules/ch01-Introduction.xml">
<!ENTITY ch02-ExecutionModes SYSTEM "modules/ch02-ExecutionModes.xml">
<!ENTITY ch03-Architecture SYSTEM "modules/ch03-Architecture.xml">
- <!ENTITY ch04-BasicProcessExecutionConcepts SYSTEM "modules/ch04-BasicProcessExecutionConcepts.xml">
+ <!ENTITY ch04-ImplementingBasicActivities SYSTEM "modules/ch04-ImplementingBasicActivities.xml">
+ <!ENTITY ch05-ProcessAnatomy SYSTEM "modules/ch05-ProcessAnatomy.xml">
+ <!ENTITY ch06-ImplementingAdvancedActivities SYSTEM "modules/ch06-ImplementingAdvancedActivities.xml">
+ <!ENTITY ch07-Variables SYSTEM "modules/ch07-Variables.xml">
+ <!ENTITY ch08-Timers SYSTEM "modules/ch08-Timers.xml">
+ <!ENTITY ch09-AsynchronousContinuations SYSTEM "modules/ch09-AsynchronousContinuations.xml">
+ <!ENTITY ch10-SoftwareLogging SYSTEM "modules/ch10-SoftwareLogging.xml">
]>
<book lang="en">
@@ -21,6 +27,12 @@
&ch01-Introduction;
&ch02-ExecutionModes;
&ch03-Architecture;
- &ch04-BasicProcessExecutionConcepts;
+ &ch04-ImplementingBasicActivities;
+ &ch05-ProcessAnatomy;
+ &ch06-ImplementingAdvancedActivities;
+ &ch07-Variables;
+ &ch08-Timers;
+ &ch09-AsynchronousContinuations;
+ &ch10-SoftwareLogging;
</book>
\ No newline at end of file
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch01-Introduction.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch01-Introduction.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -24,7 +24,7 @@
</para>
<figure id="example.process.graph">
<title>Example process definition</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/loan.process.png"/></imageobject></mediaobject>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.loan.png"/></imageobject></mediaobject>
</figure>
<para>Typically, process definitions are static. A process definition is composed of
nodes and transitions. The runtime behaviour of a node is encapsulated in a so called
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -25,7 +25,7 @@
</para>
<figure id="loan.process">
<title>The loan process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/loan.process.png"/></imageobject></mediaobject>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.loan.png"/></imageobject></mediaobject>
</figure>
<programlisting>ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
.node("submit loan request").initial().behaviour(AutomaticActivity.class)
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,544 +0,0 @@
-<chapter id="basicprocessexecutionconcepts">
- <title>Basic process execution concepts</title>
-
- <para>This chapter explains the basics of process definitions, the features offered by
- the Process Virtual Machine and how activity implementations can be build. At the same
- time the client API is shown to execute processes with those activity implementations.
- </para>
-
- <!-- ### Activity ####################################################### -->
- <section id="activity">
- <title>Activity</title>
- <para>The PVM library doesn't have a fixed set of process constructs.
- Instead, runtime behaviour of a node is delegated to an <literal>Activity</literal>.
- In other words, <literal>Activity</literal> is an interface to implement the runtime
- behaviour of process constructs in plain Java.
- </para>
- <programlisting>public <emphasis role="bold">interface Activity</emphasis> extends Serializable {
-
- void <emphasis role="bold">execute</emphasis>(ActivityExecution execution) throws Exception;
-
-}</programlisting>
- <para>When an activity is used as the node behaviour, it is in full control of the further
- propagation of the execution. In other words, a node behaviour can decide what the execution
- should do next. For example, it can take a transition with
- <literal>execution.take(Transition)</literal> or go into a wait state with
- <literal>execution.waitForSignal()</literal>. In case the node behaviour does not invoke
- any of the above execution propagation methods, the execution will
- <link linkend="defaultproceedbehaviour">proceed in a default way</link>.
- </para>
- </section>
-
- <!-- ### Activity example ############################################### -->
- <section id="activityexample">
- <title>Activity example</title>
- <para>We'll start with a very original hello world example. A Display
- activity will print a message to the console:
- </para>
- <programlisting>public <emphasis role="bold">class Display</emphasis> implements <emphasis role="bold">Activity</emphasis> {
-
- String message;
-
- public Display(String message) {
- this.message = message;
- }
-
- public void execute(ActivityExecution execution) {
- <emphasis role="bold">System.out.println(message);</emphasis>
- }
-}</programlisting>
- <para>Let' build our first process definition with this activity:</para>
- <figure id="activity.example">
- <title>Activity example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new Display("hello")</emphasis>)
- .transition().to("b")
- .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new Display("world")</emphasis>)
-.done();</programlisting>
- <para>Now we can execute this process as follows:</para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>The invocation of <literal>startExecution</literal> will print hello world to the console:</para>
- <programlisting>hello
-world</programlisting>
- <para>One thing already worth noticing is that activities can be configured
- with properties. In the Display example, you can see that the message property
- is configured differently in the two usages. With configuration properties
- it becomes possible to write reusable activities. They can then be configured
- differently each time they are used in a process. That is an essential part of
- how process languages can be build on top of the Process Virtual Machine.
- </para>
- </section>
-
- <!-- ### ExternalActivity ############################################### -->
- <section id="externalactivity">
- <title>ExternalActivity</title>
- <para>External activities are activities for which the responsibility for proceeding
- the execution is transferred externally, meaning outside the process system. This
- means that for the system that is executing the process, it's a wait state. The
- execution will wait until an external trigger is given.
- </para>
- <para>For dealing with external triggers, <literal>ExternalActivity</literal>
- adds two methods to the <literal>Activity</literal>:</para>
- <programlisting>public <emphasis role="bold">interface ExternalActivity</emphasis> extends <emphasis role="bold">Activity</emphasis> {
-
- void <emphasis role="bold">signal</emphasis>(Execution execution,
- String signal,
- Map<String, Object> parameters) throws Exception;
-
-}</programlisting>
- <para>Just like with plain activities, when an execution arrives in a node, the
- <literal>execute</literal>-method of the node behaviour is invoked.
- In external activities, the execute method typically does something to
- transfer the responsibility to another system and then enters a wait
- state by invoking <literal>execution.waitForSignal()</literal>. For
- example in the execute method, responsibility could be transferred to a
- person by creating a task entry in a task management system and then
- wait until the person completes the task.
- </para>
- <para>In case a node behaves as a wait state, then the execution will
- wait in that node until the execution's <literal>signal</literal> method
- is invoked. The execution will delegate that signal to the behaviour Activity
- of the current node.
- </para>
- <para>So the Activity's <literal>signal</literal>-method is invoked
- when the execution receives an external trigger during the wait state. With the
- signal method, responsibility is transferred back to the process execution. For
- example, when a person completes a task, the task management system calls the
- signal method on the execution.
- </para>
- <para>A signal can optionally have a signal name and a map of parameters. Most
- common way on how node behaviours interprete the signal and parameters is that
- the signal relates to the outgoing transition that needs to be taken and that the
- parameters are set as variables on the execution. But those are just examples, it
- is up to the activity to use the signal and the parameters as it pleases.
- </para>
- </section>
-
- <!-- ### ExternalActivity example ####################################### -->
- <section id="externalactivityexample">
- <title>ExternalActivity example</title>
- <para>Here's a first example of a simple wait state implementation:
- </para>
- <programlisting>public <emphasis role="bold">class WaitState</emphasis> implements ExternalActivity {
-
- public void <emphasis role="bold">execute</emphasis>(Execution execution) {
- execution.waitForSignal();
- }
-
- public void <emphasis role="bold">signal</emphasis>(Execution execution,
- String signal,
- Map<String, Object> parameters) {
- execution.take(signal);
- }
-}</programlisting>
- <para>The <literal>execute</literal>-method calls
- <literal>execution.waitForSignal()</literal>. This call is
- necessary to prevent automatic propagation of the execution. By calling
- <literal>execution.waitForSignal()</literal>, the node will
- behave as a wait state.
- </para>
- <para><literal>signal</literal>-method takes the transition with
- the signal parameter as the transition name. So when an execution receives an
- external trigger, the signal name is interpreted as the name of an outgoing
- transition and the execution will be propagated over that transition.
- </para>
- <para>Here's the same simple process that has a transition from a to b. This
- time, the behaviour of the two nodes will be WaitState's.
- </para>
- <figure id="process.diagram">
- <title>Process diagram</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
- .transition().to("b")
- .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
-.done();</programlisting>
-
-<programlisting>Execution execution = processDefinition.startExecution();</programlisting>
-<programlisting>execution.signal();</programlisting>
- </section>
-
- <!-- ### BASIC PROCESS EXECUTION ######################################## -->
- <section id="basicprocessexecution">
- <title>Basic process execution</title>
- <para>In this next example, we'll combine automatic activities and wait states.
- This example is a simplified version of a loan approval process. Graphically,
- it looks like this:
- </para>
- <figure id="the.first.graph.process">
- <title>The first graph process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/first.graph.process.png"/></imageobject></mediaobject>
- </figure>
- <para>Building process graphs in Java code can be tedious because you have to keep track of all the
- references in local variables. To resolve that, the Process Virtual Machine comes with a
- ProcessFactory. The ProcessFactory is a kind of domain specific language (DSL) that is embedded
- in Java and eases the construction of process graphs. This pattern is also known as
- a <ulink url="http://martinfowler.com/bliki/FluentInterface.html">fluent
- interface</ulink>.
- </para>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("accept loan request").initial()</emphasis>.behaviour(new WaitState())
- .transition().to("loan evaluation")
- .<emphasis role="bold">node("loan evaluation")</emphasis>.behaviour(new WaitState())
- .transition("approve").to("wire the money")
- .transition("reject").to("end")
- .<emphasis role="bold">node("wire the money")</emphasis>.behaviour(new Display("automatic payment"))
- .transition().to("end")
- .<emphasis role="bold">node("end")</emphasis>.behaviour(new WaitState())
-.done();</programlisting>
- <para>For more details about the ProcessFactory, see the javadocs. An alternative for
- the ProcessFactory would be to create an XML language and an XML parser for expressing
- processes. The XML parser can then instantiate the classes of package
- <literal>org.jbpm.pvm.internal.model</literal> directly. That approach is typically taken by
- process languages.
- </para>
- <para>The node <literal>wire the money</literal> is an automatic node. The
- <literal>Display</literal> implementation uses the Java API's to just print a
- message to the console. But the witty reader can imagine an alternative
- <literal>Activity</literal> implementation that uses the Java API of a payment
- processing library to make a real automatic payment. All the other nodes are
- wait states.
- </para>
- <para>A new execution for the process above can be started like this
- </para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>Starting a new execution implies that the initial node is executed. Since in
- this case it's a wait state, the new execution will be positioned in the
- node 'accept loan request' when the <literal>startExecution</literal>-method returns.
- </para>
- <figure id="first.execution.state.accept">
- <title>Execution positioned in 'accept loan request'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.accept.png"/></imageobject></mediaobject>
- </figure>
- <para>Now we can give this execution an external trigger with the <literal>signal</literal>-
- method on the execution. Invoking the signal method will take the execution to the next
- wait state.
- </para>
- <programlisting>execution.signal();</programlisting>
- <figure id="execution.state.evaluation">
- <title>Execution positioned in 'loan evaluation'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.evaluation.png"/></imageobject></mediaobject>
- </figure>
- <para>Now, the execution is at an interesting point. There are two transitions out of
- the state 'loan evaluation'. One transition is called 'approve' and one transition
- is called 'reject'. As we explained above in the WaitState implementation, the transition
- taken corresponds to the signal that is given. Let's feed in the 'approve' signal like this:
- </para>
- <programlisting>execution.signal("approve");</programlisting>
- <para>The 'approve' signal will cause the execution to take the 'approve' transition and
- it will arrive in the node 'wire the money'.
- </para>
- <para>In <literal>wire the money</literal>, the message will be printed to the console.
- Since, the <literal>Display</literal> activity didn't invoke the
- <literal>execution.waitForSignal()</literal>, nor any of the other execution propagation
- methods, the default behaviour will be to just proceed.
- </para>
- <para><link linkend="defaultproceedbehaviour">Proceeding</link> in this case means that
- the default outgoing transition is taken and the execution will arrive in the <literal>end</literal>
- node, which is a wait state.</para>
- <para>So only when the <literal>end</literal> wait state is reached, the <literal>signal("approve")</literal>
- returns. That is because all of the things that needed to be done between the original
- state and this new state could be executed by the process system. Executing till the
- next wait state is the default behaviour and that behaviour can be changed with
- </para>
- <para><emphasis role="bold">TODO: add link to async continuations</emphasis></para>
- <para>asynchronous continuations in case
- transactions should not include all calculations till the next wait state. For
- more about this, see <xref linkend="executionandthreads" />.
- </para>
- <para>Another signal invocation will bring it eventually in the end state.</para>
- <figure id="execution.state.end">
- <title>Execution positioned in 'end'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.end.png"/></imageobject></mediaobject>
- </figure>
- </section>
-
- <!-- ### MOTIVATION ##################################################### -->
- <section id="motivation">
- <title>Motivation</title>
- <para>There are basically two forms of process languages: graph based and composite
- process languages. First of all, this design supports both. Even graph based execution
- and node composition can be used in combination to implement something like UML super states.
- </para>
- <para>In this design, control flow activity implementations will have to be
- aware of whether they are dependent on transitions (graph based) or whether they are
- using the composite node structure. The goal of this design is that all non-control
- flow activities can be implemented in the same way so that you can use them in graph
- based process languages as well as in composite process languages.
- </para>
- </section>
-
- <!-- ### EVENTS ######################################################### -->
- <section id="events">
- <title>Events</title>
- <para>Events are points in the process definition to which a list of
- activities can be subscribed as listeners. The motivation for events is to allow for
- developers to add programming logic to a process without changing the process diagram.
- This is a very valuable instrument in
- facilitating the collaboration between business analysts and developers. Business analysts
- are responsible for expressing the requirements. When they use a process graph to document
- those requirements, developers can take this diagram and make it executable. Events can
- be a very handy to insert technical details into a process (like e.g. some database insert)
- in which the business analyst is not interested.
- </para>
- <para>Most common events are fired by the execution automatically:
- </para>
- <itemizedlist>
- <listitem><literal>Transition.EVENT_TRANSITION_TAKE = "transition-take"</literal> :
- fired on transitions when transitions are taken.
- </listitem>
- <listitem><literal>Node.EVENT_NODE_ENTER = "node-enter"</literal> : fired on the node
- when execution enters that node. This happens when execution takes a transition
- to that node, when a child node is being executed with <literal>execution.execute(Node)</literal>
- or when a transition is taken from a node outside that node to a contained node.
- The latter refers to super states in state machines.
- </listitem>
- <listitem><literal>Node.EVENT_NODE_LEAVE = "node-leave"</literal> : fired on the node
- when a transition is taken out of that node or when a child node execution is
- finished and the execution is propagated to the parent node.
- </listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_START = "process-start"</literal> : fired on a process
- when a new process is started.
- </listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_END = "process-end"</literal> : fired on a process
- when a new process is ended. This might include a executions that are ended
- with a cancelled or error state.
- </listitem>
- </itemizedlist>
- <para>Events are identified by the combination of a process element
- and an event name. Users and process languages can also fire events
- programmatically with the fire method on the Execution:
- </para>
- <programlisting>public interface Execution extends Serializable {
- ...
- void fire(String eventName, ProcessElement eventSource);
- ...
-}</programlisting>
-
- <para>A list of <link linkend="activity"><literal>Activity</literal>s</link> can be associated to an
- event. But activities on events can not influence the control flow of the execution since
- they are merely listeners to an execution wich is already in progress. This is different from
- activities that serve as the behaviour for nodes. Node behaviour activities are responsible
- for propagating the execution. So if an activity in an event invokes any of the
- following methods, then it will result in an exception.
- </para>
-
- <itemizedlist>
- <listitem><literal>waitForSignal()</literal></listitem>
- <listitem><literal>take(Transition)</literal></listitem>
- <listitem><literal>end(*)</literal></listitem>
- <listitem><literal>execute(Node)</literal></listitem>
- </itemizedlist>
-
- <para>We'll reuse the <literal><link linkend="activity">Display</link></literal>
- activity from above in a simple process: two nodes connected by a
- transition. The Display listener will be subscribed to the transition event.</para>
- <figure id="action.process">
- <title>The process to which a listener activity will be associated</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new WaitState())
- <emphasis role="bold">.event("node-leave")
- .listener(new Display("leaving a"))
- .listener(new Display("second message while leaving a"))</emphasis>
- .transition().to("b")
- <emphasis role="bold">.listener(new Display("taking transition"))</emphasis>
- .node("b").behaviour(new WaitState())
- <emphasis role="bold">.event("node-enter")
- .listener(new Display("entering b"))</emphasis>
-.done();</programlisting>
- <para>The first event shows how to register multiple listeners to the same
- event. They will be notified in the order as they are specified.
- </para>
- <para>Then, on the transition, there is only one type of event. So in that case,
- the event type must not be specified and the listeners can be added directly on
- the transition.
- </para>
- <para>A listeners will be called each time an execution fires the event to
- which the listener is subscribed. The execution will be provided in the activity
- interface as a parameter and can be used by listeners except for the methods that
- control the propagation of execution.
- </para>
- </section>
-
- <!-- ### EVENT PROPAGATION ############################################## -->
- <section>
- <title>Event propagation</title>
- <para>Events are by default propagated to enclosing process elements. The motivation
- is to allow for listeners on process definitions or composite nodes that get executed
- for all events that occur within that process element. For example this feature
- allows to register a listener on a process definition or a composite node on
- <literal>node-leave</literal> events. Such action will be executed if that node is
- left. And if that listener is registered on a composite node, it will also be executed
- for all nodes that are left within that composite node.
- </para>
- <para>To show this clearly, we'll create a <literal>DisplaySource</literal> activity
- that will print the message <literal>leaving</literal> and the source of the event
- to the console.
- </para>
- <programlisting>public class <emphasis role="bold">DisplaySource</emphasis> implements Activity {
-
- public void execute(Execution execution) {
- <emphasis role="bold">System.out.println("leaving "+execution.getEventSource());</emphasis>
- }
-}</programlisting>
- <para>Note that the purpose of event listeners is not to be visible, that's why the activity
- itself should not be displayed in the diagram. A <literal>DisplaySource</literal> activity
- will be added as a listener to the event <literal>node-leave</literal> on the composite node.
- </para>
- <para>The next process shows how the <literal>DisplaySource</literal> activity is registered
- as a listener to to the 'node-leave' event on the <literal>composite</literal> node:</para>
- <figure id="propagation.process">
- <title>A process with an invisible activity on a node-leave event on a composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
- .compositeNode("composite")
- <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
- .listener(new DisplaySource())</emphasis>
- .node("a").initial().behaviour(new WaitState())
- .transition().to("b")
- .node("b").behaviour(new WaitState())
- .transition().to("c")
- .compositeEnd()
- .node("c").behaviour(new WaitState())
-.done();</programlisting>
- <para>Next we'll start an execution.</para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>After starting a new execution, the execution will be in node <literal>a</literal> as
- that is the initial node. No nodes have been left so no message is logged. Next a signal
- will be given to the execution, causing it to take the transition from <literal>a</literal>
- to <literal>b</literal>.
- </para>
- <programlisting>execution.signal();</programlisting>
- <para>When the signal method returns, the execution will have taken the transition and
- the node-leave event will be fired on node a. That event will be propagated to the
- composite node and to the process definition. Since our propagation logger is placed
- on node composite it will receive the event and print the following message:
- </para>
- <programlisting>leaving node(a)</programlisting>
- <para>Another</para>
- <programlisting>execution.signal();</programlisting>
- <para>will take the transition from b to c. That will fire two node-leave events. One on
- node b and one on node composite. So the following lines will be appended to the console
- output:</para>
- <programlisting>leaving node(b)
-leaving node(composite)</programlisting>
- <para>Event propagation is build on the hierarchical composition structure of the process
- definition. The top level element is always the process definition. The process
- definition contains a list of nodes. Each node can be a leaf node or it can be a
- composite node, which means that it contains a list of nested nodes. Nested nodes
- can be used for e.g. super states or composite activities in nested process languages like BPEL.
- </para>
- <para>So the even model also works similarly for composite nodes as it did for the process
- definition above. Suppose that 'Phase one' models
- a super state as in state machines. Then event propagation allows to subscribe to all events
- within that super state. The idea is that the hierarchical composition corresponds to
- diagram representation. If an element 'e' is drawn inside another element 'p', then p
- is the parent of e. A process definition has a set of top level nodes. Every node can have
- a set of nested nodes. The parent of a transition is considered as the first common
- parent for it's source and destination.
- </para>
- <para>If an event listener is not interested in propagated events, propagation can be disabled
- with <literal>propagationDisabled()</literal>. The next process is the same process
- as above except that propagated events will be disabled on the event listener. The graph diagram
- remains the same.
- </para>
- <figure id="propagation.disabled.process">
- <title>A process with a listener to 'node-leave' events with propagation disabled.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
- </figure>
- <para>Building the process with the process factory:
- </para>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
- .compositeNode("composite")
- <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
- .listener(new DisplaySource())
- .propagationDisabled()</emphasis>
- .node("a").initial().behaviour(new WaitState())
- .transition().to("b")
- .node("b").behaviour(new WaitState())
- .transition().to("c")
- .nodesEnd()
- .node("c").behaviour(new WaitState())
-.done();</programlisting>
- <para>So when the first signal is given for this process, again the node-leave event will be
- fired on node a, but now the listener on the composite node will not be executed cause
- propagated events have been disabled. Disabling propagation is a property on the listener
- and doesn't influence the other listeners. The event will always be fired and propagated
- over the whole parent hierarchy.
- </para>
- <programlisting>Execution execution = processDefinition.startExecution();
-execution.signal();
-</programlisting>
- <para>Next, the second signal will take the transition from b to c.
- </para>
- <programlisting>execution.signal()</programlisting>
- <para>Again two node-leave
- events are fired just like above on nodes b and composite respectively. The first event
- is the node-leave event on node b. That will be propagated to the composite node. So the
- listener will not be executed for this event cause it has propagation disabled. But the
- listener will be executed for the node-leave event on the composite node. That is not
- propagated, but fired directly on the composite node. So the listener will now be executed
- only once for the composite node as shown in the following console output:
- </para>
- <programlisting>leaving node(composite)</programlisting>
- </section>
-
- <!-- ### PROCESS STRUCTURE ############################################## -->
- <section>
- <title>Process structure</title>
- <para>Above we already touched briefly on the two main process constructs:
- Nodes, transitions and node composition. This section will elaborate
- on all the basic combination possibilities.
- </para>
- <figure id="process.structure">
- <title>UML class diagram of the basic process structure</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.structure.classes.png"/></imageobject></mediaobject>
- </figure>
- <para>Next is a series of example diagram structures that can be formed
- with the PVM process model.
- </para>
- <figure id="transition">
- <title>Any two nodes can be connected with a transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="self.transition">
- <title>A self transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="composite.node">
- <title>Composite node is a list of nested nodes.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.into.composite">
- <title>Transition to a node inside a composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.out.of.composite">
- <title>Transition from a node inside a composite to a node outside the composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.inheritence">
- <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.outer">
- <title>Transition from a node to an outer composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.inner">
- <title>Transition from a composite node to an inner composed node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
- </figure>
- <figure id="initial.in.composite">
- <title>An initial node inside a composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
- </figure>
- </section>
-
-</chapter>
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-ImplementingBasicActivities.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,576 @@
+<chapter id="implementingbasicactivities">
+ <title>Implementing basic activities</title>
+
+ <para>This chapter explains the basics of process definitions, the features offered by
+ the Process Virtual Machine and how activity implementations can be build. At the same
+ time the client API is shown to execute processes with those activity implementations.
+ </para>
+
+ <!-- ### Activity ####################################################### -->
+ <section id="activity">
+ <title>Activity</title>
+ <para>The PVM library doesn't have a fixed set of process constructs.
+ Instead, runtime behaviour of a node is delegated to an <literal>Activity</literal>.
+ In other words, <literal>Activity</literal> is an interface to implement the runtime
+ behaviour of process constructs in plain Java.
+ </para>
+ <programlisting>public <emphasis role="bold">interface Activity</emphasis> extends Serializable {
+
+ void <emphasis role="bold">execute</emphasis>(ActivityExecution execution) throws Exception;
+
+}</programlisting>
+ <para>When an activity is used as the node behaviour, it is in full control of the further
+ propagation of the execution. In other words, a node behaviour can decide what the execution
+ should do next. For example, it can take a transition with
+ <literal>execution.take(Transition)</literal> or go into a wait state with
+ <literal>execution.waitForSignal()</literal>. In case the node behaviour does not invoke
+ any of the above execution propagation methods, the execution will
+ <link linkend="implicitproceedbehaviour">proceed in a default way</link>.
+ </para>
+ </section>
+
+ <!-- ### Activity example ############################################### -->
+ <section id="activityexample">
+ <title>Activity example</title>
+ <para>We'll start with a very original hello world example. A Display
+ activity will print a message to the console:
+ </para>
+ <programlisting>public <emphasis role="bold">class Display</emphasis> implements <emphasis role="bold">Activity</emphasis> {
+
+ String message;
+
+ public Display(String message) {
+ this.message = message;
+ }
+
+ public void execute(ActivityExecution execution) {
+ <emphasis role="bold">System.out.println(message);</emphasis>
+ }
+}</programlisting>
+ <para>Let' build our first process definition with this activity:</para>
+ <figure id="activity.example">
+ <title>Display example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.ab.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ClientProcessDefinition processDefinition = ProcessFactory.build()
+ .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new Display("hello")</emphasis>)
+ .transition().to("b")
+ .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new Display("world")</emphasis>)
+.done();</programlisting>
+ <para>Now we can execute this process as follows:</para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>The invocation of <literal>startExecution</literal> will print hello world to the console:</para>
+ <programlisting>hello
+world</programlisting>
+ <para>One thing already worth noticing is that activities can be configured
+ with properties. In the Display example, you can see that the message property
+ is configured differently in the two usages. With configuration properties
+ it becomes possible to write reusable activities. They can then be configured
+ differently each time they are used in a process. That is an essential part of
+ how process languages can be build on top of the Process Virtual Machine.
+ </para>
+ <para>The other part that needs explanation is that this activity
+ implementation does not contain any instructions for the propagation of the
+ execution. When a new process instance is started, the execution is positioned
+ in the initial node and that activity is executed. The method
+ <literal>Display.execute</literal> makes use of what is called implicit propagation
+ of execution. Concretely this means that the activity itself does not
+ invoke any of the methods on the execution to propagate it. In that case
+ implicit propagation kicks in. Implicit propagation will take the first
+ transition if there is one. If not, it will end the execution. This explains
+ why both nodes <literal>a</literal> and <literal>b</literal> are executed and that
+ the execution stops after node <literal>b</literal> is executed.
+ </para>
+ <para>More details about the implicit proceed behaviour can be found
+ in <xref linkend="implicitproceedbehaviour" /></para>
+ </section>
+
+ <!-- ### ExternalActivity ############################################### -->
+ <section id="externalactivity">
+ <title>ExternalActivity</title>
+ <para>External activities are activities for which the responsibility for proceeding
+ the execution is transferred externally, meaning outside the process system. This
+ means that for the system that is executing the process, it's a wait state. The
+ execution will wait until an external trigger is given.
+ </para>
+ <para>For dealing with external triggers, <literal>ExternalActivity</literal>
+ adds two methods to the <literal>Activity</literal>:</para>
+ <programlisting>public <emphasis role="bold">interface ExternalActivity</emphasis> extends <emphasis role="bold">Activity</emphasis> {
+
+ void <emphasis role="bold">signal</emphasis>(Execution execution,
+ String signal,
+ Map<String, Object> parameters) throws Exception;
+
+}</programlisting>
+ <para>Just like with plain activities, when an execution arrives in a node, the
+ <literal>execute</literal>-method of the node behaviour is invoked.
+ In external activities, the execute method typically does something to
+ transfer the responsibility to another system and then enters a wait
+ state by invoking <literal>execution.waitForSignal()</literal>. For
+ example in the execute method, responsibility could be transferred to a
+ person by creating a task entry in a task management system and then
+ wait until the person completes the task.
+ </para>
+ <para>In case a node behaves as a wait state, then the execution will
+ wait in that node until the execution's <literal>signal</literal> method
+ is invoked. The execution will delegate that signal to the behaviour Activity
+ of the current node.
+ </para>
+ <para>So the Activity's <literal>signal</literal>-method is invoked
+ when the execution receives an external trigger during the wait state. With the
+ signal method, responsibility is transferred back to the process execution. For
+ example, when a person completes a task, the task management system calls the
+ signal method on the execution.
+ </para>
+ <para>A signal can optionally have a signal name and a map of parameters. Most
+ common way on how node behaviours interprete the signal and parameters is that
+ the signal relates to the outgoing transition that needs to be taken and that the
+ parameters are set as variables on the execution. But those are just examples, it
+ is up to the activity to use the signal and the parameters as it pleases.
+ </para>
+ </section>
+
+ <!-- ### ExternalActivity example ####################################### -->
+ <section id="externalactivityexample">
+ <title>ExternalActivity example</title>
+ <para>Here's a first example of a simple wait state implementation:
+ </para>
+ <programlisting>public <emphasis role="bold">class WaitState</emphasis> implements <emphasis role="bold">ExternalActivity</emphasis> {
+
+ public void execute(ActivityExecution execution) {
+ <emphasis role="bold">execution.waitForSignal();</emphasis>
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, Object> parameters) {
+ <emphasis role="bold">execution.take(signalName);</emphasis>
+ }
+}</programlisting>
+ <para>The <literal>execute</literal>-method calls
+ <literal>execution.waitForSignal()</literal>. The invocation of
+ <literal>execution.waitForSignal()</literal> will bring the process execution
+ into a wait state until an external trigger is given.
+ </para>
+ <para><literal>signal</literal>-method takes the transition with
+ the signal parameter as the transition name. So when an execution receives an
+ external trigger, the signal name is interpreted as the name of an outgoing
+ transition and the execution will be propagated over that transition.
+ </para>
+ <para>Here's the same simple process that has a transition from a to b. This
+ time, the behaviour of the two nodes will be WaitState's.
+ </para>
+ <figure id="process.diagram">
+ <title>The external activity example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.ab.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ClientProcessDefinition processDefinition = ProcessFactory.build()
+ <emphasis role="bold">.node("a").initial().behaviour(new WaitState())</emphasis>
+ .transition().to("b")
+ <emphasis role="bold">.node("b").behaviour(new WaitState())</emphasis>
+.done();</programlisting>
+ <para>Let's start a new process instance for this process definition:</para>
+ <programlisting>ClientExecution execution = processDefinition.startProcessInstance();</programlisting>
+ <para>Starting this process will execute the <literal>WaitState</literal> activity
+ in node <literal>a</literal>. <literal>WaitState.execute</literal> will invoke
+ <literal>ActivityExecution.waitForSignal</literal>. So when the
+ <literal>processDefinition.startProcessInstance()</literal> returns, the execution
+ will still be positioned in node a.
+ </para>
+ <programlisting>assertEquals("a", execution.getNodeName());</programlisting>
+ <para>Then we provide the external trigger by calling the <literal>signal</literal>
+ method.
+ </para>
+ <programlisting>execution.signal();</programlisting>
+ <para>The <literal>execution.signal()</literal> will delegate to the activity
+ of the current node. So in this case that is the <literal>WaitState</literal>
+ activity in node <literal>a</literal>. The <literal>WaitState.signal</literal>
+ will invoke the <literal>ActivityExecution.take(String transitionName)</literal>.
+ Since we didn't supply a signalName, the first transition with name <literal>null</literal>
+ will be taken. The only transition we specified out of node <literal>a</literal>
+ didn't get a name so that one will be taken. And that transition points to node
+ <literal>b</literal>. When the execution arrives in node <literal>b</literal>,
+ the <literal>WaitState</literal> in node <literal>b</literal> is executed.
+ Similar as we saw above, the execution will wait in node <literal>b</literal>
+ and this time the <literal>signal</literal> method will return, leaving the
+ execution positioned in node <literal>b</literal>.
+ </para>
+ <programlisting>assertEquals("b", execution.getNodeName());</programlisting>
+ </section>
+
+ <!-- ### BASIC PROCESS EXECUTION ######################################## -->
+ <section id="basicprocessexecution">
+ <title>Basic process execution</title>
+ <para>In this next example, we'll combine automatic activities and wait states.
+ This example builds upon the loan approval process with the <literal>WaitState</literal>
+ and <literal>Display</literal> activities that we've just created. Graphically,
+ the loan process looks like this:
+ </para>
+ <figure id="basicprocessexecution.loan.process">
+ <title>The loan process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.loan.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Building process graphs in Java code can be tedious because you have to keep track of all the
+ references in local variables. To resolve that, the Process Virtual Machine comes with a
+ ProcessFactory. The ProcessFactory is a kind of domain specific language (DSL) that is embedded
+ in Java and eases the construction of process graphs. This pattern is also known as
+ a <ulink url="http://martinfowler.com/bliki/FluentInterface.html">fluent
+ interface</ulink>.
+ </para>
+ <programlisting>ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
+ .node(<emphasis role="bold">"submit loan request"</emphasis>).initial().behaviour(new Display("loan request submitted"))
+ .transition().to("evaluate")
+ <emphasis role="bold">.node("evaluate").behaviour(new WaitState())</emphasis>
+ .transition("approve").to("wire money")
+ .transition("reject").to("end")
+ <emphasis role="bold">.node("wire money").behaviour(new Display("wire the money"))</emphasis>
+ .transition().to("archive")
+ <emphasis role="bold">.node("archive").behaviour(new WaitState())</emphasis>
+ .transition().to("end")
+ <emphasis role="bold">.node("end").behaviour(new WaitState())</emphasis>
+.done();</programlisting>
+ <para>For more details about the ProcessFactory, see <ulink url="../../api/org/jbpm/pvm/package-summary.html">the
+ api docs</ulink>. An alternative for
+ the ProcessFactory would be to create an XML language and an XML parser for expressing
+ processes. The XML parser can then instantiate the classes of package
+ <literal>org.jbpm.pvm.internal.model</literal> directly. That approach is typically taken by
+ process languages.
+ </para>
+ <para>The initial node <literal>submit loan request</literal> and the node
+ <literal>wire the money</literal> are automatic nodes. In this example,
+ the <literal>Display</literal> implementation of node
+ <literal>wire the money</literal> uses the Java API's to just print a
+ message to the console. But the witty reader can imagine an alternative
+ <literal>Activity</literal> implementation that uses the Java API of a payment
+ processing library to make a real automatic payment.
+ </para>
+ <para>A new execution for the process above can be started like this
+ </para>
+ <programlisting>ClientExecution execution = processDefinition.startProcessInstance();</programlisting>
+ <para>When the <literal>startExecution</literal>-method returns, the node
+ <literal>submit loan request</literal> will be executed and the execution will be
+ positioned in the node <literal>evaluate</literal>.
+ </para>
+ <figure id="execution.loan.evaluate">
+ <title>Execution positioned in the 'evaluate' node</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.loan.evaluate.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Now, the execution is at an interesting point. There are two transitions out of
+ the state <literal>evaluate</literal>. One transition is called <literal>approve</literal>
+ and one transition is called <literal>reject</literal>. As we explained above, the WaitState
+ implementation will take the transition that corresponds to the signal that is given.
+ Let's feed in the 'approve' signal like this:
+ </para>
+ <programlisting>execution.signal("approve");</programlisting>
+ <para>The <literal>approve</literal> signal will cause the execution to take the <literal>approve</literal>
+ transition and it will arrive in the node <literal>wire money</literal>.
+ </para>
+ <para>In node <literal>wire money</literal>, the message will be printed to the console.
+ Since, the <literal>Display</literal> activity didn't invoke the
+ <literal>execution.waitForSignal()</literal>, nor any of the other execution propagation
+ methods, the implicit proceed behaviour will just make the execution continue
+ over the outgoing transition to node <literal>archive</literal>, which is again
+ a <literal>WaitState</literal>.
+ </para>
+ <figure id="execution.loan.archive">
+ <title>Execution positioned in 'archive' node</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.loan.archive.png"/></imageobject></mediaobject>
+ </figure>
+ <para>So only when the <literal>archive</literal> wait state is reached,
+ the <literal>signal("approve")</literal> returns.
+ </para>
+ <para>Another signal like this:</para>
+ <programlisting>execution.signal("approve");</programlisting>
+ <para>will bring the execution eventually in the end state.</para>
+ <figure id="execution.loan.end">
+ <title>Execution positioned in the 'end' node</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.loan.end.png"/></imageobject></mediaobject>
+ </figure>
+ </section>
+
+ <!-- ### MOTIVATION ##################################################### -->
+ <section id="motivation">
+ <title>Motivation</title>
+ <para>There are basically two forms of process languages: graph based and composite
+ process languages. First of all, this design supports both. Even graph based execution
+ and node composition can be used in combination to implement something like UML super states.
+ </para>
+ <para>In this design, control flow activity implementations will have to be
+ aware of whether they are dependent on transitions (graph based) or whether they are
+ using the composite node structure. The goal of this design is that all non-control
+ flow activities can be implemented in the same way so that you can use them in graph
+ based process languages as well as in composite process languages.
+ </para>
+ </section>
+
+ <!-- ### EVENTS ######################################################### -->
+ <section id="events">
+ <title>Events</title>
+ <para>Events are points in the process definition to which a list of
+ activities can be subscribed as listeners. The motivation for events is to allow for
+ developers to add programming logic to a process without changing the process diagram.
+ This is a very valuable instrument in
+ facilitating the collaboration between business analysts and developers. Business analysts
+ are responsible for expressing the requirements. When they use a process graph to document
+ those requirements, developers can take this diagram and make it executable. Events can
+ be a very handy to insert technical details into a process (like e.g. some database insert)
+ in which the business analyst is not interested.
+ </para>
+ <para>Most common events are fired by the execution automatically:
+ </para>
+ <itemizedlist>
+ <listitem><literal>Transition.EVENT_TRANSITION_TAKE = "transition-take"</literal> :
+ fired on transitions when transitions are taken.
+ </listitem>
+ <listitem><literal>Node.EVENT_NODE_ENTER = "node-enter"</literal> : fired on the node
+ when execution enters that node. This happens when execution takes a transition
+ to that node, when a child node is being executed with <literal>execution.execute(Node)</literal>
+ or when a transition is taken from a node outside that node to a contained node.
+ The latter refers to super states in state machines.
+ </listitem>
+ <listitem><literal>Node.EVENT_NODE_LEAVE = "node-leave"</literal> : fired on the node
+ when a transition is taken out of that node or when a child node execution is
+ finished and the execution is propagated to the parent node.
+ </listitem>
+ <listitem><literal>ProcessDefinition.EVENT_PROCESS_START = "process-start"</literal> : fired on a process
+ when a new process is started.
+ </listitem>
+ <listitem><literal>ProcessDefinition.EVENT_PROCESS_END = "process-end"</literal> : fired on a process
+ when a new process is ended. This might include a executions that are ended
+ with a cancelled or error state.
+ </listitem>
+ </itemizedlist>
+ <para>Events are identified by the combination of a process element
+ and an event name. Users and process languages can also fire events
+ programmatically with the fire method on the Execution:
+ </para>
+ <programlisting>public interface Execution extends Serializable {
+ ...
+ void fire(String eventName, ProcessElement eventSource);
+ ...
+}</programlisting>
+
+ <para>A list of <link linkend="activity"><literal>Activity</literal>s</link> can be associated to an
+ event. But activities on events can not influence the control flow of the execution since
+ they are merely listeners to an execution wich is already in progress. This is different from
+ activities that serve as the behaviour for nodes. Node behaviour activities are responsible
+ for propagating the execution. So if an activity in an event invokes any of the
+ following methods, then it will result in an exception.
+ </para>
+
+ <itemizedlist>
+ <listitem><literal>waitForSignal()</literal></listitem>
+ <listitem><literal>take(Transition)</literal></listitem>
+ <listitem><literal>end(*)</literal></listitem>
+ <listitem><literal>execute(Node)</literal></listitem>
+ </itemizedlist>
+
+ <para>We'll reuse the <literal><link linkend="activity">Display</link></literal>
+ activity from above in a simple process: two nodes connected by a
+ transition. The Display listener will be subscribed to the transition event.</para>
+ <figure id="action.process">
+ <title>The process to which a listener activity will be associated</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new WaitState())
+ <emphasis role="bold">.event("node-leave")
+ .listener(new Display("leaving a"))
+ .listener(new Display("second message while leaving a"))</emphasis>
+ .transition().to("b")
+ <emphasis role="bold">.listener(new Display("taking transition"))</emphasis>
+ .node("b").behaviour(new WaitState())
+ <emphasis role="bold">.event("node-enter")
+ .listener(new Display("entering b"))</emphasis>
+.done();</programlisting>
+ <para>The first event shows how to register multiple listeners to the same
+ event. They will be notified in the order as they are specified.
+ </para>
+ <para>Then, on the transition, there is only one type of event. So in that case,
+ the event type must not be specified and the listeners can be added directly on
+ the transition.
+ </para>
+ <para>A listeners will be called each time an execution fires the event to
+ which the listener is subscribed. The execution will be provided in the activity
+ interface as a parameter and can be used by listeners except for the methods that
+ control the propagation of execution.
+ </para>
+ </section>
+
+ <!-- ### EVENT PROPAGATION ############################################## -->
+ <section>
+ <title>Event propagation</title>
+ <para>Events are by default propagated to enclosing process elements. The motivation
+ is to allow for listeners on process definitions or composite nodes that get executed
+ for all events that occur within that process element. For example this feature
+ allows to register a listener on a process definition or a composite node on
+ <literal>node-leave</literal> events. Such action will be executed if that node is
+ left. And if that listener is registered on a composite node, it will also be executed
+ for all nodes that are left within that composite node.
+ </para>
+ <para>To show this clearly, we'll create a <literal>DisplaySource</literal> activity
+ that will print the message <literal>leaving</literal> and the source of the event
+ to the console.
+ </para>
+ <programlisting>public class <emphasis role="bold">DisplaySource</emphasis> implements Activity {
+
+ public void execute(Execution execution) {
+ <emphasis role="bold">System.out.println("leaving "+execution.getEventSource());</emphasis>
+ }
+}</programlisting>
+ <para>Note that the purpose of event listeners is not to be visible, that's why the activity
+ itself should not be displayed in the diagram. A <literal>DisplaySource</literal> activity
+ will be added as a listener to the event <literal>node-leave</literal> on the composite node.
+ </para>
+ <para>The next process shows how the <literal>DisplaySource</literal> activity is registered
+ as a listener to to the 'node-leave' event on the <literal>composite</literal> node:</para>
+ <figure id="propagation.process">
+ <title>A process with an invisible activity on a node-leave event on a composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
+ .compositeNode("composite")
+ <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
+ .listener(new DisplaySource())</emphasis>
+ .node("a").initial().behaviour(new WaitState())
+ .transition().to("b")
+ .node("b").behaviour(new WaitState())
+ .transition().to("c")
+ .compositeEnd()
+ .node("c").behaviour(new WaitState())
+.done();</programlisting>
+ <para>Next we'll start an execution.</para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>After starting a new execution, the execution will be in node <literal>a</literal> as
+ that is the initial node. No nodes have been left so no message is logged. Next a signal
+ will be given to the execution, causing it to take the transition from <literal>a</literal>
+ to <literal>b</literal>.
+ </para>
+ <programlisting>execution.signal();</programlisting>
+ <para>When the signal method returns, the execution will have taken the transition and
+ the node-leave event will be fired on node a. That event will be propagated to the
+ composite node and to the process definition. Since our propagation logger is placed
+ on node composite it will receive the event and print the following message:
+ </para>
+ <programlisting>leaving node(a)</programlisting>
+ <para>Another</para>
+ <programlisting>execution.signal();</programlisting>
+ <para>will take the transition from b to c. That will fire two node-leave events. One on
+ node b and one on node composite. So the following lines will be appended to the console
+ output:</para>
+ <programlisting>leaving node(b)
+leaving node(composite)</programlisting>
+ <para>Event propagation is build on the hierarchical composition structure of the process
+ definition. The top level element is always the process definition. The process
+ definition contains a list of nodes. Each node can be a leaf node or it can be a
+ composite node, which means that it contains a list of nested nodes. Nested nodes
+ can be used for e.g. super states or composite activities in nested process languages like BPEL.
+ </para>
+ <para>So the even model also works similarly for composite nodes as it did for the process
+ definition above. Suppose that 'Phase one' models
+ a super state as in state machines. Then event propagation allows to subscribe to all events
+ within that super state. The idea is that the hierarchical composition corresponds to
+ diagram representation. If an element 'e' is drawn inside another element 'p', then p
+ is the parent of e. A process definition has a set of top level nodes. Every node can have
+ a set of nested nodes. The parent of a transition is considered as the first common
+ parent for it's source and destination.
+ </para>
+ <para>If an event listener is not interested in propagated events, propagation can be disabled
+ with <literal>propagationDisabled()</literal>. The next process is the same process
+ as above except that propagated events will be disabled on the event listener. The graph diagram
+ remains the same.
+ </para>
+ <figure id="propagation.disabled.process">
+ <title>A process with a listener to 'node-leave' events with propagation disabled.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Building the process with the process factory:
+ </para>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
+ .compositeNode("composite")
+ <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
+ .listener(new DisplaySource())
+ .propagationDisabled()</emphasis>
+ .node("a").initial().behaviour(new WaitState())
+ .transition().to("b")
+ .node("b").behaviour(new WaitState())
+ .transition().to("c")
+ .nodesEnd()
+ .node("c").behaviour(new WaitState())
+.done();</programlisting>
+ <para>So when the first signal is given for this process, again the node-leave event will be
+ fired on node a, but now the listener on the composite node will not be executed cause
+ propagated events have been disabled. Disabling propagation is a property on the listener
+ and doesn't influence the other listeners. The event will always be fired and propagated
+ over the whole parent hierarchy.
+ </para>
+ <programlisting>Execution execution = processDefinition.startExecution();
+execution.signal();
+</programlisting>
+ <para>Next, the second signal will take the transition from b to c.
+ </para>
+ <programlisting>execution.signal()</programlisting>
+ <para>Again two node-leave
+ events are fired just like above on nodes b and composite respectively. The first event
+ is the node-leave event on node b. That will be propagated to the composite node. So the
+ listener will not be executed for this event cause it has propagation disabled. But the
+ listener will be executed for the node-leave event on the composite node. That is not
+ propagated, but fired directly on the composite node. So the listener will now be executed
+ only once for the composite node as shown in the following console output:
+ </para>
+ <programlisting>leaving node(composite)</programlisting>
+ </section>
+
+ <!-- ### PROCESS STRUCTURE ############################################## -->
+ <section>
+ <title>Process structure</title>
+ <para>Above we already touched briefly on the two main process constructs:
+ Nodes, transitions and node composition. This section will elaborate
+ on all the basic combination possibilities.
+ </para>
+ <figure id="process.structure">
+ <title>UML class diagram of the basic process structure</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.structure.classes.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Next is a series of example diagram structures that can be formed
+ with the PVM process model.
+ </para>
+ <figure id="transition">
+ <title>Any two nodes can be connected with a transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="self.transition">
+ <title>A self transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="composite.node">
+ <title>Composite node is a list of nested nodes.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.into.composite">
+ <title>Transition to a node inside a composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.out.of.composite">
+ <title>Transition from a node inside a composite to a node outside the composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.inheritence">
+ <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.outer">
+ <title>Transition from a node to an outer composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.inner">
+ <title>Transition from a composite node to an inner composed node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="initial.in.composite">
+ <title>An initial node inside a composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
+ </figure>
+ </section>
+
+</chapter>
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch05-ProcessAnatomy.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,4 @@
+<chapter id="timers">
+ <title>Timers</title>
+ <para>TODO</para>
+</chapter>
\ No newline at end of file
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch06-ImplementingAdvancedActivities.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch06-ImplementingAdvancedActivities.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch06-ImplementingAdvancedActivities.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,323 @@
+<chapter id="advancedgraphexecution">
+ <title>Advanced graph execution</title>
+
+ <!-- ### LOOPS ########################################################## -->
+ <section>
+ <title>Loops</title>
+ <para>Loops can be based on transitions or on node composition. Loops can contain wait
+ states.
+ </para>
+ <para>To support high numbers of automatic loop executions, the Process Virtual Machine
+ tranformed the propagation of execution from tail recursion to a while loop. This means
+ that all the methods in the <literal>Execution</literal> class that propagate the
+ execution like <literal>take</literal> or <literal>execute</literal> will not be
+ executed when you call them. Instead, the method invocations will be appended to a list.
+ The first invocation of such a method will start a loop that will execute all invocations
+ till that list is empty. These invocations are called atomic operations.
+ </para>
+ </section>
+
+ <!-- ### SUB PROCESSES ################################################## -->
+ <section>
+ <title>Sub processes</title>
+ <para>TODO: sub processes</para>
+ </section>
+
+ <!-- ### DEFAULT PROCEED BEHAVIOUR ###################################### -->
+ <section id="implicitproceedbehaviour">
+ <title>Implicit proceed behaviour</title>
+ <para>When an <literal>Activity</literal> is used as node behaviour, it can
+ explicitely propagate the execution with following methods:
+ </para>
+ <itemizedlist>
+ <listitem><literal>waitForSignal()</literal></listitem>
+ <listitem><literal>take(Transition)</literal></listitem>
+ <listitem><literal>end(*)</literal></listitem>
+ <listitem><literal>execute(Node)</literal></listitem>
+ <listitem><literal>createExecution(*)</literal></listitem>
+ </itemizedlist>
+ <para>When <literal>Activity</literal> implementations used for node behviour
+ don't call any of the following execution propagation methods, then, after
+ the activity is executed, the execution will apply the implicit proceed behaviour.
+ </para>
+ <para>The implicit proceed behaviour is defined as follows:</para>
+ <itemizedlist>
+ <listitem>If the current node has a default outgoing transition, take it.</listitem>
+ <listitem>If the current node has a parent node, move back to the parent node.</listitem>
+ <listitem>Otherwise, end this execution.</listitem>
+ </itemizedlist>
+ <para>Process languages can overwrite the implicit proceed behaviour
+ by overriding the <literal>proceed</literal> method in
+ <literal>ExecutionImpl</literal>.
+ </para>
+ </section>
+
+ <!-- ### FUNCTIONAL ACTIVITIES ################################ -->
+ <section id="functionalactivities">
+ <title>Functional activities</title>
+ <para>Activities that also can be used as event listeners are called functional
+ activities. Examples of automatic activities are sending an email, doing a database
+ update, generating a pdf, calculating an average, etc. All of these are automatic
+ activities that do not change the execution flow. Here's how such activities can
+ be implemented:
+ </para>
+ <programlisting>public class FunctionalActivity implements Activity, EventListener {
+ public void execute(ActivityExecution execution) {
+ perform(execution);
+ }
+ public void notify(EventListenerExecution execution) {
+ perform(execution);
+ }
+ void perform(OpenExecution execution) {
+ ...do functional work...
+ }
+ }</programlisting>
+ <para>None of these methods actually invoke execution propagation methods.
+ So after the perform method is completed, the execution will
+ <link linkend="implicitproceedbehaviour">proceed in the default way</link>.
+ </para>
+ </section>
+
+
+ <!-- ### EXECUTION AND THREADS ########################################## -->
+ <section id="executionandthreads">
+ <title>Execution and threads</title>
+ <para>This section explains how the Process Virtual Machine boroughs the thread
+ from the client to bring an execution from one wait state to another.
+ </para>
+ <para>When a client invokes a method (like e.g. the signal method) on an execution,
+ by default, the Process Virtual Machine will use that thread to progress the execution
+ until it reached a wait state. Once the next wait state has been reached, the
+ method returns and the client gets the thread back. This is the default way
+ for the Process Virtual Machine to operate. Two more levels of asynchonous
+ execution complement this default behaviour:
+ <link linkend="asynchronouscontinuations">Asynchronous continuations</link>
+ and the <link linkend="architecture">asynchronous command service</link>.
+ </para>
+ <para>The next process will show the basics concretely. It has three wait states
+ and four automatic nodes.
+ </para>
+ <figure id="automatic">
+ <title>Process with many sequential automatic activities.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Here's how to build the process:</para>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("automatic")
+ .<emphasis role="bold">node("wait 1").initial()</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
+ .transition().to("automatic 1")
+ .<emphasis role="bold">node("automatic 1")</emphasis>.behaviour(new <emphasis role="bold">Display("one")</emphasis>)
+ .transition().to("wait 2")
+ .<emphasis role="bold">node("wait 2")</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
+ .transition().to("automatic 2")
+ .<emphasis role="bold">node("automatic 2")</emphasis>.behaviour(new <emphasis role="bold">Display("two")</emphasis>)
+ .transition().to("automatic 3")
+ .<emphasis role="bold">node("automatic 3")</emphasis>.behaviour(new <emphasis role="bold">Display("three")</emphasis>)
+ .transition().to("automatic 4")
+ .<emphasis role="bold">node("automatic 4")</emphasis>.behaviour(new <emphasis role="bold">Display("four")</emphasis>)
+ .transition().to("wait 3")
+ .<emphasis role="bold">node("wait 3")</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
+.done();</programlisting>
+ <para>Let's walk you through one execution of this process.
+ </para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>Starting a new execution means that the initial node is executed. So if an automatic
+ activity would be configured as the behaviour in the initial node, the process will start executing
+ immediatly in the startExecution. In this case however, the initial node is a wait state. So
+ the startExecution method returns immediately and the execution will be positioned in the initial
+ node 'wait 1'.
+ </para>
+ <figure id="automatic.wait1">
+ <title>A new execution will be positioned in 'wait 1'.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait1.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Then an external trigger is given with the signal method.</para>
+ <programlisting>execution.signal();</programlisting>
+ <para>As explained above when introducing the WaitState, that signal will cause the default transition to be taken. The
+ transition will move the execution to node <literal>automatic 1</literal> and execute it. The execute method
+ of the <literal>Display</literal> activity in <literal>automatic 1</literal> print a line to the console and it
+ will <emphasis role="bold">not</emphasis> call <literal>execution.waitForSignal()</literal>. Therefore, the execution
+ will proceed by taking the default transition out of <literal>automatic 1</literal>. The signal method is still blocking
+ cause this action and the transitions are taken
+ by that same thread. Then the execution arrives in <literal>wait 2</literal> and executes the <literal>WaitState</literal>
+ activity. That method will invoke the <literal>execution.waitForSignal()</literal>, which will cause the signal method
+ to return. That is when the thread is given back to the client that invoked the signal method.
+ </para>
+ <para>So when the signal method returns, the execution is positioned in <literal>wait 2</literal>.</para>
+ <figure id="automatic.wait2">
+ <title>One signal brought the execution from 'initial' to 'wait 2'.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait2.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Then the execution is now waiting for an external trigger just as an object (more precisely an object graph) in
+ memory until the next external trigger is given with the signal method.
+ </para>
+ <programlisting>execution.signal();</programlisting>
+ <para>This second invocation of signal will take the execution similarly all the way to <literal>wait 3</literal> before
+ it returns.
+ </para>
+ <figure id="automatic.wait3">
+ <title>The second signal brought the execution all the way to 'wait 3'.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait3.png"/></imageobject></mediaobject>
+ </figure>
+ <para>To make executable processes, developers need to know exactly what the automatic activities,
+ what the wait states are and which threads will be allocated to the process execution. For business
+ analysts that draw the analysis process, things are a bit simpler. For the
+ activities they draw, they usually know whether it's a human or a system that is responsible.
+ But they typically don't not how this translates to threads and transactions.
+ </para>
+ <para>So for the developer, the first job is to analyse what needs to be executed
+ within the thread of control of the process and what is outside. Looking for the external
+ triggers can be a good start to find the wait states in a process, just like verbs and nouns
+ can be the rule of thumb in building UML class diagrams.
+ </para>
+ </section>
+
+ <!-- ### PROCESS CONCURRENCY ############################################ -->
+ <section>
+ <title>Process concurrency</title>
+ <para>To model process concurrency, there is a parent-child tree structure on the
+ execution. The idea is that the main path of execution is the root of that tree.
+ This implies that on the level of the Process Virtual Machine, there is no differentiation
+ between complete process instances and paths of execution within a process instance.
+ One of the main motivations for this design is that the API actually is not made more
+ complex then necessary for simple processes with only one single path of execution.
+ </para>
+ <figure id="execution.structure">
+ <title>UML class diagram of the basic execution structure</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.execution.structure.classes.png"/></imageobject></mediaobject>
+ </figure>
+ <para>To extablish multiple concurrent paths of execution, child executions can be
+ created. Only leaf executions can be active. Non-leave executions should be
+ inactive. This tree structure of executions doesn't enforce a particular type of
+ concurrency or join behaviour. It's up to the forks or and-splits and to the joins
+ or and-merges to use the execution tree structure in any way they want to define
+ the wanted concurrency behaviour. Here you see an example
+ of concurrent executions.
+ </para>
+ <figure id="concurrency">
+ <title>Concurrent paths of execution</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.concurrency.png"/></imageobject></mediaobject>
+ </figure>
+ <para>There is a billing and a shipping path of execution. In this case, the
+ flat bar nodes represent nodes that fork and join. The execution shows a three
+ executions. The main path of execution is inactive (represented as gray) and the
+ billing and shipping paths of execution are active and point to the node
+ <literal>bill</literal> and <literal>ship</literal> respectively.
+ </para>
+ <para>It's up to the node behaviour implementations how they want to use this
+ execution structure. Suppose that multiple tasks have to be completed before the
+ execution is to proceed. The node behaviour can spawn a series of child executions
+ for this. Or alternatively, the task component could support task groups that
+ are associated to one single execution. In that case, the task component becomes
+ responsible for synchronizing the tasks, thereby moving this responsibility
+ outside the scope of the execution tree structure.
+ </para>
+ </section>
+
+ <!-- ### EXCEPTION HANDLERS ############################################# -->
+ <section>
+ <title>Exception handlers</title>
+ <para>In all the <link linkend="delegationclasses">code that is associated to a process</link>
+ like Activity's, Actions and Conditions, it's possible to include try-catch blocks in
+ the method implementations to handle exceptions. But in order to build more reusable building
+ blocks for both the delegation classes and the exception handling logic, exception handlers are
+ added to the core process model.
+ </para>
+ <para>An exception handler can be associated to any process element. When an exception
+ occurs in a delegation class, a matching exception handler will be searched for. If
+ such an exception handler is found, it will get a chance to handle the exception.
+ </para>
+ <para>If an exception handler completes without problems, then the exception is considered
+ handled and the execution resumes right after the delegation code that was called. For example,
+ a transition has three actions and the second action throws an exception that is handled
+ by an exception handler, then
+ </para>
+ <para>Writing automatic activities that are exception handler aware is easy. The
+ default is to proceed anyway. No method needs to be called on the execution. So
+ if an automatic activity throws an exception that is handled by an exception handler,
+ the execution will just proceed after that activity. It becomes a big more difficult
+ for control flow activities. They might have to include try-finally blocks to
+ invoke the proper methods on the execution before an exception handler gets a
+ chance to handle the exception. For example, if an activity is a wait state and
+ an exception occurs, then there is a risk that the thread jumps over the
+ invocation of <literal>execution.waitForSignal()</literal>, causing the execution
+ to proceed after the activity.
+ </para>
+ <para>TODO: exceptionhandler.isRethrowMasked</para>
+ <para>TODO: transactional exception handlers</para>
+ <para>TODO: we never catch errors</para>
+ </section>
+
+ <!-- ### PROCESS MODIFICATIONS ########################################## -->
+ <section>
+ <title>Process modifications</title>
+ <para>TODO: process modifications</para>
+ </section>
+
+ <!-- ### LOCKING AND EXECUTION STATE #################################### -->
+ <section>
+ <title>Locking and execution state</title>
+ <para>The state of an execution is either active or locked. An active
+ execution is either executing or waiting for an external trigger. If an
+ execution is not in STATE_ACTIVE, then it is locked. A locked execution
+ is read only.
+ </para>
+ <para>When a new execution is created, it is in STATE_ACTIVE. To change
+ the state to a locked state, use lock(String). Some STATE_* constants
+ are provided that represent the most commonly used locked states. But
+ the state '...' in the picture indicates that any string can be provided
+ as the state in the lock method.
+ </para>
+ <figure id="execution.states">
+ <title>States of an execution</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.execution.states.png"/></imageobject></mediaobject>
+ </figure>
+ <para>If an execution is locked, methods that change the execution will
+ throw a PvmException and the message will reference the actual locking state.
+ Firing events, updating variables, updating priority and adding comments
+ are not considered to change an execution. Also creation and removal of child
+ executions are unchecked, which means that those methods can be invoked by
+ external API clients and node behaviour methods, even while the execution
+ is in a locked state.
+ </para>
+ <para>Make sure that comparisons between getState() and the STATE_* constants
+ are done with .equals and not with '==' because if executions are loaded
+ from persistent storage, a new string is created instead of the constants.
+ </para>
+ <para>An execution implementation will be locked:
+ </para>
+ <itemizedlist>
+ <listitem>When it is ended</listitem>
+ <listitem>When it is suspended</listitem>
+ <listitem>During asynchronous continuations</listitem>
+ </itemizedlist>
+ <para>Furthermore, locking can be used by Activity implementations to make
+ executions read only during wait states hen responsibility for the execution is
+ transferred to an external entity such as:
+ </para>
+ <itemizedlist>
+ <listitem>A human task</listitem>
+ <listitem>A service invocation</listitem>
+ <listitem>A wait state that ends when a scanner detects that a file appears</listitem>
+ </itemizedlist>
+ <para>In these situations the strategy is that the external entity should get
+ full control over the execution because it wants to control what is allowed
+ and what not. To get that control, they lock the execution so that all interactions
+ have to go through the external entity.
+ </para>
+ <para>One of the main reasons to create external entities is that they can live
+ on after the execution has already proceeded. For example, in case
+ of a service invocation, a timer could cause the execution to take the timeout transition.
+ When the response arrives after the timeout, the service invocation entity should
+ make sure it doesn't signal the execution. So the service invocation can be
+ seen as a node instance (aka activity instance) and is unique for every execution
+ of the node.
+ </para>
+ <para>External entities themselves are responsible for managing the execution
+ lock. If the timers and client applications are consequent in addressing the
+ external entities instead of the execution directly, then locking is in theory
+ unnecessary. It's up to the node behaviour implementations whether they want
+ to take the overhead of locking and unlocking.
+ </para>
+ </section>
+
+</chapter>
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch07-Variables.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Variables.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch07-Variables.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch07-Variables.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,4 @@
+<chapter id="variables">
+ <title>Variables</title>
+ <para>TODO</para>
+</chapter>
\ No newline at end of file
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch08-Timers.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Timers.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch08-Timers.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch08-Timers.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,4 @@
+<chapter id="timers">
+ <title>Timers</title>
+ <para>TODO</para>
+</chapter>
\ No newline at end of file
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch09-AsynchronousContinuations.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AsynchronousContinuations.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch09-AsynchronousContinuations.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch09-AsynchronousContinuations.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,4 @@
+<chapter id="asynchronouscontinuations">
+ <title>Asynchronous continuations</title>
+ <para>TODO</para>
+</chapter>
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch10-SoftwareLogging.xml (from rev 2276, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch10-SoftwareLogging.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch10-SoftwareLogging.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -0,0 +1,99 @@
+<chapter id="softwarelogging">
+ <title>Software logging</title>
+
+ <section>
+ <title>Configuration</title>
+ <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
+ logged, PVM logging will make the selection with following procedure:
+ <orderedlist>
+ <listitem>If a <literal>logging.properties</literal> resource is found
+ on the classpath (using the context classloader), then JDK logging will
+ be used and that file will be used to initialize the JDK logging.
+ </listitem>
+ <listitem>If log4j is found on the classpath, then log4j will be used.
+ The check for log4j will be done by checking availability of class
+ <literal>org.apache.log4j.LogManager</literal> with the context classloader.
+ </listitem>
+ <listitem>If none of the above, JDK logging will be used.</listitem>
+ </orderedlist>
+ </para>
+ </section>
+
+ <section>
+ <title>Categories</title>
+ <para>The PVM classes use their class name as the category for the logger.
+ </para>
+ <para>To have a basic understanding of what the PVM classes are doing,
+ turning on the <literal>debug</literal> level is great. Level
+ <literal>trace</literal> might be spitting out too much for that
+ purpose.
+ </para>
+ </section>
+
+ <section>
+ <title>JDK logging</title>
+ <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
+ and <literal>trace</literal> maps to <literal>finest</literal>.
+ Level <literal>finer</literal> is not used.
+ </para>
+ <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
+ the pvm library and it can create a nice one-line output for log messages.
+ It also has a neat feature that creates a unique indentation per thread.
+ To configure it, this is a typical <literal>logging.properties</literal>
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
+
+# For example, set the com.xyz.foo logger to only log SEVERE messages:
+# com.xyz.foo.level = SEVERE
+
+.level = SEVERE
+org.jbpm.level=FINE
+org.jbpm.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE</programlisting>
+
+<!--
+ <para>For production usage, jBPM also includes an error triggered log handler. This is
+ a log handler that will only keep the most recent log messages in
+ memory and these will only be flushed to a file in case an error occurs.
+ </para>
+ <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
+ to the handlers in the logging properties like this:
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
+ <para>Next snippet shows how in the same logging.properties, the error
+ triggered file handler can be configured. The given values are the default
+ values.
+ </para>
+ <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
+org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
+org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
+ <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
+ JDK handlers FileHandler and MemoryHandler can used in combination to get
+ similar results with a bit more configuration.
+ </para>
+
+-->
+ </section>
+
+ <section>
+ <title>Debugging persistence</title>
+ <para>When testing the persistence, following logging configurations can be
+ valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
+ and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
+ set in the queries.
+ </para>
+ <programlisting>org.hibernate.SQL.level=FINEST
+org.hibernate.type.level=FINEST</programlisting>
+ <para>And in case you get a failed batch as a cause in a hibernate exception,
+ you might want to set the batch size to 0 like this in the hibernate properties:
+ </para>
+ <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
+ <para>Also in the hibernate properties, the following properties allow for
+ detailed logs of the SQL that hibernate spits out:</para>
+ <programlisting>hibernate.show_sql = true
+hibernate.format_sql = true
+hibernate.use_sql_comments = true</programlisting>
+ </section>
+</chapter>
\ No newline at end of file
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,324 +0,0 @@
-<chapter id="advancedgraphexecution">
- <title>Advanced graph execution</title>
-
- <!-- ### LOOPS ########################################################## -->
- <section>
- <title>Loops</title>
- <para>Loops can be based on transitions or on node composition. Loops can contain wait
- states.
- </para>
- <para>To support high numbers of automatic loop executions, the Process Virtual Machine
- tranformed the propagation of execution from tail recursion to a while loop. This means
- that all the methods in the <literal>Execution</literal> class that propagate the
- execution like <literal>take</literal> or <literal>execute</literal> will not be
- executed when you call them. Instead, the method invocations will be appended to a list.
- The first invocation of such a method will start a loop that will execute all invocations
- till that list is empty. These invocations are called atomic operations.
- </para>
- </section>
-
- <!-- ### SUB PROCESSES ################################################## -->
- <section>
- <title>Sub processes</title>
- <para>TODO: sub processes</para>
- </section>
-
- <!-- ### DEFAULT PROCEED BEHAVIOUR ###################################### -->
- <section id="defaultproceedbehaviour">
- <title>Default proceed behaviour</title>
- <para>When an <literal>Activity</literal> is used as node behaviour, it can
- explicitely propagate the execution with following methods:
- </para>
- <itemizedlist>
- <listitem><literal>waitForSignal()</literal></listitem>
- <listitem><literal>take(Transition)</literal></listitem>
- <listitem><literal>end(*)</literal></listitem>
- <listitem><literal>execute(Node)</literal></listitem>
- <listitem><literal>createExecution(*)</literal></listitem>
- </itemizedlist>
- <para>When <literal>Activity</literal> implementations used for node behviour
- don't call any of the following execution propagation methods, then, after
- the activity is executed, the execution will just proceed.
- </para>
- <para>By default proceeding will perform the first action that applies
- in the following list:</para>
- <itemizedlist>
- <listitem>If the current node has a default outgoing transition, take it.</listitem>
- <listitem>If the current node has a parent node, move back to the parent node.</listitem>
- <listitem>Otherwise, end this execution.</listitem>
- </itemizedlist>
- <para>Process languages can overwrite the default proceed behaviour
- by overriding the <literal>proceed</literal> method in
- <literal>ExecutionImpl</literal>.
- </para>
- </section>
-
- <!-- ### FUNCTIONAL ACTIVITIES ################################ -->
- <section id="functionalactivities">
- <title>Functional activities</title>
- <para>Activities that also can be used as event listeners are called functional
- activities. Examples of automatic activities are sending an email, doing a database
- update, generating a pdf, calculating an average, etc. All of these are automatic
- activities that do not change the execution flow. Here's how such activities can
- be implemented:
- </para>
- <programlisting>public class FunctionalActivity implements Activity, EventListener {
- public void execute(ActivityExecution execution) {
- perform(execution);
- }
- public void notify(EventListenerExecution execution) {
- perform(execution);
- }
- void perform(OpenExecution execution) {
- ...do functional work...
- }
- }</programlisting>
- <para>None of these methods actually invoke execution propagation methods.
- So after the perform method is completed, the execution will
- <link linkend="defaultproceedbehaviour">proceed in the default way</link>.
- </para>
- </section>
-
-
- <!-- ### EXECUTION AND THREADS ########################################## -->
- <section id="executionandthreads">
- <title>Execution and threads</title>
- <para>This section explains how the Process Virtual Machine boroughs the thread
- from the client to bring an execution from one wait state to another.
- </para>
- <para>When a client invokes a method (like e.g. the signal method) on an execution,
- by default, the Process Virtual Machine will use that thread to progress the execution
- until it reached a wait state. Once the next wait state has been reached, the
- method returns and the client gets the thread back. This is the default way
- for the Process Virtual Machine to operate. Two more levels of asynchonous
- execution complement this default behaviour:
- <link linkend="asynchronouscontinuations">Asynchronous continuations</link>
- and the <link linkend="architecture">asynchronous command service</link>.
- </para>
- <para>The next process will show the basics concretely. It has three wait states
- and four automatic nodes.
- </para>
- <figure id="automatic">
- <title>Process with many sequential automatic activities.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.png"/></imageobject></mediaobject>
- </figure>
- <para>Here's how to build the process:</para>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("automatic")
- .<emphasis role="bold">node("wait 1").initial()</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
- .transition().to("automatic 1")
- .<emphasis role="bold">node("automatic 1")</emphasis>.behaviour(new <emphasis role="bold">Display("one")</emphasis>)
- .transition().to("wait 2")
- .<emphasis role="bold">node("wait 2")</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
- .transition().to("automatic 2")
- .<emphasis role="bold">node("automatic 2")</emphasis>.behaviour(new <emphasis role="bold">Display("two")</emphasis>)
- .transition().to("automatic 3")
- .<emphasis role="bold">node("automatic 3")</emphasis>.behaviour(new <emphasis role="bold">Display("three")</emphasis>)
- .transition().to("automatic 4")
- .<emphasis role="bold">node("automatic 4")</emphasis>.behaviour(new <emphasis role="bold">Display("four")</emphasis>)
- .transition().to("wait 3")
- .<emphasis role="bold">node("wait 3")</emphasis>.behaviour(new <emphasis role="bold">WaitState</emphasis>())
-.done();</programlisting>
- <para>Let's walk you through one execution of this process.
- </para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>Starting a new execution means that the initial node is executed. So if an automatic
- activity would be configured as the behaviour in the initial node, the process will start executing
- immediatly in the startExecution. In this case however, the initial node is a wait state. So
- the startExecution method returns immediately and the execution will be positioned in the initial
- node 'wait 1'.
- </para>
- <figure id="automatic.wait1">
- <title>A new execution will be positioned in 'wait 1'.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait1.png"/></imageobject></mediaobject>
- </figure>
- <para>Then an external trigger is given with the signal method.</para>
- <programlisting>execution.signal();</programlisting>
- <para>As explained above when introducing the WaitState, that signal will cause the default transition to be taken. The
- transition will move the execution to node <literal>automatic 1</literal> and execute it. The execute method
- of the <literal>Display</literal> activity in <literal>automatic 1</literal> print a line to the console and it
- will <emphasis role="bold">not</emphasis> call <literal>execution.waitForSignal()</literal>. Therefore, the execution
- will proceed by taking the default transition out of <literal>automatic 1</literal>. The signal method is still blocking
- cause this action and the transitions are taken
- by that same thread. Then the execution arrives in <literal>wait 2</literal> and executes the <literal>WaitState</literal>
- activity. That method will invoke the <literal>execution.waitForSignal()</literal>, which will cause the signal method
- to return. That is when the thread is given back to the client that invoked the signal method.
- </para>
- <para>So when the signal method returns, the execution is positioned in <literal>wait 2</literal>.</para>
- <figure id="automatic.wait2">
- <title>One signal brought the execution from 'initial' to 'wait 2'.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait2.png"/></imageobject></mediaobject>
- </figure>
- <para>Then the execution is now waiting for an external trigger just as an object (more precisely an object graph) in
- memory until the next external trigger is given with the signal method.
- </para>
- <programlisting>execution.signal();</programlisting>
- <para>This second invocation of signal will take the execution similarly all the way to <literal>wait 3</literal> before
- it returns.
- </para>
- <figure id="automatic.wait3">
- <title>The second signal brought the execution all the way to 'wait 3'.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.automatic.wait3.png"/></imageobject></mediaobject>
- </figure>
- <para>To make executable processes, developers need to know exactly what the automatic activities,
- what the wait states are and which threads will be allocated to the process execution. For business
- analysts that draw the analysis process, things are a bit simpler. For the
- activities they draw, they usually know whether it's a human or a system that is responsible.
- But they typically don't not how this translates to threads and transactions.
- </para>
- <para>So for the developer, the first job is to analyse what needs to be executed
- within the thread of control of the process and what is outside. Looking for the external
- triggers can be a good start to find the wait states in a process, just like verbs and nouns
- can be the rule of thumb in building UML class diagrams.
- </para>
- </section>
-
- <!-- ### PROCESS CONCURRENCY ############################################ -->
- <section>
- <title>Process concurrency</title>
- <para>To model process concurrency, there is a parent-child tree structure on the
- execution. The idea is that the main path of execution is the root of that tree.
- This implies that on the level of the Process Virtual Machine, there is no differentiation
- between complete process instances and paths of execution within a process instance.
- One of the main motivations for this design is that the API actually is not made more
- complex then necessary for simple processes with only one single path of execution.
- </para>
- <figure id="execution.structure">
- <title>UML class diagram of the basic execution structure</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.execution.structure.classes.png"/></imageobject></mediaobject>
- </figure>
- <para>To extablish multiple concurrent paths of execution, child executions can be
- created. Only leaf executions can be active. Non-leave executions should be
- inactive. This tree structure of executions doesn't enforce a particular type of
- concurrency or join behaviour. It's up to the forks or and-splits and to the joins
- or and-merges to use the execution tree structure in any way they want to define
- the wanted concurrency behaviour. Here you see an example
- of concurrent executions.
- </para>
- <figure id="concurrency">
- <title>Concurrent paths of execution</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.concurrency.png"/></imageobject></mediaobject>
- </figure>
- <para>There is a billing and a shipping path of execution. In this case, the
- flat bar nodes represent nodes that fork and join. The execution shows a three
- executions. The main path of execution is inactive (represented as gray) and the
- billing and shipping paths of execution are active and point to the node
- <literal>bill</literal> and <literal>ship</literal> respectively.
- </para>
- <para>It's up to the node behaviour implementations how they want to use this
- execution structure. Suppose that multiple tasks have to be completed before the
- execution is to proceed. The node behaviour can spawn a series of child executions
- for this. Or alternatively, the task component could support task groups that
- are associated to one single execution. In that case, the task component becomes
- responsible for synchronizing the tasks, thereby moving this responsibility
- outside the scope of the execution tree structure.
- </para>
- </section>
-
- <!-- ### EXCEPTION HANDLERS ############################################# -->
- <section>
- <title>Exception handlers</title>
- <para>In all the <link linkend="delegationclasses">code that is associated to a process</link>
- like Activity's, Actions and Conditions, it's possible to include try-catch blocks in
- the method implementations to handle exceptions. But in order to build more reusable building
- blocks for both the delegation classes and the exception handling logic, exception handlers are
- added to the core process model.
- </para>
- <para>An exception handler can be associated to any process element. When an exception
- occurs in a delegation class, a matching exception handler will be searched for. If
- such an exception handler is found, it will get a chance to handle the exception.
- </para>
- <para>If an exception handler completes without problems, then the exception is considered
- handled and the execution resumes right after the delegation code that was called. For example,
- a transition has three actions and the second action throws an exception that is handled
- by an exception handler, then
- </para>
- <para>Writing automatic activities that are exception handler aware is easy. The
- default is to proceed anyway. No method needs to be called on the execution. So
- if an automatic activity throws an exception that is handled by an exception handler,
- the execution will just proceed after that activity. It becomes a big more difficult
- for control flow activities. They might have to include try-finally blocks to
- invoke the proper methods on the execution before an exception handler gets a
- chance to handle the exception. For example, if an activity is a wait state and
- an exception occurs, then there is a risk that the thread jumps over the
- invocation of <literal>execution.waitForSignal()</literal>, causing the execution
- to proceed after the activity.
- </para>
- <para>TODO: exceptionhandler.isRethrowMasked</para>
- <para>TODO: transactional exception handlers</para>
- <para>TODO: we never catch errors</para>
- </section>
-
- <!-- ### PROCESS MODIFICATIONS ########################################## -->
- <section>
- <title>Process modifications</title>
- <para>TODO: process modifications</para>
- </section>
-
- <!-- ### LOCKING AND EXECUTION STATE #################################### -->
- <section>
- <title>Locking and execution state</title>
- <para>The state of an execution is either active or locked. An active
- execution is either executing or waiting for an external trigger. If an
- execution is not in STATE_ACTIVE, then it is locked. A locked execution
- is read only.
- </para>
- <para>When a new execution is created, it is in STATE_ACTIVE. To change
- the state to a locked state, use lock(String). Some STATE_* constants
- are provided that represent the most commonly used locked states. But
- the state '...' in the picture indicates that any string can be provided
- as the state in the lock method.
- </para>
- <figure id="execution.states">
- <title>States of an execution</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/ch04.execution.states.png"/></imageobject></mediaobject>
- </figure>
- <para>If an execution is locked, methods that change the execution will
- throw a PvmException and the message will reference the actual locking state.
- Firing events, updating variables, updating priority and adding comments
- are not considered to change an execution. Also creation and removal of child
- executions are unchecked, which means that those methods can be invoked by
- external API clients and node behaviour methods, even while the execution
- is in a locked state.
- </para>
- <para>Make sure that comparisons between getState() and the STATE_* constants
- are done with .equals and not with '==' because if executions are loaded
- from persistent storage, a new string is created instead of the constants.
- </para>
- <para>An execution implementation will be locked:
- </para>
- <itemizedlist>
- <listitem>When it is ended</listitem>
- <listitem>When it is suspended</listitem>
- <listitem>During asynchronous continuations</listitem>
- </itemizedlist>
- <para>Furthermore, locking can be used by Activity implementations to make
- executions read only during wait states hen responsibility for the execution is
- transferred to an external entity such as:
- </para>
- <itemizedlist>
- <listitem>A human task</listitem>
- <listitem>A service invocation</listitem>
- <listitem>A wait state that ends when a scanner detects that a file appears</listitem>
- </itemizedlist>
- <para>In these situations the strategy is that the external entity should get
- full control over the execution because it wants to control what is allowed
- and what not. To get that control, they lock the execution so that all interactions
- have to go through the external entity.
- </para>
- <para>One of the main reasons to create external entities is that they can live
- on after the execution has already proceeded. For example, in case
- of a service invocation, a timer could cause the execution to take the timeout transition.
- When the response arrives after the timeout, the service invocation entity should
- make sure it doesn't signal the execution. So the service invocation can be
- seen as a node instance (aka activity instance) and is unique for every execution
- of the node.
- </para>
- <para>External entities themselves are responsible for managing the execution
- lock. If the timers and client applications are consequent in addressing the
- external entities instead of the execution directly, then locking is in theory
- unnecessary. It's up to the node behaviour implementations whether they want
- to take the overhead of locking and unlocking.
- </para>
- </section>
-
-</chapter>
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AsynchronousContinuations.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AsynchronousContinuations.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AsynchronousContinuations.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,3 +0,0 @@
-<chapter id="asynchronouscontinuations">
- <title>Asynchronous continuations</title>
-</chapter>
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,99 +0,0 @@
-<chapter id="softwarelogging">
- <title>Software logging</title>
-
- <section>
- <title>Configuration</title>
- <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
- logged, PVM logging will make the selection with following procedure:
- <orderedlist>
- <listitem>If a <literal>logging.properties</literal> resource is found
- on the classpath (using the context classloader), then JDK logging will
- be used and that file will be used to initialize the JDK logging.
- </listitem>
- <listitem>If log4j is found on the classpath, then log4j will be used.
- The check for log4j will be done by checking availability of class
- <literal>org.apache.log4j.LogManager</literal> with the context classloader.
- </listitem>
- <listitem>If none of the above, JDK logging will be used.</listitem>
- </orderedlist>
- </para>
- </section>
-
- <section>
- <title>Categories</title>
- <para>The PVM classes use their class name as the category for the logger.
- </para>
- <para>To have a basic understanding of what the PVM classes are doing,
- turning on the <literal>debug</literal> level is great. Level
- <literal>trace</literal> might be spitting out too much for that
- purpose.
- </para>
- </section>
-
- <section>
- <title>JDK logging</title>
- <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
- and <literal>trace</literal> maps to <literal>finest</literal>.
- Level <literal>finer</literal> is not used.
- </para>
- <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
- the pvm library and it can create a nice one-line output for log messages.
- It also has a neat feature that creates a unique indentation per thread.
- To configure it, this is a typical <literal>logging.properties</literal>
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.level = FINEST
-java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
-
-# For example, set the com.xyz.foo logger to only log SEVERE messages:
-# com.xyz.foo.level = SEVERE
-
-.level = SEVERE
-org.jbpm.level=FINE
-org.jbpm.tx.level=FINE
-org.jbpm.pvm.internal.wire.level=FINE</programlisting>
-
-<!--
- <para>For production usage, jBPM also includes an error triggered log handler. This is
- a log handler that will only keep the most recent log messages in
- memory and these will only be flushed to a file in case an error occurs.
- </para>
- <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
- to the handlers in the logging properties like this:
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
- <para>Next snippet shows how in the same logging.properties, the error
- triggered file handler can be configured. The given values are the default
- values.
- </para>
- <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
-org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
-org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
- <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
- JDK handlers FileHandler and MemoryHandler can used in combination to get
- similar results with a bit more configuration.
- </para>
-
--->
- </section>
-
- <section>
- <title>Debugging persistence</title>
- <para>When testing the persistence, following logging configurations can be
- valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
- and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
- set in the queries.
- </para>
- <programlisting>org.hibernate.SQL.level=FINEST
-org.hibernate.type.level=FINEST</programlisting>
- <para>And in case you get a failed batch as a cause in a hibernate exception,
- you might want to set the batch size to 0 like this in the hibernate properties:
- </para>
- <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
- <para>Also in the hibernate properties, the following properties allow for
- detailed logs of the SQL that hibernate spits out:</para>
- <programlisting>hibernate.show_sql = true
-hibernate.format_sql = true
-hibernate.use_sql_comments = true</programlisting>
- </section>
-</chapter>
\ No newline at end of file
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Timers.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Timers.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Timers.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,3 +0,0 @@
-<chapter id="timers">
- <title>Timers</title>
-</chapter>
\ No newline at end of file
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Variables.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Variables.xml 2008-09-18 07:25:16 UTC (rev 2278)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Variables.xml 2008-09-18 13:55:29 UTC (rev 2279)
@@ -1,3 +0,0 @@
-<chapter id="variables">
- <title>Variables</title>
-</chapter>
\ No newline at end of file
17 years, 7 months
JBoss JBPM SVN: r2278 - in projects/jbpm-spec/trunk/modules: cts/src/test/java/org/jboss/bpm/cts/model and 9 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-18 03:25:16 -0400 (Thu, 18 Sep 2008)
New Revision: 2278
Added:
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/
projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/
projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/
projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/process-property-api10.xml
projects/jbpm-spec/trunk/modules/ri/src/main/resources/hibernate.cfg.hsqldb.xml
Removed:
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
Modified:
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyDescriptorTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyMarshallerTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyTest.java
projects/jbpm-spec/trunk/modules/cts/src/test/resources/jbpm-beans.xml
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
projects/jbpm-spec/trunk/modules/ri/src/test/resources/jbpm-beans.xml
Log:
Enable HSQL default for PersistenceService
Copied: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process (from rev 2210, projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process)
Modified: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-09-12 13:52:42 UTC (rev 2210)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessIntegrityTest.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.bpm.cts.process;
+package org.jboss.bpm.cts.model.process;
// $Id$
@@ -36,7 +36,7 @@
*/
public class ProcessIntegrityTest extends DefaultEngineTestCase
{
- public void testNoStartState() throws Exception
+ public void testNoStartEvent() throws Exception
{
try
{
@@ -51,7 +51,7 @@
}
}
- public void testNoEndState() throws Exception
+ public void testNoEndEvent() throws Exception
{
try
{
Modified: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyDescriptorTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessPropertyDescriptorTest.java 2008-09-12 13:52:42 UTC (rev 2210)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyDescriptorTest.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.bpm.cts.process;
+package org.jboss.bpm.cts.model.process;
// $Id$
@@ -40,7 +40,7 @@
{
protected Process getProcess() throws IOException
{
- URL procURL = getResourceURL("cts/process/process-property-" + getDialect() + ".xml");
+ URL procURL = getResourceURL("cts/model/process/process-property-" + getDialect() + ".xml");
ProcessManager pm = ProcessManager.locateProcessManager();
Process proc = pm.createProcess(procURL);
return proc;
Modified: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyMarshallerTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessPropertyMarshallerTest.java 2008-09-12 13:52:42 UTC (rev 2210)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyMarshallerTest.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.bpm.cts.process;
+package org.jboss.bpm.cts.model.process;
// $Id$
Modified: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessPropertyTest.java 2008-09-12 13:52:42 UTC (rev 2210)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/model/process/ProcessPropertyTest.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -19,28 +19,19 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.bpm.cts.process;
+package org.jboss.bpm.cts.model.process;
// $Id$
import java.io.IOException;
-import org.jboss.bpm.model.EventDetail;
-import org.jboss.bpm.model.Message;
-import org.jboss.bpm.model.MessageBuilder;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.model.Assignment.AssignTime;
-import org.jboss.bpm.model.Expression.ExpressionLanguage;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
- * Modeler-defined Properties MAY be added to a Process. These Properties are "local" to the Process. All Tasks,
- * Sub-Process objects, and Sub-Processes that are embedded SHALL have access to these Properties. The fully delineated
- * name of these properties are "<process name>.<property name>" (e.g., "Add Customer.Customer Name"). If a process is
- * embedded within another Process, then the fully delineated name SHALL also be preceded by the Parent Process name for
- * as many Parents there are until the top level Process.
+ * Modeler-defined Properties MAY be added to a Process.
*
* https://jira.jboss.org/jira/browse/JBPM-1392
*
@@ -50,29 +41,18 @@
public class ProcessPropertyTest extends DefaultEngineTestCase
{
/**
- * Test the the process properties can be used by Assignments
- * and finally arrive in through the End Message
+ * Test the the process properties
*/
public void testProcessProperties() throws Exception
{
Process proc = getProcess();
- proc.startProcess();
- proc.waitForEnd();
-
- Message endMessage = getMessages().get(0);
- assertNotNull("EndMessage expected", endMessage);
- assertEquals("bar", endMessage.getPropertyValue("propValue"));
}
protected Process getProcess() throws IOException
{
ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- procBuilder.addProcess("ProcessProperties").addStartEvent("Start").addSequenceFlow("TaskA");
- procBuilder.addAssignment(AssignTime.Start, ExpressionLanguage.MVEL, "ProcessProperties_foo", "propValue");
- procBuilder.addProperty("foo", "bar").addTask("TaskA").addSequenceFlow("End");
- procBuilder.addEndEvent("End").addEventDetail(EventDetail.EventDetailType.Message).addMessageRef("EndMessage");
- MessageBuilder msgBuilder = procBuilder.addMessage("EndMessage");
- msgBuilder.addToRef(getTestID()).addProperty("propValue", null, true);
+ procBuilder.addProcess("ProcessProperties").addStartEvent("Start").addSequenceFlow("End");
+ procBuilder.addEndEvent("End").addProperty("foo", "bar");
Process proc = procBuilder.getProcess();
return proc;
}
Deleted: projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-09-17 16:04:00 UTC (rev 2277)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/java/org/jboss/bpm/cts/process/ProcessIntegrityTest.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -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.jboss.bpm.cts.process;
-
-// $Id$
-
-import org.jboss.bpm.InvalidProcessException;
-import org.jboss.bpm.model.ProcessBuilder;
-import org.jboss.bpm.model.ProcessBuilderFactory;
-import org.jboss.bpm.test.DefaultEngineTestCase;
-
-/**
- * Test the intergety of various process definitions
- *
- * @author thomas.diesler(a)jboss.com
- * @since 08-Jul-2008
- */
-public class ProcessIntegrityTest extends DefaultEngineTestCase
-{
- public void testNoStartState() throws Exception
- {
- try
- {
- // Create a Process through the ProcessBuilder
- ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess("NoStartState").addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
- fail("InvalidProcessException expected");
- }
- catch (InvalidProcessException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start event") > 0);
- }
- }
-
- public void testNoEndState() throws Exception
- {
- try
- {
- // Create a Process through the ProcessBuilder
- ProcessBuilder builder = ProcessBuilderFactory.newInstance().newProcessBuilder();
- builder.addProcess("NoEndState").addStartEvent("Start").addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").
- addTask("end").getProcess();
- fail("InvalidProcessException expected");
- }
- catch (InvalidProcessException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end event") > 0);
- }
- }
-}
Added: projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/process-property-api10.xml
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/process-property-api10.xml (rev 0)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/process-property-api10.xml 2008-09-18 07:25:16 UTC (rev 2278)
@@ -0,0 +1,10 @@
+<ns2:process name="ProcessProperties" xmlns:ns2="urn:bpm.jboss:pdl-0.1">
+ <start name="Start">
+ <seqflow to="End" />
+ </start>
+ <end name="End"/>
+ <property>
+ <name>foo</name>
+ <value>bar</value>
+ </property>
+</ns2:process>
\ No newline at end of file
Property changes on: projects/jbpm-spec/trunk/modules/cts/src/test/resources/cts/model/process/process-property-api10.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jbpm-spec/trunk/modules/cts/src/test/resources/jbpm-beans.xml
===================================================================
--- projects/jbpm-spec/trunk/modules/cts/src/test/resources/jbpm-beans.xml 2008-09-17 16:04:00 UTC (rev 2277)
+++ projects/jbpm-spec/trunk/modules/cts/src/test/resources/jbpm-beans.xml 2008-09-18 07:25:16 UTC (rev 2278)
@@ -23,6 +23,7 @@
<!-- The ProcessManager -->
<bean name="jBPMProcessManager" class="org.jboss.bpm.ri.client.ProcessManagerImpl">
<property name="dialectRegistry"><inject bean="jBPMDialectRegistry"/></property>
+ <property name="persistenceService"><inject bean="jBPMPersistenceService"/></property>
<property name="dialectHandlers">
<map keyClass="java.lang.String" valueClass="org.jboss.bpm.client.DialectHandler">
<entry><key>api10</key><value><inject bean="jBPMDialectHandlerAPI10"/></value></entry>
@@ -49,4 +50,7 @@
</property>
</bean>
+ <!-- The PersistenceService -->
+ <bean name="jBPMPersistenceService" class="org.jboss.bpm.ri.client.HibernatePersistenceService"/>
+
</deployment>
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-17 16:04:00 UTC (rev 2277)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-18 07:25:16 UTC (rev 2278)
@@ -33,7 +33,6 @@
import org.hibernate.classic.Session;
import org.jboss.bpm.ProcessNotFoundException;
import org.jboss.bpm.client.PersistenceService;
-import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.ri.model.impl.AbstractElementImpl;
import org.jboss.bpm.ri.model.impl.EndEventImpl;
@@ -111,8 +110,14 @@
private SessionFactory getSessionFactory()
{
+ // If this property is not explicitly set in the beans config
+ // fall back to the -Ddatabase property that also activates
+ // the corresponding mvn profiles
if (hibernateConfig == null)
- throw new IllegalStateException("Hibernate config property cannot be null");
+ {
+ String database = System.getProperty("database", "hsqldb");
+ hibernateConfig = "hibernate.cfg." + database + ".xml";
+ }
if (sessionFactory == null)
{
Added: projects/jbpm-spec/trunk/modules/ri/src/main/resources/hibernate.cfg.hsqldb.xml
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/resources/hibernate.cfg.hsqldb.xml (rev 0)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/resources/hibernate.cfg.hsqldb.xml 2008-09-18 07:25:16 UTC (rev 2278)
@@ -0,0 +1,32 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:jbpm</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- ################################### -->
+ <!-- # common settings # -->
+ <!-- ################################### -->
+
+ <!-- Automatic schema creation -->
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+
+ <!-- Simple memory-only cache -->
+ <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+
+ <!-- logging properties -->
+ <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.use_sql_comments">true</property>
+
+ </session-factory>
+</hibernate-configuration>
Property changes on: projects/jbpm-spec/trunk/modules/ri/src/main/resources/hibernate.cfg.hsqldb.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jbpm-spec/trunk/modules/ri/src/test/resources/jbpm-beans.xml
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/test/resources/jbpm-beans.xml 2008-09-17 16:04:00 UTC (rev 2277)
+++ projects/jbpm-spec/trunk/modules/ri/src/test/resources/jbpm-beans.xml 2008-09-18 07:25:16 UTC (rev 2278)
@@ -43,8 +43,6 @@
</bean>
<!-- The PersistenceService -->
- <bean name="jBPMPersistenceService" class="org.jboss.bpm.ri.client.HibernatePersistenceService">
- <property name="hibernateConfig">hibernate.cfg.mysql.xml</property>
- </bean>
+ <bean name="jBPMPersistenceService" class="org.jboss.bpm.ri.client.HibernatePersistenceService"/>
</deployment>
17 years, 7 months
JBoss JBPM SVN: r2277 - in projects/jbpm-spec/trunk/modules: api/src/main/java/org/jboss/bpm/client and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-17 12:04:00 -0400 (Wed, 17 Sep 2008)
New Revision: 2277
Added:
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessNotFoundException.java
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
Modified:
projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java
projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java
projects/jbpm-spec/trunk/modules/ri/src/test/java/org/jboss/bpm/client/PersistenceServiceTest.java
Log:
More WIP on Persistence
Added: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessNotFoundException.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessNotFoundException.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessNotFoundException.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -0,0 +1,45 @@
+/*
+ * 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.jboss.bpm;
+
+
+// $Id$
+
+/**
+ * A RuntimeException that is when a process cannot be found in persistent storage.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Sep-2008
+ */
+@SuppressWarnings("serial")
+public class ProcessNotFoundException extends BPMException
+{
+ public ProcessNotFoundException()
+ {
+ super();
+ }
+
+ public ProcessNotFoundException(String message)
+ {
+ super(message);
+ }
+}
Property changes on: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/ProcessNotFoundException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java (rev 0)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -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.jboss.bpm.client;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.model.Process;
+
+/**
+ * The persistence service for a process.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Sep-2008
+ */
+public interface PersistenceService
+{
+ void saveProcess(Process proc);
+
+ Process loadProcess(ObjectName procID);
+
+ void deleteProcess(Process proc);
+
+}
\ No newline at end of file
Property changes on: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/PersistenceService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -52,7 +52,7 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public abstract class ProcessManager
+public abstract class ProcessManager implements PersistenceService
{
// provide logging
private static final Log log = LogFactory.getLog(ProcessManager.class);
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/client/HibernatePersistenceService.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -33,10 +33,14 @@
import org.hibernate.classic.Session;
import org.jboss.bpm.ProcessNotFoundException;
import org.jboss.bpm.client.PersistenceService;
+import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.ri.model.impl.AbstractElementImpl;
+import org.jboss.bpm.ri.model.impl.EndEventImpl;
+import org.jboss.bpm.ri.model.impl.FlowObjectImpl;
+import org.jboss.bpm.ri.model.impl.NoneTaskImpl;
import org.jboss.bpm.ri.model.impl.ProcessImpl;
-import org.jboss.bpm.ri.model.impl.SupportingElementImpl;
+import org.jboss.bpm.ri.model.impl.StartEventImpl;
/**
* A Hibernate based persistence service for a process.
@@ -89,7 +93,7 @@
}
return proc;
}
-
+
public void deleteProcess(Process proc)
{
Session session = getSessionFactory().openSession();
@@ -107,16 +111,18 @@
private SessionFactory getSessionFactory()
{
+ if (hibernateConfig == null)
+ throw new IllegalStateException("Hibernate config property cannot be null");
+
if (sessionFactory == null)
{
AnnotationConfiguration anConfig = new AnnotationConfiguration();
- for(Class clazz : ProcessImpl.class.getClasses())
- {
- System.out.println(clazz);
- }
+ anConfig.addAnnotatedClass(AbstractElementImpl.class);
+ anConfig.addAnnotatedClass(EndEventImpl.class);
+ anConfig.addAnnotatedClass(FlowObjectImpl.class);
+ anConfig.addAnnotatedClass(NoneTaskImpl.class);
anConfig.addAnnotatedClass(ProcessImpl.class);
- anConfig.addAnnotatedClass(SupportingElementImpl.class);
- anConfig.addAnnotatedClass(AbstractElementImpl.class);
+ anConfig.addAnnotatedClass(StartEventImpl.class);
sessionFactory = anConfig.configure(hibernateConfig).buildSessionFactory();
}
return sessionFactory;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/AbstractElementImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -26,6 +26,8 @@
import javax.management.ObjectName;
import javax.persistence.Column;
import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
import org.jboss.bpm.model.AbstractElement;
import org.jboss.bpm.model.Process;
@@ -37,6 +39,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@MappedSuperclass
public abstract class AbstractElementImpl implements AbstractElement
{
// provide serial version UID
@@ -67,6 +70,7 @@
/**
* Get the ID of this element
*/
+ @Transient
public abstract ObjectName getID();
/**
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ActivityImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -27,6 +27,8 @@
import java.util.Collections;
import java.util.List;
+import javax.persistence.Transient;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.InvalidProcessException;
@@ -73,16 +75,24 @@
super(name);
}
+ // Persistence ctor
+ protected ActivityImpl()
+ {
+ }
+
+ @Transient
public int getStartQuantity()
{
throw new NotImplementedException("JBPM-1631", "Activity startQuantity");
}
+ @Transient
public int getCompletionQuantity()
{
throw new NotImplementedException("JBPM-1632", "Activity completionQuantity");
}
+ @Transient
public List<Expression> getIORules()
{
return Collections.unmodifiableList(ioRules);
@@ -93,6 +103,7 @@
ioRules.add(expr);
}
+ @Transient
public List<InputSet> getInputSets()
{
return Collections.unmodifiableList(inputSets);
@@ -103,6 +114,7 @@
inputSets.add(inputSet);
}
+ @Transient
public List<OutputSet> getOutputSets()
{
return Collections.unmodifiableList(outputSets);
@@ -113,11 +125,13 @@
outputSets.add(outputSet);
}
+ @Transient
public LoopType getLoopType()
{
throw new NotImplementedException("JBPM-1633", "Activity loopType");
}
+ @Transient
public List<String> getPerformers()
{
throw new NotImplementedException("JBPM-1634", "Activity Performers");
@@ -145,11 +159,13 @@
return prop != null ? prop.getValue(clazz) : null;
}
+ @Transient
public List<Property> getProperties()
{
return Collections.unmodifiableList(props);
}
+ @Transient
public List<String> getPropertyNames()
{
List<String> names = new ArrayList<String>();
@@ -165,6 +181,7 @@
props.add(prop);
}
+ @Transient
public ConnectingObject getInFlow()
{
return inFlow;
@@ -175,6 +192,7 @@
this.inFlow = inFlow;
}
+ @Transient
public SequenceFlow getOutFlow()
{
return outFlow;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EndEventImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -28,6 +28,9 @@
import java.util.List;
import javax.management.ObjectName;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Transient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,6 +59,8 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@Entity
+@Table(name = "JBPM_END_EVENT")
public class EndEventImpl extends EventImpl implements EndEvent, SingleInFlowSetterSupport
{
// provide logging
@@ -71,7 +76,13 @@
super(name);
}
+ // Persistence ctor
+ protected EndEventImpl()
+ {
+ }
+
@Override
+ @Transient
public ObjectName getID()
{
if (id == null)
@@ -83,6 +94,7 @@
return id;
}
+ @Transient
public SequenceFlow getInFlow()
{
return inFlow;
@@ -101,6 +113,7 @@
resultSet.add(result);
}
+ @Transient
public List<EventDetail> getResult()
{
return Collections.unmodifiableList(resultSet);
@@ -130,6 +143,7 @@
exContext.addAttachment(EndSignalCallback.class, new EndSignalCallback(tokenExecutor));
}
+ @Transient
public SignalHandler getSignalHandler()
{
SignalHandler handler = super.getSignalHandler();
@@ -174,11 +188,6 @@
}
}
- public String toString()
- {
- return "EndEvent[" + getName() + "]";
- }
-
/**
* The callback that destroys the token AFTER the SYSTEM_END_EVENT_EXIT signal
*/
@@ -195,4 +204,9 @@
tokenExecutor.destroy(token);
}
}
+
+ public String toString()
+ {
+ return "EndEvent[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EventImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/EventImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -41,4 +41,10 @@
{
super(name);
}
+
+ // Persistence ctor
+ protected EventImpl()
+ {
+ }
+
}
\ No newline at end of file
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -51,6 +51,11 @@
this.targetName = targetName;
}
+ // Persistence ctor
+ protected FlowImpl()
+ {
+ }
+
public String getName()
{
return name;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/FlowObjectImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -25,6 +25,10 @@
import java.util.Collections;
import java.util.List;
+import javax.persistence.ManyToOne;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
import org.jboss.bpm.InvalidProcessException;
import org.jboss.bpm.NameNotUniqueException;
import org.jboss.bpm.model.Assignment;
@@ -47,16 +51,17 @@
//$Id$
/**
- * A Flow Object is one of the set of following graphical objects: Event, Activity, and
+ * A Flow Object is one of the set of following graphical objects: Event, Activity, and
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@MappedSuperclass
public abstract class FlowObjectImpl extends GraphicalElementImpl implements FlowObject, HandlerSetterSupport
{
// provide serial version UID
private static final long serialVersionUID = 1L;
-
+
private String name;
private Process proc;
private FlowHandler flowHandler;
@@ -69,6 +74,13 @@
this.name = name;
}
+ // Persistence ctor
+ protected FlowObjectImpl()
+ {
+ }
+
+ //@ManyToOne(targetEntity = ProcessImpl.class)
+ @Transient
public Process getProcess()
{
return proc;
@@ -84,6 +96,7 @@
this.name = name;
}
+ @Transient
public List<Assignment> getAssignments()
{
return Collections.unmodifiableList(assignments);
@@ -94,6 +107,7 @@
this.assignments.add(assignment);
}
+ @Transient
public ExecutionHandler getExecutionHandler()
{
return executionHandler;
@@ -104,6 +118,7 @@
this.executionHandler = executionHandler;
}
+ @Transient
public FlowHandler getFlowHandler()
{
return flowHandler;
@@ -114,6 +129,7 @@
this.flowHandler = flowHandler;
}
+ @Transient
public SignalHandler getSignalHandler()
{
return signalHandler;
@@ -164,7 +180,7 @@
processAssignment(ass, token);
}
}
-
+
protected void processAssignment(Assignment ass, Token token)
{
Expression expr = ass.getFrom();
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/NoneTaskImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -21,16 +21,20 @@
*/
package org.jboss.bpm.ri.model.impl;
+//$Id$
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Transient;
-//$Id$
-
/**
* Task that corresponds to the TaskType.None
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@Entity
+@Table(name = "JBPM_NONE_TASK")
public class NoneTaskImpl extends TaskImpl
{
// provide serial version UID
@@ -41,7 +45,13 @@
super(name);
}
+ // Persistence ctor
+ protected NoneTaskImpl()
+ {
+ }
+
@Override
+ @Transient
public TaskType getTaskType()
{
return TaskType.None;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/ProcessImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -32,10 +32,10 @@
import java.util.List;
import javax.management.ObjectName;
-import javax.persistence.Column;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
+import javax.persistence.FetchType;
+import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -99,15 +99,7 @@
{
}
- @Id
- @Column(name = "id")
@Override
- public String getKey()
- {
- return super.getKey();
- }
-
- @Override
@Transient
public ObjectName getID()
{
@@ -276,6 +268,7 @@
return em.waitForEnd(this, timeout);
}
+ //@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "process", targetEntity = FlowObjectImpl.class)
@Transient
public List<FlowObject> getFlowObjects()
{
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SequenceFlowImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -23,6 +23,9 @@
//$Id$
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
import org.jboss.bpm.model.Expression;
import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.SequenceFlow;
@@ -34,6 +37,8 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
+@Entity
+@Table(name = "JBPM_SEQUENCE_FLOW")
public class SequenceFlowImpl extends FlowImpl implements SequenceFlow
{
// provide serial version UID
@@ -54,6 +59,11 @@
this.conditionExpression = expr;
}
+ // Persistence ctor
+ protected SequenceFlowImpl()
+ {
+ }
+
public ConditionType getConditionType()
{
return conditionType;
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/StartEventImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -30,6 +30,7 @@
import javax.management.ObjectName;
import javax.persistence.Entity;
import javax.persistence.Table;
+import javax.persistence.Transient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -77,7 +78,13 @@
super(name == null ? "Start" : name);
}
+ // Persistence ctor
+ protected StartEventImpl()
+ {
+ }
+
@Override
+ @Transient
public ObjectName getID()
{
if (id == null)
@@ -89,6 +96,7 @@
return id;
}
+ @Transient
public List<EventDetail> getTrigger()
{
return Collections.unmodifiableList(triggers);
@@ -99,6 +107,7 @@
triggers.add(eventDetail);
}
+ @Transient
public SequenceFlow getOutFlow()
{
return outFlow;
@@ -115,6 +124,7 @@
tokenExecutor.move(token, getOutFlow());
}
+ @Transient
public SignalHandler getSignalHandler()
{
SignalHandler handler = super.getSignalHandler();
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/SupportingElementImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -24,6 +24,7 @@
//$Id$
import javax.management.ObjectName;
+import javax.persistence.Transient;
import org.jboss.bpm.model.Constants;
import org.jboss.bpm.model.ObjectNameFactory;
@@ -42,6 +43,7 @@
private static final long serialVersionUID = 1L;
@Override
+ @Transient
public ObjectName getID()
{
if (id == null)
Modified: projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/impl/TaskImpl.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -22,6 +22,7 @@
package org.jboss.bpm.ri.model.impl;
import javax.management.ObjectName;
+import javax.persistence.Transient;
import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.Constants;
@@ -53,6 +54,12 @@
super(name);
}
+ // Persistence ctor
+ protected TaskImpl()
+ {
+ }
+
+ @Transient
public ActivityType getActivityType()
{
return ActivityType.Task;
@@ -61,6 +68,7 @@
public abstract TaskType getTaskType();
@Override
+ @Transient
public ObjectName getID()
{
if (id == null)
@@ -72,6 +80,7 @@
return id;
}
+ @Transient
public SignalHandler getSignalHandler()
{
SignalHandler handler = super.getSignalHandler();
Modified: projects/jbpm-spec/trunk/modules/ri/src/test/java/org/jboss/bpm/client/PersistenceServiceTest.java
===================================================================
--- projects/jbpm-spec/trunk/modules/ri/src/test/java/org/jboss/bpm/client/PersistenceServiceTest.java 2008-09-17 15:58:09 UTC (rev 2276)
+++ projects/jbpm-spec/trunk/modules/ri/src/test/java/org/jboss/bpm/client/PersistenceServiceTest.java 2008-09-17 16:04:00 UTC (rev 2277)
@@ -71,7 +71,7 @@
/**
* Test execution of a loaded process
*/
- public void _testStartLoaded() throws Exception
+ public void testStartLoaded() throws Exception
{
ProcessManager pm = ProcessManager.locateProcessManager();
@@ -84,13 +84,13 @@
proc = pm.loadProcess(proc.getID());
// Start the process
- proc.startProcess();
- proc.waitForEnd();
+ //proc.startProcess();
+ //proc.waitForEnd();
}
finally
{
// Delete the process
- pm.deleteProcess(proc);
+ //pm.deleteProcess(proc);
}
}
17 years, 7 months
JBoss JBPM SVN: r2275 - in jbpm4/pvm/trunk: hudson and 18 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-17 11:47:24 -0400 (Wed, 17 Sep 2008)
New Revision: 2275
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/AutomaticActivity.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/ObjectExecutionModeTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/WaitState.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example02/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedExecutionModeTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/examples/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/examples/ExamplesTests.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Loan.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/interceptors.png
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedPersistenceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Order.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-SoftwareLogging.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-BasicGraphExecution.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Services.xml
Modified:
jbpm4/pvm/trunk/.classpath
jbpm4/pvm/trunk/assembly.xml
jbpm4/pvm/trunk/hudson/build.xml
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicExecutionFlowTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/AutomaticActivity.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/WaitState.java
jbpm4/pvm/trunk/modules/manual/pom.xml
jbpm4/pvm/trunk/modules/manual/src/main/diagrams/images.ppt
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch03-Architecture.xml
jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml
Log:
docs and packaging
Modified: jbpm4/pvm/trunk/.classpath
===================================================================
--- jbpm4/pvm/trunk/.classpath 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/.classpath 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="modules/core/target/classes" path="modules/core/src/main/java"/>
- <classpathentry kind="src" output="modules/core/target/classes" path="modules/core/src/main/resources"/>
- <classpathentry kind="src" output="modules/core/target/test-classes" path="modules/core/src/test/java"/>
- <classpathentry kind="src" output="modules/core/target/test-classes" path="modules/core/src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="src" output="modules/core/target/classes" path="modules/core/src/main/java"/>
+ <classpathentry kind="src" output="modules/core/target/classes" path="modules/core/src/main/resources"/>
+ <classpathentry kind="src" output="modules/core/target/test-classes" path="modules/core/src/test/java"/>
+ <classpathentry kind="src" output="modules/core/target/test-classes" path="modules/core/src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: jbpm4/pvm/trunk/assembly.xml
===================================================================
--- jbpm4/pvm/trunk/assembly.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/assembly.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -9,7 +9,7 @@
<moduleSets>
<moduleSet>
<includes>
- <include>org.jbpm:pvm</include>
+ <include>org.jbpm.jbpm4:pvm-core</include>
</includes>
<binaries>
<outputDirectory></outputDirectory>
@@ -27,7 +27,7 @@
<fileSets>
<fileSet>
<directory>modules/core/target/apidocs</directory>
- <outputDirectory>doc/api-javadocs</outputDirectory>
+ <outputDirectory>doc/api</outputDirectory>
</fileSet>
<fileSet>
<directory>modules/core/src/main/java</directory>
@@ -38,8 +38,8 @@
<outputDirectory>src</outputDirectory>
</fileSet>
<fileSet>
- <directory>modules/core/target/doc-reference</directory>
- <outputDirectory>doc/reference</outputDirectory>
+ <directory>modules/manual/target/docbook/publish/en</directory>
+ <outputDirectory>doc/manual</outputDirectory>
<excludes>
<exclude>**/*.fo</exclude>
</excludes>
Modified: jbpm4/pvm/trunk/hudson/build.xml
===================================================================
--- jbpm4/pvm/trunk/hudson/build.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/hudson/build.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -12,7 +12,8 @@
<!-- $Id$ -->
<project>
-
+
+
<property name="hudson.dir" value="${basedir}"/>
<property name="hudson.target.dir" value="${hudson.dir}/target"/>
@@ -23,10 +24,10 @@
<target name="init">
<!-- Check if ant.properties is available -->
- <available property="ant.properties.available" file="${basedir}/ant.properties"/>
- <fail message="Cannot find ant.properties. Did you copy/edit ant.properties.example?" unless="ant.properties.available"/>
+ <available property="hudson.properties.available" file="${user.home}/.jbpm4/hudson.properties"/>
+ <fail message="Cannot find ${user.home}/.jbpm4/hudson.properties. Did you copy/edit ant.properties.example?" unless="hudson.properties.available"/>
- <property file="${basedir}/ant.properties"/>
+ <property file="${user.home}/.jbpm4/hudson.properties"/>
<xmlproperty file="${basedir}/../pom.xml"/>
<property name="version.id" value="${project.version}"/>
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -29,7 +29,6 @@
import org.jbpm.pvm.model.Node;
import org.jbpm.pvm.model.ObservableElement;
import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.Transition;
import org.jbpm.pvm.processlog.ProcessLog;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -37,6 +37,19 @@
*/
public interface EventListenerExecution extends OpenExecution {
+
+ /** the original object that fired the event, part of the current position in the
+ * process graph. Can be null in case no event is being fired. This is mostly the
+ * object that is listened to with an {@link Activity}, but the eventSource can also
+ * be a child of the object to which is listened in case of event propagation. */
+ ObservableElement getEventSource();
+
+ /** the event that is being fired, part of the current position in the process
+ * graph. Can be null in case no event is being fired. */
+ Event getEvent();
+
+ // candidates to be moved to OpenExecution:
+
// logs /////////////////////////////////////////////////////////////////////
/** adds a <a href="package-summary.html#logs">log</a> to this execution. */
@@ -56,17 +69,7 @@
/** the exception in case an exception handler is handling an exception. */
Exception getException();
-
- /** the original object that fired the event, part of the current position in the
- * process graph. Can be null in case no event is being fired. This is mostly the
- * object that is listened to with an {@link Activity}, but the eventSource can also
- * be a child of the object to which is listened in case of event propagation. */
- ObservableElement getEventSource();
- /** the event that is being fired, part of the current position in the process
- * graph. Can be null in case no event is being fired. */
- Event getEvent();
-
// extensions //////////////////////////////////////////////////////////////
/** way to access process language extensions in the execution without
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestCase.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -79,24 +79,4 @@
environmentFactory.close();
}
}
-
- /*
- static String getConfigResource(Package p) {
- return p.getName().replace('.','/')+"/environment.cfg.xml";
- }
-
- static void setUpPackage(Package testPackage) {
- String packageName = testPackage.getName();
- createEnvironmentFactory(testPackage);
- }
-
- static void tearDownPackage(Package testPackage) {
- String packageName = testPackage.getName();
- EnvironmentFactory environmentFactory = environmentFactories.remove(packageName);
- if (environmentFactory!=null) {
- log.debug("closing environment factory for package ["+packageName+"]");
- environmentFactory.close();
- }
- }
- */
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentFactoryTestSetup.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -14,10 +14,6 @@
package org.jbpm.pvm.test.base;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
-
import junit.extensions.TestSetup;
import junit.framework.Test;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/DbTests.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -25,10 +25,10 @@
import junit.framework.TestSuite;
import org.jbpm.pvm.api.db.continuation.ContinuationTests;
-import org.jbpm.pvm.api.db.embedded.EmbeddedTests;
import org.jbpm.pvm.api.db.svc.DbSvcTests;
import org.jbpm.pvm.api.spring.SpringTests;
import org.jbpm.pvm.api.tx.TxTests;
+import org.jbpm.pvm.example03.EmbeddedTests;
import org.jbpm.pvm.internal.db.langext.DbLangExtTests;
import org.jbpm.pvm.internal.db.model.DbModelTests;
import org.jbpm.pvm.internal.db.type.VariableCustomTypeTest;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicExecutionFlowTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicExecutionFlowTest.java 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/basicfeatures/BasicExecutionFlowTest.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -28,11 +28,11 @@
import org.jbpm.pvm.activity.Activity;
import org.jbpm.pvm.activity.ActivityExecution;
import org.jbpm.pvm.activity.ExternalActivity;
-import org.jbpm.pvm.api.db.embedded.AutomaticActivity;
-import org.jbpm.pvm.api.db.embedded.WaitState;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.example03.AutomaticActivity;
+import org.jbpm.pvm.example03.WaitState;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.test.base.JbpmTestCase;
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/AutomaticActivity.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/AutomaticActivity.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/AutomaticActivity.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -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.pvm.example01;
+
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.activity.ActivityExecution;
+
+/**
+ * @author Tom Baeyens
+ */
+public class AutomaticActivity implements Activity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ }
+
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/ObjectExecutionModeTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/ObjectExecutionModeTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/ObjectExecutionModeTest.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,36 @@
+package org.jbpm.pvm.example01;
+
+import junit.framework.TestCase;
+
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+
+
+public class ObjectExecutionModeTest extends TestCase {
+
+
+ public void testObjectExecutionMode(){
+ ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
+ .node("submit loan request").initial().behaviour(AutomaticActivity.class)
+ .transition().to("evaluate")
+ .node("evaluate").behaviour(WaitState.class)
+ .transition("approve").to("wire money")
+ .transition("reject").to("end")
+ .node("wire money").behaviour(AutomaticActivity.class)
+ .transition().to("archive")
+ .node("archive").behaviour(WaitState.class)
+ .transition().to("end")
+ .node("end").behaviour(WaitState.class)
+ .done();
+
+ ClientExecution execution = processDefinition.startProcessInstance();
+
+ assertEquals("evaluate", execution.getNodeName());
+
+ execution.signal("approve");
+
+ execution.signal();
+ assertEquals("end", execution.getNodeName());
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/WaitState.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/WaitState.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example01/WaitState.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -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.pvm.example01;
+
+import java.util.Map;
+
+import org.jbpm.pvm.activity.ActivityExecution;
+import org.jbpm.pvm.activity.ExternalActivity;
+
+/**
+ * @author Tom Baeyens
+ */
+public class WaitState implements ExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution,
+ String signalName,
+ Map<String, Object> parameters) {
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,51 @@
+package org.jbpm.pvm.example02;
+
+import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.ExecutionService;
+import org.jbpm.pvm.ManagementService;
+import org.jbpm.pvm.ProcessService;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.example01.AutomaticActivity;
+import org.jbpm.pvm.example01.WaitState;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestCase;
+
+
+public class PersistentExecutionModeTest extends EnvironmentFactoryTestCase {
+
+ public void testPersistentExecutionMode() {
+ // the default constructor of EnvironmentFactoryTestCase will use
+ // resource environment.cfg.xml
+ EnvironmentFactory environmentFactory = getEnvironmentFactory();
+
+ ProcessService processService = environmentFactory.get(ProcessService.class);
+ ExecutionService executionService = environmentFactory.get(ExecutionService.class);
+ ManagementService managementService = environmentFactory.get(ManagementService.class);
+
+ ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
+ .node("submit loan request").initial().behaviour(AutomaticActivity.class)
+ .transition().to("evaluate")
+ .node("evaluate").behaviour(WaitState.class)
+ .transition("approve").to("wire money")
+ .transition("reject").to("end")
+ .node("wire money").behaviour(AutomaticActivity.class)
+ .transition().to("archive")
+ .node("archive").behaviour(WaitState.class)
+ .transition().to("end")
+ .node("end").behaviour(WaitState.class)
+ .done();
+
+ Deployment deployment = new Deployment(processDefinition);
+ processService.deploy(deployment);
+
+ Execution execution = executionService.startExecution("loan:1", "request7836");
+
+ assertEquals("evaluate", execution.getNodeName());
+
+ assertEquals("loan:1/request7836", execution.getId());
+
+ executionService.signalExecution("loan:1/request7836", "approve");
+ }
+}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03 (from rev 2248, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded)
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/AutomaticActivity.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/AutomaticActivity.java 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/AutomaticActivity.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -19,7 +19,7 @@
* 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.api.db.embedded;
+package org.jbpm.pvm.example03;
import org.jbpm.pvm.activity.Activity;
import org.jbpm.pvm.activity.ActivityExecution;
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedExecutionModeTest.java (from rev 2248, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/EmbeddedPersistenceTest.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedExecutionModeTest.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedExecutionModeTest.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,106 @@
+/*
+ * 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.example03;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.jbpm.pvm.test.base.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class EmbeddedExecutionModeTest extends JbpmTestCase {
+
+ SessionFactory sessionFactory;
+ Session session;
+ Transaction transaction;
+
+ public void testLoanApprove() {
+ Configuration configuration = new Configuration();
+ configuration.configure("org/jbpm/pvm/example03/hibernate.cfg.xml");
+ sessionFactory = configuration.buildSessionFactory();
+
+ startTransaction();
+
+ Loan loan = new Loan("john doe", 234.0);
+ session.save(loan);
+ assertEquals("evaluate", loan.getState());
+
+ newTransaction();
+
+ loan = (Loan) session.get(Loan.class, loan.getDbid());
+ assertEquals("evaluate", loan.getState());
+ loan.approve();
+ assertEquals("archive", loan.getState());
+
+ newTransaction();
+
+ loan = (Loan) session.get(Loan.class, loan.getDbid());
+ assertEquals("archive", loan.getState());
+ loan.archiveComplete();
+ assertEquals("end", loan.getState());
+
+ commitTransaction();
+ }
+
+ public void testLoanReject() {
+ Configuration configuration = new Configuration();
+ configuration.configure("org/jbpm/pvm/example03/hibernate.cfg.xml");
+ sessionFactory = configuration.buildSessionFactory();
+
+ startTransaction();
+
+ Loan loan = new Loan("john doe", 234.0);
+ session.save(loan);
+ assertEquals("evaluate", loan.getState());
+
+ newTransaction();
+
+ loan = (Loan) session.get(Loan.class, loan.getDbid());
+ assertEquals("evaluate", loan.getState());
+ loan.reject();
+ assertEquals("end", loan.getState());
+
+ newTransaction();
+
+ loan = (Loan) session.get(Loan.class, loan.getDbid());
+ assertEquals("end", loan.getState());
+ }
+
+
+ void newTransaction() {
+ commitTransaction();
+ startTransaction();
+ }
+
+ void startTransaction() {
+ session = sessionFactory.openSession();
+ transaction = session.beginTransaction();
+ }
+
+ void commitTransaction() {
+ transaction.commit();
+ session.close();
+ }
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedPersistenceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/EmbeddedPersistenceTest.java 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedPersistenceTest.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,104 +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.api.db.embedded;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-import org.jbpm.pvm.test.base.JbpmTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class EmbeddedPersistenceTest extends JbpmTestCase {
-
- SessionFactory sessionFactory;
- Session session;
- Transaction transaction;
-
- public void testLoanApprove() {
- Configuration configuration = new Configuration();
- configuration.configure("org/jbpm/pvm/api/db/embedded/hibernate.cfg.xml");
- sessionFactory = configuration.buildSessionFactory();
-
- startTransaction();
-
- Loan loan = new Loan("john doe", 234.0);
- session.save(loan);
- assertEquals("evaluate", loan.getState());
-
- newTransaction();
-
- loan = (Loan) session.get(Loan.class, loan.getDbid());
- assertEquals("evaluate", loan.getState());
- loan.approve();
- assertEquals("end", loan.getState());
-
- newTransaction();
-
- loan = (Loan) session.get(Loan.class, loan.getDbid());
- assertEquals("validate", loan.getState());
-
- commitTransaction();
- }
-
- public void testLoanReject() {
- Configuration configuration = new Configuration();
- configuration.configure("org/jbpm/pvm/api/db/embedded/hibernate.cfg.xml");
- sessionFactory = configuration.buildSessionFactory();
-
- startTransaction();
-
- Loan loan = new Loan("john doe", 234.0);
- session.save(loan);
- assertEquals("evaluate", loan.getState());
-
- newTransaction();
-
- loan = (Loan) session.get(Loan.class, loan.getDbid());
- assertEquals("evaluate", loan.getState());
- loan.approve();
- assertEquals("end", loan.getState());
-
- newTransaction();
-
- loan = (Loan) session.get(Loan.class, loan.getDbid());
- assertEquals("validate", loan.getState());
- }
-
-
- void newTransaction() {
- commitTransaction();
- startTransaction();
- }
-
- void startTransaction() {
- session = sessionFactory.openSession();
- transaction = session.beginTransaction();
- }
-
- void commitTransaction() {
- transaction.commit();
- session.close();
- }
-}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java (from rev 2263, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/EmbeddedTests.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/EmbeddedTests.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,17 @@
+package org.jbpm.pvm.example03;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+public class EmbeddedTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("org.jbpm.pvm.api.db.embedded");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(EmbeddedExecutionModeTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/Loan.java 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,96 +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.api.db.embedded;
-
-
-import org.jbpm.pvm.client.ClientExecution;
-import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.model.ProcessFactory;
-
-/**
- * @author Tom Baeyens
- */
-public class Loan {
-
- // the loan process definition as a static resource
- private static final ClientProcessDefinition processDefinition = createLoanProcess();
-
- private static ClientProcessDefinition createLoanProcess() {
- ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
- .node("submit loan request").initial().behaviour(AutomaticActivity.class)
- .transition().to("evaluate")
- .node("evaluate").behaviour(WaitState.class)
- .transition("approve").to("wire money")
- .transition("reject").to("end")
- .node("wire money").behaviour(AutomaticActivity.class)
- .transition().to("archive")
- .node("archive").behaviour(WaitState.class)
- .transition().to("end")
- .node("end").behaviour(WaitState.class)
- .done();
-
- return processDefinition;
- }
-
- long dbid;
- String customer;
- double amount;
- ClientExecution execution;
-
- // constructor for persistence
- protected Loan() {
- }
-
- public Loan(String customer, double amount) {
- this.customer = customer;
- this.amount = amount;
- this.execution = processDefinition.startProcessInstance();
- }
-
- public void approve() {
- execution.signal("approve");
- }
-
- public void reject() {
- execution.signal("reject");
- }
-
- public void archiveComplete() {
- execution.signal();
- }
-
- public String getState() {
- return execution.getNode().getName();
- }
-
- // getters //////////////////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getCustomer() {
- return customer;
- }
- public double getAmount() {
- return amount;
- }
-}
Copied: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java (from rev 2263, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/Loan.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/Loan.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,101 @@
+/*
+ * 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.example03;
+
+
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.model.ProcessFactory;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Loan {
+
+ /** the loan process definition as a static resource */
+ private static final ClientProcessDefinition processDefinition = createLoanProcess();
+
+ private static ClientProcessDefinition createLoanProcess() {
+ ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
+ .node("submit loan request").initial().behaviour(AutomaticActivity.class)
+ .transition().to("evaluate")
+ .node("evaluate").behaviour(WaitState.class)
+ .transition("approve").to("wire money")
+ .transition("reject").to("end")
+ .node("wire money").behaviour(AutomaticActivity.class)
+ .transition().to("archive")
+ .node("archive").behaviour(WaitState.class)
+ .transition().to("end")
+ .node("end").behaviour(WaitState.class)
+ .done();
+
+ return processDefinition;
+ }
+
+ /** exposes the process definition to the execution hibernate type */
+ private static ClientProcessDefinition getProcessDefinition() {
+ return processDefinition;
+ }
+
+ long dbid;
+ String customer;
+ double amount;
+ ClientExecution execution;
+
+ /** constructor for persistence */
+ protected Loan() {
+ }
+
+ public Loan(String customer, double amount) {
+ this.customer = customer;
+ this.amount = amount;
+ this.execution = processDefinition.startProcessInstance();
+ }
+
+ public void approve() {
+ execution.signal("approve");
+ }
+
+ public void reject() {
+ execution.signal("reject");
+ }
+
+ public void archiveComplete() {
+ execution.signal();
+ }
+
+ public String getState() {
+ return execution.getNodeName();
+ }
+
+ // getters //////////////////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getCustomer() {
+ return customer;
+ }
+ public double getAmount() {
+ return amount;
+ }
+}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/WaitState.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/embedded/WaitState.java 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/example03/WaitState.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -19,7 +19,7 @@
* 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.api.db.embedded;
+package org.jbpm.pvm.example03;
import java.util.Map;
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/examples/ExamplesTests.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/examples/ExamplesTests.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/examples/ExamplesTests.java 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,27 @@
+package org.jbpm.pvm.examples;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jbpm.pvm.example01.ObjectExecutionModeTest;
+import org.jbpm.pvm.example02.PersistentExecutionModeTest;
+import org.jbpm.pvm.example03.EmbeddedExecutionModeTest;
+import org.jbpm.pvm.test.base.EnvironmentFactoryTestSetup;
+
+public class ExamplesTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("org.jbpm.pvm.examples");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ObjectExecutionModeTest.class);
+ suite.addTestSuite(EmbeddedExecutionModeTest.class);
+
+ TestSuite defaultConfigTests = new TestSuite("default config tests");
+ defaultConfigTests.addTestSuite(PersistentExecutionModeTest.class);
+ suite.addTest(new EnvironmentFactoryTestSetup(defaultConfigTests, "environment.cfg.xml"));
+
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03 (from rev 2248, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded)
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Loan.hbm.xml (from rev 2263, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded/Loan.hbm.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Loan.hbm.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Loan.hbm.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,23 @@
+<?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 package="org.jbpm.pvm.example03" default-access="field">
+
+ <typedef name="execution" class="org.jbpm.pvm.internal.hibernate.ExecutionType" />
+
+ <class name="Loan" table="LOAN">
+
+ <id name="dbid">
+ <generator class="sequence"/>
+ </id>
+
+ <property name="execution" type="execution" />
+ <property name="customer" />
+ <property name="amount" />
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Deleted: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Order.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded/Order.hbm.xml 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/Order.hbm.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,18 +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 package="org.jbpm.pvm.api.db.embedded" default-access="field">
-
- <typedef name="execution" class="org.jbpm.pvm.internal.hibernate.ExecutionType" />
-
- <class name="Order" table="ORDERS">
-
- <id name="dbid">
- <generator class="sequence"/>
- </id>
-
- <property name="processInstance" type="execution" />
-
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded/hibernate.cfg.xml 2008-09-15 12:10:13 UTC (rev 2248)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,23 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
- <session-factory>
-
- <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
- <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
- <property name="hibernate.connection.username">sa</property>
- <property name="hibernate.connection.password"></property>
- <property name="hibernate.hbm2ddl.auto">create</property>
- <property name="hibernate.show_sql">true"</property>
- <property name="hibernate.format_sql">true"</property>
- <property name="hibernate.use_sql_comments">true"</property>
-
- <mapping resource="org/jbpm/pvm/api/db/embedded/Order.hbm.xml"/>
-
- </session-factory>
-</hibernate-configuration>
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml (from rev 2263, jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/api/db/embedded/hibernate.cfg.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/example03/hibernate.cfg.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+ <property name="hibernate.hbm2ddl.auto">create</property>
+ <property name="hibernate.show_sql">true"</property>
+ <property name="hibernate.format_sql">true"</property>
+ <property name="hibernate.use_sql_comments">true"</property>
+
+ <mapping resource="org/jbpm/pvm/example03/Loan.hbm.xml"/>
+
+ </session-factory>
+</hibernate-configuration>
Modified: jbpm4/pvm/trunk/modules/manual/pom.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/pom.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/pom.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -29,89 +29,36 @@
<relativePath>../../pom.xml</relativePath>
</parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>pvm-core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
<build>
+ <!-- ### PLUGINS ###################################################### -->
<plugins>
-<!--
<plugin>
- <groupId>com.agilejava.docbkx</groupId>
- <artifactId>docbkx-maven-plugin</artifactId>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+
<executions>
<execution>
- <id>manual</id>
- <goals>
- <goal>generate-html</goal>
- </goals>
<phase>package</phase>
- <configuration>
- <sourceDirectory>${basedir}/src/main/docbook/en</sourceDirectory>
- <targetDirectory>${basedir}/target/manual/html_single</targetDirectory>
- <postProcess>
- <copy todir="${basedir}/target/manual/html_single/images">
- <fileset dir="${basedir}/src/main/docbook/en/images">
- <include name="**/*.png" />
- <include name="**/*.gif" />
- <include name="**/*.jpg" />
- </fileset>
- </copy>
- </postProcess>
- </configuration>
- </execution>
-
- <execution>
- <id>doc-reference chunk html</id>
<goals>
- <goal>generate-html</goal>
+ <goal>resources</goal>
+ <goal>generate</goal>
</goals>
- <phase>package</phase>
- <configuration>
- <sourceDirectory>${basedir}/src/docbook/doc-reference/en</sourceDirectory>
- <targetDirectory>${basedir}/target/manual/html/reference</targetDirectory>
- <chunkedOutput>true</chunkedOutput>
- <postProcess>
- <copy todir="${basedir}/target/manual/html/reference/images">
- <fileset
- dir="${basedir}/src/docbook/doc-reference/en/images">
- <include name="**/*.png" />
- <include name="**/*.gif" />
- <include name="**/*.jpg" />
- </fileset>
- </copy>
- </postProcess>
- </configuration>
</execution>
- <execution>
- <id>doc-reference pdf</id>
- <goals>
- <goal>generate-pdf</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <sourceDirectory>${basedir}/src/docbook/doc-reference/en</sourceDirectory>
- <targetDirectory>${basedir}/target/manual/pdf/reference</targetDirectory>
- <imgSrcPath>${basedir}/src/docbook/doc-reference/en/</imgSrcPath>
- </configuration>
- </execution>
+ </executions>
- </executions>
<dependencies>
<dependency>
- <groupId>org.docbook</groupId>
- <artifactId>docbook-xml</artifactId>
- <version>4.4</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </plugin>
--->
-
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <extensions>true</extensions>
-
- <dependencies>
- <dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
<version>1.1.0</version>
@@ -128,7 +75,7 @@
<sourceDocumentName>master.xml</sourceDocumentName>
<masterTranslation>en</masterTranslation>
<imageResource>
- <directory>src/main/docbook/en</directory>
+ <directory>${basedir}/src/main/docbook/en</directory>
<includes>
<include>images/*.png</include>
</includes>
@@ -141,6 +88,7 @@
</format>
</formats>
</configuration>
+
</plugin>
</plugins>
Modified: jbpm4/pvm/trunk/modules/manual/src/main/diagrams/images.ppt
===================================================================
(Binary files differ)
Added: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/interceptors.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/images/interceptors.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/master.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book [
- <!ENTITY ch01-Introduction SYSTEM "modules/ch01-Introduction.xml">
- <!ENTITY ch02-ExecutionModes SYSTEM "modules/ch02-ExecutionModes.xml">
- <!ENTITY ch03-Architecture SYSTEM "modules/ch03-Architecture.xml">
- <!ENTITY ch04-SoftwareLogging SYSTEM "modules/ch04-SoftwareLogging.xml">
+ <!ENTITY ch01-Introduction SYSTEM "modules/ch01-Introduction.xml">
+ <!ENTITY ch02-ExecutionModes SYSTEM "modules/ch02-ExecutionModes.xml">
+ <!ENTITY ch03-Architecture SYSTEM "modules/ch03-Architecture.xml">
+ <!ENTITY ch04-BasicProcessExecutionConcepts SYSTEM "modules/ch04-BasicProcessExecutionConcepts.xml">
]>
<book lang="en">
@@ -21,6 +21,6 @@
&ch01-Introduction;
&ch02-ExecutionModes;
&ch03-Architecture;
- &ch04-SoftwareLogging;
+ &ch04-BasicProcessExecutionConcepts;
</book>
\ No newline at end of file
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -64,7 +64,7 @@
method. So after the <literal>startProcessInstance</literal> we can verify if the
execution is positioned in the evaluate node.
</para>
- <programlisting>assertEquals("evaluate", processInstance.getNodeName());</programlisting>
+ <programlisting>assertEquals("evaluate", execution.getNodeName());</programlisting>
<para>To make the process execute further, we provide an external trigger with the
<literal>signal</literal> method. The result of the evaluation will be given as the
signalName parameter like this:
@@ -75,12 +75,12 @@
the automatic activity <literal>wire money</literal> and then return after entering
the next wait state <literal>archive</literal>.
</para>
- <programlisting>assertEquals("archive", processInstance.getNodeName());</programlisting>
+ <programlisting>assertEquals("archive", execution.getNodeName());</programlisting>
<para>When the execution is waiting in the archive node, the default signal will
make it take the first unnamed transition.
</para>
<programlisting>execution.signal();
-assertEquals("end", processInstance.getNodeName());</programlisting>
+assertEquals("end", execution.getNodeName());</programlisting>
<para>The process has executed in the thread of the client. The
<literal>startProcessInstance</literal> method only returned when the <literal>evaluate</literal>
node was reached. In other words, the <literal>ClientProcessDefinition.startProcessInstance</literal>
@@ -165,9 +165,9 @@
</para>
<programlisting>EnvironmentFactory environmentFactory = new PvmEnvironmentFactory("environment.cfg.xml");
-processService = environmentFactory.get(ProcessService.class);
-executionService = environmentFactory.get(ExecutionService.class);
-managementService = environmentFactory.get(ManagementService.class);</programlisting>
+ProcessService processService = environmentFactory.get(ProcessService.class);
+ExecutionService executionService = environmentFactory.get(ExecutionService.class);
+ManagementService managementService = environmentFactory.get(ManagementService.class);</programlisting>
<para>The responsibility of the <literal>ProcessService</literal> is to manage
the repository of process definitions. Before we can start a process execution,
the process definition needs to be deployed into the process repository.
@@ -225,6 +225,11 @@
process execution like this:
</para>
<programlisting>executionService.signalExecution("loan:1/request7836", "approve");</programlisting>
+ <para>More information about service interfaces to run in persistent
+ mode can be found in package
+ <ulink url="../../api/org/jbpm/pvm/package-summary.html"><literal>org.jbpm.pvm</literal> of the
+ api docs</ulink>.
+ </para>
</section>
<section id="embeddedexecutionmode">
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch03-Architecture.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch03-Architecture.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch03-Architecture.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -110,7 +110,8 @@
environment.close();
}</programlisting>
<para>The PVM itself will fetch all it's transactional resources and configurations
- from the environment.
+ from the environment. It's recommended that <literal>Activity</literal> implementations
+ do the same.
</para>
</section>
@@ -129,16 +130,121 @@
<section>
<title>Services</title>
- <para>Services are session facades that expose methods for persistent usage of
- the PVM.
+ <para>There are three services: <literal>ProcessService</literal>,
+ <literal>ExecutionService</literal> and <literal>ManagementService</literal>.
+ In general, services are session facades that expose methods for persistent
+ usage of the PVM. The next fragments show the essential methods as example
+ to illustrate those services.
</para>
- </section>
+ <para>The <literal>ProcessService</literal> manages the repository of
+ process definitions.
+ </para>
+ <programlisting>public interface ProcessService {
- <section>
- <title>Configuration</title>
- <para>
+ ProcessDefinition deploy(Deployment deployment);
+
+ ProcessDefinition findLatestProcessDefinition(String processDefinitionName);
+
+ ...
+
+}</programlisting>
+ <para>The <literal>ExecutionService</literal> manages the runtime
+ executions.</para>
+ <programlisting>public interface ExecutionService {
+
+ Execution startExecution(String processDefinitionId, String executionKey);
+
+ Execution signalExecution(String executionId, String signalName);
+
+ ...
+
+}</programlisting>
+ <para>The <literal>ManagementService</literal> groups all management operations
+ that are needed to keep the system up and running.
</para>
+ <programlisting>public interface ManagementService {
+
+ List<Job> getJobsWithException(int firstResult, int maxResults);
+
+ void executeJob(String jobId);
+
+ ...
+
+}</programlisting>
+ <para>The implementation of all these methods is encapsulated in
+ <literal>Command</literal>s. And the three services all delegate the
+ execution of the commands to a <literal>CommandService</literal>:
+ </para>
+ <programlisting>public interface CommandService {
+
+ <T> T execute(Command<T> command);
+
+}</programlisting>
+ <para>The <literal>CommandService</literal> is configured in the
+ environment. A chain of CommandServices can act as interceptors
+ around a command. This is the core mechanism on how persistence and
+ transactional support can be offered in a variety of environments.
+ </para>
+ <para>From the default configuration which is included in full above,
+ here is the section that configures the services
+ </para>
+ <programlisting><contexts xmlns="http://jbpm.org/pvm/1.0/wire">
+
+ <environment-factory>
+
+ <process-service />
+ <execution-service />
+ <management-service />
+
+ <command-service>
+ <retry-interceptor />
+ <environment-interceptor />
+ <standard-transaction-interceptor />
+ </command-service>
+
+ ...
+ </programlisting>
+ <para>The three services <literal>process-service</literal>, <literal>execution-service</literal>
+ and <literal>management-service</literal> will look up the configured
+ <literal>command-service</literal> by type. The <literal>command-service</literal>
+ tag corresponds to the default command service that essentially does nothing else
+ then just execute the command providing it the current environment.
+ </para>
+ <para>The configured <literal>command-service</literal> results into the following
+ a chain of three interceptors followed by the default command executor.
+ </para>
+ <figure id="interceptors">
+ <title>The CommandService interceptors</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/interceptors.png"/></imageobject></mediaobject>
+ </figure>
+ <para>The retry interceptor is the first in the chain and that one that will be exposed as the
+ <literal>CommandService.class</literal> from the environment. So the retry interceptor
+ will be given to the respective services <literal>process-service</literal>, <literal>execution-service</literal>
+ and <literal>management-service</literal>.
+ </para>
+ <para>The <literal>retry-interceptor</literal> will catch hibernate StaleObjectExceptions
+ (indicating optimistic locking failures) and retry to execute the command.
+ </para>
+ <para>The <literal>environment-interceptor</literal> will put an environment block
+ around the execution of the command.
+ </para>
+ <para>The <literal>standard-transaction-interceptor</literal> will initialize a
+ <literal>StandardTransaction</literal>. The hibernate session/transaction will be
+ enlisted as a resource with this standard transaction.
+ </para>
+ <para>Different configurations of this interceptor stack will also enable to
+ </para>
+ <itemizedlist>
+ <listitem>delegate execution to a local ejb command service so that an container
+ managed transaction is started.
+ </listitem>
+ <listitem>delegate to a remote ejb command service so that the command actually
+ gets executed on a different JVM.
+ </listitem>
+ <listitem>package the command as an asynchronous message so that the command gets
+ executed asynchronously in a different transaction.
+ </listitem>
+ </itemizedlist>
</section>
-
</chapter>
\ No newline at end of file
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml (from rev 2248, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-BasicGraphExecution.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-BasicProcessExecutionConcepts.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,544 @@
+<chapter id="basicprocessexecutionconcepts">
+ <title>Basic process execution concepts</title>
+
+ <para>This chapter explains the basics of process definitions, the features offered by
+ the Process Virtual Machine and how activity implementations can be build. At the same
+ time the client API is shown to execute processes with those activity implementations.
+ </para>
+
+ <!-- ### Activity ####################################################### -->
+ <section id="activity">
+ <title>Activity</title>
+ <para>The PVM library doesn't have a fixed set of process constructs.
+ Instead, runtime behaviour of a node is delegated to an <literal>Activity</literal>.
+ In other words, <literal>Activity</literal> is an interface to implement the runtime
+ behaviour of process constructs in plain Java.
+ </para>
+ <programlisting>public <emphasis role="bold">interface Activity</emphasis> extends Serializable {
+
+ void <emphasis role="bold">execute</emphasis>(ActivityExecution execution) throws Exception;
+
+}</programlisting>
+ <para>When an activity is used as the node behaviour, it is in full control of the further
+ propagation of the execution. In other words, a node behaviour can decide what the execution
+ should do next. For example, it can take a transition with
+ <literal>execution.take(Transition)</literal> or go into a wait state with
+ <literal>execution.waitForSignal()</literal>. In case the node behaviour does not invoke
+ any of the above execution propagation methods, the execution will
+ <link linkend="defaultproceedbehaviour">proceed in a default way</link>.
+ </para>
+ </section>
+
+ <!-- ### Activity example ############################################### -->
+ <section id="activityexample">
+ <title>Activity example</title>
+ <para>We'll start with a very original hello world example. A Display
+ activity will print a message to the console:
+ </para>
+ <programlisting>public <emphasis role="bold">class Display</emphasis> implements <emphasis role="bold">Activity</emphasis> {
+
+ String message;
+
+ public Display(String message) {
+ this.message = message;
+ }
+
+ public void execute(ActivityExecution execution) {
+ <emphasis role="bold">System.out.println(message);</emphasis>
+ }
+}</programlisting>
+ <para>Let' build our first process definition with this activity:</para>
+ <figure id="activity.example">
+ <title>Activity example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
+ .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new Display("hello")</emphasis>)
+ .transition().to("b")
+ .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new Display("world")</emphasis>)
+.done();</programlisting>
+ <para>Now we can execute this process as follows:</para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>The invocation of <literal>startExecution</literal> will print hello world to the console:</para>
+ <programlisting>hello
+world</programlisting>
+ <para>One thing already worth noticing is that activities can be configured
+ with properties. In the Display example, you can see that the message property
+ is configured differently in the two usages. With configuration properties
+ it becomes possible to write reusable activities. They can then be configured
+ differently each time they are used in a process. That is an essential part of
+ how process languages can be build on top of the Process Virtual Machine.
+ </para>
+ </section>
+
+ <!-- ### ExternalActivity ############################################### -->
+ <section id="externalactivity">
+ <title>ExternalActivity</title>
+ <para>External activities are activities for which the responsibility for proceeding
+ the execution is transferred externally, meaning outside the process system. This
+ means that for the system that is executing the process, it's a wait state. The
+ execution will wait until an external trigger is given.
+ </para>
+ <para>For dealing with external triggers, <literal>ExternalActivity</literal>
+ adds two methods to the <literal>Activity</literal>:</para>
+ <programlisting>public <emphasis role="bold">interface ExternalActivity</emphasis> extends <emphasis role="bold">Activity</emphasis> {
+
+ void <emphasis role="bold">signal</emphasis>(Execution execution,
+ String signal,
+ Map<String, Object> parameters) throws Exception;
+
+}</programlisting>
+ <para>Just like with plain activities, when an execution arrives in a node, the
+ <literal>execute</literal>-method of the node behaviour is invoked.
+ In external activities, the execute method typically does something to
+ transfer the responsibility to another system and then enters a wait
+ state by invoking <literal>execution.waitForSignal()</literal>. For
+ example in the execute method, responsibility could be transferred to a
+ person by creating a task entry in a task management system and then
+ wait until the person completes the task.
+ </para>
+ <para>In case a node behaves as a wait state, then the execution will
+ wait in that node until the execution's <literal>signal</literal> method
+ is invoked. The execution will delegate that signal to the behaviour Activity
+ of the current node.
+ </para>
+ <para>So the Activity's <literal>signal</literal>-method is invoked
+ when the execution receives an external trigger during the wait state. With the
+ signal method, responsibility is transferred back to the process execution. For
+ example, when a person completes a task, the task management system calls the
+ signal method on the execution.
+ </para>
+ <para>A signal can optionally have a signal name and a map of parameters. Most
+ common way on how node behaviours interprete the signal and parameters is that
+ the signal relates to the outgoing transition that needs to be taken and that the
+ parameters are set as variables on the execution. But those are just examples, it
+ is up to the activity to use the signal and the parameters as it pleases.
+ </para>
+ </section>
+
+ <!-- ### ExternalActivity example ####################################### -->
+ <section id="externalactivityexample">
+ <title>ExternalActivity example</title>
+ <para>Here's a first example of a simple wait state implementation:
+ </para>
+ <programlisting>public <emphasis role="bold">class WaitState</emphasis> implements ExternalActivity {
+
+ public void <emphasis role="bold">execute</emphasis>(Execution execution) {
+ execution.waitForSignal();
+ }
+
+ public void <emphasis role="bold">signal</emphasis>(Execution execution,
+ String signal,
+ Map<String, Object> parameters) {
+ execution.take(signal);
+ }
+}</programlisting>
+ <para>The <literal>execute</literal>-method calls
+ <literal>execution.waitForSignal()</literal>. This call is
+ necessary to prevent automatic propagation of the execution. By calling
+ <literal>execution.waitForSignal()</literal>, the node will
+ behave as a wait state.
+ </para>
+ <para><literal>signal</literal>-method takes the transition with
+ the signal parameter as the transition name. So when an execution receives an
+ external trigger, the signal name is interpreted as the name of an outgoing
+ transition and the execution will be propagated over that transition.
+ </para>
+ <para>Here's the same simple process that has a transition from a to b. This
+ time, the behaviour of the two nodes will be WaitState's.
+ </para>
+ <figure id="process.diagram">
+ <title>Process diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
+ .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
+ .transition().to("b")
+ .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
+.done();</programlisting>
+
+<programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+<programlisting>execution.signal();</programlisting>
+ </section>
+
+ <!-- ### BASIC PROCESS EXECUTION ######################################## -->
+ <section id="basicprocessexecution">
+ <title>Basic process execution</title>
+ <para>In this next example, we'll combine automatic activities and wait states.
+ This example is a simplified version of a loan approval process. Graphically,
+ it looks like this:
+ </para>
+ <figure id="the.first.graph.process">
+ <title>The first graph process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/first.graph.process.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Building process graphs in Java code can be tedious because you have to keep track of all the
+ references in local variables. To resolve that, the Process Virtual Machine comes with a
+ ProcessFactory. The ProcessFactory is a kind of domain specific language (DSL) that is embedded
+ in Java and eases the construction of process graphs. This pattern is also known as
+ a <ulink url="http://martinfowler.com/bliki/FluentInterface.html">fluent
+ interface</ulink>.
+ </para>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
+ .<emphasis role="bold">node("accept loan request").initial()</emphasis>.behaviour(new WaitState())
+ .transition().to("loan evaluation")
+ .<emphasis role="bold">node("loan evaluation")</emphasis>.behaviour(new WaitState())
+ .transition("approve").to("wire the money")
+ .transition("reject").to("end")
+ .<emphasis role="bold">node("wire the money")</emphasis>.behaviour(new Display("automatic payment"))
+ .transition().to("end")
+ .<emphasis role="bold">node("end")</emphasis>.behaviour(new WaitState())
+.done();</programlisting>
+ <para>For more details about the ProcessFactory, see the javadocs. An alternative for
+ the ProcessFactory would be to create an XML language and an XML parser for expressing
+ processes. The XML parser can then instantiate the classes of package
+ <literal>org.jbpm.pvm.internal.model</literal> directly. That approach is typically taken by
+ process languages.
+ </para>
+ <para>The node <literal>wire the money</literal> is an automatic node. The
+ <literal>Display</literal> implementation uses the Java API's to just print a
+ message to the console. But the witty reader can imagine an alternative
+ <literal>Activity</literal> implementation that uses the Java API of a payment
+ processing library to make a real automatic payment. All the other nodes are
+ wait states.
+ </para>
+ <para>A new execution for the process above can be started like this
+ </para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>Starting a new execution implies that the initial node is executed. Since in
+ this case it's a wait state, the new execution will be positioned in the
+ node 'accept loan request' when the <literal>startExecution</literal>-method returns.
+ </para>
+ <figure id="first.execution.state.accept">
+ <title>Execution positioned in 'accept loan request'</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.accept.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Now we can give this execution an external trigger with the <literal>signal</literal>-
+ method on the execution. Invoking the signal method will take the execution to the next
+ wait state.
+ </para>
+ <programlisting>execution.signal();</programlisting>
+ <figure id="execution.state.evaluation">
+ <title>Execution positioned in 'loan evaluation'</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.evaluation.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Now, the execution is at an interesting point. There are two transitions out of
+ the state 'loan evaluation'. One transition is called 'approve' and one transition
+ is called 'reject'. As we explained above in the WaitState implementation, the transition
+ taken corresponds to the signal that is given. Let's feed in the 'approve' signal like this:
+ </para>
+ <programlisting>execution.signal("approve");</programlisting>
+ <para>The 'approve' signal will cause the execution to take the 'approve' transition and
+ it will arrive in the node 'wire the money'.
+ </para>
+ <para>In <literal>wire the money</literal>, the message will be printed to the console.
+ Since, the <literal>Display</literal> activity didn't invoke the
+ <literal>execution.waitForSignal()</literal>, nor any of the other execution propagation
+ methods, the default behaviour will be to just proceed.
+ </para>
+ <para><link linkend="defaultproceedbehaviour">Proceeding</link> in this case means that
+ the default outgoing transition is taken and the execution will arrive in the <literal>end</literal>
+ node, which is a wait state.</para>
+ <para>So only when the <literal>end</literal> wait state is reached, the <literal>signal("approve")</literal>
+ returns. That is because all of the things that needed to be done between the original
+ state and this new state could be executed by the process system. Executing till the
+ next wait state is the default behaviour and that behaviour can be changed with
+ </para>
+ <para><emphasis role="bold">TODO: add link to async continuations</emphasis></para>
+ <para>asynchronous continuations in case
+ transactions should not include all calculations till the next wait state. For
+ more about this, see <xref linkend="executionandthreads" />.
+ </para>
+ <para>Another signal invocation will bring it eventually in the end state.</para>
+ <figure id="execution.state.end">
+ <title>Execution positioned in 'end'</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.end.png"/></imageobject></mediaobject>
+ </figure>
+ </section>
+
+ <!-- ### MOTIVATION ##################################################### -->
+ <section id="motivation">
+ <title>Motivation</title>
+ <para>There are basically two forms of process languages: graph based and composite
+ process languages. First of all, this design supports both. Even graph based execution
+ and node composition can be used in combination to implement something like UML super states.
+ </para>
+ <para>In this design, control flow activity implementations will have to be
+ aware of whether they are dependent on transitions (graph based) or whether they are
+ using the composite node structure. The goal of this design is that all non-control
+ flow activities can be implemented in the same way so that you can use them in graph
+ based process languages as well as in composite process languages.
+ </para>
+ </section>
+
+ <!-- ### EVENTS ######################################################### -->
+ <section id="events">
+ <title>Events</title>
+ <para>Events are points in the process definition to which a list of
+ activities can be subscribed as listeners. The motivation for events is to allow for
+ developers to add programming logic to a process without changing the process diagram.
+ This is a very valuable instrument in
+ facilitating the collaboration between business analysts and developers. Business analysts
+ are responsible for expressing the requirements. When they use a process graph to document
+ those requirements, developers can take this diagram and make it executable. Events can
+ be a very handy to insert technical details into a process (like e.g. some database insert)
+ in which the business analyst is not interested.
+ </para>
+ <para>Most common events are fired by the execution automatically:
+ </para>
+ <itemizedlist>
+ <listitem><literal>Transition.EVENT_TRANSITION_TAKE = "transition-take"</literal> :
+ fired on transitions when transitions are taken.
+ </listitem>
+ <listitem><literal>Node.EVENT_NODE_ENTER = "node-enter"</literal> : fired on the node
+ when execution enters that node. This happens when execution takes a transition
+ to that node, when a child node is being executed with <literal>execution.execute(Node)</literal>
+ or when a transition is taken from a node outside that node to a contained node.
+ The latter refers to super states in state machines.
+ </listitem>
+ <listitem><literal>Node.EVENT_NODE_LEAVE = "node-leave"</literal> : fired on the node
+ when a transition is taken out of that node or when a child node execution is
+ finished and the execution is propagated to the parent node.
+ </listitem>
+ <listitem><literal>ProcessDefinition.EVENT_PROCESS_START = "process-start"</literal> : fired on a process
+ when a new process is started.
+ </listitem>
+ <listitem><literal>ProcessDefinition.EVENT_PROCESS_END = "process-end"</literal> : fired on a process
+ when a new process is ended. This might include a executions that are ended
+ with a cancelled or error state.
+ </listitem>
+ </itemizedlist>
+ <para>Events are identified by the combination of a process element
+ and an event name. Users and process languages can also fire events
+ programmatically with the fire method on the Execution:
+ </para>
+ <programlisting>public interface Execution extends Serializable {
+ ...
+ void fire(String eventName, ProcessElement eventSource);
+ ...
+}</programlisting>
+
+ <para>A list of <link linkend="activity"><literal>Activity</literal>s</link> can be associated to an
+ event. But activities on events can not influence the control flow of the execution since
+ they are merely listeners to an execution wich is already in progress. This is different from
+ activities that serve as the behaviour for nodes. Node behaviour activities are responsible
+ for propagating the execution. So if an activity in an event invokes any of the
+ following methods, then it will result in an exception.
+ </para>
+
+ <itemizedlist>
+ <listitem><literal>waitForSignal()</literal></listitem>
+ <listitem><literal>take(Transition)</literal></listitem>
+ <listitem><literal>end(*)</literal></listitem>
+ <listitem><literal>execute(Node)</literal></listitem>
+ </itemizedlist>
+
+ <para>We'll reuse the <literal><link linkend="activity">Display</link></literal>
+ activity from above in a simple process: two nodes connected by a
+ transition. The Display listener will be subscribed to the transition event.</para>
+ <figure id="action.process">
+ <title>The process to which a listener activity will be associated</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
+ .node("a").initial().behaviour(new WaitState())
+ <emphasis role="bold">.event("node-leave")
+ .listener(new Display("leaving a"))
+ .listener(new Display("second message while leaving a"))</emphasis>
+ .transition().to("b")
+ <emphasis role="bold">.listener(new Display("taking transition"))</emphasis>
+ .node("b").behaviour(new WaitState())
+ <emphasis role="bold">.event("node-enter")
+ .listener(new Display("entering b"))</emphasis>
+.done();</programlisting>
+ <para>The first event shows how to register multiple listeners to the same
+ event. They will be notified in the order as they are specified.
+ </para>
+ <para>Then, on the transition, there is only one type of event. So in that case,
+ the event type must not be specified and the listeners can be added directly on
+ the transition.
+ </para>
+ <para>A listeners will be called each time an execution fires the event to
+ which the listener is subscribed. The execution will be provided in the activity
+ interface as a parameter and can be used by listeners except for the methods that
+ control the propagation of execution.
+ </para>
+ </section>
+
+ <!-- ### EVENT PROPAGATION ############################################## -->
+ <section>
+ <title>Event propagation</title>
+ <para>Events are by default propagated to enclosing process elements. The motivation
+ is to allow for listeners on process definitions or composite nodes that get executed
+ for all events that occur within that process element. For example this feature
+ allows to register a listener on a process definition or a composite node on
+ <literal>node-leave</literal> events. Such action will be executed if that node is
+ left. And if that listener is registered on a composite node, it will also be executed
+ for all nodes that are left within that composite node.
+ </para>
+ <para>To show this clearly, we'll create a <literal>DisplaySource</literal> activity
+ that will print the message <literal>leaving</literal> and the source of the event
+ to the console.
+ </para>
+ <programlisting>public class <emphasis role="bold">DisplaySource</emphasis> implements Activity {
+
+ public void execute(Execution execution) {
+ <emphasis role="bold">System.out.println("leaving "+execution.getEventSource());</emphasis>
+ }
+}</programlisting>
+ <para>Note that the purpose of event listeners is not to be visible, that's why the activity
+ itself should not be displayed in the diagram. A <literal>DisplaySource</literal> activity
+ will be added as a listener to the event <literal>node-leave</literal> on the composite node.
+ </para>
+ <para>The next process shows how the <literal>DisplaySource</literal> activity is registered
+ as a listener to to the 'node-leave' event on the <literal>composite</literal> node:</para>
+ <figure id="propagation.process">
+ <title>A process with an invisible activity on a node-leave event on a composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
+ .compositeNode("composite")
+ <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
+ .listener(new DisplaySource())</emphasis>
+ .node("a").initial().behaviour(new WaitState())
+ .transition().to("b")
+ .node("b").behaviour(new WaitState())
+ .transition().to("c")
+ .compositeEnd()
+ .node("c").behaviour(new WaitState())
+.done();</programlisting>
+ <para>Next we'll start an execution.</para>
+ <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
+ <para>After starting a new execution, the execution will be in node <literal>a</literal> as
+ that is the initial node. No nodes have been left so no message is logged. Next a signal
+ will be given to the execution, causing it to take the transition from <literal>a</literal>
+ to <literal>b</literal>.
+ </para>
+ <programlisting>execution.signal();</programlisting>
+ <para>When the signal method returns, the execution will have taken the transition and
+ the node-leave event will be fired on node a. That event will be propagated to the
+ composite node and to the process definition. Since our propagation logger is placed
+ on node composite it will receive the event and print the following message:
+ </para>
+ <programlisting>leaving node(a)</programlisting>
+ <para>Another</para>
+ <programlisting>execution.signal();</programlisting>
+ <para>will take the transition from b to c. That will fire two node-leave events. One on
+ node b and one on node composite. So the following lines will be appended to the console
+ output:</para>
+ <programlisting>leaving node(b)
+leaving node(composite)</programlisting>
+ <para>Event propagation is build on the hierarchical composition structure of the process
+ definition. The top level element is always the process definition. The process
+ definition contains a list of nodes. Each node can be a leaf node or it can be a
+ composite node, which means that it contains a list of nested nodes. Nested nodes
+ can be used for e.g. super states or composite activities in nested process languages like BPEL.
+ </para>
+ <para>So the even model also works similarly for composite nodes as it did for the process
+ definition above. Suppose that 'Phase one' models
+ a super state as in state machines. Then event propagation allows to subscribe to all events
+ within that super state. The idea is that the hierarchical composition corresponds to
+ diagram representation. If an element 'e' is drawn inside another element 'p', then p
+ is the parent of e. A process definition has a set of top level nodes. Every node can have
+ a set of nested nodes. The parent of a transition is considered as the first common
+ parent for it's source and destination.
+ </para>
+ <para>If an event listener is not interested in propagated events, propagation can be disabled
+ with <literal>propagationDisabled()</literal>. The next process is the same process
+ as above except that propagated events will be disabled on the event listener. The graph diagram
+ remains the same.
+ </para>
+ <figure id="propagation.disabled.process">
+ <title>A process with a listener to 'node-leave' events with propagation disabled.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Building the process with the process factory:
+ </para>
+ <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
+ .compositeNode("composite")
+ <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
+ .listener(new DisplaySource())
+ .propagationDisabled()</emphasis>
+ .node("a").initial().behaviour(new WaitState())
+ .transition().to("b")
+ .node("b").behaviour(new WaitState())
+ .transition().to("c")
+ .nodesEnd()
+ .node("c").behaviour(new WaitState())
+.done();</programlisting>
+ <para>So when the first signal is given for this process, again the node-leave event will be
+ fired on node a, but now the listener on the composite node will not be executed cause
+ propagated events have been disabled. Disabling propagation is a property on the listener
+ and doesn't influence the other listeners. The event will always be fired and propagated
+ over the whole parent hierarchy.
+ </para>
+ <programlisting>Execution execution = processDefinition.startExecution();
+execution.signal();
+</programlisting>
+ <para>Next, the second signal will take the transition from b to c.
+ </para>
+ <programlisting>execution.signal()</programlisting>
+ <para>Again two node-leave
+ events are fired just like above on nodes b and composite respectively. The first event
+ is the node-leave event on node b. That will be propagated to the composite node. So the
+ listener will not be executed for this event cause it has propagation disabled. But the
+ listener will be executed for the node-leave event on the composite node. That is not
+ propagated, but fired directly on the composite node. So the listener will now be executed
+ only once for the composite node as shown in the following console output:
+ </para>
+ <programlisting>leaving node(composite)</programlisting>
+ </section>
+
+ <!-- ### PROCESS STRUCTURE ############################################## -->
+ <section>
+ <title>Process structure</title>
+ <para>Above we already touched briefly on the two main process constructs:
+ Nodes, transitions and node composition. This section will elaborate
+ on all the basic combination possibilities.
+ </para>
+ <figure id="process.structure">
+ <title>UML class diagram of the basic process structure</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.structure.classes.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Next is a series of example diagram structures that can be formed
+ with the PVM process model.
+ </para>
+ <figure id="transition">
+ <title>Any two nodes can be connected with a transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="self.transition">
+ <title>A self transition.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="composite.node">
+ <title>Composite node is a list of nested nodes.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.into.composite">
+ <title>Transition to a node inside a composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.out.of.composite">
+ <title>Transition from a node inside a composite to a node outside the composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.inheritence">
+ <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.outer">
+ <title>Transition from a node to an outer composite.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="transition.to.inner">
+ <title>Transition from a composite node to an inner composed node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
+ </figure>
+ <figure id="initial.in.composite">
+ <title>An initial node inside a composite node.</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
+ </figure>
+ </section>
+
+</chapter>
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-SoftwareLogging.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-SoftwareLogging.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-SoftwareLogging.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,99 +0,0 @@
-<chapter id="softwarelogging">
- <title>Software logging</title>
-
- <section>
- <title>Configuration</title>
- <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
- logged, PVM logging will make the selection with following procedure:
- <orderedlist>
- <listitem>If a <literal>logging.properties</literal> resource is found
- on the classpath (using the context classloader), then JDK logging will
- be used and that file will be used to initialize the JDK logging.
- </listitem>
- <listitem>If log4j is found on the classpath, then log4j will be used.
- The check for log4j will be done by checking availability of class
- <literal>org.apache.log4j.LogManager</literal> with the context classloader.
- </listitem>
- <listitem>If none of the above, JDK logging will be used.</listitem>
- </orderedlist>
- </para>
- </section>
-
- <section>
- <title>Categories</title>
- <para>The PVM classes use their class name as the category for the logger.
- </para>
- <para>To have a basic understanding of what the PVM classes are doing,
- turning on the <literal>debug</literal> level is great. Level
- <literal>trace</literal> might be spitting out too much for that
- purpose.
- </para>
- </section>
-
- <section>
- <title>JDK logging</title>
- <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
- and <literal>trace</literal> maps to <literal>finest</literal>.
- Level <literal>finer</literal> is not used.
- </para>
- <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
- the pvm library and it can create a nice one-line output for log messages.
- It also has a neat feature that creates a unique indentation per thread.
- To configure it, this is a typical <literal>logging.properties</literal>
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.level = FINEST
-java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
-
-# For example, set the com.xyz.foo logger to only log SEVERE messages:
-# com.xyz.foo.level = SEVERE
-
-.level = SEVERE
-org.jbpm.level=FINE
-org.jbpm.tx.level=FINE
-org.jbpm.pvm.internal.wire.level=FINE</programlisting>
-
-<!--
- <para>For production usage, jBPM also includes an error triggered log handler. This is
- a log handler that will only keep the most recent log messages in
- memory and these will only be flushed to a file in case an error occurs.
- </para>
- <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
- to the handlers in the logging properties like this:
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
- <para>Next snippet shows how in the same logging.properties, the error
- triggered file handler can be configured. The given values are the default
- values.
- </para>
- <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
-org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
-org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
- <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
- JDK handlers FileHandler and MemoryHandler can used in combination to get
- similar results with a bit more configuration.
- </para>
-
--->
- </section>
-
- <section>
- <title>Debugging persistence</title>
- <para>When testing the persistence, following logging configurations can be
- valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
- and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
- set in the queries.
- </para>
- <programlisting>org.hibernate.SQL.level=FINEST
-org.hibernate.type.level=FINEST</programlisting>
- <para>And in case you get a failed batch as a cause in a hibernate exception,
- you might want to set the batch size to 0 like this in the hibernate properties:
- </para>
- <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
- <para>Also in the hibernate properties, the following properties allow for
- detailed logs of the SQL that hibernate spits out:</para>
- <programlisting>hibernate.show_sql = true
-hibernate.format_sql = true
-hibernate.use_sql_comments = true</programlisting>
- </section>
-</chapter>
\ No newline at end of file
Modified: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-AdvancedGraphExecution.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -53,6 +53,33 @@
</para>
</section>
+ <!-- ### FUNCTIONAL ACTIVITIES ################################ -->
+ <section id="functionalactivities">
+ <title>Functional activities</title>
+ <para>Activities that also can be used as event listeners are called functional
+ activities. Examples of automatic activities are sending an email, doing a database
+ update, generating a pdf, calculating an average, etc. All of these are automatic
+ activities that do not change the execution flow. Here's how such activities can
+ be implemented:
+ </para>
+ <programlisting>public class FunctionalActivity implements Activity, EventListener {
+ public void execute(ActivityExecution execution) {
+ perform(execution);
+ }
+ public void notify(EventListenerExecution execution) {
+ perform(execution);
+ }
+ void perform(OpenExecution execution) {
+ ...do functional work...
+ }
+ }</programlisting>
+ <para>None of these methods actually invoke execution propagation methods.
+ So after the perform method is completed, the execution will
+ <link linkend="defaultproceedbehaviour">proceed in the default way</link>.
+ </para>
+ </section>
+
+
<!-- ### EXECUTION AND THREADS ########################################## -->
<section id="executionandthreads">
<title>Execution and threads</title>
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-BasicGraphExecution.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-BasicGraphExecution.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-BasicGraphExecution.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,553 +0,0 @@
-<chapter id="basicgraphexecution">
- <title>Basic graph execution</title>
-
- <!-- ### Activity ####################################################### -->
- <section id="activity">
- <title>Activity</title>
- <para>The PVM library doesn't have a fixed set of process constructs.
- Instead, runtime behaviour of a node is delegated to an <literal>Activity</literal>.
- In other words, <literal>Activity</literal> is an interface to implement the runtime
- behaviour of process constructs in plain Java. Also, <literal>Activity</literal>
- implementations can be subscrribed as listeners to
- <link linkend="events">process events</link>.
- </para>
- <programlisting>public <emphasis role="bold">interface Activity</emphasis> extends Serializable {
- void <emphasis role="bold">execute</emphasis>(Execution execution) throws Exception;
-}</programlisting>
- <para><literal>Activity</literal>'s can be used as node behaviour and as listeners to process
- events. When an activity is used as the node behaviour, it is in full control of the further
- propagation of the execution. In other words, a node behaviour can decide what the execution
- should do next. For example, it can take a transition
- with <literal>execution.take(Transition)</literal>, go into a wait state with
- <literal>execution.waitForSignal()</literal>. Or the node behaviour can not invoke
- any of the above, in that case the Process Virtual Machine will just
- <link linkend="defaultproceedbehaviour">proceed the execution in a default way</link>.
- </para>
- <para>Events are only fired during process execution. Since during an event the
- execution is already 'in motion', event listeners can not control the propagation
- of execution. Therefore, <literal>Activity</literal> implementations can only
- be used as event listeners if they don't invoke any of the execution propagation
- methods.
- </para>
- <para>This way, it is very easy to implement automatic activities that can be
- used as node behaviour as well as event listeners. Examples of automatic activities
- are sending an email, doing a database update, generating a pdf, calculating an average,
- etc. All of these can be executed by the process system and they can be used both as
- node behaviour as well as event listeners. In case they are used as node behaviour
- they can rely on the default proceed behaviour.
- </para>
- </section>
-
- <!-- ### Activity example ############################################### -->
- <section id="activityexample">
- <title>Activity example</title>
- <para>We'll start with a very original hello world example. A Display
- activity will print a message to the console:
- </para>
- <programlisting>public <emphasis role="bold">class Display</emphasis> implements <emphasis role="bold">Activity</emphasis> {
-
- String message;
-
- public Display(String message) {
- this.message = message;
- }
-
- public void execute(Execution execution) {
- <emphasis role="bold">System.out.println(message);</emphasis>
- }
-}</programlisting>
- <para>Let' build our first process definition with this activity:</para>
- <figure id="activity.example">
- <title>Activty example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new Display("hello")</emphasis>)
- .transition().to("b")
- .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new Display("world")</emphasis>)
-.done();</programlisting>
- <para>Now we can execute this process as follows:</para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>The invocation of <literal>startExecution</literal> will print hello world to the console:</para>
- <programlisting>hello
-world</programlisting>
- <para>One thing already worth noticing is that activities can be configured
- with properties. In the Display example, you can see that the message property
- is configured differently in the two usages. With configuration properties
- it becomes possible to write reusable activities. They can then be configured
- differently each time they are used in a process. That is an essential part of
- how process languages can be build on top of the Process Virtual Machine.
- </para>
- </section>
-
- <!-- ### ExternalActivity ############################################### -->
- <section id="externalactivity">
- <title>ExternalActivity</title>
- <para>External activities are activities for which the responsibility for proceeding
- the execution is transferred externally, meaning outside the process system. This
- means that for the system that is executing the process, it's a wait state. The
- execution will wait until an external trigger is given.
- </para>
- <para>For dealing with external triggers, <literal>ExternalActivity</literal>
- adds two methods to the <literal>Activity</literal>:</para>
- <programlisting>public <emphasis role="bold">interface ExternalActivity</emphasis> extends <emphasis role="bold">Activity</emphasis> {
-
- void <emphasis role="bold">signal</emphasis>(Execution execution,
- String signal,
- Map<String, Object> parameters) throws Exception;
-
-}</programlisting>
- <para>Just like with plain activities, when an execution arrives in a node, the
- <literal>execute</literal>-method of the node behaviour is invoked.
- In external activities, the execute method typically does something to
- transfer the responsibility to another system and then enters a wait
- state by invoking <literal>execution.waitForSignal()</literal>. For
- example in the execute method, responsibility could be transferred to a
- person by creating a task entry in a task management system and then
- wait until the person completes the task.
- </para>
- <para>In case a node behaves as a wait state, then the execution will
- wait in that node until the execution's <literal>signal</literal> method
- is invoked. The execution will delegate that signal to the behaviour Activity
- of the current node.
- </para>
- <para>So the Activity's <literal>signal</literal>-method is invoked
- when the execution receives an external trigger during the wait state. With the
- signal method, responsibility is transferred back to the process execution. For
- example, when a person completes a task, the task management system calls the
- signal method on the execution.
- </para>
- <para>A signal can optionally have a signal name and a map of parameters. Most
- common way on how node behaviours interprete the signal and parameters is that
- the signal relates to the outgoing transition that needs to be taken and that the
- parameters are set as variables on the execution. But those are just examples, it
- is up to the activity to use the signal and the parameters as it pleases.
- </para>
- </section>
-
- <!-- ### ExternalActivity example ####################################### -->
- <section id="externalactivityexample">
- <title>ExternalActivity example</title>
- <para>Here's a first example of a simple wait state implementation:
- </para>
- <programlisting>public <emphasis role="bold">class WaitState</emphasis> implements ExternalActivity {
-
- public void <emphasis role="bold">execute</emphasis>(Execution execution) {
- execution.waitForSignal();
- }
-
- public void <emphasis role="bold">signal</emphasis>(Execution execution,
- String signal,
- Map<String, Object> parameters) {
- execution.take(signal);
- }
-}</programlisting>
- <para>The <literal>execute</literal>-method calls
- <literal>execution.waitForSignal()</literal>. This call is
- necessary to prevent automatic propagation of the execution. By calling
- <literal>execution.waitForSignal()</literal>, the node will
- behave as a wait state.
- </para>
- <para><literal>signal</literal>-method takes the transition with
- the signal parameter as the transition name. So when an execution receives an
- external trigger, the signal name is interpreted as the name of an outgoing
- transition and the execution will be propagated over that transition.
- </para>
- <para>Here's the same simple process that has a transition from a to b. This
- time, the behaviour of the two nodes will be WaitState's.
- </para>
- <figure id="process.diagram">
- <title>Process diagram</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("a").initial()</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
- .transition().to("b")
- .<emphasis role="bold">node("b")</emphasis>.behaviour(<emphasis role="bold">new WaitState()</emphasis>)
-.done();</programlisting>
-
-<programlisting>Execution execution = processDefinition.startExecution();</programlisting>
-<programlisting>execution.signal();</programlisting>
- </section>
-
- <!-- ### BASIC PROCESS EXECUTION ######################################## -->
- <section id="basicprocessexecution">
- <title>Basic process execution</title>
- <para>In this next example, we'll combine automatic activities and wait states.
- This example is a simplified version of a loan approval process. Graphically,
- it looks like this:
- </para>
- <figure id="the.first.graph.process">
- <title>The first graph process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/first.graph.process.png"/></imageobject></mediaobject>
- </figure>
- <para>Building process graphs in Java code can be tedious because you have to keep track of all the
- references in local variables. To resolve that, the Process Virtual Machine comes with a
- ProcessFactory. The ProcessFactory is a kind of domain specific language (DSL) that is embedded
- in Java and eases the construction of process graphs. This pattern is also known as
- a <ulink url="http://martinfowler.com/bliki/FluentInterface.html">fluent
- interface</ulink>.
- </para>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .<emphasis role="bold">node("accept loan request").initial()</emphasis>.behaviour(new WaitState())
- .transition().to("loan evaluation")
- .<emphasis role="bold">node("loan evaluation")</emphasis>.behaviour(new WaitState())
- .transition("approve").to("wire the money")
- .transition("reject").to("end")
- .<emphasis role="bold">node("wire the money")</emphasis>.behaviour(new Display("automatic payment"))
- .transition().to("end")
- .<emphasis role="bold">node("end")</emphasis>.behaviour(new WaitState())
-.done();</programlisting>
- <para>For more details about the ProcessFactory, see the javadocs. An alternative for
- the ProcessFactory would be to create an XML language and an XML parser for expressing
- processes. The XML parser can then instantiate the classes of package
- <literal>org.jbpm.pvm.internal.model</literal> directly. That approach is typically taken by
- process languages.
- </para>
- <para>The node <literal>wire the money</literal> is an automatic node. The
- <literal>Display</literal> implementation uses the Java API's to just print a
- message to the console. But the witty reader can imagine an alternative
- <literal>Activity</literal> implementation that uses the Java API of a payment
- processing library to make a real automatic payment. All the other nodes are
- wait states.
- </para>
- <para>A new execution for the process above can be started like this
- </para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>Starting a new execution implies that the initial node is executed. Since in
- this case it's a wait state, the new execution will be positioned in the
- node 'accept loan request' when the <literal>startExecution</literal>-method returns.
- </para>
- <figure id="first.execution.state.accept">
- <title>Execution positioned in 'accept loan request'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.accept.png"/></imageobject></mediaobject>
- </figure>
- <para>Now we can give this execution an external trigger with the <literal>signal</literal>-
- method on the execution. Invoking the signal method will take the execution to the next
- wait state.
- </para>
- <programlisting>execution.signal();</programlisting>
- <figure id="execution.state.evaluation">
- <title>Execution positioned in 'loan evaluation'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.evaluation.png"/></imageobject></mediaobject>
- </figure>
- <para>Now, the execution is at an interesting point. There are two transitions out of
- the state 'loan evaluation'. One transition is called 'approve' and one transition
- is called 'reject'. As we explained above in the WaitState implementation, the transition
- taken corresponds to the signal that is given. Let's feed in the 'approve' signal like this:
- </para>
- <programlisting>execution.signal("approve");</programlisting>
- <para>The 'approve' signal will cause the execution to take the 'approve' transition and
- it will arrive in the node 'wire the money'.
- </para>
- <para>In <literal>wire the money</literal>, the message will be printed to the console.
- Since, the <literal>Display</literal> activity didn't invoke the
- <literal>execution.waitForSignal()</literal>, nor any of the other execution propagation
- methods, the default behaviour will be to just proceed.
- </para>
- <para><link linkend="defaultproceedbehaviour">Proceeding</link> in this case means that
- the default outgoing transition is taken and the execution will arrive in the <literal>end</literal>
- node, which is a wait state.</para>
- <para>So only when the <literal>end</literal> wait state is reached, the <literal>signal("approve")</literal>
- returns. That is because all of the things that needed to be done between the original
- state and this new state could be executed by the process system. Executing till the
- next wait state is the default behaviour and that behaviour can be changed with
- </para>
- <para><emphasis role="bold">TODO: add link to async continuations</emphasis></para>
- <para>asynchronous continuations in case
- transactions should not include all calculations till the next wait state. For
- more about this, see <xref linkend="executionandthreads" />.
- </para>
- <para>Another signal invocation will bring it eventually in the end state.</para>
- <figure id="execution.state.end">
- <title>Execution positioned in 'end'</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/execution.state.end.png"/></imageobject></mediaobject>
- </figure>
- </section>
-
- <!-- ### MOTIVATION ##################################################### -->
- <section id="motivation">
- <title>Motivation</title>
- <para>There are basically two forms of process languages: graph based and composite
- process languages. First of all, this design supports both. Even graph based execution
- and node composition can be used in combination to implement something like UML super states.
- </para>
- <para>In this design, control flow activity implementations will have to be
- aware of whether they are dependent on transitions (graph based) or whether they are
- using the composite node structure. The goal of this design is that all non-control
- flow activities can be implemented in the same way so that you can use them in graph
- based process languages as well as in composite process languages.
- </para>
- </section>
-
- <!-- ### EVENTS ######################################################### -->
- <section id="events">
- <title>Events</title>
- <para>Events are points in the process definition to which a list of
- activities can be subscribed as listeners. The motivation for events is to allow for
- developers to add programming logic to a process without changing the process diagram.
- This is a very valuable instrument in
- facilitating the collaboration between business analysts and developers. Business analysts
- are responsible for expressing the requirements. When they use a process graph to document
- those requirements, developers can take this diagram and make it executable. Events can
- be a very handy to insert technical details into a process (like e.g. some database insert)
- in which the business analyst is not interested.
- </para>
- <para>Most common events are fired by the execution automatically:
- </para>
- <itemizedlist>
- <listitem><literal>Transition.EVENT_TRANSITION_TAKE = "transition-take"</literal> :
- fired on transitions when transitions are taken.
- </listitem>
- <listitem><literal>Node.EVENT_NODE_ENTER = "node-enter"</literal> : fired on the node
- when execution enters that node. This happens when execution takes a transition
- to that node, when a child node is being executed with <literal>execution.execute(Node)</literal>
- or when a transition is taken from a node outside that node to a contained node.
- The latter refers to super states in state machines.
- </listitem>
- <listitem><literal>Node.EVENT_NODE_LEAVE = "node-leave"</literal> : fired on the node
- when a transition is taken out of that node or when a child node execution is
- finished and the execution is propagated to the parent node.
- </listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_START = "process-start"</literal> : fired on a process
- when a new process is started.
- </listitem>
- <listitem><literal>ProcessDefinition.EVENT_PROCESS_END = "process-end"</literal> : fired on a process
- when a new process is ended. This might include a executions that are ended
- with a cancelled or error state.
- </listitem>
- </itemizedlist>
- <para>Events are identified by the combination of a process element
- and an event name. Users and process languages can also fire events
- programmatically with the fire method on the Execution:
- </para>
- <programlisting>public interface Execution extends Serializable {
- ...
- void fire(String eventName, ProcessElement eventSource);
- ...
-}</programlisting>
-
- <para>A list of <link linkend="activity"><literal>Activity</literal>s</link> can be associated to an
- event. But activities on events can not influence the control flow of the execution since
- they are merely listeners to an execution wich is already in progress. This is different from
- activities that serve as the behaviour for nodes. Node behaviour activities are responsible
- for propagating the execution. So if an activity in an event invokes any of the
- following methods, then it will result in an exception.
- </para>
-
- <itemizedlist>
- <listitem><literal>waitForSignal()</literal></listitem>
- <listitem><literal>take(Transition)</literal></listitem>
- <listitem><literal>end(*)</literal></listitem>
- <listitem><literal>execute(Node)</literal></listitem>
- </itemizedlist>
-
- <para>We'll reuse the <literal><link linkend="activity">Display</link></literal>
- activity from above in a simple process: two nodes connected by a
- transition. The Display listener will be subscribed to the transition event.</para>
- <figure id="action.process">
- <title>The process to which a listener activity will be associated</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new WaitState())
- <emphasis role="bold">.event("node-leave")
- .listener(new Display("leaving a"))
- .listener(new Display("second message while leaving a"))</emphasis>
- .transition().to("b")
- <emphasis role="bold">.listener(new Display("taking transition"))</emphasis>
- .node("b").behaviour(new WaitState())
- <emphasis role="bold">.event("node-enter")
- .listener(new Display("entering b"))</emphasis>
-.done();</programlisting>
- <para>The first event shows how to register multiple listeners to the same
- event. They will be notified in the order as they are specified.
- </para>
- <para>Then, on the transition, there is only one type of event. So in that case,
- the event type must not be specified and the listeners can be added directly on
- the transition.
- </para>
- <para>A listeners will be called each time an execution fires the event to
- which the listener is subscribed. The execution will be provided in the activity
- interface as a parameter and can be used by listeners except for the methods that
- control the propagation of execution.
- </para>
- </section>
-
- <!-- ### EVENT PROPAGATION ############################################## -->
- <section>
- <title>Event propagation</title>
- <para>Events are by default propagated to enclosing process elements. The motivation
- is to allow for listeners on process definitions or composite nodes that get executed
- for all events that occur within that process element. For example this feature
- allows to register a listener on a process definition or a composite node on
- <literal>node-leave</literal> events. Such action will be executed if that node is
- left. And if that listener is registered on a composite node, it will also be executed
- for all nodes that are left within that composite node.
- </para>
- <para>To show this clearly, we'll create a <literal>DisplaySource</literal> activity
- that will print the message <literal>leaving</literal> and the source of the event
- to the console.
- </para>
- <programlisting>public class <emphasis role="bold">DisplaySource</emphasis> implements Activity {
-
- public void execute(Execution execution) {
- <emphasis role="bold">System.out.println("leaving "+execution.getEventSource());</emphasis>
- }
-}</programlisting>
- <para>Note that the purpose of event listeners is not to be visible, that's why the activity
- itself should not be displayed in the diagram. A <literal>DisplaySource</literal> activity
- will be added as a listener to the event <literal>node-leave</literal> on the composite node.
- </para>
- <para>The next process shows how the <literal>DisplaySource</literal> activity is registered
- as a listener to to the 'node-leave' event on the <literal>composite</literal> node:</para>
- <figure id="propagation.process">
- <title>A process with an invisible activity on a node-leave event on a composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
- </figure>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
- .compositeNode("composite")
- <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
- .listener(new DisplaySource())</emphasis>
- .node("a").initial().behaviour(new WaitState())
- .transition().to("b")
- .node("b").behaviour(new WaitState())
- .transition().to("c")
- .compositeEnd()
- .node("c").behaviour(new WaitState())
-.done();</programlisting>
- <para>Next we'll start an execution.</para>
- <programlisting>Execution execution = processDefinition.startExecution();</programlisting>
- <para>After starting a new execution, the execution will be in node <literal>a</literal> as
- that is the initial node. No nodes have been left so no message is logged. Next a signal
- will be given to the execution, causing it to take the transition from <literal>a</literal>
- to <literal>b</literal>.
- </para>
- <programlisting>execution.signal();</programlisting>
- <para>When the signal method returns, the execution will have taken the transition and
- the node-leave event will be fired on node a. That event will be propagated to the
- composite node and to the process definition. Since our propagation logger is placed
- on node composite it will receive the event and print the following message:
- </para>
- <programlisting>leaving node(a)</programlisting>
- <para>Another</para>
- <programlisting>execution.signal();</programlisting>
- <para>will take the transition from b to c. That will fire two node-leave events. One on
- node b and one on node composite. So the following lines will be appended to the console
- output:</para>
- <programlisting>leaving node(b)
-leaving node(composite)</programlisting>
- <para>Event propagation is build on the hierarchical composition structure of the process
- definition. The top level element is always the process definition. The process
- definition contains a list of nodes. Each node can be a leaf node or it can be a
- composite node, which means that it contains a list of nested nodes. Nested nodes
- can be used for e.g. super states or composite activities in nested process languages like BPEL.
- </para>
- <para>So the even model also works similarly for composite nodes as it did for the process
- definition above. Suppose that 'Phase one' models
- a super state as in state machines. Then event propagation allows to subscribe to all events
- within that super state. The idea is that the hierarchical composition corresponds to
- diagram representation. If an element 'e' is drawn inside another element 'p', then p
- is the parent of e. A process definition has a set of top level nodes. Every node can have
- a set of nested nodes. The parent of a transition is considered as the first common
- parent for it's source and destination.
- </para>
- <para>If an event listener is not interested in propagated events, propagation can be disabled
- with <literal>propagationDisabled()</literal>. The next process is the same process
- as above except that propagated events will be disabled on the event listener. The graph diagram
- remains the same.
- </para>
- <figure id="propagation.disabled.process">
- <title>A process with a listener to 'node-leave' events with propagation disabled.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/propagation.process.png"/></imageobject></mediaobject>
- </figure>
- <para>Building the process with the process factory:
- </para>
- <programlisting>ProcessDefinition processDefinition = ProcessFactory.build("propagate")
- .compositeNode("composite")
- <emphasis role="bold">.event(Node.EVENT_NODE_LEAVE)
- .listener(new DisplaySource())
- .propagationDisabled()</emphasis>
- .node("a").initial().behaviour(new WaitState())
- .transition().to("b")
- .node("b").behaviour(new WaitState())
- .transition().to("c")
- .nodesEnd()
- .node("c").behaviour(new WaitState())
-.done();</programlisting>
- <para>So when the first signal is given for this process, again the node-leave event will be
- fired on node a, but now the listener on the composite node will not be executed cause
- propagated events have been disabled. Disabling propagation is a property on the listener
- and doesn't influence the other listeners. The event will always be fired and propagated
- over the whole parent hierarchy.
- </para>
- <programlisting>Execution execution = processDefinition.startExecution();
-execution.signal();
-</programlisting>
- <para>Next, the second signal will take the transition from b to c.
- </para>
- <programlisting>execution.signal()</programlisting>
- <para>Again two node-leave
- events are fired just like above on nodes b and composite respectively. The first event
- is the node-leave event on node b. That will be propagated to the composite node. So the
- listener will not be executed for this event cause it has propagation disabled. But the
- listener will be executed for the node-leave event on the composite node. That is not
- propagated, but fired directly on the composite node. So the listener will now be executed
- only once for the composite node as shown in the following console output:
- </para>
- <programlisting>leaving node(composite)</programlisting>
- </section>
-
- <!-- ### PROCESS STRUCTURE ############################################## -->
- <section>
- <title>Process structure</title>
- <para>Above we already touched briefly on the two main process constructs:
- Nodes, transitions and node composition. This section will elaborate
- on all the basic combination possibilities.
- </para>
- <figure id="process.structure">
- <title>UML class diagram of the basic process structure</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.structure.classes.png"/></imageobject></mediaobject>
- </figure>
- <para>Next is a series of example diagram structures that can be formed
- with the PVM process model.
- </para>
- <figure id="transition">
- <title>Any two nodes can be connected with a transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="self.transition">
- <title>A self transition.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/self.transition.png"/></imageobject></mediaobject>
- </figure>
- <figure id="composite.node">
- <title>Composite node is a list of nested nodes.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/composite.node.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.into.composite">
- <title>Transition to a node inside a composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.into.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.out.of.composite">
- <title>Transition from a node inside a composite to a node outside the composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.out.of.composite.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.inheritence">
- <title>Transition of composite nodes are inherited. The node inside can take the transition of the composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.inheritence.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.outer">
- <title>Transition from a node to an outer composite.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.outer.png"/></imageobject></mediaobject>
- </figure>
- <figure id="transition.to.inner">
- <title>Transition from a composite node to an inner composed node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/transition.to.inner.png"/></imageobject></mediaobject>
- </figure>
- <figure id="initial.in.composite">
- <title>An initial node inside a composite node.</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/initial.in.composite.png"/></imageobject></mediaobject>
- </figure>
- </section>
-
-</chapter>
Deleted: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Services.xml
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Services.xml 2008-09-17 14:10:01 UTC (rev 2274)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-Services.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -1,82 +0,0 @@
-<chapter id="services">
- <title>Services</title>
-
- <para>Services can be fetched from the EnvironmentFactory, which in it's turn
- can be created from a configuration file.
- </para>
-
- <programlisting>EnvironmentFactory environmentFactory = new PvmEnvironmentFactory("pvm.cfg.xml");
-ProcessService processService = environmentFactory.get(ProcessService.class);</programlisting>
-
- <para>Services are thread safe so only 1 single service object should be maintained
- by the application and it can serve all requests for the application.
- </para>
-
-
-
- <section id="architecture">
- <title>Architecture</title>
- <para>Service methods are implemented through command classes.
- Each method creates a command object and the command is executed with
- the <literal>execute</literal> method of the <literal>CommandService</literal>.
- The <literal>CommandService</literal> is responsible for setting up the
- environment.
- </para>
- <para>There are four command services:
- </para>
- <itemizedlist>
- <listitem><literal>command-service</literal> will just
- execute the command and pass in the current environment.</listitem>
- <listitem>(UNTESTED) <literal>async-command-service</literal> will send an
- asynchronous message. So right after that in a separate transaction,
- the message is consumed and the command is executed.</listitem>
- <listitem>(TODO) <literal>cmt-command-service</literal> will delegate
- execution of the command to a local SLSB that has transaction attribute
- <literal>required</literal>.</listitem>
- <listitem>(TODO) <literal>remote-command-service</literal> will delegate
- execution of the command to a remote SLSB.</listitem>
- </itemizedlist>
- <para>Each of the command services can be configured with a list of
- interceptors that span around the command execution. Following
- interceptors are available:</para>
- <itemizedlist>
- <listitem><literal>environment-interceptor</literal>: Will execute the
- command within an <link linkend="environmentblock">environment block</link>.
- </listitem>
- <listitem>(UNTESTED) <literal>authorization-interceptor</literal>: Will perform
- an authrorization check before the command is executed. The
- authorization interceptor will look up the AuthorizationSession
- from the environment to delegate the actual authorization check to.
- </listitem>
- <listitem><literal>retry-interceptor</literal>: Will catch hibernate's
- optmistic locking exceptions (StaleStateException) and retries
- to execute the command for a configurable number of times
- </listitem>
- <listitem><literal>transaction-interceptor</literal>: Will get
- the transaction from the current context and invoke
- setRollbackOnly() on it in case an exception comes out of
- the command execution.
- </listitem>
- </itemizedlist>
- <para>Following configuration can be used in default standard persistence
- situations:
- </para>
- <programlisting><contexts>
- <environment-factory>
-
- <pvm-service />
-
- <command-service>
- <retry-interceptor />
- <environment-interceptor />
- <transaction-interceptor />
- </command-service>
-
- ...
- </environment-factory>
- ...
-
-</contexts></programlisting>
- </section>
-
-</chapter>
\ No newline at end of file
Copied: jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml (from rev 2248, jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/ch04-SoftwareLogging.xml)
===================================================================
--- jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml (rev 0)
+++ jbpm4/pvm/trunk/modules/manual/src/main/docbook/en/modules/chxx-SoftwareLogging.xml 2008-09-17 15:47:24 UTC (rev 2275)
@@ -0,0 +1,99 @@
+<chapter id="softwarelogging">
+ <title>Software logging</title>
+
+ <section>
+ <title>Configuration</title>
+ <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
+ logged, PVM logging will make the selection with following procedure:
+ <orderedlist>
+ <listitem>If a <literal>logging.properties</literal> resource is found
+ on the classpath (using the context classloader), then JDK logging will
+ be used and that file will be used to initialize the JDK logging.
+ </listitem>
+ <listitem>If log4j is found on the classpath, then log4j will be used.
+ The check for log4j will be done by checking availability of class
+ <literal>org.apache.log4j.LogManager</literal> with the context classloader.
+ </listitem>
+ <listitem>If none of the above, JDK logging will be used.</listitem>
+ </orderedlist>
+ </para>
+ </section>
+
+ <section>
+ <title>Categories</title>
+ <para>The PVM classes use their class name as the category for the logger.
+ </para>
+ <para>To have a basic understanding of what the PVM classes are doing,
+ turning on the <literal>debug</literal> level is great. Level
+ <literal>trace</literal> might be spitting out too much for that
+ purpose.
+ </para>
+ </section>
+
+ <section>
+ <title>JDK logging</title>
+ <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
+ and <literal>trace</literal> maps to <literal>finest</literal>.
+ Level <literal>finer</literal> is not used.
+ </para>
+ <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
+ the pvm library and it can create a nice one-line output for log messages.
+ It also has a neat feature that creates a unique indentation per thread.
+ To configure it, this is a typical <literal>logging.properties</literal>
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
+
+# For example, set the com.xyz.foo logger to only log SEVERE messages:
+# com.xyz.foo.level = SEVERE
+
+.level = SEVERE
+org.jbpm.level=FINE
+org.jbpm.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE</programlisting>
+
+<!--
+ <para>For production usage, jBPM also includes an error triggered log handler. This is
+ a log handler that will only keep the most recent log messages in
+ memory and these will only be flushed to a file in case an error occurs.
+ </para>
+ <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
+ to the handlers in the logging properties like this:
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
+ <para>Next snippet shows how in the same logging.properties, the error
+ triggered file handler can be configured. The given values are the default
+ values.
+ </para>
+ <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
+org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
+org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
+ <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
+ JDK handlers FileHandler and MemoryHandler can used in combination to get
+ similar results with a bit more configuration.
+ </para>
+
+-->
+ </section>
+
+ <section>
+ <title>Debugging persistence</title>
+ <para>When testing the persistence, following logging configurations can be
+ valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
+ and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
+ set in the queries.
+ </para>
+ <programlisting>org.hibernate.SQL.level=FINEST
+org.hibernate.type.level=FINEST</programlisting>
+ <para>And in case you get a failed batch as a cause in a hibernate exception,
+ you might want to set the batch size to 0 like this in the hibernate properties:
+ </para>
+ <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
+ <para>Also in the hibernate properties, the following properties allow for
+ detailed logs of the SQL that hibernate spits out:</para>
+ <programlisting>hibernate.show_sql = true
+hibernate.format_sql = true
+hibernate.use_sql_comments = true</programlisting>
+ </section>
+</chapter>
\ No newline at end of file
17 years, 7 months