[jbpm-commits] JBoss JBPM SVN: r5963 - in jbpm4/trunk: modules/db/src/main/java/org/jbpm/db and 34 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Dec 15 11:21:32 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-12-15 11:21:28 -0500 (Tue, 15 Dec 2009)
New Revision: 5963
Added:
jbpm4/trunk/modules/distro/src/main/files/install/jdbc/hsqldb.inmem.properties
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/ProcessEngineImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringHelper.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringProcessEngine.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/FlushDeserializedObject.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringToStandardSynchronization.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransaction.java
jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.mail.templates.examples.xml
jbpm4/trunk/qa/hudson-jbpm4-spring.sh
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/test/spring/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringProcessEngine.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/DeserializedObjects.java
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/spring/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.testsuite.jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml
jbpm4/trunk/modules/examples/pom.xml
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/AntHelper.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ConfigurationImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Transaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/InitializePropertiesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/converter/SerializableToBytesConverter.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentInterceptorBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.hibernate.cfg.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.spring.cfg.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/tx/TransactionResourcesSetRollbackOnlyTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/test-db/pom.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/async/eventlistener/AsyncEventListenerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java
Log:
JBPM-2631 spring transactions
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -44,6 +44,7 @@
impl = instantiate("org.jbpm.pvm.internal.cfg.ConfigurationImpl");
}
+ // constructor for ConfigurationImpl to prevent construction loop
protected Configuration(Object o) {
}
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -32,8 +32,8 @@
import org.jbpm.api.cmd.Environment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.id.PropertyImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.DeploymentProperty;
Added: jbpm4/trunk/modules/distro/src/main/files/install/jdbc/hsqldb.inmem.properties
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/jdbc/hsqldb.inmem.properties (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/jdbc/hsqldb.inmem.properties 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,4 @@
+jdbc.driver=org.hsqldb.jdbcDriver
+jdbc.url=jdbc:hsqldb:mem:.
+jdbc.username=sa
+jdbc.password=
Property changes on: jbpm4/trunk/modules/distro/src/main/files/install/jdbc/hsqldb.inmem.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.driver_class">@jdbc.driver@</property>
+ <property name="hibernate.connection.url">@jdbc.url@</property>
+ <property name="hibernate.connection.username">@jdbc.username@</property>
+ <property name="hibernate.connection.password">@jdbc.password@</property>
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property name="hibernate.format_sql">true</property>
+ <property name="current_session_context_class">thread</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Property changes on: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.inmem.hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.jbpm.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.jbpm.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -10,5 +10,9 @@
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
+
+ <process-engine-context>
+ <string name="spring.cfg" value="applicationContext.xml" />
+ </process-engine-context>
</jbpm-configuration>
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.testsuite.jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.testsuite.jbpm.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/jbpm/spring.testsuite.jbpm.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -9,5 +9,10 @@
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
+ <import resource="jbpm.mail.templates.examples.xml" />
+
+ <process-engine-context>
+ <string name="spring.cfg" value="applicationContext.xml" />
+ </process-engine-context>
</jbpm-configuration>
Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/spring/applicationContext.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -11,23 +11,25 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
- <!-- A best practice should be to keep split the config into multiple files
- <property name="configLocations" value="hibernate.cfg.xml, hibernate.jbpm.cfg.xml" />
- -->
- </bean>
+ <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory" />
- <property name="dataSource" ref="dataSource" />
- </bean>
+ <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
- <property name="url" value="jdbc:hsqldb:mem:." />
- <property name="username" value="sa" />
- <property name="password" value="" />
- </bean>
+ <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+ <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+ <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+ <property name="url" value="jdbc:hsqldb:mem:." />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </bean>
+
</beans>
\ No newline at end of file
Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/examples/pom.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -152,6 +152,41 @@
</build>
</profile>
+ <!-- Note: Spring profile cannot be used together with 'database'
+ property currently (see http://jira.codehaus.org/browse/MNG-3328) -->
+ <profile>
+ <id>run.spring.testsuite</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>spring-test-cfg-customization</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="../distro/src/main/files/install/build.xml" target="create.cfg">
+ <property name="tx" value="spring.testsuite" />
+ <property name="database" value="hsqldb.inmem" />
+ <property name="mail.cfg" value="testsuite" />
+ <property name="cfg.dest.dir" value="target/test-classes" />
+ <property name="install.src.dir" value="../distro/src/main/files/install/src" />
+ <property name="jdbc.properties.dir" value="../distro/src/main/files/install/jdbc" />
+ <property name="logging" value="none" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
\ No newline at end of file
Modified: jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
===================================================================
--- jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -27,8 +27,8 @@
import org.dom4j.Document;
import org.dom4j.Element;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.xml.Problem;
import org.junit.Assert;
import org.junit.Ignore;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/AntHelper.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/AntHelper.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/AntHelper.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -28,7 +28,7 @@
import org.apache.commons.logging.LogFactory;
import org.jbpm.api.Configuration;
import org.jbpm.api.ProcessEngine;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
/**
* common strategy for jbpm ant tasks to obtain a hibernate SessionFactory.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ConfigurationImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ConfigurationImpl.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ConfigurationImpl.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -32,6 +32,8 @@
import org.jbpm.api.ProcessEngine;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Context;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
+import org.jbpm.pvm.internal.processengine.SpringProcessEngine;
import org.jbpm.pvm.internal.stream.FileStreamInput;
import org.jbpm.pvm.internal.stream.InputStreamInput;
import org.jbpm.pvm.internal.stream.ResourceStreamInput;
@@ -41,6 +43,7 @@
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.springframework.context.ApplicationContext;
/**
@@ -56,12 +59,14 @@
transient String jndiName;
transient boolean checkDb = true;
transient boolean isSpringEnabled = false;
- transient boolean isInstantiatedFromSpring = false;
+ // type is Object because we don't want a dependency on spring in this class
+ transient Object applicationContext = null;
transient WireContext processEngineWireContext = new WireContext(new WireDefinition(), Context.CONTEXTNAME_PROCESS_ENGINE, true);
transient WireDefinition transactionWireDefinition = new WireDefinition();
transient ProcessEngine producedProcessEngine;
public ConfigurationImpl() {
+ // to prevent a loop in the constructors, we need to delegate to a non-default constructor in Configuration
super(null);
}
@@ -83,14 +88,10 @@
}
}
- return instantiateProcessEngine();
-
- /*
if (isSpringEnabled) {
- return new SpringProcessEngine(this);
+ return SpringProcessEngine.create(this);
}
return new ProcessEngineImpl(this);
- */
}
/**
@@ -155,9 +156,9 @@
return this;
}
- public ConfigurationImpl springInitiated() {
+ public ConfigurationImpl springInitiated(Object applicationContext) {
this.isSpringEnabled = true;
- this.isInstantiatedFromSpring = true;
+ this.applicationContext = applicationContext;
return this;
}
@@ -171,6 +172,10 @@
return this;
}
+ public boolean isInstantiatedFromSpring() {
+ return (applicationContext!=null);
+ }
+
// getters and setters //////////////////////////////////////////////////////
public WireContext getProcessEngineWireContext() {
@@ -188,7 +193,10 @@
public ProcessEngine getProducedProcessEngine() {
return producedProcessEngine;
}
- public boolean isInstantiatedFromSpring() {
- return isInstantiatedFromSpring;
+ public void setProducedProcessEngine(ProcessEngineImpl processEngine) {
+ this.producedProcessEngine = processEngine;
}
+ public Object getApplicationContext() {
+ return applicationContext;
+ }
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,307 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cfg;
-
-import java.io.Serializable;
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jbpm.api.ExecutionService;
-import org.jbpm.api.HistoryService;
-import org.jbpm.api.IdentityService;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.ManagementService;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.api.RepositoryService;
-import org.jbpm.api.TaskService;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cmd.CheckDbCmd;
-import org.jbpm.pvm.internal.cmd.CommandService;
-import org.jbpm.pvm.internal.env.Context;
-import org.jbpm.pvm.internal.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.PvmEnvironment;
-import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
-import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-
-/**
- * an environment factory that also is the process-engine context.
- *
- * <p>
- * This environment factory will produce environments with 2 contexts: the
- * process-engine context and the block context.
- * </p>
- *
- * <p>
- * An process-engine context is build from two wire definitions: the
- * process-engine wire definition and the environment wire definition.
- * </p>
- *
- * <p>
- * The process-engine context itself is build from the process-engine
- * wire definition. So all objects that are created in this context remain
- * cached for the lifetime of this process-engine context object.
- * </p>
- *
- * <p>
- * This process-engine context is also a environment factory. The produced
- * environments contain 2 contexts: the process-engine context itself and a
- * new environment context, build from the environment wire definition. For each
- * created environment, a new environment context will be created from the same
- * environment wire definition. Objects in the environment context will live for
- * as long as the environment.
- * </p>
- *
- * @author Tom Baeyens
- */
-public class ProcessEngineImpl implements Context, ProcessEngine, EnvironmentFactory, Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(ProcessEngineImpl.class.getName());
-
- public static final String JBPM_LIBRARY_VERSION = "4.3-SNAPSHOT";
-
- transient protected WireContext processEngineWireContext;
- transient protected WireDefinition transactionWireDefinition;
-
- transient protected ThreadLocal<List<UserProvidedEnvironmentObject>> userProvidedEnvironmentObjectsThreadLocal = new ThreadLocal<List<UserProvidedEnvironmentObject>>();
- transient protected ThreadLocal<String> authenticatedUserIdThreadLocal = new ThreadLocal<String>();
-
- transient protected CommandService userCommandService = null;
-
- public ProcessEngineImpl() {
-
- }
-
- public ProcessEngineImpl(ConfigurationImpl configuration) {
- initializeProcessEngine(configuration);
- }
-
- protected void initializeProcessEngine(ConfigurationImpl configuration) {
- configuration.producedProcessEngine = this;
- this.processEngineWireContext = configuration.getProcessEngineWireContext();
- this.transactionWireDefinition = configuration.getTransactionWireDefinition();
-
- if (log.isTraceEnabled()) {
- log.trace("created ProcessEngine "+System.identityHashCode(this));
- if ( (processEngineWireContext!=null)
- && (processEngineWireContext.getWireDefinition()!=null)
- && (processEngineWireContext.getWireDefinition().getDescriptorTypes()!=null)
- ) {
- log.trace(" process-engine-context "+System.identityHashCode(processEngineWireContext));
- for (Class<?> descriptorType: processEngineWireContext.getWireDefinition().getDescriptorTypes()) {
- log.trace(" "+descriptorType.getName());
- }
- }
- if ( (transactionWireDefinition!=null)
- && (transactionWireDefinition.getDescriptorTypes()!=null)
- ) {
- log.trace(" transaction-context:");
- for (Class<?> descriptorType: transactionWireDefinition.getDescriptorTypes()) {
- log.trace(" "+descriptorType.getName());
- }
- }
- }
-
- processEngineWireContext.create();
- userCommandService = (CommandService) processEngineWireContext.get(CommandService.NAME_TX_REQUIRED_COMMAND_SERVICE);
-
- String jndiName = configuration.getJndiName();
- if (jndiName!=null) {
- try {
- log.debug("publishing jBPM ProcessEngine in jndi at "+jndiName);
- InitialContext initialContext = new InitialContext();
- initialContext.bind(jndiName, this);
- } catch (NamingException e) {
- throw new JbpmException("JNDI binding problem", e);
- }
- }
-
- if (configuration.isCheckDb()) {
- userCommandService.execute(new CheckDbCmd());
- }
- }
-
-
- public ExecutionService getExecutionService() {
- return get(ExecutionService.class);
- }
- public HistoryService getHistoryService() {
- return get(HistoryService.class);
- }
- public ManagementService getManagementService() {
- return get(ManagementService.class);
- }
- public TaskService getTaskService() {
- return get(TaskService.class);
- }
- public IdentityService getIdentityService() {
- return get(IdentityService.class);
- }
- public RepositoryService getRepositoryService() {
- return get(RepositoryService.class);
- }
-
- public EnvironmentImpl openEnvironment() {
- PvmEnvironment environment = new PvmEnvironment(this);
-
- if (log.isTraceEnabled()) log.trace("opening " + environment);
-
- installAuthenticatedUserId(environment);
- installProcessEngineContext(environment);
- installTransactionContext(environment);
-
- return environment;
- }
-
- protected void installAuthenticatedUserId(EnvironmentImpl environment) {
- String authenticatedUserId = authenticatedUserIdThreadLocal.get();
- if (authenticatedUserId!=null) {
- environment.setAuthenticatedUserId(authenticatedUserId);
- authenticatedUserIdThreadLocal.set(null);
- }
- }
-
- protected void installTransactionContext(PvmEnvironment environment) {
- WireContext transactionContext = new WireContext(transactionWireDefinition, Context.CONTEXTNAME_TRANSACTION, true);
- // add the environment block context to the environment
- environment.setContext(transactionContext);
-
- EnvironmentImpl.pushEnvironment(environment);
- try {
- // finish the creation of the environment wire context
- transactionContext.create();
-
- } catch (RuntimeException e) {
- EnvironmentImpl.popEnvironment();
- throw e;
- }
- }
-
- protected void installProcessEngineContext(PvmEnvironment environment) {
- // add the process-engine context
- environment.setContext(processEngineWireContext);
- }
-
- public void close() {
- JobExecutor jobExecutor = get(JobExecutor.class);
- if (jobExecutor!=null) {
- // stop the job executor and wait till all job executor threads have stopped.
- jobExecutor.stop(true);
- }
- processEngineWireContext.fire(WireContext.EVENT_CLOSE, null);
- }
-
- // process-engine context delegation methods
- // ///////////////////////////////////
-
- public Object get(String key) {
- return processEngineWireContext.get(key);
- }
-
- public <T> T get(Class<T> type) {
- return processEngineWireContext.get(type);
- }
-
- public String getName() {
- return processEngineWireContext.getName();
- }
-
- public boolean has(String key) {
- return processEngineWireContext.has(key);
- }
-
- public Set<String> keys() {
- return processEngineWireContext.keys();
- }
-
- public Object set(String key, Object value) {
- return processEngineWireContext.set(key, value);
- }
-
- public void addProcessEngineWireDefinition(WireDefinition wireDefinition) {
- processEngineWireContext.getWireDefinition().addWireDefinition(wireDefinition);
- }
-
- public void addTransactionWireDefinition(WireDefinition wireDefinition) {
- transactionWireDefinition.addWireDefinition(wireDefinition);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public void setTransactionWireDefinition(WireDefinition transactionWireDefinition) {
- this.transactionWireDefinition = transactionWireDefinition;
- }
- public WireContext getProcessEngineWireContext() {
- return processEngineWireContext;
- }
- public void setProcessEngineWireContext(WireContext processEngineWireContext) {
- this.processEngineWireContext = processEngineWireContext;
- }
- public WireDefinition getTransactionWireDefinition() {
- return transactionWireDefinition;
- }
-
- public ProcessEngine setAuthenticatedUserId(String authenticatedUserId) {
- authenticatedUserIdThreadLocal.set(authenticatedUserId);
- return this;
- }
-
- public ProcessEngine setHibernateSession(Object hibernateSession) {
- addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(hibernateSession, null, true));
- return this;
- }
-
- public ProcessEngine setJdbcConnection(Connection jdbcConnection) {
- addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(jdbcConnection, null, true));
- return this;
- }
-
- protected synchronized void addUserProvidedEnvironmentObject(UserProvidedEnvironmentObject userProvidedEnvironmentObject) {
- List<UserProvidedEnvironmentObject> environmentObjects = userProvidedEnvironmentObjectsThreadLocal.get();
- if (environmentObjects==null) {
- environmentObjects = new ArrayList<UserProvidedEnvironmentObject>();
- userProvidedEnvironmentObjectsThreadLocal.set(environmentObjects);
- }
- environmentObjects.add(userProvidedEnvironmentObject);
- }
-
- public <T> T execute(Command<T> command) {
- return userCommandService.execute(command);
- }
-
- // left in for legacy test code
- public static EnvironmentFactory parseXmlString(String jbpmConfigurationXml) {
- return (EnvironmentFactory) new ConfigurationImpl()
- .setXmlString(jbpmConfigurationXml)
- .skipDbCheck()
- .buildProcessEngine();
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cfg;
-
-import org.jbpm.api.ProcessEngine;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * @author Joram Barrez
- */
-public class SpringConfiguration extends ConfigurationImpl implements ApplicationContextAware {
-
- transient protected ApplicationContext applicationContext;
-
- public SpringConfiguration() {
- springInitiated();
- }
-
- public void setJbpmCfgLocation(String jbpmCfgLocation) {
- setResource(jbpmCfgLocation);
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- @Override
- protected ProcessEngine instantiateProcessEngine() {
- return new SpringProcessEngine(this, applicationContext);
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringProcessEngine.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringProcessEngine.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cfg;
-
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.PvmEnvironment;
-import org.jbpm.pvm.internal.env.SpringContext;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * this environment factory will see only the singleton beans.
- *
- * The created {@link SpringEnvironment}s will see the prototype beans and it
- * will cache them.
- *
- * @author Andries Inze
- */
-public class SpringProcessEngine extends ProcessEngineImpl implements EnvironmentFactory, ProcessEngine, ApplicationContextAware {
-
- private static final Log log = Log.getLog(SpringProcessEngine.class.getName());
-
- private static final long serialVersionUID = 1L;
-
- private ApplicationContext applicationContext;
-
- /*
- public static ProcessEngine create() {
- return create(ConfigurationImpl.DEFAULT_CONFIG_RESOURCENAME);
- }
-
-
- public static ProcessEngine create(String jbpmCfg) {
- return new ConfigurationImpl()
- .springInitiated()
- .setResource(jbpmCfg)
- .buildProcessEngine();
- }*/
-
- public SpringProcessEngine(ConfigurationImpl configuration, ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
-
- if (!configuration.isInstantiatedFromSpring()) {
- String springCfg = (String) configuration.getProcessEngineWireContext().get("spring.cfg");
- if (springCfg==null) {
- springCfg = "applicationContext.xml";
- }
- applicationContext = new ClassPathXmlApplicationContext(springCfg);
- }
-
- initializeProcessEngine(configuration);
- }
-
- public EnvironmentImpl openEnvironment() {
- PvmEnvironment environment = new PvmEnvironment(this);
-
- if (log.isTraceEnabled())
- log.trace("opening jbpm-spring" + environment);
-
- environment.setContext(new SpringContext(applicationContext));
-
- installAuthenticatedUserId(environment);
- installProcessEngineContext(environment);
- installTransactionContext(environment);
-
- return environment;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T get(Class<T> type) {
- String[] names = applicationContext.getBeanNamesForType(type);
-
- if (names.length >= 1) {
-
- if (names.length > 1 && log.isWarnEnabled()) {
- log.warn("Multiple beans for type " + type + " found. Returning the first result.");
- }
-
- return (T) applicationContext.getBean(names[0]);
- }
-
- return super.get(type);
- }
-
- @Override
- public Object get(String key) {
- if (applicationContext.containsBean(key)) {
- return applicationContext.getBean(key);
- }
-
- return super.get(key);
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -26,10 +26,10 @@
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.id.PropertyImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
/**
* @author Tom Baeyens
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -106,10 +106,13 @@
* transaction. */
protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Exception exception) {
Transaction transaction = environment.get(Transaction.class);
- // transaction.setRollbackOnly();
-
CommandService commandService = (CommandService) environment.get(CommandService.NAME_NEW_TX_REQUIRED_COMMAND_SERVICE);
JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
transaction.registerSynchronization(jobExceptionHandler);
+
+ if (exception instanceof RuntimeException) {
+ throw (RuntimeException) exception;
+ }
+ throw new JbpmException("job failed: "+exception.getMessage(), exception);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -22,7 +22,7 @@
package org.jbpm.pvm.internal.env;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.Closable;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Transaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Transaction.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Transaction.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -23,28 +23,14 @@
import javax.transaction.Synchronization;
-import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.type.Variable;
-
/** provides access to the transaction in the environment.
*
* @author Tom Baeyens
*/
public interface Transaction {
- /** marks a transaction for rollback only.
- * The transaction will be rolled back upon closing the environment. */
- void setRollbackOnly();
-
- /** is this transaction marked for rollback only ? */
- boolean isRollbackOnly();
-
/** register a transaction listener. This method will have no
* effect if the transactionListener is null. */
void registerSynchronization(Synchronization synchronization);
-
- /** registers an object that is deserialized from the db so that it
- * can be serialized and saved at the commit. */
- void registerDeserializedObject(Object object, ScopeInstanceImpl scopeInstance, Variable variable);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/InitializePropertiesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/InitializePropertiesCmd.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/InitializePropertiesCmd.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -29,7 +29,6 @@
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
@@ -40,6 +39,7 @@
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.lob.Lob;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.DeploymentProperty;
import org.jbpm.pvm.internal.task.ParticipationImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -27,7 +27,6 @@
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
@@ -38,6 +37,7 @@
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.lob.Lob;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.DeploymentProperty;
import org.jbpm.pvm.internal.task.ParticipationImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -31,8 +31,8 @@
import org.jbpm.api.Configuration;
import org.jbpm.api.JbpmException;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
/**
* starts the job executor on init and closes the
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/ProcessEngineImpl.java (from rev 5957, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/ProcessEngineImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/ProcessEngineImpl.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,310 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.processengine;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.HistoryService;
+import org.jbpm.api.IdentityService;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ManagementService;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.api.TaskService;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
+import org.jbpm.pvm.internal.cmd.CheckDbCmd;
+import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.pvm.internal.env.Context;
+import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.PvmEnvironment;
+import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+
+/**
+ * an environment factory that also is the process-engine context.
+ *
+ * <p>
+ * This environment factory will produce environments with 2 contexts: the
+ * process-engine context and the block context.
+ * </p>
+ *
+ * <p>
+ * An process-engine context is build from two wire definitions: the
+ * process-engine wire definition and the environment wire definition.
+ * </p>
+ *
+ * <p>
+ * The process-engine context itself is build from the process-engine
+ * wire definition. So all objects that are created in this context remain
+ * cached for the lifetime of this process-engine context object.
+ * </p>
+ *
+ * <p>
+ * This process-engine context is also a environment factory. The produced
+ * environments contain 2 contexts: the process-engine context itself and a
+ * new environment context, build from the environment wire definition. For each
+ * created environment, a new environment context will be created from the same
+ * environment wire definition. Objects in the environment context will live for
+ * as long as the environment.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public class ProcessEngineImpl implements Context, ProcessEngine, EnvironmentFactory, Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(ProcessEngineImpl.class.getName());
+
+ public static final String JBPM_LIBRARY_VERSION = "4.3-SNAPSHOT";
+
+ transient protected WireContext processEngineWireContext;
+ transient protected WireDefinition transactionWireDefinition;
+
+ transient protected ThreadLocal<List<UserProvidedEnvironmentObject>> userProvidedEnvironmentObjectsThreadLocal = new ThreadLocal<List<UserProvidedEnvironmentObject>>();
+ transient protected ThreadLocal<String> authenticatedUserIdThreadLocal = new ThreadLocal<String>();
+
+ transient protected CommandService userCommandService = null;
+
+ public ProcessEngineImpl() {
+ }
+
+ public ProcessEngineImpl(ConfigurationImpl configuration) {
+ initializeProcessEngine(configuration);
+ checkDb(configuration);
+ }
+
+ protected void initializeProcessEngine(ConfigurationImpl configuration) {
+ configuration.setProducedProcessEngine(this);
+ this.processEngineWireContext = configuration.getProcessEngineWireContext();
+ this.transactionWireDefinition = configuration.getTransactionWireDefinition();
+
+ if (log.isTraceEnabled()) {
+ log.trace("created ProcessEngine "+System.identityHashCode(this));
+ if ( (processEngineWireContext!=null)
+ && (processEngineWireContext.getWireDefinition()!=null)
+ && (processEngineWireContext.getWireDefinition().getDescriptorTypes()!=null)
+ ) {
+ log.trace(" process-engine-context "+System.identityHashCode(processEngineWireContext));
+ for (Class<?> descriptorType: processEngineWireContext.getWireDefinition().getDescriptorTypes()) {
+ log.trace(" "+descriptorType.getName());
+ }
+ }
+ if ( (transactionWireDefinition!=null)
+ && (transactionWireDefinition.getDescriptorTypes()!=null)
+ ) {
+ log.trace(" transaction-context:");
+ for (Class<?> descriptorType: transactionWireDefinition.getDescriptorTypes()) {
+ log.trace(" "+descriptorType.getName());
+ }
+ }
+ }
+
+ processEngineWireContext.create();
+ userCommandService = (CommandService) processEngineWireContext.get(CommandService.NAME_TX_REQUIRED_COMMAND_SERVICE);
+
+ String jndiName = configuration.getJndiName();
+ if (jndiName!=null) {
+ try {
+ log.debug("publishing jBPM ProcessEngine in jndi at "+jndiName);
+ InitialContext initialContext = new InitialContext();
+ initialContext.bind(jndiName, this);
+ } catch (NamingException e) {
+ throw new JbpmException("JNDI binding problem", e);
+ }
+ }
+
+ }
+
+ protected void checkDb(ConfigurationImpl configuration) {
+ if (configuration.isCheckDb()) {
+ userCommandService.execute(new CheckDbCmd());
+ }
+ }
+
+ public ExecutionService getExecutionService() {
+ return get(ExecutionService.class);
+ }
+ public HistoryService getHistoryService() {
+ return get(HistoryService.class);
+ }
+ public ManagementService getManagementService() {
+ return get(ManagementService.class);
+ }
+ public TaskService getTaskService() {
+ return get(TaskService.class);
+ }
+ public IdentityService getIdentityService() {
+ return get(IdentityService.class);
+ }
+ public RepositoryService getRepositoryService() {
+ return get(RepositoryService.class);
+ }
+
+ public EnvironmentImpl openEnvironment() {
+ PvmEnvironment environment = new PvmEnvironment(this);
+
+ if (log.isTraceEnabled()) log.trace("opening " + environment);
+
+ installAuthenticatedUserId(environment);
+ installProcessEngineContext(environment);
+ installTransactionContext(environment);
+
+ return environment;
+ }
+
+ protected void installAuthenticatedUserId(EnvironmentImpl environment) {
+ String authenticatedUserId = authenticatedUserIdThreadLocal.get();
+ if (authenticatedUserId!=null) {
+ environment.setAuthenticatedUserId(authenticatedUserId);
+ authenticatedUserIdThreadLocal.set(null);
+ }
+ }
+
+ protected void installTransactionContext(PvmEnvironment environment) {
+ WireContext transactionContext = new WireContext(transactionWireDefinition, Context.CONTEXTNAME_TRANSACTION, true);
+ // add the environment block context to the environment
+ environment.setContext(transactionContext);
+
+ EnvironmentImpl.pushEnvironment(environment);
+ try {
+ // finish the creation of the environment wire context
+ transactionContext.create();
+
+ } catch (RuntimeException e) {
+ EnvironmentImpl.popEnvironment();
+ throw e;
+ }
+ }
+
+ protected void installProcessEngineContext(PvmEnvironment environment) {
+ // add the process-engine context
+ environment.setContext(processEngineWireContext);
+ }
+
+ public void close() {
+ JobExecutor jobExecutor = get(JobExecutor.class);
+ if (jobExecutor!=null) {
+ // stop the job executor and wait till all job executor threads have stopped.
+ jobExecutor.stop(true);
+ }
+ processEngineWireContext.fire(WireContext.EVENT_CLOSE, null);
+ }
+
+ // process-engine context delegation methods
+ // ///////////////////////////////////
+
+ public Object get(String key) {
+ return processEngineWireContext.get(key);
+ }
+
+ public <T> T get(Class<T> type) {
+ return processEngineWireContext.get(type);
+ }
+
+ public String getName() {
+ return processEngineWireContext.getName();
+ }
+
+ public boolean has(String key) {
+ return processEngineWireContext.has(key);
+ }
+
+ public Set<String> keys() {
+ return processEngineWireContext.keys();
+ }
+
+ public Object set(String key, Object value) {
+ return processEngineWireContext.set(key, value);
+ }
+
+ public void addProcessEngineWireDefinition(WireDefinition wireDefinition) {
+ processEngineWireContext.getWireDefinition().addWireDefinition(wireDefinition);
+ }
+
+ public void addTransactionWireDefinition(WireDefinition wireDefinition) {
+ transactionWireDefinition.addWireDefinition(wireDefinition);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public void setTransactionWireDefinition(WireDefinition transactionWireDefinition) {
+ this.transactionWireDefinition = transactionWireDefinition;
+ }
+ public WireContext getProcessEngineWireContext() {
+ return processEngineWireContext;
+ }
+ public void setProcessEngineWireContext(WireContext processEngineWireContext) {
+ this.processEngineWireContext = processEngineWireContext;
+ }
+ public WireDefinition getTransactionWireDefinition() {
+ return transactionWireDefinition;
+ }
+
+ public ProcessEngine setAuthenticatedUserId(String authenticatedUserId) {
+ authenticatedUserIdThreadLocal.set(authenticatedUserId);
+ return this;
+ }
+
+ public ProcessEngine setHibernateSession(Object hibernateSession) {
+ addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(hibernateSession, null, true));
+ return this;
+ }
+
+ public ProcessEngine setJdbcConnection(Connection jdbcConnection) {
+ addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(jdbcConnection, null, true));
+ return this;
+ }
+
+ protected synchronized void addUserProvidedEnvironmentObject(UserProvidedEnvironmentObject userProvidedEnvironmentObject) {
+ List<UserProvidedEnvironmentObject> environmentObjects = userProvidedEnvironmentObjectsThreadLocal.get();
+ if (environmentObjects==null) {
+ environmentObjects = new ArrayList<UserProvidedEnvironmentObject>();
+ userProvidedEnvironmentObjectsThreadLocal.set(environmentObjects);
+ }
+ environmentObjects.add(userProvidedEnvironmentObject);
+ }
+
+ public <T> T execute(Command<T> command) {
+ return userCommandService.execute(command);
+ }
+
+ // left in for legacy test code
+ public static EnvironmentFactory parseXmlString(String jbpmConfigurationXml) {
+ return (EnvironmentFactory) new ConfigurationImpl()
+ .setXmlString(jbpmConfigurationXml)
+ .skipDbCheck()
+ .buildProcessEngine();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/ProcessEngineImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringHelper.java (from rev 5957, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringHelper.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringHelper.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.processengine;
+
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * @author Joram Barrez
+ */
+public class SpringHelper implements ApplicationContextAware {
+
+ protected ApplicationContext applicationContext;
+ protected String jbpmCfg = "jbpm.cfg.xml";
+
+ public void setJbpmCfg(String jbpmCfg) {
+ this.jbpmCfg = jbpmCfg;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+ protected ProcessEngine createProcessEngine() {
+ return new ConfigurationImpl()
+ .springInitiated(applicationContext)
+ .setResource(jbpmCfg)
+ .buildProcessEngine();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringProcessEngine.java (from rev 5957, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringProcessEngine.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringProcessEngine.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringProcessEngine.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.processengine;
+
+import org.hibernate.cfg.Configuration;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
+import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.env.PvmEnvironment;
+import org.jbpm.pvm.internal.env.SpringContext;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
+
+/**
+ * this environment factory will see only the singleton beans.
+ *
+ * The created {@link SpringEnvironment}s will see the prototype beans and it
+ * will cache them.
+ *
+ * @author Andries Inze
+ */
+public class SpringProcessEngine extends ProcessEngineImpl implements EnvironmentFactory, ProcessEngine {
+
+ private static final Log log = Log.getLog(SpringProcessEngine.class.getName());
+
+ private static final long serialVersionUID = 1L;
+
+ private ApplicationContext applicationContext;
+
+ public static ProcessEngine create(ConfigurationImpl configuration) {
+ SpringProcessEngine springProcessEngine = null;
+
+ ApplicationContext applicationContext = null;
+ if (configuration.isInstantiatedFromSpring()) {
+ applicationContext = (ApplicationContext) configuration.getApplicationContext();
+
+ springProcessEngine = new SpringProcessEngine();
+ springProcessEngine.applicationContext = applicationContext;
+ springProcessEngine.initializeProcessEngine(configuration);
+
+ LocalSessionFactoryBean localSessionFactoryBean = springProcessEngine.get(LocalSessionFactoryBean.class);
+ Configuration hibernateConfiguration = localSessionFactoryBean.getConfiguration();
+ springProcessEngine.processEngineWireContext
+ .getWireDefinition()
+ .addDescriptor(new ProvidedObjectDescriptor(hibernateConfiguration, true));
+
+ springProcessEngine.checkDb(configuration);
+
+ } else {
+ String springCfg = (String) configuration.getProcessEngineWireContext().get("spring.cfg");
+ if (springCfg==null) {
+ springCfg = "applicationContext.xml";
+ }
+ applicationContext = new ClassPathXmlApplicationContext(springCfg);
+ springProcessEngine = (SpringProcessEngine) applicationContext.getBean("processEngine");
+ }
+
+ return springProcessEngine;
+ }
+
+ public EnvironmentImpl openEnvironment() {
+ PvmEnvironment environment = new PvmEnvironment(this);
+
+ if (log.isTraceEnabled())
+ log.trace("opening jbpm-spring" + environment);
+
+ environment.setContext(new SpringContext(applicationContext));
+
+ installAuthenticatedUserId(environment);
+ installProcessEngineContext(environment);
+ installTransactionContext(environment);
+
+ return environment;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T get(Class<T> type) {
+ String[] names = applicationContext.getBeanNamesForType(type);
+
+ if (names.length >= 1) {
+
+ if (names.length > 1 && log.isWarnEnabled()) {
+ log.warn("Multiple beans for type " + type + " found. Returning the first result.");
+ }
+
+ return (T) applicationContext.getBean(names[0]);
+ }
+
+ return super.get(type);
+ }
+
+ @Override
+ public Object get(String key) {
+ if (applicationContext.containsBean(key)) {
+ return applicationContext.getBean(key);
+ }
+
+ return super.get(key);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/processengine/SpringProcessEngine.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -23,30 +23,24 @@
import org.jbpm.api.cmd.Command;
import org.jbpm.pvm.internal.cmd.CommandService;
-import org.springframework.orm.hibernate3.HibernateTransactionManager;
-import org.springframework.orm.hibernate3.SessionFactoryUtils;
-import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
-import org.springframework.util.Assert;
/**
* @author Andries Inze
*/
public class CommandTransactionCallback<T> implements TransactionCallback {
- private Command<T> command;
- private CommandService commandService;
- private PlatformTransactionManager manager;
+ private Command<T> command;
+ private CommandService commandService;
- public CommandTransactionCallback(Command<T> command,
- CommandService commandService, PlatformTransactionManager platformTransactionManager) {
- this.command = command;
- this.commandService = commandService;
- this.manager = platformTransactionManager;
- }
+ public CommandTransactionCallback(Command<T> command,
+ CommandService commandService) {
+ this.command = command;
+ this.commandService = commandService;
+ }
- public T doInTransaction(TransactionStatus status) {
- return commandService.execute(command);
- }
+ public T doInTransaction(TransactionStatus status) {
+ return commandService.execute(command);
+ }
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/DeserializedObjects.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/DeserializedObjects.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/DeserializedObjects.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.tx;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.type.Variable;
-import org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter;
-import org.jbpm.pvm.internal.type.variable.BlobVariable;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeserializedObjects implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final SerializableToBytesConverter serializableToBytesConverter = new SerializableToBytesConverter();
-
- protected List<Object[]> deserializedObjects = new ArrayList<Object[]>();
-
- public void registerDeserializedObject(Object object, ScopeInstanceImpl scopeInstance, Variable variable) {
- if (deserializedObjects!=null) {
- deserializedObjects.add(new Object[] { object, scopeInstance, variable });
- }
- }
-
- public void flushDeserializedObjects() {
- List<Object[]> copy = new ArrayList<Object[]>(deserializedObjects);
- deserializedObjects = null;
- for (Object[] triple: copy) {
- Object deserializedObject = triple[0];
- ScopeInstanceImpl scopeInstance = (ScopeInstanceImpl) triple[1];
- BlobVariable blobVariable = (BlobVariable) triple[2];
-
- String variableName = blobVariable.getKey();
- Object currentValue = scopeInstance.getVariable(variableName);
-
- // first check if the deserialized object still is the value for that variable.
- // a different, new object (of any type) might have been set in the meantime in that key-value-pair
- if ( (currentValue!=null)
- && (currentValue==deserializedObject)
- ) {
- // next, we check if the serialized object was actually changed or not
- byte[] newBytes = (byte[]) serializableToBytesConverter.convert(currentValue, null, null);
- byte[] persistedBytes = blobVariable.getLob().extractBytes();
- // if it is changed
- if (!Arrays.equals(persistedBytes, newBytes)) {
- // then do an automatic update
- blobVariable.setValue(deserializedObject, scopeInstance);
- }
- }
- }
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/FlushDeserializedObject.java (from rev 5957, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/DeserializedObjects.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/FlushDeserializedObject.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/FlushDeserializedObject.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.tx;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import javax.transaction.Synchronization;
+
+import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
+import org.jbpm.pvm.internal.type.Variable;
+import org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter;
+import org.jbpm.pvm.internal.type.variable.BlobVariable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FlushDeserializedObject implements Serializable, Synchronization {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final SerializableToBytesConverter serializableToBytesConverter = new SerializableToBytesConverter();
+
+ protected Object[] deserializedObjectData;
+
+ public FlushDeserializedObject(Object object, ScopeInstanceImpl scopeInstance, Variable variable) {
+ deserializedObjectData = new Object[] { object, scopeInstance, variable };
+ }
+
+ public void beforeCompletion() {
+ flushDeserializedObject();
+ }
+
+ public void afterCompletion(int arg0) {
+ }
+
+ public void flushDeserializedObject() {
+ Object deserializedObject = deserializedObjectData[0];
+ ScopeInstanceImpl scopeInstance = (ScopeInstanceImpl) deserializedObjectData[1];
+ BlobVariable blobVariable = (BlobVariable) deserializedObjectData[2];
+
+ String variableName = blobVariable.getKey();
+ Object currentValue = scopeInstance.getVariable(variableName);
+
+ // first check if the deserialized object still is the value for that variable.
+ // a different, new object (of any type) might have been set in the meantime in that key-value-pair
+ if ( (currentValue!=null)
+ && (currentValue==deserializedObject)
+ ) {
+ // next, we check if the serialized object was actually changed or not
+ byte[] newBytes = (byte[]) serializableToBytesConverter.convert(currentValue, null, null);
+ byte[] persistedBytes = blobVariable.getLob().extractBytes();
+ // if it is changed
+ if (!Arrays.equals(persistedBytes, newBytes)) {
+ // then do an automatic update
+ blobVariable.setValue(deserializedObject, scopeInstance);
+ }
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/FlushDeserializedObject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringToStandardSynchronization.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringToStandardSynchronization.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringToStandardSynchronization.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.tx;
+
+import javax.transaction.Synchronization;
+
+import org.springframework.transaction.support.TransactionSynchronization;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SpringToStandardSynchronization implements TransactionSynchronization {
+
+ Synchronization synchronization;
+
+ public SpringToStandardSynchronization(Synchronization synchronization) {
+ this.synchronization = synchronization;
+ }
+
+ public void afterCompletion(int status) {
+ synchronization.afterCompletion(status);
+ }
+
+ public void beforeCompletion() {
+ synchronization.beforeCompletion();
+ }
+
+
+ public void afterCommit() {
+ }
+ public void beforeCommit(boolean readOnly) {
+ }
+ public void resume() {
+ }
+ public void suspend() {
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringToStandardSynchronization.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransaction.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransaction.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.tx;
+
+import java.io.Serializable;
+
+import javax.transaction.Synchronization;
+
+import org.jbpm.pvm.internal.env.Transaction;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SpringTransaction implements Transaction, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public void registerSynchronization(Synchronization synchronization) {
+ TransactionSynchronizationManager.registerSynchronization( new SpringToStandardSynchronization(synchronization));
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransaction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,17 +21,16 @@
*/
package org.jbpm.pvm.internal.tx;
-import org.hibernate.Session;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.Command;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.spring.CommandTransactionCallback;
import org.jbpm.pvm.internal.svc.Interceptor;
+import org.jbpm.pvm.internal.svc.Policy;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
-import org.springframework.transaction.support.TransactionCallback;
-import org.springframework.transaction.support.TransactionTemplate;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.AbstractPlatformTransactionManager;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
/**
* calls setRollbackOnly on the transaction in the environment in case an
@@ -44,57 +43,31 @@
@SuppressWarnings("unused")
private static final Log log = Log.getLog(SpringTransactionInterceptor.class.getName());
- private boolean useCurrent;
-
+ protected int springPropagationBehaviour = -1;
private String transactionManagerName;
@SuppressWarnings("unchecked")
public <T> T execute(Command<T> command) {
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- if (environment == null) {
- throw new JbpmException("no environment for managing hibernate transaction");
- }
-
- StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
- PlatformTransactionManager platformTransactionManager = resolveTransactionManager(environment);
- if (platformTransactionManager == null) {
- throw new JbpmException("No platformTransaction manager defined.");
- }
-
- if (standardTransaction != null) {
- standardTransaction.begin();
- }
-
+ T returnValue = null;
+
+ AbstractPlatformTransactionManager platformTransactionManager = (AbstractPlatformTransactionManager) resolveTransactionManager();
+ DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition(springPropagationBehaviour);
+ TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
+ boolean completedSuccessfully = false;
try {
+ returnValue = next.execute(command);
+
+ completedSuccessfully = true;
- TransactionTemplate template = new TransactionTemplate(platformTransactionManager);
-
- if (useCurrent) {
- template.setPropagationBehavior(TransactionDefinition.PROPAGATION_MANDATORY);
+ } finally {
+ if (completedSuccessfully) {
+ platformTransactionManager.commit(transactionStatus);
} else {
- template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+ platformTransactionManager.rollback(transactionStatus);
}
-
- TransactionCallback transactionCallback = new CommandTransactionCallback<T>(command, next, platformTransactionManager);
- T t = (T) template.execute(transactionCallback);
-
- Session session = environment.get(Session.class);
-
- if (session.isOpen()) {
- session.flush();
- }
- return t;
- } catch (RuntimeException e) {
- if (standardTransaction != null) {
- standardTransaction.setRollbackOnly();
- }
- throw e;
-
- } finally {
- if (standardTransaction != null) {
- standardTransaction.complete();
- }
}
+
+ return returnValue;
}
/**
@@ -102,25 +75,22 @@
* @param environment
* @return the transaction manager
*/
- private PlatformTransactionManager resolveTransactionManager(EnvironmentImpl environment) {
- PlatformTransactionManager platformTransactionManager;
-
+ private PlatformTransactionManager resolveTransactionManager() {
if (transactionManagerName != null && transactionManagerName.length() > 0) {
- platformTransactionManager = (PlatformTransactionManager) environment.get(transactionManagerName);
-
- if (platformTransactionManager == null) {
- throw new JbpmException("No platformTransaction manager defined for name '" + platformTransactionManager + "'");
- }
- } else {
- platformTransactionManager = environment.get(PlatformTransactionManager.class);
+ return (PlatformTransactionManager) EnvironmentImpl.getFromCurrent(transactionManagerName);
}
- return platformTransactionManager;
- }
- public void setUseCurrent(Boolean useCurrent) {
- this.useCurrent = useCurrent;
+ return EnvironmentImpl.getFromCurrent(PlatformTransactionManager.class);
}
+ public void setPolicy(Policy policy) {
+ if (policy==Policy.REQUIRES_NEW) {
+ springPropagationBehaviour = TransactionDefinition.PROPAGATION_REQUIRES_NEW;
+ } else {
+ springPropagationBehaviour = TransactionDefinition.PROPAGATION_REQUIRED;
+ }
+ }
+
public void setTransactionManagerName(String transactionManagerName) {
this.transactionManagerName = transactionManagerName;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransaction.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -29,8 +29,6 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Transaction;
-import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.type.Variable;
/** simple 2 phase commit transaction.
@@ -54,7 +52,6 @@
protected List<StandardResource> resources;
protected List<StandardSynchronization> synchronizations;
protected State state = State.CREATED;
- protected DeserializedObjects deserializedObjects = new DeserializedObjects();
// methods for interceptor //////////////////////////////////////////////////
@@ -99,8 +96,6 @@
log.trace("committing "+this);
try {
- deserializedObjects.flushDeserializedObjects();
-
beforeCompletion();
if (resources!=null) {
@@ -242,12 +237,6 @@
return resources;
}
- // deserialized objects /////////////////////////////////////////////////////
-
- public void registerDeserializedObject(Object object, ScopeInstanceImpl scopeInstance, Variable variable) {
- deserializedObjects.registerDeserializedObject(object, scopeInstance, variable);
- }
-
// general methods //////////////////////////////////////////////////////////
public String toString() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,8 +21,6 @@
*/
package org.jbpm.pvm.internal.tx.jta;
-import java.util.List;
-
import javax.naming.InitialContext;
import javax.transaction.Status;
import javax.transaction.Synchronization;
@@ -34,7 +32,7 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Transaction;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.tx.DeserializedObjects;
+import org.jbpm.pvm.internal.tx.FlushDeserializedObject;
import org.jbpm.pvm.internal.type.Variable;
@@ -50,7 +48,6 @@
protected String userTransactionJndiName = JNDINAME_USERTRANSACTION_JBOSS_GLOBAL;
protected String transactionManagerJndiName = JNDINAME_TRANSACTIONMANAGER_JBOSS_GLOBAL;
- protected DeserializedObjects deserializedObjects = new DeserializedObjects();
public boolean isRollbackOnly() {
try {
@@ -94,7 +91,6 @@
public void commit() {
try {
- deserializedObjects.flushDeserializedObjects();
lookupJeeUserTransaction().commit();
} catch (Exception e) {
throw new JbpmException("couldn't commit: "+e.getMessage(), e);
@@ -155,10 +151,4 @@
log.trace("jta transaction status: "+JtaStatusHelper.toString(status));
return status;
}
-
- // deserialized objects /////////////////////////////////////////////////////
-
- public void registerDeserializedObject(Object object, ScopeInstanceImpl scopeInstance, Variable variable) {
- deserializedObjects.registerDeserializedObject(object, scopeInstance, variable);
- }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/converter/SerializableToBytesConverter.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/converter/SerializableToBytesConverter.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/converter/SerializableToBytesConverter.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -32,6 +32,7 @@
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.Transaction;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
+import org.jbpm.pvm.internal.tx.FlushDeserializedObject;
import org.jbpm.pvm.internal.type.Converter;
import org.jbpm.pvm.internal.type.Variable;
@@ -68,7 +69,7 @@
Transaction transaction = EnvironmentImpl.getFromCurrent(Transaction.class, false);
if (transaction!=null) {
- transaction.registerDeserializedObject(object, scopeInstance, variable);
+ transaction.registerSynchronization(new FlushDeserializedObject(object, scopeInstance, variable));
}
return object;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -31,10 +31,10 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.Context;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.Closable;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentInterceptorBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentInterceptorBinding.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentInterceptorBinding.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -22,8 +22,8 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.svc.Policy;
import org.jbpm.pvm.internal.wire.descriptor.EnvironmentInterceptorDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
+import org.jbpm.pvm.internal.svc.Policy;
import org.jbpm.pvm.internal.tx.SpringTransactionInterceptor;
import org.jbpm.pvm.internal.tx.StandardTransactionInterceptor;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -29,10 +30,11 @@
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
-/** parses a descriptor for creating a {@link StandardTransactionInterceptor}.
+/**
+ * parses a descriptor for creating a {@link StandardTransactionInterceptor}.
*
* See schema docs for more details.
- *
+ *
* @author Tom Baeyens
*/
public class SpringTransactionInterceptorBinding extends WireInterceptorBinding {
@@ -43,18 +45,18 @@
public Object parse(Element element, Parse parse, Parser parser) {
SpringTransactionInterceptor springTransactionInterceptor = new SpringTransactionInterceptor();
-
- Boolean useCurrent = XmlUtil.attributeBoolean(element, "current", false, parse);
- if (useCurrent!=null) {
- // set it accordingly
- springTransactionInterceptor.setUseCurrent(useCurrent);
+
+ if ( element.hasAttribute("policy")
+ && ("requiresNew".equals(element.getAttribute("policy")))
+ ) {
+ springTransactionInterceptor.setPolicy(Policy.REQUIRES_NEW);
}
-
+
String transactionManagerName = XmlUtil.attribute(element, "transaction-manager");
- if (transactionManagerName!=null) {
+ if (transactionManagerName != null) {
springTransactionInterceptor.setTransactionManagerName(transactionManagerName);
}
-
+
return new ProvidedObjectDescriptor(springTransactionInterceptor);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.pvm.internal.env.Transaction;
+import org.jbpm.pvm.internal.tx.SpringTransaction;
import org.jbpm.pvm.internal.tx.StandardTransaction;
import org.jbpm.pvm.internal.tx.jta.JtaTransaction;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -53,6 +54,8 @@
transactionDescriptor = new ObjectDescriptor(StandardTransaction.class);
} else if ("jta".equals(type)){
transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
+ } else if ("spring".equals(type)){
+ transactionDescriptor = new ObjectDescriptor(SpringTransaction.class);
} else {
parse.addProblem("unsupported transaction type: "+type, element);
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -14,12 +14,6 @@
<identity-service />
<task-service />
- <hibernate-configuration>
- <cfg resource="jbpm.hibernate.cfg.xml" />
- </hibernate-configuration>
-
- <hibernate-session-factory />
-
<object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
<field name="commandService"><ref object="newTxRequiredCommandService" /></field>
</object>
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.hibernate.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.hibernate.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -17,6 +17,12 @@
<standard-transaction-interceptor />
</command-service>
+ <hibernate-configuration>
+ <cfg resource="jbpm.hibernate.cfg.xml" />
+ </hibernate-configuration>
+
+ <hibernate-session-factory />
+
</process-engine-context>
<transaction-context>
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -19,6 +19,13 @@
<command-service>
<environment-interceptor />
</command-service>
+
+ <hibernate-configuration>
+ <cfg resource="jbpm.hibernate.cfg.xml" />
+ </hibernate-configuration>
+
+ <hibernate-session-factory />
+
</process-engine-context>
<transaction-context>
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.spring.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.spring.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.spring.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -7,7 +7,7 @@
<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
- <spring-transaction-interceptor />
+ <spring-transaction-interceptor policy="requiresNew" />
</command-service>
<!-- Default command service has a Spring transaction interceptor-->
@@ -20,8 +20,8 @@
</process-engine-context>
<transaction-context>
- <transaction />
- <hibernate-session />
+ <transaction type="spring" />
+ <hibernate-session current="true" />
</transaction-context>
</jbpm-configuration>
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,10 +21,10 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.Context;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.test.BaseJbpmTestCase;
/**
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.xml.WireParser;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.test.BaseJbpmTestCase;
/**
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.test.BaseJbpmTestCase;
/**
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -23,11 +23,11 @@
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -23,12 +23,12 @@
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.env.ExecutionContext;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/tx/TransactionResourcesSetRollbackOnlyTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/tx/TransactionResourcesSetRollbackOnlyTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/tx/TransactionResourcesSetRollbackOnlyTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -22,7 +22,6 @@
package org.jbpm.pvm.internal.tx;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.env.Transaction;
import org.jbpm.test.BaseJbpmTestCase;
@@ -52,7 +51,7 @@
resourceOne = (TestResource) environment.get("resourceOne");
- environment.get(Transaction.class).setRollbackOnly();
+ environment.get(StandardTransaction.class).setRollbackOnly();
assertFalse(resourceOne.isPrepared);
assertFalse(resourceOne.isCommitted);
@@ -100,7 +99,7 @@
assertFalse(resourceOne.isCommitted);
assertFalse(resourceOne.isRolledBack);
- environment.get(Transaction.class).setRollbackOnly();
+ environment.get(StandardTransaction.class).setRollbackOnly();
resourceTwo = (TestResource) environment.get("resourceTwo");
assertFalse(resourceTwo.isPrepared);
@@ -160,7 +159,7 @@
assertFalse(resourceTwo.isCommitted);
assertFalse(resourceTwo.isRolledBack);
- environment.get(Transaction.class).setRollbackOnly();
+ environment.get(StandardTransaction.class).setRollbackOnly();
assertEquals(1, environment.get(StandardTransaction.class).resources.size());
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.Context;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -16,9 +16,9 @@
import java.util.HashSet;
import java.util.Set;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.wire.WireContext;
/**
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,8 +1,8 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.wire.WireContext;
/**
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -1,8 +1,8 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireException;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireException;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireObjectEventInfo;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -23,10 +23,10 @@
import java.util.List;
-import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.Context;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.Listener;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.test.BaseJbpmTestCase;
Added: jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java
===================================================================
--- jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java (rev 0)
+++ jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,139 @@
+package org.jbpm.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import org.apache.cactus.ServletTestSuite;
+
+public class AllIntegrationTests extends TestCase {
+
+ public static Test suite() {
+ ServletTestSuite suite = new ServletTestSuite();
+ suite.addTestSuite(org.jbpm.examples.async.activity.AsyncActivityTest.class);
+ suite.addTestSuite(org.jbpm.examples.async.fork.AsyncForkTest.class);
+ suite.addTestSuite(org.jbpm.examples.bpmn.usertask.taskform.TaskFormTest.class);
+ suite.addTestSuite(org.jbpm.examples.concurrency.graphbased.ConcurrencyGraphBasedTest.class);
+ suite.addTestSuite(org.jbpm.examples.custom.CustomTest.class);
+ suite.addTestSuite(org.jbpm.examples.decision.conditions.DecisionConditionsTest.class);
+ suite.addTestSuite(org.jbpm.examples.decision.expression.DecisionExpressionTest.class);
+ suite.addTestSuite(org.jbpm.examples.decision.handler.DecisionHandlerTest.class);
+ suite.addTestSuite(org.jbpm.examples.end.multiple.EndMultipleTest.class);
+ suite.addTestSuite(org.jbpm.examples.end.processinstance.EndProcessInstanceTest.class);
+ suite.addTestSuite(org.jbpm.examples.end.state.EndStateTest.class);
+ suite.addTestSuite(org.jbpm.examples.eventlistener.EventListenerTest.class);
+ suite.addTestSuite(org.jbpm.examples.hql.HqlTest.class);
+ suite.addTestSuite(org.jbpm.examples.java.JavaInstantiateTest.class);
+ suite.addTestSuite(org.jbpm.examples.mail.inline.InlineMailTest.class);
+ suite.addTestSuite(org.jbpm.examples.mail.template.TemplateMailTest.class);
+ suite.addTestSuite(org.jbpm.examples.script.expression.ScriptExpressionTest.class);
+ suite.addTestSuite(org.jbpm.examples.script.text.ScriptTextTest.class);
+ suite.addTestSuite(org.jbpm.examples.serializablevariable.SerializableVariableTest.class);
+ suite.addTestSuite(org.jbpm.examples.services.ServicesTest.class);
+ suite.addTestSuite(org.jbpm.examples.sql.SqlTest.class);
+ suite.addTestSuite(org.jbpm.examples.state.choice.StateChoiceTest.class);
+ suite.addTestSuite(org.jbpm.examples.state.sequence.StateSequenceTest.class);
+ suite.addTestSuite(org.jbpm.examples.subprocess.outcomeactivity.SubProcessOutcomeActivityTest.class);
+ suite.addTestSuite(org.jbpm.examples.subprocess.outcomevalue.SubProcessOutcomeValueTest.class);
+ suite.addTestSuite(org.jbpm.examples.subprocess.variables.SubProcessVariablesTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.assignee.TaskAssigneeTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.assignmenthandler.TaskAssignmentHandlerTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.candidates.TaskCandidatesTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.comments.TaskCommentsTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.notification.TaskNotificationTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.reminder.TaskReminderTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.swimlane.TaskSwimlaneTest.class);
+ suite.addTestSuite(org.jbpm.examples.task.variables.TaskVariablesTest.class);
+ suite.addTestSuite(org.jbpm.examples.timer.businesstime.TimerBusinessTimeTest.class);
+ suite.addTestSuite(org.jbpm.examples.timer.event.TimerEventTest.class);
+ suite.addTestSuite(org.jbpm.examples.timer.repeat.TimerRepeatTest.class);
+ suite.addTestSuite(org.jbpm.examples.timer.transition.TimerTransitionTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.ExclusiveGatewayTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.ParallelGatewayTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.ScriptTaskTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.ServiceTaskTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.SimplestProcessTest.class);
+ suite.addTestSuite(org.jbpm.bpmn.UserTaskTest.class);
+ suite.addTestSuite(org.jbpm.examples.async.eventlistener.AsyncEventListenerTest.class);
+ suite.addTestSuite(org.jbpm.examples.goup.concurrency.GroupConcurrencyTest.class);
+ suite.addTestSuite(org.jbpm.examples.goup.multipleentries.MultipleEntriesTest.class);
+ suite.addTestSuite(org.jbpm.examples.goup.simple.GroupSimpleTest.class);
+ suite.addTestSuite(org.jbpm.examples.goup.timer.GroupTimerTest.class);
+ suite.addTestSuite(org.jbpm.examples.rules.RulesTest.class);
+ suite.addTestSuite(org.jbpm.examples.rulesdecision.RulesDecisionTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.ForkJoinInSameTransactionTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.ForkTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.ForkToTaskTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.GroupBasicsTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.GroupTimersTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.JoinTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.StatesJoinEndTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.StateTest.class);
+ suite.addTestSuite(org.jbpm.test.activities.TasksJoinEndTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.custom.CustomConfigurationsTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.decision.DecisionTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.group.GroupConcurrencyCombinationTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.mail.MailTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.subprocess.SubProcessDeleteTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.subprocess.SubProcessTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskAssignmentHandlerExprTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskCandidatesTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskCompletionTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskOutcomesTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskReassignTest.class);
+ suite.addTestSuite(org.jbpm.test.async.AsyncBasicsTest.class);
+ suite.addTestSuite(org.jbpm.test.async.AsyncEndCombinationTest.class);
+ suite.addTestSuite(org.jbpm.test.async.AsyncEventListenerOnEndTest.class);
+ suite.addTestSuite(org.jbpm.test.auth.UserProvidedAuthenticationTest.class);
+ suite.addTestSuite(org.jbpm.test.classloading.DelayedInstantiationTest.class);
+ suite.addTestSuite(org.jbpm.test.deploy.DeploymentResourceTest.class);
+ suite.addTestSuite(org.jbpm.test.deploy.ImageTest.class);
+ suite.addTestSuite(org.jbpm.test.deploy.SuspendDeploymentTest.class);
+ suite.addTestSuite(org.jbpm.test.eventlistener.EventListenerTest.class);
+ suite.addTestSuite(org.jbpm.test.eventlistener.HqlEventListenerTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.ConcurrentEndTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.ExecutionEagerLoadingTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.ExecutionExpressionTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.ExecutionQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.FindExecutionTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.SignalExecutionTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.StartExecutionTest.class);
+ suite.addTestSuite(org.jbpm.test.execution.SystemVariablesTest.class);
+ suite.addTestSuite(org.jbpm.test.history.AvgDurationTest.class);
+ suite.addTestSuite(org.jbpm.test.history.ChoiceDistributionTest.class);
+ suite.addTestSuite(org.jbpm.test.history.EndProcessInstanceTest.class);
+ suite.addTestSuite(org.jbpm.test.history.HistoryTaskAssigneeTest.class);
+ suite.addTestSuite(org.jbpm.test.history.ProcessInstanceHistoryTest.class);
+ suite.addTestSuite(org.jbpm.test.identity.IdentityTest.class);
+ suite.addTestSuite(org.jbpm.test.migration.InstanceMigratorTest.class);
+ suite.addTestSuite(org.jbpm.test.process.ActivityCoordinatesTest.class);
+ suite.addTestSuite(org.jbpm.test.process.DeploymentResourcesTest.class);
+ suite.addTestSuite(org.jbpm.test.process.DescriptionTest.class);
+ suite.addTestSuite(org.jbpm.test.process.ProcessDefinitionStartFormTest.class);
+ suite.addTestSuite(org.jbpm.test.process.RepositoryServiceTest.class);
+ suite.addTestSuite(org.jbpm.test.query.DeploymentQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.HistoryActivityInstanceQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.HistoryDetailQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.HistoryProcessInstanceQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.HistoryTaskQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.JobQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.ProcessDefinitionQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.QueryTest.class);
+ suite.addTestSuite(org.jbpm.test.query.TaskQueryTest.class);
+ suite.addTestSuite(org.jbpm.test.task.SubTaskTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskCommentsTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskCreateUpdateDeleteTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskListTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskParticipationsTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskPropertiesTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskQueryCandidatesTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskQueryProcessTest.class);
+ suite.addTestSuite(org.jbpm.test.task.TaskVariablesTest.class);
+ suite.addTestSuite(org.jbpm.test.timer.TaskTimerTaskTest.class);
+ suite.addTestSuite(org.jbpm.test.timer.TimerTest.class);
+ suite.addTestSuite(org.jbpm.test.usertx.UserTransactionTest.class);
+ suite.addTestSuite(org.jbpm.test.variables.BasicVariablesTest.class);
+ suite.addTestSuite(org.jbpm.test.variables.SerializedVariableUpdateTest.class);
+ suite.addTestSuite(org.jbpm.test.variables.VariableBasicTypesTest.class);
+ suite.addTestSuite(org.jbpm.test.variables.VariableExpressionTest.class);
+ return suite;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -15,9 +15,6 @@
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.format_sql">true</property>
- <!-- Enable Hibernate's automatic session context management -->
- <property name="current_session_context_class">thread</property>
-
<mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -162,12 +162,6 @@
property currently (see http://jira.codehaus.org/browse/MNG-3328) -->
<profile>
<id>run.spring.testsuite</id>
- <activation>
- <property>
- <name>jbpm.test.cfg.type</name>
- <value>spring-test</value>
- </property>
- </activation>
<build>
<plugins>
<plugin>
@@ -181,23 +175,15 @@
</goals>
<configuration>
<tasks>
- <echo message="config ${config}" />
- <mkdir dir="target/jdbc.properties" />
- <copy todir="target/jdbc.properties" overwrite="true">
- <fileset dir="../../qa/jdbc" />
- </copy>
- <copy todir="target/jdbc.properties" overwrite="true" failonerror="false">
- <fileset dir="${user.home}/.jbpm4/jdbc" />
- </copy>
- <ant antfile="../distro/src/main/files/install/build.xml" target="create.cfg">
- <property name="tx" value="spring.testsuite" />
- <property name="mail.cfg" value="testsuite" />
- <property name="database" value="hsqldb" /> <!-- Spring config is tested against hsqldb only -->
- <property name="cfg.dest.dir" value="target/test-classes" />
- <property name="install.src.dir" value="../distro/src/main/files/install/src" />
- <property name="jdbc.properties.dir" value="target/jdbc.properties" />
- <property name="logging" value="none" />
- </ant>
+ <ant antfile="../distro/src/main/files/install/build.xml" target="create.cfg">
+ <property name="tx" value="spring.testsuite" />
+ <property name="database" value="hsqldb.inmem" />
+ <property name="mail.cfg" value="testsuite" />
+ <property name="cfg.dest.dir" value="target/test-classes" />
+ <property name="install.src.dir" value="../distro/src/main/files/install/src" />
+ <property name="jdbc.properties.dir" value="../distro/src/main/files/install/jdbc" />
+ <property name="logging" value="none" />
+ </ant>
</tasks>
</configuration>
</execution>
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/async/eventlistener/AsyncEventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/async/eventlistener/AsyncEventListenerTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/examples/async/eventlistener/AsyncEventListenerTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -53,8 +53,14 @@
Job job = managementService.createJobQuery()
.processInstanceId(processInstanceId)
.uniqueResult();
- managementService.executeJob(job.getId());
+ try {
+ managementService.executeJob(job.getId());
+ fail("expected exception");
+ } catch (Exception e) {
+ // OK
+ }
+
job = managementService.createJobQuery()
.processInstanceId(processInstanceId)
.uniqueResult();
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java 2009-12-15 15:51:59 UTC (rev 5962)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/JobQueryTest.java 2009-12-15 16:21:28 UTC (rev 5963)
@@ -96,9 +96,12 @@
assertEquals(3, messages.size());
- managementService.executeJob(messages.get(0).getId());
- managementService.executeJob(messages.get(0).getId());
- managementService.executeJob(messages.get(0).getId());
+ try {
+ managementService.executeJob(messages.get(0).getId());
+ fail("expected exception");
+ } catch (Exception e) {
+ // OK
+ }
List<Job> errorJobs = managementService.createJobQuery()
.exception(true)
Added: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.mail.templates.examples.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.mail.templates.examples.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.mail.templates.examples.xml 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <mail-template name="rectify-template">
+ <to addresses="${addressee}" />
+ <cc users="bb" groups="innerparty" />
+ <bcc groups="thinkpol" />
+ <subject>rectify ${newspaper}</subject>
+ <text>${newspaper} ${date} ${details}</text>
+ </mail-template>
+
+ </process-engine-context>
+
+</jbpm-configuration>
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.mail.templates.examples.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/qa/hudson-jbpm4-spring.sh
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-spring.sh (rev 0)
+++ jbpm4/trunk/qa/hudson-jbpm4-spring.sh 2009-12-15 16:21:28 UTC (rev 5963)
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+# runs the smoke test suite
+
+mvn -U -Prun.spring.testsuite clean install
More information about the jbpm-commits
mailing list