JBoss JBPM SVN: r6268 - jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-20 23:07:43 -0400 (Tue, 20 Apr 2010)
New Revision: 6268
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
Log:
ensure maven surefire tests in hudson get a maximum memory amount of at least 256m; fix bad script
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2010-04-21 01:31:26 UTC (rev 6267)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2010-04-21 03:07:43 UTC (rev 6268)
@@ -164,18 +164,17 @@
echo $MVN_CMD; $MVN_CMD | tee $WORKSPACE/dependency-tree.txt
#
-# Calculate surefire max memory
+# Give tests a max memory amount of at least 256 MB
#
TOTAL_MEM=`free -mo | grep Mem | awk '{ print $2 }'`
-echo Total memory\: $TOTAL_MEM
+echo "Total memory: $TOTAL_MEM"
MAX_MEM=`expr $TOTAL_MEM / 4`
-[ $MAX_MEM -lt 256 ] && MAX_MEM=256
-echo Max memory\: $MAX_MEM
+[ $MAX_MEM -lt 256 ] && MVN_OPTS="$MVN_OPTS -Dsurefire.jvm.args=-Xmx256m"
#
# Execute tests
#
-MVN_CMD="mvn -o -fae $MVN_OPTS -Dsurefire.jvm.args=-Xmx$MAX_MEMm test"
+MVN_CMD="mvn -o -fae $MVN_OPTS test"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/tests.log
cat $WORKSPACE/tests.log | egrep FIXME\|FAILED | sort -u | tee $WORKSPACE/fixme.txt
cat $WORKSPACE/fixme.txt | egrep "\[\S*]" > $WORKSPACE/errata-$CONTAINER.txt
14 years
JBoss JBPM SVN: r6267 - in jbpm4/trunk/modules/test-db/src/test: resources and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-20 21:31:26 -0400 (Tue, 20 Apr 2010)
New Revision: 6267
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/CustomMailProducerTest.java
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTest.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
Log:
JBPM-2844: check in custom mail producer test
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/CustomMailProducerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/CustomMailProducerTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/CustomMailProducerTest.java 2010-04-21 01:31:26 UTC (rev 6267)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.activity.mail;
+
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.mail.Message;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.test.JbpmTestCase;
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class CustomMailProducerTest extends JbpmTestCase {
+
+ private Wiser wiser;
+ private String group1;
+ private String group2;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ // start mail server
+ wiser = new Wiser();
+ wiser.setPort(2525);
+ wiser.start();
+ // create actors
+ identityService.createUser("bb", "Big Brother", null, "bb@oceania");
+ identityService.createUser("obrien", null, "O'Brien", "obrien@miniluv");
+ identityService.createUser("charr", null, "Charrington", "charr@miniluv");
+ group1 = identityService.createGroup("thinkpol");
+ group2 = identityService.createGroup("innerparty");
+ identityService.createMembership("obrien", group2);
+ identityService.createMembership("charr", group1);
+ identityService.createMembership("obrien", group1);
+ }
+
+ protected void tearDown() throws Exception {
+ // delete actors
+ identityService.deleteGroup(group1);
+ identityService.deleteGroup(group2);
+ identityService.deleteUser("bb");
+ identityService.deleteUser("obrien");
+ identityService.deleteUser("charr");
+ // stop mail server
+ wiser.stop();
+ super.tearDown();
+ }
+
+ public void testCustomMailProducer() {
+ // deploy process
+ deployJpdlXmlString("<process name='custommail'>"
+ + " <start>"
+ + " <transition to='send mail' />"
+ + " </start>"
+ + " <mail name='send mail' class='"
+ + CustomMailProducer.class.getName()
+ + "'>"
+ + " <field name='templateName'><string value='rectify-template'/></field>"
+ + " <transition to='end' />"
+ + " </mail>"
+ + " <end name='end'/>"
+ + "</process>");
+
+ // prepare dynamic values
+ String addressee = "winston@minitrue";
+ String newspaper = "times";
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(1983, Calendar.DECEMBER, 3);
+ Date date = calendar.getTime();
+ String details = "reporting bb dayorder doubleplusungood refs unpersons rewrite "
+ + "fullwise upsub antefiling";
+ // assemble variables
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("addressee", addressee);
+ variables.put("newspaper", newspaper);
+ variables.put("date", date);
+ variables.put("details", details);
+ // start process instance
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("custommail",
+ variables);
+ assertProcessInstanceEnded(processInstance);
+
+ // examine produced messages
+ List<WiserMessage> messages = wiser.getMessages();
+ // winston, bb, innerparty(obrien), thinkpol(charr, obrien)
+ assertEquals(5, messages.size());
+ }
+
+ public static class CustomMailProducer extends MailProducerImpl {
+
+ private String templateName;
+ private static final long serialVersionUID = 1L;
+
+ public Collection<Message> produce(Execution execution) {
+ MailTemplateRegistry templateRegistry = EnvironmentImpl
+ .getFromCurrent(MailTemplateRegistry.class);
+ setTemplate(templateRegistry.getTemplate(templateName));
+ return super.produce(execution);
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/CustomMailProducerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTest.java 2010-04-20 18:41:23 UTC (rev 6266)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/mail/MailTest.java 2010-04-21 01:31:26 UTC (rev 6267)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;
@@ -31,9 +32,9 @@
* @author Tom Baeyens
*/
public class MailTest extends JbpmTestCase {
-
- Wiser wiser = null;
+ private Wiser wiser;
+
protected void setUp() throws Exception {
super.setUp();
// start mail server
@@ -41,30 +42,30 @@
wiser.setPort(2525);
wiser.start();
}
-
+
protected void tearDown() throws Exception {
+ // stop mail server
wiser.stop();
super.tearDown();
}
public void testMailToPlainAddress() {
- deployJpdlXmlString(
- "<process name='MailTest'>" +
- " <start>" +
- " <transition to='mailtestmail' />" +
- " </start>" +
- " <mail name='mailtestmail'>" +
- " <to addresses='jos@rubensstraat' />" +
- " <subject>mail</subject>" +
- " <text>youhoooo</text>" +
- " <transition to='end' />" +
- " </mail>" +
- " <state name='end'/>" +
- "</process>"
- );
-
- executionService.startProcessInstanceByKey("MailTest");
-
+ deployJpdlXmlString("<process name='plainaddress'>"
+ + " <start>"
+ + " <transition to='mailtestmail' />"
+ + " </start>"
+ + " <mail name='mailtestmail'>"
+ + " <to addresses='jos@rubensstraat' />"
+ + " <subject>mail</subject>"
+ + " <text>youhoooo</text>"
+ + " <transition to='end' />"
+ + " </mail>"
+ + " <end name='end'/>"
+ + "</process>");
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("plainaddress");
+ assertProcessInstanceEnded(processInstance);
+
List<WiserMessage> messages = wiser.getMessages();
assertEquals(1, messages.size());
}
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2010-04-20 18:41:23 UTC (rev 6266)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2010-04-21 01:31:26 UTC (rev 6267)
@@ -9,4 +9,6 @@
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.mail.templates.examples.xml" />
+
</jbpm-configuration>
14 years
JBoss JBPM SVN: r6266 - projects/exception_framework/trunk.
by do-not-reply@jboss.org
Author: eschabell
Date: 2010-04-20 14:41:23 -0400 (Tue, 20 Apr 2010)
New Revision: 6266
Modified:
projects/exception_framework/trunk/readme.txt
Log:
Added comment on mavenized project.
Modified: projects/exception_framework/trunk/readme.txt
===================================================================
--- projects/exception_framework/trunk/readme.txt 2010-04-20 18:30:40 UTC (rev 6265)
+++ projects/exception_framework/trunk/readme.txt 2010-04-20 18:41:23 UTC (rev 6266)
@@ -1,5 +1,5 @@
Project space to put together the results of a generic exception framework
-example based on jBPM version 3.2.5.SP5.
+example based on jBPM version 3.2.8 (see pom.xml for dependencies).
Currently only running a test to show simple node failing, then passing exception and
all process context over to the Exception Framework. This framework defaults currently
14 years
JBoss JBPM SVN: r6265 - projects/exception_framework/trunk.
by do-not-reply@jboss.org
Author: eschabell
Date: 2010-04-20 14:30:40 -0400 (Tue, 20 Apr 2010)
New Revision: 6265
Modified:
projects/exception_framework/trunk/readme.txt
Log:
Added comment on mavenized project.
Modified: projects/exception_framework/trunk/readme.txt
===================================================================
--- projects/exception_framework/trunk/readme.txt 2010-04-20 18:27:47 UTC (rev 6264)
+++ projects/exception_framework/trunk/readme.txt 2010-04-20 18:30:40 UTC (rev 6265)
@@ -6,6 +6,8 @@
to a Human Task for processing the error. In our test we end this task to continue
processing and go back to the originating process.
+This project is maven enabled.
+
TODO: State node failure example via unit test class.
With my thanks to Maurice de Chateau for his contributions.
14 years
JBoss JBPM SVN: r6264 - in projects/exception_framework/trunk: src and 16 other directories.
by do-not-reply@jboss.org
Author: eschabell
Date: 2010-04-20 14:27:47 -0400 (Tue, 20 Apr 2010)
New Revision: 6264
Added:
projects/exception_framework/trunk/pom.xml
projects/exception_framework/trunk/src/
projects/exception_framework/trunk/src/main/
projects/exception_framework/trunk/src/main/config/
projects/exception_framework/trunk/src/main/config/hibernate.cfg.hsqldb.xml
projects/exception_framework/trunk/src/main/config/hibernate.cfg.xml
projects/exception_framework/trunk/src/main/config/jbpm-hsqldb-ds.xml
projects/exception_framework/trunk/src/main/config/jbpm.cfg.xml
projects/exception_framework/trunk/src/main/config/jbpm.mail.templates.xml
projects/exception_framework/trunk/src/main/config/log4j.properties
projects/exception_framework/trunk/src/main/config/version.info.xml
projects/exception_framework/trunk/src/main/java/
projects/exception_framework/trunk/src/main/java/org/
projects/exception_framework/trunk/src/main/java/org/jboss/
projects/exception_framework/trunk/src/main/java/org/jboss/handler/
projects/exception_framework/trunk/src/main/java/org/jboss/handler/AbstractExceptionActionHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/handler/DetermineExceptionHandlingHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/handler/HumanTaskHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/handler/RetryHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/handler/StartExceptionFrameworkHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/handler/TriggerOriginatingProcessHandler.java
projects/exception_framework/trunk/src/main/java/org/jboss/util/
projects/exception_framework/trunk/src/main/java/org/jboss/util/ThreadPoolSingleton.java
projects/exception_framework/trunk/src/main/jpdl/
projects/exception_framework/trunk/src/main/jpdl/process/
projects/exception_framework/trunk/src/main/jpdl/process/gpd.xml
projects/exception_framework/trunk/src/main/jpdl/process/processdefinition.xml
projects/exception_framework/trunk/src/main/jpdl/process/processimage.jpg
projects/exception_framework/trunk/src/test/
projects/exception_framework/trunk/src/test/java/
projects/exception_framework/trunk/src/test/java/org/
projects/exception_framework/trunk/src/test/java/org/jboss/
projects/exception_framework/trunk/src/test/java/org/jboss/handler/
projects/exception_framework/trunk/src/test/java/org/jboss/handler/ExceptionThrowingHandler.java
projects/exception_framework/trunk/src/test/java/org/jboss/test/
projects/exception_framework/trunk/src/test/java/org/jboss/test/TestForNodeExceptionHandling.java
projects/exception_framework/trunk/src/test/java/org/jboss/util/
projects/exception_framework/trunk/src/test/java/org/jboss/util/ProcessDefinitionReference.java
projects/exception_framework/trunk/src/test/java/org/jboss/util/TaskCallback.java
Modified:
projects/exception_framework/trunk/
projects/exception_framework/trunk/readme.txt
Log:
Initial project code commit, working node unit test that makes use of an exception framework, see readme for details.
Property changes on: projects/exception_framework/trunk
___________________________________________________________________
Name: svn:ignore
+ .settings
bin
target
.classpath
.project
Added: projects/exception_framework/trunk/pom.xml
===================================================================
--- projects/exception_framework/trunk/pom.xml (rev 0)
+++ projects/exception_framework/trunk/pom.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,70 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>exception_framework</groupId>
+ <artifactId>exception_framework</artifactId>
+ <name>Exception Framework</name>
+ <version>0.0.1-SNAPSHOT</version>
+ <description>A generic jBPM exception framework.</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>surefire-report-maven-plugin</artifactId>
+ <version>2.0-beta-1</version>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>Maven Repository jboss</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.com/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>3.2.8</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.15</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>1.1</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mod4j.org.apache.commons</groupId>
+ <artifactId>lang</artifactId>
+ <version>2.1.0</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Modified: projects/exception_framework/trunk/readme.txt
===================================================================
--- projects/exception_framework/trunk/readme.txt 2010-04-20 17:54:48 UTC (rev 6263)
+++ projects/exception_framework/trunk/readme.txt 2010-04-20 18:27:47 UTC (rev 6264)
@@ -1,5 +1,16 @@
Project space to put together the results of a generic exception framework
-example for jBPM v3.2.x. Coming soon...
+example based on jBPM version 3.2.5.SP5.
+Currently only running a test to show simple node failing, then passing exception and
+all process context over to the Exception Framework. This framework defaults currently
+to a Human Task for processing the error. In our test we end this task to continue
+processing and go back to the originating process.
+
+TODO: State node failure example via unit test class.
+
+With my thanks to Maurice de Chateau for his contributions.
+
+Regards,
Eric D. Schabell
-
+eric(a)schabell.org
+erics(a)redhat.com
\ No newline at end of file
Added: projects/exception_framework/trunk/src/main/config/hibernate.cfg.hsqldb.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/hibernate.cfg.hsqldb.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/hibernate.cfg.hsqldb.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,263 @@
+<?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>
+
+ <!-- hibernate dialect -->
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- JDBC connection properties (begin) -->
+ <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>
+ <!-- JDBC connection properties (end) -->
+
+ <!-- DataSource properties (begin) ===
+ <property name="hibernate.connection.datasource">java:comp/env/jdbc/JbpmDataSource</property>
+ ==== DataSource properties (end) -->
+
+ <!-- JTA transaction properties (begin) ===
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ ==== JTA transaction properties (end) -->
+
+ <!-- CMT transaction properties (begin) ===
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ ==== CMT transaction properties (end) -->
+
+ <!-- ################################### -->
+ <!-- # common settings # -->
+ <!-- ################################### -->
+
+ <!-- Automatic schema creation (begin) -->
+ <property name="hibernate.hbm2ddl.auto">create</property>
+ <!-- Automatic schema creation (end) -->
+
+ <!-- Simple memory-only cache -->
+ <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+
+ <!-- SQL rendering properties -->
+ <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.use_sql_comments">true</property>
+
+ <!-- ############################################ -->
+ <!-- # mapping files with external dependencies # -->
+ <!-- ############################################ -->
+
+ <!-- Additional mappings defined per module go here -->
+ <!--mapping resource="hibernate.extra.hbm.xml" /-->
+ <!--mapping resource="hibernate.identity.hbm.xml" /-->
+
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <!-- hql queries -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
+
+ <!-- type mappings -->
+ <mapping resource="org/jbpm/db/hibernate.types.hbm.xml" />
+
+ <!-- hql queries used in simulation for querying historical data.
+ uncomment if you want to use the GetSimulationInputCommand
+ or you want to use the queries directly.
+ beware: the queries need the stddev function to be enabled in your dialect.
+ for more information, visit:
+ http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!--
+ <mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
+ -->
+
+ <!-- graph.action mapping files -->
+ <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- ########################################### -->
+ <!-- # mapping file with external dependencies # -->
+ <!-- ########################################### -->
+ <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
+ uncomment this if bsh is not in your classpath.
+ the script element will not be available in process definition files.
+ note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- job mapping files -->
+ <mapping resource="org/jbpm/job/Job.hbm.xml"/>
+ <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/CleanUpProcessJob.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
+
+ <!-- ################## -->
+ <!-- # cache settings # -->
+ <!-- ##################-->
+
+ <!-- strategy="nonstrict-read-write" can be used with HashtableCacheProvider -->
+
+ <class-cache class="org.jbpm.bytes.ByteArray" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.bytes.ByteArray.byteBlocks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.context.def.VariableAccess" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.file.def.FileDefinition.processFiles" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.action.Script.variableAccesses" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Action" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Event" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Event.actions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.ExceptionHandler" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ExceptionHandler.actions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Node" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.exceptionHandlers" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.leavingTransitions" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.arrivingTransitions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.ProcessDefinition" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.exceptionHandlers" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.nodes" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.actions" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.definitions" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.def.SuperState.nodes" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Transition" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Transition.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Transition.exceptionHandlers" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.Decision.decisionConditions" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.ProcessState.variableAccesses" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.TaskNode.tasks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.instantiation.Delegation" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.module.def.ModuleDefinition" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.taskmgmt.def.Swimlane.tasks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.taskmgmt.def.TaskController" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskController.variableAccesses" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.taskmgmt.def.Task" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.Task.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.Task.exceptionHandlers" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.swimlanes" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks" usage="nonstrict-read-write" />
+ </session-factory>
+</hibernate-configuration>
Property changes on: projects/exception_framework/trunk/src/main/config/hibernate.cfg.hsqldb.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/hibernate.cfg.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/hibernate.cfg.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/hibernate.cfg.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,265 @@
+<?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>
+
+ <!-- hibernate dialect -->
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- JDBC connection properties (begin) -->
+ <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>
+ <!-- JDBC connection properties (end) -->
+
+ <!-- DataSource properties (begin) ===
+ <property name="hibernate.connection.datasource">java:comp/env/jdbc/JbpmDataSource</property>
+ ==== DataSource properties (end) -->
+
+ <!-- JTA transaction properties (begin) ===
+ <property name="jta.UserTransaction">UserTransaction</property>
+ <property name="hibernate.current_session_context_class">jta</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ ==== JTA transaction properties (end) -->
+
+ <!-- CMT transaction properties (begin) ===
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ ==== CMT transaction properties (end) -->
+
+ <!-- ################################### -->
+ <!-- # common settings # -->
+ <!-- ################################### -->
+
+ <!-- Automatic schema creation (begin) -->
+ <property name="hibernate.hbm2ddl.auto">create</property>
+ <!-- Automatic schema creation (end) -->
+
+ <!-- Simple memory-only cache -->
+ <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+
+ <!-- SQL rendering properties -->
+ <property name="hibernate.format_sql">true</property>
+ <property name="hibernate.use_sql_comments">true</property>
+
+ <!-- ############################################ -->
+ <!-- # mapping files with external dependencies # -->
+ <!-- ############################################ -->
+
+ <!-- Additional mappings defined per module go here -->
+ <!-- mapping resource="hibernate.extra.hbm.xml" /-->
+ <!--mapping resource="hibernate.identity.hbm.xml" /-->
+
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <!-- hql queries -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
+
+ <!-- type mappings -->
+ <mapping resource="org/jbpm/db/hibernate.types.hbm.xml" />
+
+ <!-- hql queries used in simulation for querying historical data.
+ uncomment if you want to use the GetSimulationInputCommand
+ or you want to use the queries directly.
+ beware: the queries need the stddev function to be enabled in your dialect.
+ for more information, visit:
+ http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!--
+ <mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
+ -->
+
+ <!-- graph.action mapping files -->
+ <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- ########################################### -->
+ <!-- # mapping file with external dependencies # -->
+ <!-- ########################################### -->
+ <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
+ uncomment this if bsh is not in your classpath.
+ the script element will not be available in process definition files.
+ note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- job mapping files -->
+ <mapping resource="org/jbpm/job/Job.hbm.xml"/>
+ <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/CleanUpProcessJob.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
+
+ <!-- ################## -->
+ <!-- # cache settings # -->
+ <!-- ##################-->
+
+ <!-- strategy="nonstrict-read-write" can be used with HashtableCacheProvider -->
+
+ <class-cache class="org.jbpm.bytes.ByteArray" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.bytes.ByteArray.byteBlocks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.context.def.VariableAccess" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.file.def.FileDefinition.processFiles" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.action.Script.variableAccesses" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Action" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Event" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Event.actions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.ExceptionHandler" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ExceptionHandler.actions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Node" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.exceptionHandlers" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.leavingTransitions" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Node.arrivingTransitions" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.ProcessDefinition" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.exceptionHandlers" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.nodes" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.actions" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.definitions" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.def.SuperState.nodes" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.graph.def.Transition" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Transition.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.graph.def.Transition.exceptionHandlers" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.Decision.decisionConditions" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.ProcessState.variableAccesses" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.graph.node.TaskNode.tasks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.instantiation.Delegation" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.module.def.ModuleDefinition" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.taskmgmt.def.Swimlane.tasks" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.taskmgmt.def.TaskController" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskController.variableAccesses" usage="nonstrict-read-write" />
+
+ <class-cache class="org.jbpm.taskmgmt.def.Task" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.Task.events" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.Task.exceptionHandlers" usage="nonstrict-read-write" />
+
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.swimlanes" usage="nonstrict-read-write" />
+ <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks" usage="nonstrict-read-write" />
+ </session-factory>
+</hibernate-configuration>
Property changes on: projects/exception_framework/trunk/src/main/config/hibernate.cfg.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/jbpm-hsqldb-ds.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/jbpm-hsqldb-ds.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/jbpm-hsqldb-ds.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+
+ <local-tx-datasource>
+ <jndi-name>JbpmDS</jndi-name>
+
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbpmDB</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+
+ <!-- disable idle connection removal, hsqldb does not reap threads on closed connections -->
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+ <!-- check all statements are closed when the connection is returned to the pool -->
+ <track-statements />
+ <!-- hsqldb benefits from prepared statement caching -->
+ <prepared-statement-cache-size>32</prepared-statement-cache-size>
+
+ <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
+ <type-mapping>Hypersonic SQL</type-mapping>
+
+ <!-- ensure the datasource is not initialized before the database itself -->
+ <depends>jboss:service=Hypersonic,database=jbpmDB</depends>
+ </local-tx-datasource>
+
+ <!-- for hsqldb accessed from jboss only, in-process (standalone) mode -->
+ <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=jbpmDB">
+ <attribute name="Database">jbpmDB</attribute>
+ <attribute name="InProcessMode">true</attribute>
+ </mbean>
+
+</datasources>
Property changes on: projects/exception_framework/trunk/src/main/config/jbpm-hsqldb-ds.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/jbpm.cfg.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/jbpm.cfg.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/jbpm.cfg.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,9 @@
+<jbpm-configuration>
+
+ <!--
+ The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
+ Those configurations can be overwritten by putting this file called
+ jbpm.cfg.xml on the root of the classpath and put in the customized values.
+ -->
+
+</jbpm-configuration>
Property changes on: projects/exception_framework/trunk/src/main/config/jbpm.cfg.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/jbpm.mail.templates.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/jbpm.mail.templates.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/jbpm.mail.templates.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,24 @@
+<mail-templates>
+
+ <variable name="BaseTaskListURL" value="http://localhost:8080/jbpm/home?taskId=" />
+
+ <mail-template name='task-assign'>
+ <actors>#{taskInstance.actorId}</actors>
+ <subject>Task '#{taskInstance.name}'</subject>
+ <text><![CDATA[Hi,
+Task '#{taskInstance.name}' has been assigned to you.
+Go for it: #{BaseTaskListURL}#{taskInstance.id}
+Thanks.
+---powered by JBoss jBPM---]]></text>
+ </mail-template>
+
+ <mail-template name='task-reminder'>
+ <actors>#{taskInstance.actorId}</actors>
+ <subject>Task '#{taskInstance.name}' !</subject>
+ <text><![CDATA[Hey,
+Don't forget about #{BaseTaskListURL}#{taskInstance.id}
+Get going !
+---powered by JBoss jBPM---]]></text>
+ </mail-template>
+
+</mail-templates>
Property changes on: projects/exception_framework/trunk/src/main/config/jbpm.mail.templates.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/log4j.properties
===================================================================
--- projects/exception_framework/trunk/src/main/config/log4j.properties (rev 0)
+++ projects/exception_framework/trunk/src/main/config/log4j.properties 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,36 @@
+# Set root logger level to DEBUG and its only appender to CONSOLE.
+log4j.rootLogger=DEBUG, CONSOLE
+
+# CONSOLE
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n
+
+# LIMIT CATEGORIES:
+log4j.logger.org.jbpm=ERROR
+log4j.logger.org.jbpm.graph=ERROR
+
+# Hibernate debugging levels and their output
+log4j.logger.org.hibernate=ERROR
+#Log all SQL DML statements as they are executed
+#log4j.logger.org.hibernate.SQL=DEBUG
+#Log all JDBC parameters
+#log4j.logger.org.hibernate.type=DEBUG
+#Log all SQL DDL statements as they are executed
+#log4j.logger.org.hibernate.tool.hbm2ddl=DEBUG
+#Log the state of all entities (max 20 entities) associated with the session at flush time
+#log4j.logger.org.hibernate.pretty=DEBUG
+#Log all second-level cache activity
+#log4j.logger.org.hibernate.cache=DEBUG
+#Log transaction related activity
+#log4j.logger.org.hibernate.transaction=DEBUG
+#Log all JDBC resource acquisition
+#log4j.logger.org.hibernate.jdbc=TRACE
+#Log HQL and SQL ASTs and other information about query parsing
+#log4j.logger.org.hibernate.hql.ast=DEBUG
+#Log all JAAS authorization requests
+#log4j.logger.org.hibernate.secure=DEBUG
+#Log everything (a lot of information, but very useful for troubleshooting)
+#log4j.logger.org.hibernate=DEBUG
+#log4j.logger.org.hibernate.tools=DEBUG
+
Property changes on: projects/exception_framework/trunk/src/main/config/log4j.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/config/version.info.xml
===================================================================
--- projects/exception_framework/trunk/src/main/config/version.info.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/config/version.info.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,21 @@
+<jbpm-version-info name="jBPM3" namespace="urn:jbpm.org:jpdl-3.2">
+
+ <classpathentry path="lib/jbpm-jpdl.jar" src="src/jbpm-jpdl-sources.jar" />
+ <classpathentry path="lib/jbpm-identity.jar" src="src/jbpm-identity-sources.jar" />
+
+ <classpathentry path="lib/antlr.jar" />
+ <classpathentry path="lib/asm.jar"/>
+ <classpathentry path="lib/bsh.jar"/>
+ <classpathentry path="lib/cglib.jar"/>
+ <classpathentry path="lib/commons-collections.jar"/>
+ <classpathentry path="lib/commons-logging.jar"/>
+ <classpathentry path="lib/dom4j.jar"/>
+ <classpathentry path="lib/hibernate.jar"/>
+ <classpathentry path="lib/hsqldb.jar"/>
+ <classpathentry path="lib/junit.jar"/>
+ <classpathentry path="lib/log4j.jar"/>
+
+ <config path="config"/>
+ <examples path="examples" />
+
+</jbpm-version-info>
Property changes on: projects/exception_framework/trunk/src/main/config/version.info.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/AbstractExceptionActionHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/AbstractExceptionActionHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/AbstractExceptionActionHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,208 @@
+package org.jboss.handler;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jboss.util.ThreadPoolSingleton;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.Token;
+import org.jbpm.graph.node.State;
+import org.jbpm.instantiation.ProcessClassLoader;
+import org.jbpm.util.ClassLoaderUtil;
+
+/**
+ * Base class for ActionHandler which call services.
+ */
+public abstract class AbstractExceptionActionHandler implements ActionHandler {
+ /** Serial version UID. */
+ private static final long serialVersionUID = 1L;
+
+ public static final String EXCEPTION_ORIGINATING_NODE_NAME_KEY = "EXCEPTION_ORIGINATING_NODE_NAME";
+
+ private String transitionName;
+
+ /** False means you are using our exception framework handling of exceptions. */
+ private boolean useJbpmExceptionHandler = false;
+
+ private boolean signalAfterException = false;
+
+ protected final String getCurrentAction() {
+ return "action handling";
+ }
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(AbstractExceptionActionHandler.class);
+
+
+ public final void execute(ExecutionContext executionContext) throws Exception {
+
+ getLogger().info("Start AbstractExceptionActionHanlder.");
+
+ ExecutionContext.pushCurrentContext(executionContext);
+ try {
+ if (executionContext.getNode() instanceof State) {
+ // Asynchronous handling.
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Scheduling async job [" + getClass().getName() + "] for process instance " + executionContext.getProcessInstance().getId());
+ }
+
+ // Dig into Hibernate here to accomplish transaction isolation.
+ executionContext.getJbpmContext().getSession().getTransaction().registerSynchronization(
+ new ServiceRunner(executionContext.getToken().getId(), getClass().getName()));
+ } else {
+ try {
+ // Synchronous handling: Perform the action directly.
+ getLogger().debug("Performing action on Node with id: " + executionContext.getProcessInstance().getId());
+ doPerformAction(executionContext);
+ } catch (Exception ex) {
+ getLogger().error("Handler threw exception.", ex);
+ getLogger().debug("Using jBPMExceptionHandler for exception caught on Node with id: " + executionContext.getProcessInstance().getId());
+ executionContext.getNode().raiseException(ex, executionContext);
+ }
+ }
+ } catch (Exception ex) {
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info(("Exception caught during AbstractExceptionActionHandling."), ex);
+ }
+ } finally {
+ ExecutionContext.popCurrentContext(executionContext);
+ }
+
+ getLogger().info("Ended AbstractExceptionActionHanlder.");
+ }
+
+
+ /**
+ * Implement this method for processing a single node.
+ *
+ * @param executionContext An execution context.
+ * @throws Exception For all unexpected errors.
+ */
+ public abstract void doPerformAction(ExecutionContext executionContext) throws Exception;
+
+ /**
+ * Set this flag when it is required to have the process signalled 'normally' in case an exception is caught (and handled)
+ * within the asynchronous part of the handling.
+ * <p>
+ * The default behaviour is that no signalling takes place; this puts the responsibility of the progress of the process in the
+ * hands of the mechanism handling the exception.
+ *
+ * @param signal Whether signalling is to take place after exception handling.
+ */
+ protected final void setSignalAfterException(final boolean signal) {
+ signalAfterException = signal;
+ }
+
+ /**
+ * Set the transition to be taken for an asynchronous execution.
+ *
+ * @param transitionName The name of the transition.
+ */
+ protected void setTransition(String transitionName) {
+ this.transitionName = transitionName;
+ }
+
+ /**
+ * Set whether the 'standard' jBPM <exception-handler> construct in the
+ * process definition is to be used for the exception handling for an
+ * asynchronous execution.
+ * <p>
+ * The default behaviour for this class is to handle it implicitly and
+ * redirect the flow towards an exception handling node, which is required
+ * to be present in the definition (and its name in the context).
+ *
+ * @param useJbpmExceptionHandler
+ * Indicating whether (or not) to use the jBPM mechanism. By
+ * default this value is <code>false</code>.
+ */
+ protected final void useJbpmExceptionHandler(
+ final boolean useJbpmExceptionHandler) {
+ this.useJbpmExceptionHandler = useJbpmExceptionHandler;
+ }
+
+
+ /**
+ * Inner class which performs the actual action handling for asynchronous
+ * State nodes.
+ */
+ class ServiceRunner implements Runnable, Synchronization {
+ private long tokenId;
+ private String handlerClassName;
+
+ public ServiceRunner(long tokenId, String handlerClassName) {
+ this.tokenId = tokenId;
+ this.handlerClassName = handlerClassName;
+ }
+
+ /** {@inheritDoc} */
+ public void run() {
+ JbpmContext jbpmCtx = JbpmConfiguration.getInstance().createJbpmContext();
+ try {
+ // Get the token in which the process is waiting.
+ final Token token = jbpmCtx.getTokenForUpdate(tokenId);
+ ExecutionContext executionContext = new ExecutionContext(token);
+
+ // Perform the action in the concrete subclass.
+ ExecutionContext.pushCurrentContext(executionContext);
+ AbstractExceptionActionHandler currentHandler = null;
+ boolean exceptionCaught = false;
+ try {
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ProcessClassLoader>() {
+ public ProcessClassLoader run() {
+ return new ProcessClassLoader(ClassLoaderUtil.class.getClassLoader(), token.getProcessInstance().getProcessDefinition());
+ }
+ });
+ currentHandler = (AbstractExceptionActionHandler) cl.loadClass(
+ handlerClassName).newInstance();
+ currentHandler.doPerformAction(executionContext);
+ } catch (Exception ex) {
+ getLogger().error("Handler threw exception.", ex);
+ executionContext.getNode().raiseException(ex, executionContext);
+ exceptionCaught = true;
+ } finally {
+ ExecutionContext.popCurrentContext(executionContext);
+ }
+
+ // Move the process along, if applicable.
+ if (!exceptionCaught || !useJbpmExceptionHandler || signalAfterException) {
+ if (!StringUtils.isBlank(transitionName) && executionContext.getNode().hasLeavingTransition(transitionName)) {
+ token.signal(transitionName);
+ } else {
+ // Use the default transition.
+ token.signal();
+ }
+ }
+ } finally {
+ jbpmCtx.close();
+ }
+ }
+
+ /** Inherited method not used here. */
+ public void beforeCompletion() {
+ // Not used here.
+ }
+
+ public void afterCompletion(int status) {
+ if (getLogger().isDebugEnabled()
+ && status != Status.STATUS_COMMITTED && status != Status.STATUS_ROLLEDBACK) {
+ getLogger().debug("Attempting to start asynchronous action handling while tx status was " + status);
+ }
+
+ // The original transaction is completed, a new one can be started.
+ ThreadPoolSingleton.INSTANCE.executeServiceCall(this);
+ }
+ }
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/DetermineExceptionHandlingHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/DetermineExceptionHandlingHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/DetermineExceptionHandlingHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,50 @@
+package org.jboss.handler;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.node.DecisionHandler;
+
+/**
+ * Handler for deciding whether it is applicable to automatically have the
+ * Exception throwing node retry its business.
+ */
+public class DetermineExceptionHandlingHandler implements DecisionHandler {
+ /** Serial version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger
+ .getLogger(DetermineExceptionHandlingHandler.class);
+
+ private static final String DROPOUT_TRANSITION_NAME = "No";
+ private static final String RETRY_TRANSITION_NAME = "Yes";
+
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+
+ public String decide(ExecutionContext executionContext) throws Exception {
+ // TODO Auto-generated method stub
+ // check for our path of execution in exception handling.
+ String transition = null;
+ if (executionContext.getContextInstance().getVariable("take_exception_transtion") != null) {
+ getLogger().debug("Determined that context variable with name: "
+ + executionContext.getContextInstance().getVariable("take_exception_transtion")
+ + " exists!");
+ transition = (String) executionContext.getContextInstance().getVariable("take_exception_transtion");
+ }
+
+ // TODO: Determine from configuration data whether the Exception that is
+ // handled here is applicable to be retried automatically.
+
+ if ( StringUtils.isNotBlank(transition) && StringUtils.equals(transition, "retry")) {
+ getLogger().debug("Determine Exception Handling Handler choosing transition: " + RETRY_TRANSITION_NAME);
+ return RETRY_TRANSITION_NAME;
+ }
+
+ getLogger().debug("Determine Exception Handling Handler choosing transition: " + DROPOUT_TRANSITION_NAME);
+ return DROPOUT_TRANSITION_NAME;
+ }
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/HumanTaskHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/HumanTaskHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/HumanTaskHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,51 @@
+package org.jboss.handler;
+
+import org.apache.log4j.Logger;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * Handler for preparing before and following up after a manual human task.
+ */
+public class HumanTaskHandler extends AbstractExceptionActionHandler {
+ /** Serial version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(HumanTaskHandler.class);
+
+ // Transition names.
+ private static final String RETRY_TRANSITION_NAME = "Retry";
+
+ public void doPerformAction(ExecutionContext executionContext) throws Exception {
+ if (Event.EVENTTYPE_NODE_LEAVE.equals(executionContext.getEvent().getEventType()) && RETRY_TRANSITION_NAME.equals(executionContext.getTransition().getName())) {
+ getLogger().debug("Have EVENTTYPE_NODE_LEAVE so updating retry transistions before going further!");
+ getLogger().debug("Picked up event type " + executionContext.getEvent().getEventType() + " and transition name is " + executionContext.getTransition().getName());
+ updateRetryTransition(executionContext);
+ }
+ }
+
+ /**
+ * Point the retry transition to the Node from which the Exception
+ * originated.
+ *
+ * @param executionContext The current jBPM context.
+ */
+ private void updateRetryTransition(ExecutionContext executionContext) {
+ String name = (String) executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_NAME_KEY);
+ Node originatingNode = executionContext.getProcessDefinition().getNode(name);
+ getLogger().debug("updateRetryTranisition EXCEPTION_ORIGINATING_NODE_NAME_KEY is: " + name);
+ if (originatingNode == null) {
+ String msg = "No originating node available for retry after exception handling.";
+ LOGGER.error(msg);
+ throw new IllegalStateException(msg);
+ }
+
+ executionContext.getNode().getLeavingTransition(RETRY_TRANSITION_NAME).setTo(originatingNode);
+ }
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/RetryHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/RetryHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/RetryHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,47 @@
+package org.jboss.handler;
+
+import org.apache.log4j.Logger;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * Handler for retrying a node that threw an Exception before, after the waiting
+ * period configured for the specific situation.
+ */
+public class RetryHandler extends AbstractExceptionActionHandler {
+ /** Serial version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(RetryHandler.class);
+
+ public void doPerformAction(ExecutionContext executionContext) throws Exception {
+ // TODO: Determine the waiting period from the configuration.
+
+ // TODO: Wait the applicable period.
+
+ // Check whether a leaving transition is available.
+ Transition transition = executionContext.getNode().getDefaultLeavingTransition();
+ getLogger().debug("Default leaving transition from RetryHandler is: " + transition);
+ if (transition == null) {
+ // Create a transition.
+ transition = new Transition();
+ executionContext.getNode().addLeavingTransition(transition);
+ getLogger().debug("Leaving transition from RetryHandler has been set to: " + transition);
+ }
+ // Set the transition to the originating node.
+ Node originatingNode = executionContext.getProcessDefinition().getNode(EXCEPTION_ORIGINATING_NODE_NAME_KEY);
+ if (originatingNode == null) {
+ String msg = "No originating node available for retry after exception handling.";
+ LOGGER.error(msg);
+ throw new IllegalStateException(msg);
+ }
+ getLogger().debug("Transition from RetryHandler is being set to: " + originatingNode);
+ transition.setTo(originatingNode);
+ }
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/StartExceptionFrameworkHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/StartExceptionFrameworkHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/StartExceptionFrameworkHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,90 @@
+package org.jboss.handler;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class StartExceptionFrameworkHandler implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Context variable keys for storing exception information. */
+ public static final String EXCEPTION_ORIGINATING_NODE_NAME_KEY = "EXCEPTION_ORIGINATING_NODE_NAME";
+ public static final String EXCEPTION_ORIGINATING_PROCESS_NAME_KEY = "EXCEPTION_ORIGINATING_PROCESS_NAME";
+ public static final String EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY = "EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST";
+ public static final String EXCEPTION_ORIGINATING_PROCESS_ID_KEY = "EXCEPTION_ORIGINATING_PROCESS_ID";
+ public static final String EXCEPTION_FRAMEWORK_PROCESS_ID_KEY = "EXCEPTION_FRAMEWORK_PROCESS_ID";
+
+ /** Exception framework process name. */
+ public static final String EXCEPTION_FRAMEWORK_PROCESS_NAME_KEY = "Exception Framework";
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(StartExceptionFrameworkHandler.class);
+
+ /** Holds our process instance. */
+ private ProcessInstance processInstance;
+
+ /**
+ * Handler starts the exception framework.
+ */
+ public final void execute(ExecutionContext executionContext) throws Exception {
+
+ getLogger().info("Start StartExceptionFrameworkHanlder.");
+
+ try {
+ // get new instance of exception framework and start processing!
+ List<ProcessDefinition> listProcs = executionContext.getJbpmContext().getGraphSession().findAllProcessDefinitions();
+
+ if (getLogger().isDebugEnabled()) {
+ for (ProcessDefinition processDefinition : listProcs) {
+ getLogger().debug("Process definition is: " + processDefinition + " with version: " + processDefinition.getVersion() + ".");
+ }
+ }
+ processInstance = executionContext.getJbpmContext().newProcessInstance(EXCEPTION_FRAMEWORK_PROCESS_NAME_KEY);
+ if (getLogger().isDebugEnabled()) {
+ if (processInstance == null) {
+ getLogger().debug("Process instance of exception framework was not created.");
+ }
+ getLogger().debug("Passing the process instance of exception framework to be signaled.");
+ }
+
+ // push the exception framework process id into the context.
+ executionContext.setVariable(EXCEPTION_FRAMEWORK_PROCESS_ID_KEY, processInstance.getRootToken().getId());
+
+ // push originating stuff.
+ processInstance.getContextInstance().setVariable(EXCEPTION_ORIGINATING_NODE_NAME_KEY, executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_NAME_KEY));
+ processInstance.getContextInstance().setVariable(EXCEPTION_ORIGINATING_PROCESS_NAME_KEY, executionContext.getVariable(EXCEPTION_ORIGINATING_PROCESS_NAME_KEY));
+ processInstance.getContextInstance().setVariable(EXCEPTION_ORIGINATING_PROCESS_ID_KEY, executionContext.getVariable(EXCEPTION_ORIGINATING_PROCESS_ID_KEY));
+ processInstance.getContextInstance().setVariable(EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY, executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY));
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Set variable " + EXCEPTION_ORIGINATING_NODE_NAME_KEY + " for process instance with value :" + executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_NAME_KEY));
+ getLogger().debug("Set variable " + EXCEPTION_ORIGINATING_PROCESS_NAME_KEY + " for process instance with value :" + executionContext.getVariable(EXCEPTION_ORIGINATING_PROCESS_NAME_KEY));
+ getLogger().debug("Set variable " + EXCEPTION_ORIGINATING_PROCESS_ID_KEY + " for process instance with value :" + executionContext.getVariable(EXCEPTION_ORIGINATING_PROCESS_ID_KEY));
+ getLogger().debug("Set variable " + EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY + " for process instance with value :" + executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY));
+ }
+
+
+ processInstance.signal();
+ } catch (Exception ex) {
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info(("Exception caught during StartExceptionFrameworkHandler."), ex);
+ }
+ }
+
+ getLogger().info("Ended StartExceptionFrameworkHandler.");
+ }
+
+ protected String getCurrentAction() {
+ return "starting exception framework process";
+ }
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/handler/TriggerOriginatingProcessHandler.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/handler/TriggerOriginatingProcessHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/handler/TriggerOriginatingProcessHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,92 @@
+package org.jboss.handler;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class TriggerOriginatingProcessHandler implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Context variable keys for storing exception information. */
+ public static final String EXCEPTION_ORIGINATING_PROCESS_ID_KEY = "EXCEPTION_ORIGINATING_PROCESS_ID";
+ public static final String EXCEPTION_ORIGINATING_NODE_LEAVE_TRANSITION_KEY = "EXCEPTION_ORIGINATING_NODE_LEAVE_TRANSITION";
+
+ private String transitionName;
+
+ private ProcessInstance originatorProcInst;
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(TriggerOriginatingProcessHandler.class);
+
+ public final void execute(ExecutionContext executionContext) throws Exception {
+ getLogger().info("Start TriggerOriginatingProcessHandler.");
+
+ try {
+ JbpmConfiguration jbpmConf = JbpmConfiguration.getInstance();
+ JbpmContext jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ // Get our process instance back.
+ originatorProcInst = jbpmCtx.getProcessInstance((Long) executionContext.getVariable(EXCEPTION_ORIGINATING_PROCESS_ID_KEY));
+
+ if (getLogger().isDebugEnabled()) {
+ if (originatorProcInst == null) {
+ getLogger().debug("Process instance of exception framework was not created.");
+ }
+ }
+
+ // Determine from the context variable (see ContextConstants) which transition to take
+ // when we go back to the originating node. It should always be set to something, but we
+ // will take the default if it is null and log it as an error.
+ transitionName = (String) executionContext.getVariable(EXCEPTION_ORIGINATING_NODE_LEAVE_TRANSITION_KEY);
+
+ if (StringUtils.isBlank(transitionName)) {
+ // Leave the node through the default transition, nothing to do just log this as an error as
+ // should never have to happen.
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Leaving transition not set in the context, leaving over the default transition.");
+ }
+ } else {
+ // Leave the node through the given transition we need to get out of the context variable if it exists,
+ // so checking it.
+ if (originatorProcInst.getRootToken().getNode().hasLeavingTransition(transitionName)) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Leaving node over the given transition " + transitionName);
+ }
+ } else {
+ // given non-existing transition, take default and log error.
+ getLogger().error("Leaving transition not set in the context, leaving over the default transition.");
+ transitionName = null;
+ }
+ }
+
+ if (StringUtils.isBlank(transitionName)) {
+ originatorProcInst.getRootToken().signal();
+ } else {
+ originatorProcInst.getRootToken().signal(transitionName);
+ }
+ executionContext.leaveNode();
+ } finally {
+ jbpmCtx.close();
+ }
+ } catch (Exception ex) {
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info(("Exception caught during TriggerOriginatingProcessHandler."), ex);
+ }
+ }
+ getLogger().info("Ended TriggerOriginatingProcessHandler.");
+ }
+
+
+ protected String getCurrentAction() {
+ return "signaling originating process";
+ }
+
+ protected Logger getLogger() {
+ return LOGGER;
+ }
+}
Added: projects/exception_framework/trunk/src/main/java/org/jboss/util/ThreadPoolSingleton.java
===================================================================
--- projects/exception_framework/trunk/src/main/java/org/jboss/util/ThreadPoolSingleton.java (rev 0)
+++ projects/exception_framework/trunk/src/main/java/org/jboss/util/ThreadPoolSingleton.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,78 @@
+package org.jboss.util;
+
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.util.concurrent.Executor;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Ensures this is a singleton implementation of the ThreadPool for service calls.
+ */
+public enum ThreadPoolSingleton {
+ /** The Threadpool singleton instance. */
+ INSTANCE;
+
+ private static final Logger LOGGER = Logger.getLogger(ThreadPoolSingleton.class);
+
+ private final Integer numberThreads = 10;
+ private Executor exec = new HandleableThreadPoolExecutor();
+
+ private UncaughtExceptionHandler handler;
+
+ /**
+ * This is what we do!
+ *
+ * @param command
+ * The runnable command.
+ */
+ public void executeServiceCall(Runnable command) {
+ exec.execute(command);
+ }
+
+ /**
+ * @param ueh
+ * A handler that is going to catch the uncaught exceptions instead of the default handler (e.g. for testing
+ * purposes).
+ */
+ public void setUncaughtExceptionHandler(UncaughtExceptionHandler ueh) {
+ handler = ueh;
+ }
+
+ /**
+ * ThreadPoolExecutor that allows for setting an <code>UncaughtExceptionHandler</code> to each thread that is used to execute a
+ * given <code>Runnable</code>.
+ */
+ private class HandleableThreadPoolExecutor extends ThreadPoolExecutor {
+ /** Default constructor that creates a 'fixed thread pool'. */
+ HandleableThreadPoolExecutor() {
+ super(numberThreads, numberThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
+ setRejectedExecutionHandler(new DefaultRejectedExecutionHandler());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void beforeExecute(Thread t, Runnable r) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Starting task " + r + " in thread " + t);
+ }
+ if (handler != null) {
+ t.setUncaughtExceptionHandler(handler);
+ }
+ }
+ }
+
+ /**
+ * Default implementation for the <code>RejectedExecutionHandler</code>.
+ */
+ private static class DefaultRejectedExecutionHandler implements RejectedExecutionHandler {
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor tpe) {
+ LOGGER.error(tpe + " unable to handle task " + r);
+ throw new RejectedExecutionException();
+ }
+ }
+}
Added: projects/exception_framework/trunk/src/main/jpdl/process/gpd.xml
===================================================================
--- projects/exception_framework/trunk/src/main/jpdl/process/gpd.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/jpdl/process/gpd.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="Exception Framework" width="1315" height="512">
+ <node name="start" x="188" y="18" width="140" height="40">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Determine Exception Handling" x="150" y="107" width="225" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Human Task" x="55" y="186" width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Retry" x="336" y="190" width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Trigger Originating Process" x="142" y="279" width="247" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="end" x="181" y="364" width="140" height="40"/>
+ <deployment serverName="" serverPort="" serverDeployer="/gpd-deployer/upload">
+ <classesAndResources/>
+ <filesAndFolders>
+ <element value="/exception_framework/src/main/jpdl/process/gpd.xml"/>
+ <element value="/exception_framework/src/main/jpdl/process/processdefinition.xml"/>
+ <element value="/exception_framework/src/main/jpdl/process/processimage.jpg"/>
+ </filesAndFolders>
+ </deployment>
+</root-container>
Added: projects/exception_framework/trunk/src/main/jpdl/process/processdefinition.xml
===================================================================
--- projects/exception_framework/trunk/src/main/jpdl/process/processdefinition.xml (rev 0)
+++ projects/exception_framework/trunk/src/main/jpdl/process/processdefinition.xml 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="Exception Framework">
+
+ <start-state name="start">
+ <transition to="Determine Exception Handling" />
+ </start-state>
+
+ <decision name="Determine Exception Handling">
+ <handler class="org.jboss.handler.DetermineExceptionHandlingHandler" />
+ <transition to="Human Task" name="No" />
+ <transition to="Retry" name="Yes" />
+ </decision>
+
+ <task-node name="Human Task">
+ <task name="Technical dropout">
+ <assignment actor-id="EXPERT" />
+ </task>
+ <event type="node-enter">
+ <action class="org.jboss.handler.HumanTaskHandler"></action>
+ </event>
+ <event type="node-leave">
+ <action class="org.jboss.handler.HumanTaskHandler" />
+ </event>
+ <transition to="Trigger Originating Process"></transition>
+ </task-node>
+
+ <state name="Retry">
+ <event type="node-enter">
+ <action class="org.jboss.handler.RetryHandler" />
+ </event>
+ <transition to="Trigger Originating Process" />
+ </state>
+
+ <node name="Trigger Originating Process">
+ <action class="org.jboss.handler.TriggerOriginatingProcessHandler" />
+ <transition to="end" />
+ </node>
+
+ <end-state name="end" />
+
+</process-definition>
\ No newline at end of file
Added: projects/exception_framework/trunk/src/main/jpdl/process/processimage.jpg
===================================================================
(Binary files differ)
Property changes on: projects/exception_framework/trunk/src/main/jpdl/process/processimage.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/exception_framework/trunk/src/test/java/org/jboss/handler/ExceptionThrowingHandler.java
===================================================================
--- projects/exception_framework/trunk/src/test/java/org/jboss/handler/ExceptionThrowingHandler.java (rev 0)
+++ projects/exception_framework/trunk/src/test/java/org/jboss/handler/ExceptionThrowingHandler.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,200 @@
+package org.jboss.handler;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.instantiation.Delegation;
+import org.jbpm.job.ExecuteActionJob;
+import org.jbpm.msg.MessageService;
+import org.jbpm.svc.ServiceFactory;
+import org.jbpm.svc.Services;
+
+public class ExceptionThrowingHandler implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Context variable keys for storing exception information. */
+ public static final String EXCEPTION_ORIGINATING_NODE_NAME_KEY = "EXCEPTION_ORIGINATING_NODE_NAME";
+ public static final String EXCEPTION_ORIGINATING_PROCESS_NAME_KEY = "EXCEPTION_ORIGINATING_PROCESS_NAME";
+ public static final String EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY = "EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST";
+ public static final String EXCEPTION_ORIGINATING_PROCESS_ID_KEY = "EXCEPTION_ORIGINATING_PROCESS_ID";
+
+ private boolean leaveNode = true;
+
+ private String transitionName;
+
+ private static String retryTransitionName = "Retry";
+
+ /** Set to false to use custom exception framework. */
+ private boolean useJbpmExceptionHandler = false;
+
+ /** Conditional error throwing variable. **/
+ private static final String EXCEPTION_THROWN = "EXCEPTION_THROWN";
+
+ /** Logging facility. */
+ private static final Logger LOGGER = Logger.getLogger(ExceptionThrowingHandler.class);
+
+
+ /**
+ * Our execution method where the work is done!
+ *
+ * @param executionContext Current execution context.
+ */
+ public void execute(ExecutionContext executionContext) throws Exception {
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Starting jBPM custom exception framework.");
+ }
+
+ ExecutionContext.pushCurrentContext(executionContext);
+
+ try {
+ try {
+ // Perform the action.
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Performing action for process instance with id: " + executionContext.getProcessInstance().getId());
+ }
+ doPerformAction(executionContext);
+
+ if (leaveNode) {
+ // Leave the node through the given transition.
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Leaving node over "
+ + (StringUtils.isBlank(transitionName) ? "default transition." : "transition: "
+ + transitionName));
+ }
+
+ // When leaving the node we can either have set a transition to take while in the doPerformAction via the
+ // setTransition method or leave it to the default transition, here we decide what has happened.
+ if (StringUtils.isBlank(transitionName)) {
+ executionContext.getNode().leave(executionContext);
+ } else {
+ executionContext.getNode().leave(executionContext, transitionName);
+ }
+ }
+ } catch (Exception ex) {
+ if (useJbpmExceptionHandler) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug(
+ "Using jBPMExceptionHandler for exception caught in process instance with id: "
+ + executionContext.getProcessInstance().getId());
+ }
+ executionContext.getNode().raiseException(ex, executionContext);
+ } else {
+ if (getLogger().isDebugEnabled()) {
+ getLogger()
+ .debug(
+ "Using handleException (custom) for exception caught in process instance with id: "
+ + executionContext.getProcessInstance().getId()
+ + " and pushing exception to context with setException.");
+ }
+ executionContext.setException(ex);
+
+ handleException(executionContext);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Exception passed to framework, now we wait.");
+ }
+ }
+ }
+ } catch (Exception ex) {
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info(("Exception caught during jBPM custom framework execution"), ex);
+ }
+ } finally {
+ ExecutionContext.popCurrentContext(executionContext);
+ }
+ }
+
+
+ /**
+ * This method is used to handle exceptions.
+ *
+ * @param executionContext Current execution context.
+ */
+ private void handleException(ExecutionContext executionContext) {
+ getLogger().info("Start exception handling for custom jBPM exception framework.");
+
+ // Save the current node in the context to make a retry possible.
+ executionContext.setVariable(EXCEPTION_ORIGINATING_NODE_NAME_KEY, executionContext.getNode().getName());
+ executionContext.setVariable(EXCEPTION_ORIGINATING_PROCESS_NAME_KEY, executionContext.getProcessDefinition().getName());
+ executionContext.setVariable(EXCEPTION_ORIGINATING_PROCESS_ID_KEY, executionContext.getProcessInstance().getId());
+
+ // Also save the transitions that we will want to provide a choice of (all outgoing transitions
+ // plus a retry transition that loops back to the same node. First we add the loopback transition
+ // to the existing list (note, adding to back of list, do not want it to become the default!).
+ Transition retryTransition = new Transition();
+ retryTransition.setName(retryTransitionName);
+ retryTransition.setTo(executionContext.getNode());
+ executionContext.getNode().addLeavingTransition(retryTransition);
+ executionContext.setVariable(EXCEPTION_ORIGINATING_NODE_TRANSITION_LIST_KEY, executionContext.getNode().getLeavingTransitions());
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("The EXCEPTION_ORIGINATING_NODE_NAME_KEY is set to: " + executionContext.getNode().getName());
+ getLogger().debug("The EXCEPTION_ORIGINATING_PROCESS_NAME_KEY is set to: " + executionContext.getProcessDefinition().getName());
+ getLogger().debug("The EXCEPTION_ORIGINATING_PROCESS_ID_KEY is set to: " + executionContext.getProcessInstance().getId());
+ getLogger().debug("The following transitions have been pushed into the context: ");
+ int i = 0;
+ for (Iterator iterator = executionContext.getNode().getLeavingTransitions().iterator(); iterator.hasNext();) {
+ Transition transition = (Transition) iterator.next();
+ getLogger().debug("Transition " + i + " called " + transition.getName());
+ i++;
+ }
+ }
+
+ // Pass the context off to the exception framework process.
+ ServiceFactory serviceFactory = executionContext.getJbpmContext().getServiceFactory(Services.SERVICENAME_MESSAGE);
+ if (serviceFactory != null) {
+ MessageService messageService = (MessageService) serviceFactory.openService();
+ Action action = new Action(new Delegation(StartExceptionFrameworkHandler.class.getName()));
+ ExecuteActionJob job = new ExecuteActionJob(executionContext.getToken());
+ job.setAction(action);
+ job.setDueDate(new Date());
+
+ // have to explicitly save the action context.
+ executionContext.getJbpmContext().getSession().saveOrUpdate(action);
+ messageService.send(job);
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Scheduled job with jobExecuter and waiting for it to run...");
+ }
+ }
+
+ getLogger().info("Ended exception handling for jBPM custom exception framework.");
+ }
+
+ /**
+ * The action for this handler with the sole purpose of throwing an exception.
+ *
+ * @param executionContext Current execution context.
+ * @throws Exception
+ */
+ public void doPerformAction(ExecutionContext executionContext) throws Exception {
+
+ // ensuring that the exception is thrown only once.
+ if (StringUtils.isEmpty((String) executionContext.getVariable(EXCEPTION_THROWN))) {
+ // mark the exception as being thrown once and only once!
+ if (getLogger().isDebugEnabled()) {
+ LOGGER.debug("ExceptionThrowningHandler ==> throwing in the kitchen sink now...");
+ }
+
+ executionContext.setVariable(EXCEPTION_THROWN, "kitchen_sink");
+ throw new IllegalStateException("Creating a problem.");
+ }
+
+ // reset the error variable.
+ executionContext.setVariable(EXCEPTION_THROWN, null);
+ }
+
+ /** The logger. */
+ protected Logger getLogger() {
+ return LOGGER;
+
+ }
+
+}
Added: projects/exception_framework/trunk/src/test/java/org/jboss/test/TestForNodeExceptionHandling.java
===================================================================
--- projects/exception_framework/trunk/src/test/java/org/jboss/test/TestForNodeExceptionHandling.java (rev 0)
+++ projects/exception_framework/trunk/src/test/java/org/jboss/test/TestForNodeExceptionHandling.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,239 @@
+package org.jboss.test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.log4j.Appender;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jboss.util.ProcessDefinitionReference;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.GraphSession;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests for the Abstract Action Handler.
+ */
+public class TestForNodeExceptionHandling {
+
+ /** The global jBPM configuration. */
+ private static JbpmConfiguration jbpmConf = JbpmConfiguration.getInstance();
+
+ /** Variables for Tasks. */
+ private static final String ACTOR_ID = "EXPERT";
+ private static final String TASK_NAME = "Technical dropout";
+ private static final Set<String> POOLED_ACTORS = null;
+ private static final String SWIMLANE = null;
+
+ public static final String ORIGINATING_PROCESS_NAME = "Originator Process";
+ public static final String EXCEPTION_FRAMEWORK_PROCESS_NAME = "Exception Framework";
+
+ /**
+ * Fix the standard logging setup to work better within the IDE console,
+ * just comment out to use and COMMENT OUT BEFORE CHECKIN.
+ */
+ @BeforeClass
+ public static final void oneTimeSetupExceptionFrameworkTesting() {
+ // Turn on for logging in console to be within my IDE window size.
+ //((PatternLayout) ((Appender) Logger.getRootLogger().getAllAppenders().nextElement()).getLayout()).setConversionPattern("%r [%t] %p %c %x -%n%n %m%n%n");
+
+
+ // Start the JobExecutor for async continuations within the test environment.
+ jbpmConf.startJobExecutor();
+
+ // Initialize logging.
+ BasicConfigurator.configure();
+ // - Remove the superfluous appender.
+ Logger.getRootLogger().removeAppender((Appender) Logger.getRootLogger().getAllAppenders().nextElement());
+ // Adjust levels:
+ Logger.getRootLogger().setLevel(Level.ERROR);
+ Logger.getLogger("org.jboss").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jbpm.graph").setLevel(Level.DEBUG);
+
+ // Deploy my exception framework too.
+ try {
+ deployExceptionFramework();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Called once after all test runs, stops the JobExecutor.
+ *
+ * @throws Exception When something unexpected goes wrong.
+ */
+ @AfterClass
+ public static final void oneTimeTearDown() throws Exception {
+ // End the JobExecutor thread.
+ jbpmConf.getJobExecutor().stop();
+ }
+
+ /**
+ * The main test we want to run here to throw an exception in the Node of our
+ * test process and handle it through our Exception Framework.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testRun() throws Exception {
+ // deploy process first.
+ JbpmContext jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ // Create an instance of the jBPM process.
+ ProcessDefinition procDef = getTestProcess().parseAndDeployProcess();
+ ProcessInstance procInst = new ProcessInstance(procDef);
+ jbpmCtx.save(procInst);
+ } finally {
+ // Close the transaction.
+ jbpmCtx.close();
+ }
+
+ // signal process to start.
+ jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ long processInstanceId = getProcessId(ORIGINATING_PROCESS_NAME);
+ ProcessInstance procInst = jbpmCtx.getProcessInstance(processInstanceId);
+ assertThat("No exception process instance returned.", procInst, is(not(nullValue())));
+ procInst.signal();
+ } finally {
+ jbpmCtx.close();
+ }
+
+ Thread.sleep(5000);
+
+ // In Human Task and need to end which will cause the flow to signal back
+ // to the originating process.
+ endTask();
+
+ // Test that originating process is in end state.
+ jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ long processInstanceId = getProcessId(ORIGINATING_PROCESS_NAME);
+ ProcessInstance procInst = jbpmCtx.getProcessInstance(processInstanceId);
+ assertThat("No exception process instance returned.", procInst, is(not(nullValue())));
+ assertThat("Exception process not ended.", procInst.hasEnded(), is(true));
+ } finally {
+ jbpmCtx.close();
+ }
+
+ // Test that it is in end state now for exception framework.
+ jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ long processInstanceId = getProcessId(EXCEPTION_FRAMEWORK_PROCESS_NAME);
+ ProcessInstance procInst = jbpmCtx.getProcessInstance(processInstanceId);
+ assertThat("No exception process instance returned.", procInst, is(not(nullValue())));
+ assertThat("Exception process in unexpected state.", procInst.hasEnded(), is(true));
+ } finally {
+ jbpmCtx.close();
+ }
+ }
+
+ /**
+ * Gives you the test process definition.
+ */
+ protected ProcessDefinitionReference getTestProcess() throws Exception {
+ String testProcDef = "<process-definition xmlns=\"urn:jbpm.org:jpdl-3.1\" name=\"" + ORIGINATING_PROCESS_NAME + "\">"
+ + "<start-state name=\"start\">"
+ + "<transition to=\"node1\" />"
+ + "</start-state>"
+ + "<node name=\"node1\" async=\"true\">"
+ + "<action class=\"org.jboss.handler.ExceptionThrowingHandler\" />"
+ + "<transition to=\"end\" name=\"node_to_end\" />"
+ + "</node>"
+ + "<end-state name=\"end\" />"
+ + "</process-definition>";
+ return new ProcessDefinitionReference(testProcDef);
+ }
+
+ private static void deployExceptionFramework() throws Exception {
+ // Open the transaction.
+ JbpmContext jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ // Create an instance of the jBPM exception framework process.
+ String frameworkXml = "process/processdefinition.xml";
+ ProcessDefinition procDef = ProcessDefinition.parseXmlResource(frameworkXml);
+ jbpmCtx.deployProcessDefinition(procDef);
+ } finally {
+ // Close the transaction.
+ jbpmCtx.close();
+ }
+ }
+
+ private void endTask() {
+ // Open the transaction.
+ JbpmContext jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ long processInstanceId = getProcessId(EXCEPTION_FRAMEWORK_PROCESS_NAME);
+ ProcessInstance procInst = jbpmCtx.getProcessInstance(processInstanceId);
+ assertThat("No exception process instance returned.", procInst, is(not(nullValue())));
+
+ Collection<TaskInstance> taskInsts = procInst.getTaskMgmtInstance().getUnfinishedTasks(procInst.getRootToken());
+ assertThat("No task instances found.", taskInsts, is(not(nullValue())));
+
+ TaskInstance taskInst = getIndicatedTaskInstance(taskInsts, ACTOR_ID, TASK_NAME, POOLED_ACTORS, SWIMLANE);
+ if (taskInst != null) {
+ // End the task instance.
+ taskInst.end();
+ }
+ } finally {
+ // Tear down the pojo persistence context.
+ jbpmCtx.close();
+ }
+ }
+
+
+ private long getProcessId (String processName) {
+ long procId;
+
+ // Open the transaction.
+ JbpmContext jbpmCtx = jbpmConf.createJbpmContext();
+ try {
+ // Get our process instance back.
+ GraphSession graphSession = jbpmCtx.getGraphSession();
+ ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition(processName);
+ assertThat("No process definition found.", processDefinition, is(not(nullValue())));
+
+ // Now, we search for all process instances of this process definition.
+ List processInstances = graphSession.findProcessInstances(processDefinition.getId());
+ ProcessInstance procInst = (ProcessInstance) processInstances.get(0);
+ procId = procInst.getId();
+ } finally {
+ // Tear down the pojo persistence context.
+ jbpmCtx.close();
+ }
+
+ return procId;
+ }
+
+ private TaskInstance getIndicatedTaskInstance(Collection<TaskInstance> taskInsts, final String actorId, final String taskName,
+ final Set<String> pooledActors, final String swimlane) {
+ TaskInstance indicated = null;
+ for (TaskInstance taskInst : taskInsts) {
+ if ((actorId == null || actorId.equals(taskInst.getActorId()))
+ && (taskName == null || taskName.equals(taskInst.getTask().getName()))
+ && (pooledActors == null || CollectionUtils.isSubCollection(pooledActors, taskInst.getPooledActors()))
+ && (swimlane == null || swimlane.equals(taskInst.getSwimlaneInstance().getName()))) {
+ indicated = taskInst;
+ break;
+ }
+ }
+ return indicated;
+ }
+
+}
Added: projects/exception_framework/trunk/src/test/java/org/jboss/util/ProcessDefinitionReference.java
===================================================================
--- projects/exception_framework/trunk/src/test/java/org/jboss/util/ProcessDefinitionReference.java (rev 0)
+++ projects/exception_framework/trunk/src/test/java/org/jboss/util/ProcessDefinitionReference.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,88 @@
+package org.jboss.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ * Container for a process definition reference, with the possibility to include
+ * a list of these containers for the subprocesses.
+ */
+public class ProcessDefinitionReference {
+ private static final Logger LOGGER = Logger.getLogger(ProcessDefinitionReference.class);
+
+ private static final JbpmConfiguration JBPM_CONF = JbpmConfiguration.getInstance();
+
+ /** The String containing an XML process definition or the name of a parsable resource. */
+ private String procDefString;
+
+ /** The list of subprocesses. */
+ private List<ProcessDefinitionReference> subprocs = new ArrayList<ProcessDefinitionReference>();
+
+ /**
+ * Constructor for process definition <code>String</code>s.
+ *
+ * @param procDefString
+ * The process definition, in one of the following formats:
+ * <ul>
+ * <li>An XML format string containing the definition.
+ * <li>The file pathname for the process archive resource (ending
+ * in '.par') containing the definition.
+ * <li>The file pathname for the resource containing the
+ * definition.
+ * </ul>
+ */
+ public ProcessDefinitionReference(final String procDefString) {
+ this.procDefString = procDefString;
+ }
+
+ /**
+ * Chainable convenience method for adding subprocesses.
+ *
+ * @param ref The reference object for the subprocess definition to be added.
+ * @return A reference to the process to which the subprocess was just added.
+ */
+ public ProcessDefinitionReference addSubproc(ProcessDefinitionReference ref) {
+ subprocs.add(ref);
+ return this;
+ }
+
+ /**
+ * @return The reference to the top-level process definition, which is
+ * deployed along with all of its nested subprocesses.
+ */
+ public ProcessDefinition parseAndDeployProcess() {
+ // First do the subprocesses (recursively).
+ for (ProcessDefinitionReference subProcRef : subprocs) {
+ subProcRef.parseAndDeployProcess();
+ }
+
+ // Then do this process itself.
+ // - Parse.
+ ProcessDefinition procDef = null;
+ if (procDefString.endsWith("</process-definition>")) {
+ // It's a process definition XML String.
+ procDef = ProcessDefinition.parseXmlString(procDefString);
+ } else if (procDefString.endsWith(".par")) {
+ // It's a process archive.
+ try {
+ procDef = ProcessDefinition.parseParResource(procDefString);
+ } catch (IOException ioEx) {
+ LOGGER.error("Cannot parse .par file as a resource.", ioEx);
+ }
+ } else {
+ // Assume it's a definition in a resource on the classpath.
+ procDef = ProcessDefinition.parseXmlResource(procDefString);
+ }
+ // - Deploy.
+ if (procDef != null) {
+ JBPM_CONF.getCurrentJbpmContext().deployProcessDefinition(procDef);
+ }
+
+ return procDef;
+ }
+}
Added: projects/exception_framework/trunk/src/test/java/org/jboss/util/TaskCallback.java
===================================================================
--- projects/exception_framework/trunk/src/test/java/org/jboss/util/TaskCallback.java (rev 0)
+++ projects/exception_framework/trunk/src/test/java/org/jboss/util/TaskCallback.java 2010-04-20 18:27:47 UTC (rev 6264)
@@ -0,0 +1,15 @@
+package org.jboss.util;
+
+import org.jbpm.graph.exe.ExecutionContext;
+
+/** Interface for implementation of Task performing during tests. */
+public interface TaskCallback {
+ /**
+ * Called to allow for performing work to mimic a manual task.
+ *
+ * @param executionContext
+ * The jBPM execution context for the transaction in which the
+ * work can be done.
+ */
+ void performTask(ExecutionContext executionContext);
+}
14 years
JBoss JBPM SVN: r6262 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm: db/hibernate and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-16 21:58:58 -0400 (Fri, 16 Apr 2010)
New Revision: 6262
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/def/Access.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/AccessType.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
Log:
substitute a space for the empty string prior to assigning field Access.access because oracle treats the empty string as null
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/def/Access.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/def/Access.java 2010-04-17 00:11:15 UTC (rev 6261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/def/Access.java 2010-04-17 01:58:58 UTC (rev 6262)
@@ -34,7 +34,13 @@
public Access(String access) {
if (access != null) {
- this.access = access.toLowerCase();
+ if (access.length() > 0) {
+ this.access = access.toLowerCase();
+ }
+ else {
+ // oracle treats an empty string as null; store a space instead
+ this.access = " ";
+ }
}
}
@@ -58,8 +64,7 @@
* verifies if the given accessLiteral is included in the access text.
*/
public boolean hasAccess(String accessLiteral) {
- if (access == null) return false;
- return (access.indexOf(accessLiteral.toLowerCase()) != -1);
+ return access == null ? false : access.indexOf(accessLiteral.toLowerCase()) != -1;
}
public String toString() {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/AccessType.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/AccessType.java 2010-04-17 00:11:15 UTC (rev 6261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/AccessType.java 2010-04-17 01:58:58 UTC (rev 6262)
@@ -64,7 +64,7 @@
}
public String toString(Object value) {
- return (value!=null? value.toString() : "null");
+ return value != null ? value.toString() : "null";
}
public Object fromStringValue(String xml) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2010-04-17 00:11:15 UTC (rev 6261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2010-04-17 01:58:58 UTC (rev 6262)
@@ -166,7 +166,6 @@
catch (DocumentException e) {
throw new JpdlException("failed to parse process document", e);
}
-
return processDefinition;
}
@@ -426,7 +425,6 @@
Delegation taskControllerDelegation = new Delegation();
taskControllerDelegation.read(taskControllerElement, this);
taskController.setTaskControllerDelegation(taskControllerDelegation);
-
}
else {
List variableAccesses = readVariableAccesses(taskControllerElement);
14 years
JBoss JBPM SVN: r6261 - jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-16 20:11:15 -0400 (Fri, 16 Apr 2010)
New Revision: 6261
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
Log:
ensure maven surefire tests in hudson get a maximum memory amount of at least 256m
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2010-04-15 20:04:36 UTC (rev 6260)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2010-04-17 00:11:15 UTC (rev 6261)
@@ -164,9 +164,18 @@
echo $MVN_CMD; $MVN_CMD | tee $WORKSPACE/dependency-tree.txt
#
+# Calculate surefire max memory
+#
+TOTAL_MEM=`free -mo | grep Mem | awk '{ print $2 }'`
+echo Total memory\: $TOTAL_MEM
+MAX_MEM=`expr $TOTAL_MEM / 4`
+[ $MAX_MEM -lt 256 ] && MAX_MEM=256
+echo Max memory\: $MAX_MEM
+
+#
# Execute tests
#
-MVN_CMD="mvn -o -fae $MVN_OPTS test"
+MVN_CMD="mvn -o -fae $MVN_OPTS -Dsurefire.jvm.args=-Xmx$MAX_MEMm test"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/tests.log
cat $WORKSPACE/tests.log | egrep FIXME\|FAILED | sort -u | tee $WORKSPACE/fixme.txt
cat $WORKSPACE/fixme.txt | egrep "\[\S*]" > $WORKSPACE/errata-$CONTAINER.txt
14 years
JBoss JBPM SVN: r6260 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm: graph/node and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-15 16:04:36 -0400 (Thu, 15 Apr 2010)
New Revision: 6260
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java
Log:
restored old method of deleting process instances because mysql did not like the new one
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2010-04-15 16:45:49 UTC (rev 6259)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java 2010-04-15 20:04:36 UTC (rev 6260)
@@ -27,11 +27,11 @@
import java.util.Iterator;
import java.util.List;
-import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.ObjectNotFoundException;
import org.hibernate.Session;
+import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.jbpm.JbpmContext;
@@ -245,19 +245,15 @@
public void deleteProcessDefinition(ProcessDefinition processDefinition) {
try {
// delete all instances of the given process
- Iterator processInstanceIter = session.getNamedQuery("GraphSession.findAllProcessInstancesForDefinition")
- .setLong("processDefinitionId", processDefinition.getId())
- .iterate();
- while (processInstanceIter.hasNext()) {
- ProcessInstance processInstance = (ProcessInstance) processInstanceIter.next();
- if (processInstance != null) {
- deleteProcessInstance(processInstance);
- // flush changes and then evict process instance to avoid exhausting memory
- session.flush();
- session.evict(processInstance);
- }
+ List processInstances = session.createCriteria(ProcessInstance.class)
+ .add(Restrictions.eq("processDefinition", processDefinition))
+ .setProjection(Projections.id())
+ .list();
+ for (Iterator iter = processInstances.iterator(); iter.hasNext();) {
+ Long id = (Long) iter.next();
+ ProcessInstance processInstance = (ProcessInstance) session.get(ProcessInstance.class, id);
+ if (processInstance != null) deleteProcessInstance(processInstance);
}
- Hibernate.close(processInstanceIter);
List referencingProcessStates = findReferencingProcessStates(processDefinition);
for (Iterator i = referencingProcessStates.iterator(); i.hasNext();) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java 2010-04-15 16:45:49 UTC (rev 6259)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java 2010-04-15 20:04:36 UTC (rev 6260)
@@ -11,7 +11,6 @@
private static final long serialVersionUID = 1L;
public ProcessDefinition findSubProcess(Element subProcessElement) {
-
// if this parsing is done in the context of a process deployment,
// there is a database connection to look up the subprocess.
// when there is no jbpmSession, the definition will be left null...
@@ -41,8 +40,7 @@
return graphSession.findProcessDefinition(subProcessName, version);
}
catch (NumberFormatException e) {
- throw new JpdlException("subprocess version is invalid: "
- + subProcessElement.getPath());
+ throw new JpdlException("bad subprocess version: " + subProcessVersion);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java 2010-04-15 16:45:49 UTC (rev 6259)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java 2010-04-15 20:04:36 UTC (rev 6260)
@@ -120,7 +120,7 @@
}
}
catch (JbpmException e) {
- jpdlReader.addWarning(e.getMessage());
+ jpdlReader.addError("failed to resolve subprocess", e);
}
// check whether this is a recursive process invocation
14 years
JBoss JBPM SVN: r6259 - in jbpm3/branches/jbpm-3.2-soa/modules/core: src/test/java/org/jbpm/perf and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-15 12:45:49 -0400 (Thu, 15 Apr 2010)
New Revision: 6259
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
Log:
move surefire.jvm.args property to jdk14 profile in order to allow jdk5+ ergonomics to decide max heap size
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2010-04-15 15:04:30 UTC (rev 6258)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2010-04-15 16:45:49 UTC (rev 6259)
@@ -25,11 +25,6 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <!-- Properties -->
- <properties>
- <surefire.jvm.args>-Xmx128m</surefire.jvm.args>
- </properties>
-
<!-- Dependencies -->
<dependencies>
<!-- Compile Dependencies -->
@@ -225,6 +220,9 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <properties>
+ <surefire.jvm.args>-Xmx128m</surefire.jvm.args>
+ </properties>
</profile>
<!--
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2010-04-15 15:04:30 UTC (rev 6258)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2010-04-15 16:45:49 UTC (rev 6259)
@@ -21,8 +21,6 @@
*/
package org.jbpm.perf;
-import java.text.NumberFormat;
-
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
@@ -59,6 +57,16 @@
}
public void testAsyncCall() {
+ Runtime rt = Runtime.getRuntime();
+ System.out.print("Free memory: ");
+ System.out.println(rt.freeMemory());
+ System.out.print("Total memory: ");
+ System.out.println(rt.totalMemory());
+ System.out.print("Max memory: ");
+ System.out.println(rt.maxMemory());
+ System.out.print("Processors: ");
+ System.out.println(rt.availableProcessors());
+
long firstTime = System.currentTimeMillis();
launchProcessInstances(WARMUP_INSTANCES);
processJobs(TIMEOUT);
@@ -68,11 +76,9 @@
processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES + 1));
long duration = System.currentTimeMillis() - secondTime;
- NumberFormat format = NumberFormat.getNumberInstance();
- format.setMaximumFractionDigits(1);
- System.out.println("==> Processed "
- + format.format(1000D * MEASURED_INSTANCES / duration)
- + " instances per second <==");
+ System.out.println("### Processed "
+ + (1000 * MEASURED_INSTANCES / duration)
+ + " instances per second ###");
}
private void launchProcessInstances(int count) {
14 years
JBoss JBPM SVN: r6258 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-04-15 11:04:30 -0400 (Thu, 15 Apr 2010)
New Revision: 6258
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/AbstractXmlTestCase.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/NodeXmlTest.java
Log:
JBPM-2091: remove annoying stdout print from NodeXmlTest
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/AbstractXmlTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/AbstractXmlTestCase.java 2010-04-15 13:46:26 UTC (rev 6257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/AbstractXmlTestCase.java 2010-04-15 15:04:30 UTC (rev 6258)
@@ -30,28 +30,29 @@
import org.jbpm.AbstractJbpmTestCase;
import org.jbpm.graph.def.ProcessDefinition;
-public abstract class AbstractXmlTestCase extends AbstractJbpmTestCase {
+abstract class AbstractXmlTestCase extends AbstractJbpmTestCase {
- static Element toXmlAndParse(ProcessDefinition processDefinition, String xpathExpression)
- throws Exception {
+ protected static Element toXmlAndParse(ProcessDefinition processDefinition,
+ String xpathExpression) throws Exception {
Element element = toXmlAndParse(processDefinition);
return (Element) element.selectSingleNode(xpathExpression);
}
- static Element toXmlAndParse(ProcessDefinition processDefinition, String xpathExpression,
- String namespace) throws Exception {
+ protected static Element toXmlAndParse(ProcessDefinition processDefinition,
+ String xpathExpression, String namespace) throws Exception {
Element element = toXmlAndParseWithNamespace(processDefinition);
XPath xpath = DocumentHelper.createXPath(xpathExpression);
xpath.setNamespaceURIs(Collections.singletonMap("", namespace));
return (Element) xpath.selectSingleNode(element);
}
- static Element toXmlAndParse(ProcessDefinition processDefinition) throws Exception {
+ protected static Element toXmlAndParse(ProcessDefinition processDefinition) throws Exception {
String xml = JpdlXmlWriter.toString(processDefinition);
return DocumentHelper.parseText(xml).getRootElement();
}
- static Element toXmlAndParseWithNamespace(ProcessDefinition processDefinition) throws Exception {
+ protected static Element toXmlAndParseWithNamespace(ProcessDefinition processDefinition)
+ throws Exception {
StringWriter stringWriter = new StringWriter();
JpdlXmlWriter jpdlWriter = new JpdlXmlWriter(stringWriter);
jpdlWriter.setUseNamespace(true);
@@ -59,8 +60,4 @@
String xml = stringWriter.toString();
return DocumentHelper.parseText(xml).getRootElement();
}
-
- static void printXml(ProcessDefinition processDefinition) {
- System.out.println(JpdlXmlWriter.toString(processDefinition));
- }
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/NodeXmlTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/NodeXmlTest.java 2010-04-15 13:46:26 UTC (rev 6257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/xml/NodeXmlTest.java 2010-04-15 15:04:30 UTC (rev 6258)
@@ -21,6 +21,8 @@
*/
package org.jbpm.jpdl.xml;
+import java.util.List;
+
import org.dom4j.Element;
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.Node;
@@ -30,97 +32,96 @@
public class NodeXmlTest extends AbstractXmlTestCase {
public void testReadNode() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <node />" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <node />"
+ + "</process-definition>");
assertNotNull(processDefinition.getNodes().get(0));
}
public void testWriteNode() throws Exception {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.addNode(new Node());
- Element element = toXmlAndParse( processDefinition, "/process-definition/node" );
+
+ Element element = toXmlAndParse(processDefinition, "/process-definition/node");
assertNotNull(element);
assertEquals("node", element.getName());
assertEquals(0, element.attributeCount());
}
public void testReadNodeName() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <node name='wash car' />" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <node name='wash car' />"
+ + "</process-definition>");
assertEquals("wash car", processDefinition.getNode("wash car").getName());
}
public void testWriteNodeName() throws Exception {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.addNode(new Node("n"));
- Element element = toXmlAndParse( processDefinition, "/process-definition/node" );
- assertNotNull(element);
+
+ Element element = toXmlAndParse(processDefinition, "/process-definition/node");
assertEquals("n", element.attributeValue("name"));
assertEquals(1, element.attributeCount());
}
-
+
public void testReadNodeEvents() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <node name='n'>" +
- " <event type='node-enter'/>" +
- " <event type='customeventtype' />" +
- " </node>" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <node name='n'>"
+ + " <event type='node-enter'/>"
+ + " <event type='customeventtype' />"
+ + " </node>"
+ + "</process-definition>");
+
Node node = processDefinition.getNode("n");
- assertEquals(2,node.getEvents().size());
- assertEquals("node-enter",node.getEvent("node-enter").getEventType());
- assertEquals("customeventtype",node.getEvent("customeventtype").getEventType());
+ assertEquals(2, node.getEvents().size());
+ assertEquals("node-enter", node.getEvent("node-enter").getEventType());
+ assertEquals("customeventtype", node.getEvent("customeventtype").getEventType());
}
public void testWriteNodeEvents() throws Exception {
- ProcessDefinition processDefinition = new ProcessDefinition();
Node node = new Node("n");
- processDefinition.addNode(node);
node.addEvent(new Event("one"));
node.addEvent(new Event("two"));
node.addEvent(new Event("three"));
- printXml(processDefinition);
- Element element = toXmlAndParse( processDefinition, "/process-definition/node" );
+
+ ProcessDefinition processDefinition = new ProcessDefinition();
+ processDefinition.addNode(node);
+
+ Element element = toXmlAndParse(processDefinition, "/process-definition/node");
assertNotNull(element);
assertEquals(3, element.elements("event").size());
}
-
+
public void testReadNodeTransitions() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <node name='n'>" +
- " <transition name='one' to='n'/>" +
- " <transition name='two' to='n'/>" +
- " <transition name='three' to='n'/>" +
- " </node>" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <node name='n'>"
+ + " <transition name='one' to='n'/>"
+ + " <transition name='two' to='n'/>"
+ + " <transition name='three' to='n'/>"
+ + " </node>"
+ + "</process-definition>");
+
Node node = processDefinition.getNode("n");
- assertEquals(3,node.getLeavingTransitionsMap().size());
- assertEquals("one",((Transition)node.getLeavingTransitionsList().get(0)).getName());
- assertEquals("two",((Transition)node.getLeavingTransitionsList().get(1)).getName());
- assertEquals("three",((Transition)node.getLeavingTransitionsList().get(2)).getName());
+ List leavingTransitionsList = node.getLeavingTransitionsList();
+ assertEquals(3, leavingTransitionsList.size());
+ assertEquals("one", ((Transition) leavingTransitionsList.get(0)).getName());
+ assertEquals("two", ((Transition) leavingTransitionsList.get(1)).getName());
+ assertEquals("three", ((Transition) leavingTransitionsList.get(2)).getName());
}
public void testWriteNodeTransitions() throws Exception {
- ProcessDefinition processDefinition = new ProcessDefinition();
Node node = new Node("n");
- processDefinition.addNode(node);
node.addLeavingTransition(new Transition("one"));
node.addLeavingTransition(new Transition("two"));
node.addLeavingTransition(new Transition("three"));
- Element element = toXmlAndParse( processDefinition, "/process-definition/node" );
+
+ ProcessDefinition processDefinition = new ProcessDefinition();
+ processDefinition.addNode(node);
+
+ Element element = toXmlAndParse(processDefinition, "/process-definition/node");
assertEquals(3, element.elements("transition").size());
- assertEquals("one", ((Element)element.elements("transition").get(0)).attributeValue("name"));
- assertEquals("two", ((Element)element.elements("transition").get(1)).attributeValue("name"));
- assertEquals("three", ((Element)element.elements("transition").get(2)).attributeValue("name"));
+ assertEquals("one", ((Element) element.elements("transition").get(0)).attributeValue("name"));
+ assertEquals("two", ((Element) element.elements("transition").get(1)).attributeValue("name"));
+ assertEquals("three", ((Element) element.elements("transition").get(2)).attributeValue("name"));
}
}
14 years