Author: tom.baeyens(a)jboss.com
Date: 2009-09-16 08:52:34 -0400 (Wed, 16 Sep 2009)
New Revision: 5649
Added:
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/id/AcquireDbidBlockCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseDbidGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdComposer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryDbidGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdComposer.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireIdBlockCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/IdGenerator.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/IdGeneratorTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
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/ant/JbpmDeployTask.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/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.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/id/InitializePropertiesCmd.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/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/HibernateSessionResource.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/IdGeneratorBinding.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.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/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-db/src/test/resources/logging.properties
Log:
JBPM-2526 switched executions over to jbpm dbid generation
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-09-16
11:34:14 UTC (rev 5648)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -70,7 +70,7 @@
if (implementationClassNames==null) {
implementationClassNames = new HashMap<String, String>();
// null represents the default configuration (== the JbpmConfiguration)
- implementationClassNames.put(null,
"org.jbpm.pvm.internal.cfg.JbpmConfiguration");
+ implementationClassNames.put(null,
"org.jbpm.pvm.internal.cfg.ProcessEngineImpl");
implementationClassNames.put("spring-test",
"org.jbpm.pvm.internal.cfg.SpringConfiguration");
// TODO
// implementationClasses.put("mc",
"org.jbpm.pvm.internal.cfg.McConfiguration");
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -32,6 +32,7 @@
import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.session.RepositorySession;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
@@ -84,6 +85,12 @@
executionImpl.historyActivityStart();
subProcessInstance.start();
+
+ DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
+ if (dbSession!=null) {
+ dbSession.save(subProcessInstance);
+ }
+
execution.waitForSignal();
}
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -27,7 +27,7 @@
import org.dom4j.Document;
import org.dom4j.Element;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.xml.Problem;
import org.junit.Assert;
@@ -177,7 +177,7 @@
}
private void setUpEnviroment() throws Exception {
- EnvironmentFactory environmentFactory = JbpmConfiguration
+ EnvironmentFactory environmentFactory = ProcessEngineImpl
.parseXmlString("<jbpm-configuration>"
+ " <process-engine-context>"
+ " <script-manager default-expression-language='juel'"
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/AntHelper.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -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.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
/**
* common strategy for jbpm ant tasks to obtain a hibernate SessionFactory.
@@ -40,7 +40,7 @@
private static final Log log = LogFactory.getLog(AntHelper.class);
public static ProcessEngine getProcessEngine(String jbpmCfgXml) {
- ProcessEngine processEngine = (JbpmConfiguration) processEngines.get(jbpmCfgXml);
+ ProcessEngine processEngine = (ProcessEngineImpl) processEngines.get(jbpmCfgXml);
if (processEngine == null) {
Configuration configuration = new Configuration();
if (jbpmCfgXml!=null) {
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -52,7 +52,7 @@
ClassLoader originalClassLoader = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(JbpmDeployTask.class.getClassLoader());
try {
- // get the JbpmConfiguration
+ // get the ProcessEngineImpl
ProcessEngine processEngine = AntHelper.getProcessEngine(jbpmCfg);
// if attribute process is set, deploy that process file
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,336 +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.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.jbpm.api.Configuration;
-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.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.JbpmConfigurationParser;
-import org.jbpm.pvm.internal.env.PvmEnvironment;
-import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
-import org.jbpm.pvm.internal.stream.FileStreamInput;
-import org.jbpm.pvm.internal.stream.InputStreamInput;
-import org.jbpm.pvm.internal.stream.ResourceStreamInput;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.stream.StringStreamInput;
-import org.jbpm.pvm.internal.stream.UrlStreamInput;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-
-/**
- * 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 JbpmConfiguration extends Configuration implements Context, ProcessEngine,
EnvironmentFactory {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(JbpmConfiguration.class.getName());
-
- protected boolean isConfigured = false;
- protected WireContext processEngineWireContext = new WireContext(new WireDefinition(),
Context.CONTEXTNAME_PROCESS_ENGINE, true);
- protected WireDefinition transactionWireDefinition = new WireDefinition();
-
- protected ThreadLocal<List<UserProvidedEnvironmentObject>>
userProvidedEnvironmentObjectsThreadLocal = new
ThreadLocal<List<UserProvidedEnvironmentObject>>();
- protected ThreadLocal<String> authenticatedUserIdThreadLocal = new
ThreadLocal<String>();
-
- protected CommandService userCommandService = null;
-
- public JbpmConfiguration() {
- super((Configuration)null);
- }
-
- public ProcessEngine buildProcessEngine() {
- if (!isConfigured) {
- setResource("jbpm.cfg.xml");
- }
- 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("user.command.service");
- return this;
- }
-
- public Configuration setHibernateSessionFactory(Object hibernateSessionFactory) {
- processEngineWireContext
- .getWireDefinition()
- .addDescriptor(new ProvidedObjectDescriptor(hibernateSessionFactory, true));
- return this;
- }
-
- public Configuration setInputStream(InputStream inputStream) {
- parse(new InputStreamInput(inputStream));
- return this;
- }
-
- public Configuration setResource(String resource) {
- parse(new ResourceStreamInput(resource, getClassLoader()));
- return this;
- }
-
- public Configuration setUrl(URL url) {
- parse(new UrlStreamInput(url));
- return this;
- }
-
- public Configuration setFile(File file) {
- parse(new FileStreamInput(file));
- return this;
- }
-
- public Configuration setXmlString(String xmlString) {
- parse(new StringStreamInput(xmlString));
- return this;
- }
-
-
- public static EnvironmentFactory parseXmlString(String xmlString) {
- JbpmConfiguration jbpmConfiguration = new JbpmConfiguration();
- jbpmConfiguration.setXmlString(xmlString);
- return jbpmConfiguration;
- }
-
- protected void parse(StreamInput streamSource) {
- isConfigured = true;
- JbpmConfigurationParser.getInstance()
- .createParse()
- .pushObject(this)
- .setStreamSource(streamSource)
- .execute()
- .checkErrors("jbpm configuration " + streamSource);
- }
-
- public ExecutionService getExecutionService() {
- return processEngineWireContext.get(ExecutionService.class);
- }
- public HistoryService getHistoryService() {
- return processEngineWireContext.get(HistoryService.class);
- }
- public ManagementService getManagementService() {
- return processEngineWireContext.get(ManagementService.class);
- }
- public TaskService getTaskService() {
- return processEngineWireContext.get(TaskService.class);
- }
- public IdentityService getIdentityService() {
- return processEngineWireContext.get(IdentityService.class);
- }
- public RepositoryService getRepositoryService() {
- return processEngineWireContext.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() {
- 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) {
- EnvironmentImpl environment = openEnvironment();
- try {
- return userCommandService.execute(command);
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new JbpmException(e.getMessage(), e);
- } finally {
- environment.close();
- }
- }
-}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,338 @@
+/*
+ * 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.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.Configuration;
+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.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.JbpmConfigurationParser;
+import org.jbpm.pvm.internal.env.PvmEnvironment;
+import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
+import org.jbpm.pvm.internal.stream.FileStreamInput;
+import org.jbpm.pvm.internal.stream.InputStreamInput;
+import org.jbpm.pvm.internal.stream.ResourceStreamInput;
+import org.jbpm.pvm.internal.stream.StreamInput;
+import org.jbpm.pvm.internal.stream.StringStreamInput;
+import org.jbpm.pvm.internal.stream.UrlStreamInput;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+
+/**
+ * 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 extends Configuration implements Context, ProcessEngine,
EnvironmentFactory {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(ProcessEngineImpl.class.getName());
+
+ public static final String JBPM_LIBRARY_VERSION = "4.1-SNAPSHOT";
+
+ protected boolean isConfigured = false;
+ protected WireContext processEngineWireContext = new WireContext(new WireDefinition(),
Context.CONTEXTNAME_PROCESS_ENGINE, true);
+ protected WireDefinition transactionWireDefinition = new WireDefinition();
+
+ protected ThreadLocal<List<UserProvidedEnvironmentObject>>
userProvidedEnvironmentObjectsThreadLocal = new
ThreadLocal<List<UserProvidedEnvironmentObject>>();
+ protected ThreadLocal<String> authenticatedUserIdThreadLocal = new
ThreadLocal<String>();
+
+ protected CommandService userCommandService = null;
+
+ public ProcessEngineImpl() {
+ super((Configuration)null);
+ }
+
+ public ProcessEngine buildProcessEngine() {
+ if (!isConfigured) {
+ setResource("jbpm.cfg.xml");
+ }
+ 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("user.command.service");
+ return this;
+ }
+
+ public Configuration setHibernateSessionFactory(Object hibernateSessionFactory) {
+ processEngineWireContext
+ .getWireDefinition()
+ .addDescriptor(new ProvidedObjectDescriptor(hibernateSessionFactory, true));
+ return this;
+ }
+
+ public Configuration setInputStream(InputStream inputStream) {
+ parse(new InputStreamInput(inputStream));
+ return this;
+ }
+
+ public Configuration setResource(String resource) {
+ parse(new ResourceStreamInput(resource, getClassLoader()));
+ return this;
+ }
+
+ public Configuration setUrl(URL url) {
+ parse(new UrlStreamInput(url));
+ return this;
+ }
+
+ public Configuration setFile(File file) {
+ parse(new FileStreamInput(file));
+ return this;
+ }
+
+ public Configuration setXmlString(String xmlString) {
+ parse(new StringStreamInput(xmlString));
+ return this;
+ }
+
+
+ public static EnvironmentFactory parseXmlString(String xmlString) {
+ ProcessEngineImpl processEngineImpl = new ProcessEngineImpl();
+ processEngineImpl.setXmlString(xmlString);
+ return processEngineImpl;
+ }
+
+ protected void parse(StreamInput streamSource) {
+ isConfigured = true;
+ JbpmConfigurationParser.getInstance()
+ .createParse()
+ .pushObject(this)
+ .setStreamSource(streamSource)
+ .execute()
+ .checkErrors("jbpm configuration " + streamSource);
+ }
+
+ public ExecutionService getExecutionService() {
+ return processEngineWireContext.get(ExecutionService.class);
+ }
+ public HistoryService getHistoryService() {
+ return processEngineWireContext.get(HistoryService.class);
+ }
+ public ManagementService getManagementService() {
+ return processEngineWireContext.get(ManagementService.class);
+ }
+ public TaskService getTaskService() {
+ return processEngineWireContext.get(TaskService.class);
+ }
+ public IdentityService getIdentityService() {
+ return processEngineWireContext.get(IdentityService.class);
+ }
+ public RepositoryService getRepositoryService() {
+ return processEngineWireContext.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() {
+ 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) {
+ EnvironmentImpl environment = openEnvironment();
+ try {
+ return userCommandService.execute(command);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new JbpmException(e.getMessage(), e);
+ } finally {
+ environment.close();
+ }
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.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/cfg/SpringConfiguration.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -47,7 +47,7 @@
*
* @author Andries Inze
*/
-public class SpringConfiguration extends JbpmConfiguration implements EnvironmentFactory,
ProcessEngine, ApplicationContextAware {
+public class SpringConfiguration extends ProcessEngineImpl implements EnvironmentFactory,
ProcessEngine, ApplicationContextAware {
private static final Log log = Log.getLog(SpringConfiguration.class.getName());
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -64,11 +64,6 @@
processInstance.setVariables(variables);
processInstance.start();
- if (!processInstance.isEnded()) {
- Session session = EnvironmentImpl.getFromCurrent(Session.class);
- session.save(processInstance);
- }
-
return processInstance;
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.env;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -57,9 +57,9 @@
Element documentElement = document.getDocumentElement();
// if the default environment factory was already set in the parse
- JbpmConfiguration jbpmConfiguration = (JbpmConfiguration)
parse.findObject(JbpmConfiguration.class);
- if (jbpmConfiguration==null) {
- jbpmConfiguration = new JbpmConfiguration();
+ ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)
parse.findObject(ProcessEngineImpl.class);
+ if (processEngineImpl==null) {
+ processEngineImpl = new ProcessEngineImpl();
}
for (Element importElement : XmlUtil.elements(documentElement, "import"))
{
@@ -67,7 +67,7 @@
String resource = importElement.getAttribute("resource");
Parse importParse = createParse()
.setResource(resource)
- .pushObject(jbpmConfiguration)
+ .pushObject(processEngineImpl)
.execute();
parse.addProblems(importParse.getProblems());
@@ -76,7 +76,7 @@
Element processEngineElement = XmlUtil.element(documentElement,
"process-engine-context");
if (processEngineElement != null) {
- WireDefinition processEngineContextDefinition =
jbpmConfiguration.getProcessEngineWireContext().getWireDefinition();
+ WireDefinition processEngineContextDefinition =
processEngineImpl.getProcessEngineWireContext().getWireDefinition();
parse.pushObject(processEngineContextDefinition);
try {
processEngineContextParser.parseDocumentElement(processEngineElement, parse);
@@ -87,7 +87,7 @@
Element txCtxElement = XmlUtil.element(documentElement,
"transaction-context");
if (txCtxElement != null) {
- WireDefinition transactionContextDefinition =
jbpmConfiguration.getTransactionWireDefinition();
+ WireDefinition transactionContextDefinition =
processEngineImpl.getTransactionWireDefinition();
parse.pushObject(transactionContextDefinition);
try {
transactionContextParser.parseDocumentElement(txCtxElement, parse);
@@ -96,9 +96,9 @@
}
}
- parse.setDocumentObject(jbpmConfiguration);
+ parse.setDocumentObject(processEngineImpl);
- return jbpmConfiguration;
+ return processEngineImpl;
}
public Parser getProcessEngineContextParser() {
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -22,7 +22,7 @@
package org.jbpm.pvm.internal.env;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.util.Closable;
@@ -35,10 +35,10 @@
private static final Log log = Log.getLog(PvmEnvironment.class.getName());
- protected JbpmConfiguration jbpmConfiguration;
+ protected ProcessEngineImpl processEngineImpl;
- public PvmEnvironment(JbpmConfiguration jbpmConfiguration) {
- this.jbpmConfiguration = jbpmConfiguration;
+ public PvmEnvironment(ProcessEngineImpl processEngineImpl) {
+ this.processEngineImpl = processEngineImpl;
}
public String toString() {
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireIdBlockCmd.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,39 @@
+package org.jbpm.pvm.internal.id;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+
+/**
+ * @author Tom Baeyens
+ */
+public class AcquireDbidBlockCmd implements Command<Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ long blocksize;
+
+ public AcquireDbidBlockCmd(long blocksize) {
+ this.blocksize = blocksize;
+ }
+
+ public Long execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+
+ PropertyImpl property = (PropertyImpl) session.createQuery(
+ "select property " +
+ "from "+PropertyImpl.class.getName()+" as property " +
+ "where property.key =
'"+PropertyImpl.NEXT_ID_KEY+"'"
+ ).uniqueResult();
+
+ String nextIdText = property.getValue();
+ Long nextId = new Long(nextIdText);
+
+ property.setValue(Long.toString(nextId.longValue()+blocksize));
+
+ session.update(property);
+ session.flush();
+
+ return nextId;
+ }
+}
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireDbidBlockCmd.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireIdBlockCmd.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireIdBlockCmd.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/AcquireIdBlockCmd.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,39 +0,0 @@
-package org.jbpm.pvm.internal.id;
-
-import org.hibernate.Session;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
-
-/**
- * @author Tom Baeyens
- */
-public class AcquireIdBlockCmd implements Command<Long> {
-
- private static final long serialVersionUID = 1L;
-
- long blocksize;
-
- public AcquireIdBlockCmd(long blocksize) {
- this.blocksize = blocksize;
- }
-
- public Long execute(Environment environment) throws Exception {
- Session session = environment.get(Session.class);
-
- PropertyImpl property = (PropertyImpl) session.createQuery(
- "select property " +
- "from "+PropertyImpl.class.getName()+" as property " +
- "where property.key =
'"+PropertyImpl.NEXT_ID_KEY+"'"
- ).uniqueResult();
-
- String nextIdText = property.getValue();
- Long nextId = new Long(nextIdText);
-
- property.setValue(Long.toString(nextId.longValue()+blocksize));
-
- session.update(property);
- session.flush();
-
- return nextId;
- }
-}
\ No newline at end of file
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseDbidGenerator.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdGenerator.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseDbidGenerator.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseDbidGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,103 @@
+/*
+ * 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.id;
+
+import java.util.Random;
+
+import org.hibernate.StaleStateException;
+import org.jbpm.api.JbpmException;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cmd.CommandService;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DatabaseDbidGenerator extends DbidGenerator {
+
+ private static Log log = Log.getLog(DatabaseDbidGenerator.class.getName());
+
+ static Random random = new Random();
+
+ // configuration
+ CommandService commandService;
+ long blocksize = 10000;
+ int maxAttempts = 3;
+
+ // runtime state
+ long lastId = -2;
+ long nextId = -1;
+
+ public synchronized long getNextId() {
+ // if no more ids available
+ if (lastId<nextId) {
+ // acquire a next block of ids
+
+ // reset the id block
+ lastId = -2;
+ nextId = -1;
+
+ // try couple of times
+ try {
+ for ( int attempts = maxAttempts; (attempts>0) && (nextId==-1) ;
attempts-- ) {
+ try {
+ // acquire block
+ nextId = commandService.execute(new AcquireDbidBlockCmd(blocksize));
+ lastId = nextId + blocksize - 1;
+
+ log.debug("acquired new id block
["+nextId+"-"+lastId+"]");
+
+ } catch (StaleStateException e) {
+ // optimistic locking exception indicating another thread tried to
+ // acquire a block of ids concurrently
+ attempts--;
+
+ // if no attempts left
+ if (attempts==0) {
+ // fail the surrounding transaction
+ throw new JbpmException("couldn't acquire block of ids, tried
"+maxAttempts+" times");
+ }
+
+ // if there are still attempts left, first wait a bit
+ int millis = 20 + random.nextInt(200);
+ log.debug("optimistic locking failure while trying to acquire id block.
retrying in "+millis+" millis");
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e1) {
+ log.debug("waiting after id block locking failure got
interrupted");
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new JbpmException("couldn't acquire block of ids", e);
+ }
+ }
+
+ return nextId++;
+ }
+
+ public void initialize() {
+ nextId = commandService.execute(new InitializePropertiesCmd(blocksize));
+ lastId = nextId + blocksize - 1;
+ log.debug("initial id block ["+nextId+"-"+lastId+"]");
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseDbidGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.id;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DatabaseIdComposer extends IdComposer {
+
+ private static Log log = Log.getLog(DatabaseIdComposer.class.getName());
+
+ public String createId(ProcessDefinition processDefinition, Execution parent,
ExecutionImpl execution) {
+
+ String base = null;
+ if (parent!=null) {
+ base = parent.getId();
+ } else if (processDefinition.getKey()!=null){
+ base = processDefinition.getKey();
+ } else {
+ base = processDefinition.getId();
+ }
+
+ String executionPart = null;
+ if ( (parent==null)
+ && (execution.getKey()!=null)
+ ) {
+ executionPart = execution.getKey();
+
+ } else if (execution.getName()!=null) {
+ executionPart = execution.getName();
+
+ } else {
+ executionPart = Long.toString(execution.getDbid());
+ }
+
+ String executionId = base+"."+executionPart;
+
+ if (log.isDebugEnabled()) log.debug("generated execution id
"+executionId);
+
+ return executionId;
+ }
+}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdGenerator.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdGenerator.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,103 +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.id;
-
-import java.util.Random;
-
-import org.hibernate.StaleStateException;
-import org.jbpm.api.JbpmException;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cmd.CommandService;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DatabaseIdGenerator extends IdGenerator {
-
- private static Log log = Log.getLog(DatabaseIdGenerator.class.getName());
-
- static Random random = new Random();
-
- // configuration
- CommandService commandService;
- long blocksize = 10000;
- int maxAttempts = 3;
-
- // runtime state
- long lastId = -2;
- long nextId = -1;
-
- public synchronized long getNextId() {
- // if no more ids available
- if (lastId<nextId) {
- // acquire a next block of ids
-
- // reset the id block
- lastId = -2;
- nextId = -1;
-
- // try couple of times
- try {
- for ( int attempts = maxAttempts; (attempts>0) && (nextId==-1) ;
attempts-- ) {
- try {
- // acquire block
- nextId = commandService.execute(new AcquireIdBlockCmd(blocksize));
- lastId = nextId + blocksize - 1;
-
- log.debug("acquired new id block
["+nextId+"-"+lastId+"]");
-
- } catch (StaleStateException e) {
- // optimistic locking exception indicating another thread tried to
- // acquire a block of ids concurrently
- attempts--;
-
- // if no attempts left
- if (attempts==0) {
- // fail the surrounding transaction
- throw new JbpmException("couldn't acquire block of ids, tried
"+maxAttempts+" times");
- }
-
- // if there are still attempts left, first wait a bit
- int millis = 20 + random.nextInt(200);
- log.debug("optimistic locking failure while trying to acquire id block.
retrying in "+millis+" millis");
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e1) {
- log.debug("waiting after id block locking failure got
interrupted");
- }
- }
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't acquire block of ids", e);
- }
- }
-
- return nextId++;
- }
-
- public void initialize() {
- nextId = commandService.execute(new InitializePropertiesCmd(blocksize));
- lastId = nextId + blocksize - 1;
- log.debug("initial id block ["+nextId+"-"+lastId+"]");
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdGenerator.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,47 @@
+/*
+ * 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.id;
+
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class DbidGenerator {
+
+ static DbidGenerator defaultIdGenerator = new MemoryDbidGenerator();
+
+ public static DbidGenerator getDbidGenerator() {
+ DbidGenerator dbidGenerator = EnvironmentImpl.getFromCurrent(DbidGenerator.class,
false);
+ if (dbidGenerator!=null) {
+ return dbidGenerator;
+ }
+ return getDefaultIdGenerator();
+ }
+
+ public static DbidGenerator getDefaultIdGenerator() {
+ return defaultIdGenerator;
+ }
+
+ public abstract long getNextId();
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdComposer.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/IdGenerator.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdComposer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdComposer.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.id;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class IdComposer {
+
+ private static IdComposer defaultIdComposer = new MemoryIdComposer();
+
+ public static IdComposer getIdComposer() {
+ IdComposer idComposer = EnvironmentImpl.getFromCurrent(IdComposer.class, false);
+ if (idComposer!=null) {
+ return idComposer;
+ }
+ return getDefaultIdComposer();
+ }
+
+ public static IdComposer getDefaultIdComposer() {
+ return defaultIdComposer;
+ }
+
+ /** generates a unique id for the given execution. */
+ public abstract String createId(ProcessDefinition processDefinition, Execution parent,
ExecutionImpl execution);
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdGenerator.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdGenerator.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/IdGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,47 +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.id;
-
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class IdGenerator {
-
- static IdGenerator defaultIdGenerator = new MemoryIdGenerator();
-
- public static IdGenerator getIdGenerator() {
- IdGenerator idGenerator = EnvironmentImpl.getFromCurrent(IdGenerator.class, false);
- if (idGenerator!=null) {
- return idGenerator;
- }
- return getDefaultIdGenerator();
- }
-
- public static IdGenerator getDefaultIdGenerator() {
- return defaultIdGenerator;
- }
-
- public abstract long getNextId();
-}
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/InitializePropertiesCmd.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -26,6 +26,7 @@
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;
/**
@@ -61,19 +62,16 @@
"where property.key =
'"+PropertyImpl.SCHEMA_VERSION_KEY+"'"
).uniqueResult();
- String jbpmVersion = "4.1-SNAPSHOT";
-
+ log.debug("version of jbpm library:
"+ProcessEngineImpl.JBPM_LIBRARY_VERSION);
+
if (property==null) {
- log.debug("initializing db schema version to "+jbpmVersion);
- property = new PropertyImpl(PropertyImpl.SCHEMA_VERSION_KEY, jbpmVersion);
- session.save(property);
+ log.debug("version of jbpm db schema: none");
} else {
String dbSchemaVersion = property.getValue();
- if (!jbpmVersion.equals(dbSchemaVersion)) {
- throw new JbpmException("jBPM runtime version "+jbpmVersion+"
doesn't match with DB schema, which is version ");
- } else {
- log.debug("runtime and db schema version both "+jbpmVersion);
+ log.debug("version of jbpm db schema: "+dbSchemaVersion);
+ if (!ProcessEngineImpl.JBPM_LIBRARY_VERSION.equals(dbSchemaVersion)) {
+ throw new JbpmException("jBPM runtime version
"+ProcessEngineImpl.JBPM_LIBRARY_VERSION+" doesn't match with DB schema,
which is version ");
}
}
}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryDbidGenerator.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdGenerator.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryDbidGenerator.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryDbidGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.id;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MemoryDbidGenerator extends DbidGenerator {
+
+ static long nextId = 1;
+
+ public synchronized long getNextId() {
+ return nextId++;
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryDbidGenerator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdComposer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdComposer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdComposer.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.id;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class MemoryIdComposer extends IdComposer {
+
+ public String createId(ProcessDefinition processDefinition, Execution parent,
ExecutionImpl execution) {
+ return null;
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdComposer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdGenerator.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdGenerator.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/MemoryIdGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,36 +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.id;
-
-
-/**
- * @author Tom Baeyens
- */
-public class MemoryIdGenerator extends IdGenerator {
-
- static long nextId = 1;
-
- public synchronized long getNextId() {
- return nextId++;
- }
-
-}
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -31,7 +31,7 @@
import org.jbpm.api.Configuration;
import org.jbpm.api.JbpmException;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
/**
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model;
-
-import org.hibernate.Session;
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DefaultIdGenerator implements IdGenerator {
-
- private static Log log = Log.getLog(DefaultIdGenerator.class.getName());
-
- public String createId(ProcessDefinition processDefinition, Execution parent,
ExecutionImpl execution) {
-
- Session session = EnvironmentImpl.getFromCurrent(Session.class);
- session.save(execution);
- // the next flush is introduced because of the following situation:
- // for hsqldb: id generation is done by inserting and then reading the id value
- // for db's that have separate id generators (postgres, oracle, mysql), the
previous
- // save will only make hibernate generate a new id, but the insert is not yet done
- // Then the following scenario might happen:
- // * the new execution is added to collection of the parent execution
- // * the parent execution ends, causing the new child to be removed from the
collection
- // * the child executions collection's cascade is set to all-delete-orphan so
- // we expect hibernate to delete it
- // * for some reason, then hibernate gets confused and still inserts the
- // execution afterwards.
- session.flush();
-
-
- String base = null;
- if (parent!=null) {
- base = parent.getId();
- } else if (processDefinition.getKey()!=null){
- base = processDefinition.getKey();
- } else {
- base = processDefinition.getId();
- }
-
- String executionPart = null;
- if ( (parent==null)
- && (execution.getKey()!=null)
- ) {
- executionPart = execution.getKey();
-
- } else if (execution.getName()!=null) {
- executionPart = execution.getName();
-
- } else {
- executionPart = Long.toString(execution.getDbid());
- }
-
- String executionId = base+"."+executionPart;
-
- if (log.isDebugEnabled()) log.debug("generated execution id
"+executionId);
-
- return executionId;
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -57,6 +57,8 @@
import org.jbpm.pvm.internal.history.events.DecisionEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceCreate;
import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
+import org.jbpm.pvm.internal.id.DbidGenerator;
+import org.jbpm.pvm.internal.id.IdComposer;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
@@ -179,14 +181,25 @@
this.state = STATE_CREATED;
this.key = key;
- IdGenerator idGenerator = processDefinition.getIdGenerator();
- if (idGenerator!=null) {
- this.id = idGenerator.createId(processDefinition, null, this);
- }
+ save();
+ composeIds();
HistoryEvent.fire(new ProcessInstanceCreate(), this);
}
+ protected void save() {
+ this.dbid = DbidGenerator.getDbidGenerator().getNextId();
+ DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
+ if (dbSession!=null) {
+ dbSession.save(this);
+ }
+ }
+
+ protected void composeIds() {
+ this.id = IdComposer.getIdComposer().createId(processDefinition, parent, this);
+ }
+
+
// execution method : start /////////////////////////////////////////////////
public void start() {
@@ -346,8 +359,13 @@
this.propagation = Propagation.EXPLICIT;
+ DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
+
if (parent!=null) {
parent.removeExecution(this);
+ if (dbSession!=null) {
+ dbSession.delete(this);
+ }
} else { // this is a process instance
HistoryEvent.fire(new ProcessInstanceEnd(), this);
@@ -358,7 +376,6 @@
superProcessExecution.signal();
}
- DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class, false);
if (dbSession!=null) {
dbSession.deleteProcessInstance(id, false);
}
@@ -798,24 +815,25 @@
}
public ExecutionImpl createExecution(String name) {
- // ?!
+ // when an activity calls createExecution, propagation is explicit.
+ // this means that the default propagation (proceed()) will not be called
propagation = Propagation.EXPLICIT;
- // create child execution
+ // create new execution
ExecutionImpl childExecution = newChildExecution();
- addExecution(childExecution);
-
- // initialize new concurrent execution
+ // initialize child execution
childExecution.setProcessDefinition(getProcessDefinition());
childExecution.processInstance = this.processInstance;
childExecution.name = name;
+
+ childExecution.save();
+ // make sure that child execution are saved before added to a persistent collection
+ // cause of the 'assigned' id strategy, adding the childExecution to the
persistent collection
+ // before the dbid is assigned will result in identifier of an instance of
ExecutionImpl altered from 0 to x
+ addExecution(childExecution);
+ // composeIds uses the parent so the childExecution has to be added before the ids
are composed
+ childExecution.composeIds();
- // id generation (after initialization)
- IdGenerator keyGenerator = EnvironmentImpl.getFromCurrent(IdGenerator.class, false);
- if (keyGenerator!=null) {
- childExecution.id = keyGenerator.createId(getProcessDefinition(), this,
childExecution);
- }
-
log.debug("created "+childExecution);
return childExecution;
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/IdGenerator.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/IdGenerator.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/IdGenerator.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessDefinition;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface IdGenerator {
-
- /** generates a unique id for the given execution. */
- String createId(ProcessDefinition processDefinition, Execution parent, ExecutionImpl
execution);
-
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -124,15 +124,6 @@
return new ExecutionImpl();
}
- /** by default, during initialization, an id will be generated when
- * an IdGenerator is present in the environment. By default,
- * this makes the execution persistent. So in case the process definition
- * is not persistent and there is an environment present (like in the case
- * of task lifecycle for jpdl processes), this method needs to be overwritten. */
- public IdGenerator getIdGenerator() {
- return EnvironmentImpl.getFromCurrent(IdGenerator.class, false);
- }
-
// task definitions /////////////////////////////////////////////////////////
public void addTaskDefinitionImpl(TaskDefinitionImpl taskDefinition) {
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -42,7 +42,7 @@
environment = environmentFactory.openEnvironment();
try {
- injectEnvironmentObjects(environment);
+ // injectEnvironmentObjects(environment);
return next.execute(command);
} finally {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -25,10 +25,10 @@
import java.util.Map;
import org.jbpm.api.JbpmException;
+import org.jbpm.pvm.internal.id.IdComposer;
import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.IdGenerator;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
/**
@@ -85,7 +85,7 @@
task.setState(lifeCycleExecution.getActivity().getName());
}
- public IdGenerator getIdGenerator() {
+ public IdComposer getIdGenerator() {
// overrides the default ProcessDefinitionImpl behaviour that will end up
// in the execution being persisted
return null;
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/HibernateSessionResource.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/HibernateSessionResource.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/HibernateSessionResource.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -36,7 +36,9 @@
public HibernateSessionResource(Session session) {
this.session = session;
- if (log.isTraceEnabled()) log.trace("beginning transaction on hibernate session
"+System.identityHashCode(session));
+ if (log.isDebugEnabled()) {
+ log.debug("----- beginning hibernate tx
"+System.identityHashCode(session)+"
--------------------------------------------------------");
+ }
try {
this.transaction = session.beginTransaction();
@@ -46,7 +48,7 @@
throw e;
}
- if (log.isTraceEnabled()) log.trace("begun hibernate transaction
"+System.identityHashCode(transaction)+" on hibernate session
"+System.identityHashCode(session));
+ if (log.isTraceEnabled()) log.trace("begun hibernate tx
"+System.identityHashCode(transaction)+" on hibernate session
"+System.identityHashCode(session));
}
public void prepare() {
@@ -55,7 +57,9 @@
}
public void commit() {
- if (log.isTraceEnabled()) log.trace("committing hibernate transaction
"+System.identityHashCode(transaction));
+ if (log.isDebugEnabled()) {
+ log.debug("----- committing hibernate tx
"+System.identityHashCode(transaction)+"
-------------------------------------------------------");
+ }
try {
transaction.commit();
} finally {
@@ -69,7 +73,9 @@
}
public void rollback() {
- if (log.isTraceEnabled()) log.trace("rolling back hibernate transaction
"+System.identityHashCode(transaction));
+ if (log.isDebugEnabled()) {
+ log.debug("----- rolling back hibernate tx
"+System.identityHashCode(transaction)+"
-----------------------------------------------------");
+ }
try {
transaction.rollback();
} finally {
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -31,7 +31,7 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -66,7 +66,7 @@
*
* <p>A WireContext is used often in combination with {@link EnvironmentImpl} to
* decouple the processDefinition virtual machine from its environment. In the
- * {@link JbpmConfiguration}, both the process-engine context and
+ * {@link ProcessEngineImpl}, both the process-engine context and
* the environment contexts are WireContexts. The PVM will use the persistence service,
* asynchronous message service, timer service and other services through specified
* abstractions in the environment.
@@ -244,7 +244,7 @@
* set to true, the {@link #createTime()} method needs to be called explicitly by the
client after
* construction is complete. The use case is creation of environment where the
transactionName needs to be
* set and the scope needs to be added to the environment before the creation of this
wire scope is done.
- * @see JbpmConfiguration#openEnvironment()
+ * @see ProcessEngineImpl#openEnvironment()
*/
public WireContext(WireDefinition wireDefinition, String name, boolean delayCreate) {
this.wireDefinition = wireDefinition;
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentInterceptorBinding.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.wire.descriptor.EnvironmentInterceptorDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
@@ -38,7 +38,7 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- EnvironmentFactory environmentFactory = (EnvironmentFactory)
parse.findObject(JbpmConfiguration.class);
+ EnvironmentFactory environmentFactory = (EnvironmentFactory)
parse.findObject(ProcessEngineImpl.class);
return new EnvironmentInterceptorDescriptor(environmentFactory);
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdGeneratorBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdGeneratorBinding.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IdGeneratorBinding.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.model.DefaultIdGenerator;
+import org.jbpm.pvm.internal.id.DatabaseIdComposer;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
@@ -38,7 +38,7 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- return new ObjectDescriptor(DefaultIdGenerator.class);
+ return new ObjectDescriptor(DatabaseIdComposer.class);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-09-16 11:34:14
UTC (rev 5648)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-09-16 12:52:34
UTC (rev 5649)
@@ -18,11 +18,13 @@
<hibernate-session-factory />
- <object class="org.jbpm.pvm.internal.id.DatabaseIdGenerator"
init="eager">
+ <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator"
init="eager">
<field name="commandService"><ref
type="org.jbpm.pvm.internal.cmd.CommandService" /></field>
<invoke method="initialize" />
</object>
+ <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer"
init="eager" />
+
<script-manager default-expression-language="juel"
default-script-language="juel">
<script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-09-16 11:34:14
UTC (rev 5648)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-09-16 12:52:34
UTC (rev 5649)
@@ -23,7 +23,7 @@
table="JBPM4_EXECUTION"
discriminator-value="pvm">
<id name="dbid" column="DBID_">
- <generator class="native" />
+ <generator class="assigned" />
</id>
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/BasicEnvironmentTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -34,7 +34,7 @@
public class BasicEnvironmentTest extends BaseJbpmTestCase {
public void testBasicEnvironmentOperation() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object name='a'
class='"+Object.class.getName()+"' />" +
@@ -77,7 +77,7 @@
}
public void testCurrentEnvironment(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine/>" +
" <environment/>" +
@@ -107,7 +107,7 @@
public void testUnexistingElement() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object name='a'
class='"+Object.class.getName()+"' />" +
@@ -128,7 +128,7 @@
}
public void testNoBlockEnvironment(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine/>" +
"</jbpm-configuration>"
@@ -149,7 +149,7 @@
}
public void testNoApplicationEnvironment(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <environment/>" +
"</jbpm-configuration>"
@@ -171,7 +171,7 @@
}
public void testEmptyEnvironment(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment/>"
);
assertNotNull(environmentFactory);
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentSearchOrderTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.wire.WireContext;
@@ -36,7 +36,7 @@
{
public void testEnvironmentDefaultSearchOrder() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='process-engine-a' />"
+
@@ -58,7 +58,7 @@
}
public void testEnvironmentGivenSearchOrder() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='process-engine-a' />"
+
@@ -82,7 +82,7 @@
}
public void testEnvironmentGivenSearchOrderUnexistingObject() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='process-engine-a' />"
+
@@ -108,7 +108,7 @@
public void testEnvironmentDefaultSearchOrderWithAddedContext() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='process-engine-a' />"
+
@@ -142,7 +142,7 @@
}
public void testEnvironmentGivenSearchOrderWithAddedContext() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='process-engine-a' />"
+
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/EnvironmentTypeLookupTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.test.BaseJbpmTestCase;
@@ -35,7 +35,7 @@
}
public void testApplicationTypeLookup() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object class='"+A.class.getName()+"' />" +
@@ -59,7 +59,7 @@
public void testBlockTypeLookup() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='distraction' />" +
@@ -83,7 +83,7 @@
public void testNonExistingTypeLookup() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <string name='a' value='A' />" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/env/NestedEnvironmentTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.env;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.test.BaseJbpmTestCase;
@@ -32,7 +32,7 @@
public class NestedEnvironmentTest extends BaseJbpmTestCase {
public void testNestedEnvironments() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object name='a'
class='"+Object.class.getName()+"' />" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -23,7 +23,7 @@
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -42,7 +42,7 @@
}
public void dontTestGroovyExpression() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <script-manager default-expression-language='juel'" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -23,7 +23,7 @@
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -39,7 +39,7 @@
public class JuelExpressionTest extends BaseJbpmTestCase {
public void testJuelExpression() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <script-manager default-expression-language='juel'" +
Copied:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
(from rev 5640,
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/IdGeneratorTest.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.id;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Session;
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cmd.CommandService;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DbidGeneratorTest extends TestCase {
+
+ private static Log log = Log.getLog(DbidGeneratorTest.class.getName());
+
+ public void testIdGenerator() {
+ ProcessEngine processEngine = new Configuration().buildProcessEngine();
+
+ CommandService commandService = processEngine.get(CommandService.class);
+ commandService.execute(new Command<Void>() {
+ private static final long serialVersionUID = 1L;
+ public Void execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ assertEquals("10001", session.createQuery(
+ "select property.value " +
+ "from "+PropertyImpl.class.getName()+" as property "
+
+ "where property.key =
'"+PropertyImpl.NEXT_ID_KEY+"'").uniqueResult());
+ return null;
+ }
+ });
+
+ DbidGenerator dbidGenerator = processEngine.get(DbidGenerator.class);
+
+ for (int i=1; i<10020; i++) {
+ assertEquals(i, dbidGenerator.getNextId());
+ if ((i%1000) == 0) {
+ log.debug("just got dbid "+i+"...");
+ }
+ }
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/IdGeneratorTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/IdGeneratorTest.java 2009-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/IdGeneratorTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,61 +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.id;
-
-import junit.framework.TestCase;
-
-import org.hibernate.Session;
-import org.jbpm.api.Configuration;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.cmd.Environment;
-import org.jbpm.pvm.internal.cmd.CommandService;
-
-
-/**
- * @author Tom Baeyens
- */
-public class IdGeneratorTest extends TestCase {
-
- public void testIdGenerator() {
- ProcessEngine processEngine = new Configuration().buildProcessEngine();
-
- CommandService commandService = processEngine.get(CommandService.class);
- commandService.execute(new Command<Void>() {
- private static final long serialVersionUID = 1L;
- public Void execute(Environment environment) throws Exception {
- Session session = environment.get(Session.class);
- assertEquals(2, session.createQuery("select property from
"+PropertyImpl.class.getName()+" as property").list().size());
- return null;
- }
- });
-
- IdGenerator idGenerator = processEngine.get(IdGenerator.class);
-
- for (int i=1; i<10020; i++) {
- assertEquals(i, idGenerator.getNextId());
- if ((i%100) == 0) {
- System.err.println(i);
- }
- }
- }
-}
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -22,7 +22,7 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -76,7 +76,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -126,7 +126,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -160,7 +160,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -201,7 +201,7 @@
// <subscribe event='...' /> will use the scope as the observable and
only notify on the specified event
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -237,7 +237,7 @@
// <subscribe event='...' /> will use the scope as the observable and
only notify on the specified event
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -284,7 +284,7 @@
// <subscribe event='...' /> will use the scope as the observable and
only notify on the specified event
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -320,7 +320,7 @@
}
public void testOtherWireScope() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object name='factory'
class='"+Object.class.getName()+"' />" +
@@ -363,14 +363,14 @@
index++;
assertEquals("close", events.get(index).eventName);
- JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) environmentFactory;
- WireContext applicationWireContext =
jbpmConfiguration.getProcessEngineWireContext();
+ ProcessEngineImpl processEngineImpl = (ProcessEngineImpl) environmentFactory;
+ WireContext applicationWireContext =
processEngineImpl.getProcessEngineWireContext();
assertEquals(applicationWireContext, events.get(index).source);
assertNull(events.get(index).info);
}
public void testOtherWireScopeWithEventFiltering() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
" <object name='factory'
class='"+Object.class.getName()+"' />" +
@@ -408,7 +408,7 @@
}
public void testUnexistingScope() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -437,7 +437,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -491,7 +491,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -16,7 +16,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.wire.WireContext;
@@ -149,7 +149,7 @@
}
public void testHasOnEmptyEnv(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes/>"
);
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,6 +1,6 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.wire.WireContext;
@@ -12,7 +12,7 @@
public class EnvWireTest extends WireTestCase {
public void testEnvironmentWire(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context /> " +
" <transaction-context>" +
@@ -36,7 +36,7 @@
}
public void testEnvironmentFactoryWire(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -59,7 +59,7 @@
}
public void testContextRefEnvironmentWire(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -83,7 +83,7 @@
}
public void testContextRefEnvironmentFactoryWire(){
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context>" +
" <context-ref name='c' />" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -1,6 +1,6 @@
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.util.DefaultObservable;
@@ -44,7 +44,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithNoArg() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -86,7 +86,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithBadName() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -123,7 +123,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithOneArg() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -170,7 +170,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithTwoArgs() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context /> "+
" <transaction-context>" +
@@ -230,7 +230,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithThreeArgs() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<jbpm-configuration>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -282,7 +282,7 @@
* Test subscription using a specified method and two objects.
*/
public void testMethodWithArgsAndMultipleObjectsSubcription() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -373,7 +373,7 @@
}
public void testMethodAndOverLoading() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -428,7 +428,7 @@
}
public void testMethodAndBadArg() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.util.DefaultObservable;
@@ -38,7 +38,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is no eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -80,7 +80,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -126,7 +126,7 @@
// <subscribe objects='...' /> will use the object as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -193,7 +193,7 @@
}
public void testUnexistingObject() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -216,7 +216,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is eager initialization
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -266,7 +266,7 @@
}
public void testNotObservableObject() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -288,7 +288,7 @@
}
public void testNotListener() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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.util.DefaultObservable;
@@ -40,7 +40,7 @@
// class Descriptor
public void testRegisterToAllDescriptors() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -82,7 +82,7 @@
}
public void testOneObjectDescriptor() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -139,7 +139,7 @@
}
public void testMultipleObjectDescriptors() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -215,7 +215,7 @@
}
public void testOneObjectDescriptorWithEventFilter() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
@@ -256,7 +256,7 @@
}
public void testMultipleObjectDescriptorsWithEventFilter() {
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
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-09-16
11:34:14 UTC (rev 5648)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java 2009-09-16
12:52:34 UTC (rev 5649)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
+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;
@@ -46,7 +46,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialisation
- EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
+ EnvironmentFactory environmentFactory = ProcessEngineImpl.parseXmlString(
"<environment-scopes>" +
" <process-engine-context />" +
" <transaction-context>" +
Modified: jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/logging.properties 2009-09-16 11:34:14
UTC (rev 5648)
+++ jbpm4/trunk/modules/test-db/src/test/resources/logging.properties 2009-09-16 12:52:34
UTC (rev 5649)
@@ -1,7 +1,7 @@
handlers= java.util.logging.ConsoleHandler
redirect.commons.logging = enabled
-java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
org.jbpm.level=FINE
@@ -12,7 +12,7 @@
org.hibernate.level=INFO
org.hibernate.cfg.SettingsFactory.level=SEVERE
org.hibernate.cfg.HbmBinder.level=SEVERE
-# org.hibernate.SQL.level=FINEST
-# org.hibernate.type.level=FINEST
+org.hibernate.SQL.level=FINEST
+org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
\ No newline at end of file