JBoss JBPM SVN: r2711 - jbpm4/trunk/modules.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:17:58 -0400 (Fri, 31 Oct 2008)
New Revision: 2711
Removed:
jbpm4/trunk/modules/test/
Log:
unification api proposals
15 years, 6 months
JBoss JBPM SVN: r2710 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm and 27 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:17:37 -0400 (Fri, 31 Oct 2008)
New Revision: 2710
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/JbpmConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/SpringConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cmd/
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/PvmEnvironmentFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/Command.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CommandService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/Db.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentTestCase.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/JbpmTestCase.java
Modified:
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/job/JobTestHelper.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionNamesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/GetNextDueDateCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutor.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/jobexecutor/JobExecutorThread.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerSynchronization.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringCommandService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.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/svc/Interceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/RetryInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransactionInterceptor.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/AsyncCommandServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ExecutionServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobTestHelperBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ManagementServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/StandardCommandServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CommandServiceDescriptor.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerConfiguration.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.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/jobexecutor/ExclusiveTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.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/pvm/src/test/java/org/jbpm/pvm/samples/ExamplesConfiguration.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex13/EnvironmentTest.java
Log:
unification api proposals
Modified: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -26,9 +26,7 @@
import java.util.logging.LogManager;
import java.util.logging.Logger;
-import org.jbpm.PvmException;
-
/**
* @author Tom Baeyens
*/
Modified: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -11,8 +11,6 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-
public class LogFormatter extends Formatter {
static final String NEWLINE = System.getProperty("line.separator");
@@ -52,7 +50,11 @@
msg.append("| [");
String loggerName = logRecord.getLoggerName();
- msg.append(ReflectUtil.getUnqualifiedClassName(loggerName));
+ int dotIndex = loggerName.lastIndexOf('.');
+ if (dotIndex!=-1) {
+ loggerName = loggerName.substring(dotIndex+1);
+ }
+ msg.append(loggerName);
msg.append("] ");
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/JbpmConfiguration.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/PvmEnvironmentFactory.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/JbpmConfiguration.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/JbpmConfiguration.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -0,0 +1,230 @@
+/*
+ * 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.cfg;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Set;
+
+import org.jbpm.Configuration;
+import org.jbpm.ExecutionService;
+import org.jbpm.ManagementService;
+import org.jbpm.ProcessEngine;
+import org.jbpm.ProcessService;
+import org.jbpm.ResourceManager;
+import org.jbpm.TaskService;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.env.Context;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.env.PvmEnvironment;
+import org.jbpm.pvm.internal.env.PvmEnvironmentFactoryParser;
+import org.jbpm.pvm.internal.stream.FileStreamSource;
+import org.jbpm.pvm.internal.stream.InputStreamSource;
+import org.jbpm.pvm.internal.stream.ResourceStreamSource;
+import org.jbpm.pvm.internal.stream.StreamSource;
+import org.jbpm.pvm.internal.stream.StringStreamSource;
+import org.jbpm.pvm.internal.stream.UrlStreamSource;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+
+/**
+ * an environment factory that also is the environment-factory context.
+ *
+ * <p>
+ * This environment factory will produce environments with 2 contexts: the
+ * environment-factory context and the block context.
+ * </p>
+ *
+ * <p>
+ * An environment-factory context is build from two wire definitions: the
+ * environment-factory wire definition and the environment wire definition.
+ * </p>
+ *
+ * <p>
+ * The environment-factory context itself is build from the environment-factory
+ * wire definition. So all objects that are created in this context remain
+ * cached for the lifetime of this environment-factory context object.
+ * </p>
+ *
+ * <p>
+ * This environment-factory context is also a environment factory. The produced
+ * environments contain 2 contexts: the environment-factory 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 static PvmEnvironmentFactoryParser pvmEnvironmentFactoryParser = new PvmEnvironmentFactoryParser();
+
+ protected boolean isConfigured = false;
+ protected WireContext environmentFactoryCtxWireContext = null;
+ protected WireDefinition environmentCtxWireDefinition = null;
+
+ public JbpmConfiguration() {
+ }
+
+ public ProcessEngine buildProcessEngine() {
+ if (!isConfigured) {
+ setResource("jbpm.cfg.xml");
+ }
+ return this;
+ }
+
+ public void setInputStream(InputStream inputStream) {
+ parse(new InputStreamSource(inputStream));
+ }
+
+ public void setResource(String resource) {
+ parse(new ResourceStreamSource(resource, getClassLoader()));
+ }
+
+ public void setUrl(URL url) {
+ parse(new UrlStreamSource(url));
+ }
+
+ public void setFile(File file) {
+ parse(new FileStreamSource(file));
+ }
+
+ public void setXmlString(String xmlString) {
+ parse(new StringStreamSource(xmlString));
+ }
+
+ protected void parse(StreamSource streamSource) {
+ isConfigured = true;
+ PvmEnvironmentFactoryParser.getInstance()
+ .createParse()
+ .setDocumentObject(this)
+ .setStreamSource(streamSource)
+ .execute()
+ .checkProblems("jbpm configuration " + streamSource);
+ }
+
+ public ExecutionService getExecutionService() {
+ return environmentFactoryCtxWireContext.get(ExecutionService.class);
+ }
+
+ public ManagementService getManagementService() {
+ return environmentFactoryCtxWireContext.get(ManagementService.class);
+ }
+
+ public ProcessService getProcessService() {
+ return environmentFactoryCtxWireContext.get(ProcessService.class);
+ }
+
+ public TaskService getTaskService() {
+ return environmentFactoryCtxWireContext.get(TaskService.class);
+ }
+
+ public ResourceManager getResourceManager() {
+ return null;
+ }
+
+ public static EnvironmentFactory parseXmlString(String xmlString) {
+ JbpmConfiguration jbpmConfiguration = new JbpmConfiguration();
+ jbpmConfiguration.setXmlString(xmlString);
+ jbpmConfiguration.buildProcessEngine();
+ return jbpmConfiguration;
+ }
+
+ public Environment openEnvironment() {
+ PvmEnvironment environment = new PvmEnvironment(this);
+
+ log.debug("opening " + environment);
+
+ // set the classloader
+ ClassLoader classLoader = environmentFactoryCtxWireContext.getClassLoader();
+ if (classLoader != null) {
+ environment.setClassLoader(classLoader);
+ }
+
+ // add the environment-factory context
+ environment.addContext(environmentFactoryCtxWireContext);
+
+ // add the environment block context
+ WireContext environmentContext = new WireContext(environmentCtxWireDefinition, Context.CONTEXTNAME_ENVIRONMENT, environment, true);
+ // add the environment block context to the environment
+ environment.addContext(environmentContext);
+
+ // finish the creation of the environment wire context
+ environmentContext.create();
+
+ // if all went well, return the created environment
+ return environment;
+ }
+
+ public void close() {
+ environmentFactoryCtxWireContext.fire(WireContext.EVENT_CLOSE, null);
+ }
+
+ // environment-factory context delegation methods
+ // ///////////////////////////////////
+
+ public Object get(String key) {
+ return environmentFactoryCtxWireContext.get(key);
+ }
+
+ public <T> T get(Class<T> type) {
+ return environmentFactoryCtxWireContext.get(type);
+ }
+
+ public String getName() {
+ return environmentFactoryCtxWireContext.getName();
+ }
+
+ public boolean has(String key) {
+ return environmentFactoryCtxWireContext.has(key);
+ }
+
+ public Set<String> keys() {
+ return environmentFactoryCtxWireContext.keys();
+ }
+
+ public Object set(String key, Object value) {
+ return environmentFactoryCtxWireContext.set(key, value);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public void setEnvironmentCtxWireDefinition(WireDefinition blockWireDefinition) {
+ this.environmentCtxWireDefinition = blockWireDefinition;
+ }
+ public WireContext getEnvironmentFactoryCtxWireContext() {
+ return environmentFactoryCtxWireContext;
+ }
+ public void setEnvironmentFactoryCtxWireContext(WireContext applicationWireContext) {
+ this.environmentFactoryCtxWireContext = applicationWireContext;
+ }
+ public WireDefinition getEnvironmentCtxWireDefinition() {
+ return environmentCtxWireDefinition;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/SpringConfiguration.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/SpringConfiguration.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/cfg/SpringConfiguration.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -0,0 +1,98 @@
+/*
+ * 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.cfg;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.spring.SpringEnvironment;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/** this environment factory will see only the singleton beans.
+ *
+ * The created {@link SpringEnvironment}s will see the prototype
+ * beans and it will cache them.
+ *
+ * @author Tom Baeyens
+ */
+public class SpringConfiguration extends EnvironmentFactory implements ApplicationContextAware {
+
+ // TODO pull up the common behaviour between this class and the SpringEnvironmentContext
+
+ private static final long serialVersionUID = 1L;
+
+ ApplicationContext applicationContext;
+
+ public SpringEnvironment openEnvironment() {
+ return new SpringEnvironment(this);
+ }
+
+ public boolean has(String key) {
+ return applicationContext.isSingleton(key);
+ }
+
+ public Object get(String key) {
+ if (has(key)) {
+ return applicationContext.getBean(key);
+ }
+ return null;
+ }
+
+ public <T> T get(Class<T> type) {
+ String name = ReflectUtil.getUnqualifiedClassName(type);
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
+ return (T) get(name);
+ }
+
+ public Set<String> keys() {
+ HashSet<String> keys = new HashSet<String>();
+ for (String key : applicationContext.getBeanDefinitionNames()) {
+ if (has(key)) {
+ keys.add(key);
+ }
+ }
+ return keys;
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+
+ public void close() {
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public Object set(String key, Object value) {
+ return null;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/job/JobTestHelper.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/job/JobTestHelper.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/job/JobTestHelper.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,9 +24,9 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.jbpm.Execution;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.jobexecutor.ExecuteJobCmd;
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/PvmEnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/PvmEnvironmentFactory.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/PvmEnvironmentFactory.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,188 +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.env;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Set;
-
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.env.PvmEnvironment;
-import org.jbpm.pvm.internal.env.PvmEnvironmentFactoryParser;
-import org.jbpm.pvm.internal.stream.FileStreamSource;
-import org.jbpm.pvm.internal.stream.InputStreamSource;
-import org.jbpm.pvm.internal.stream.ResourceStreamSource;
-import org.jbpm.pvm.internal.stream.StreamSource;
-import org.jbpm.pvm.internal.stream.StringStreamSource;
-import org.jbpm.pvm.internal.stream.UrlStreamSource;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-
-
-/**
- * an environment factory that also is the environment-factory context.
- *
- * <p>This environment factory will produce environments with 2 contexts:
- * the environment-factory context and the block context.
- * </p>
- *
- * <p>An environment-factory context is build from two wire definitions: the environment-factory
- * wire definition and the environment wire definition.
- * </p>
- *
- * <p>The environment-factory context itself is build from the environment-factory wire definition.
- * So all objects that are created in this context remain cached for the lifetime of
- * this environment-factory context object.
- * </p>
- *
- * <p>This environment-factory context is also a environment factory. The produced environments
- * contain 2 contexts: the environment-factory 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 PvmEnvironmentFactory extends EnvironmentFactory implements Context {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(PvmEnvironmentFactory.class.getName());
- protected static PvmEnvironmentFactoryParser pvmEnvironmentFactoryParser = new PvmEnvironmentFactoryParser();
-
- protected WireContext environmentFactoryCtxWireContext = null;
- protected WireDefinition environmentCtxWireDefinition = null;
-
- public PvmEnvironmentFactory() {
- }
-
- public PvmEnvironmentFactory(String resource) {
- this(resource, null);
- }
-
- public PvmEnvironmentFactory(String resource, ClassLoader classLoader) {
- this(new ResourceStreamSource(resource, classLoader));
- }
-
- public PvmEnvironmentFactory(File file) {
- this(new FileStreamSource(file));
- }
-
- public PvmEnvironmentFactory(URL url) {
- this(new UrlStreamSource(url));
- }
-
- public PvmEnvironmentFactory(InputStream inputStream) {
- this(new InputStreamSource(inputStream));
- }
-
- public static PvmEnvironmentFactory parseXmlString(String xmlString) {
- return new PvmEnvironmentFactory(new StringStreamSource(xmlString));
- }
-
- PvmEnvironmentFactory(StreamSource streamSource) {
- PvmEnvironmentFactoryParser.getInstance()
- .createParse()
- .setDocumentObject(this)
- .setStreamSource(streamSource)
- .execute()
- .checkProblems("pvm environment configuration "+streamSource);
- }
-
- public Environment openEnvironment() {
- PvmEnvironment environment = new PvmEnvironment(this);
-
- log.debug("opening "+environment);
-
- // set the classloader
- ClassLoader classLoader = environmentFactoryCtxWireContext.getClassLoader();
- if (classLoader!=null) {
- environment.setClassLoader(classLoader);
- }
-
- // add the environment-factory context
- environment.addContext(environmentFactoryCtxWireContext);
-
- // add the environment block context
- WireContext environmentContext = new WireContext(environmentCtxWireDefinition, Context.CONTEXTNAME_ENVIRONMENT, environment, true);
- // add the environment block context to the environment
- environment.addContext(environmentContext);
-
- try {
- // finish the creation of the environment wire context
- environmentContext.create();
-
- } catch (RuntimeException e) {
- // On exception, pop environment
- Environment.popEnvironment();
- throw e;
- }
- // if all went well, return the created environment
- return environment;
- }
-
- public void close() {
- environmentFactoryCtxWireContext.fire(WireContext.EVENT_CLOSE, null);
- }
-
- // environment-factory context delegation methods ///////////////////////////////////
-
- public Object get(String key) {
- return environmentFactoryCtxWireContext.get(key);
- }
-
- public <T> T get(Class<T> type) {
- return environmentFactoryCtxWireContext.get(type);
- }
-
- public String getName() {
- return environmentFactoryCtxWireContext.getName();
- }
-
- public boolean has(String key) {
- return environmentFactoryCtxWireContext.has(key);
- }
-
- public Set<String> keys() {
- return environmentFactoryCtxWireContext.keys();
- }
-
- public Object set(String key, Object value) {
- return environmentFactoryCtxWireContext.set(key, value);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public void setEnvironmentCtxWireDefinition(WireDefinition blockWireDefinition) {
- this.environmentCtxWireDefinition = blockWireDefinition;
- }
- public WireContext getEnvironmentFactoryCtxWireContext() {
- return environmentFactoryCtxWireContext;
- }
- public void setEnvironmentFactoryCtxWireContext(WireContext applicationWireContext) {
- this.environmentFactoryCtxWireContext = applicationWireContext;
- }
- public WireDefinition getEnvironmentCtxWireDefinition() {
- return environmentCtxWireDefinition;
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/SpringEnvironmentFactory.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,97 +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.env;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jbpm.pvm.internal.spring.SpringEnvironment;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/** this environment factory will see only the singleton beans.
- *
- * The created {@link SpringEnvironment}s will see the prototype
- * beans and it will cache them.
- *
- * @author Tom Baeyens
- */
-public class SpringEnvironmentFactory extends EnvironmentFactory implements ApplicationContextAware {
-
- // TODO pull up the common behaviour between this class and the SpringEnvironmentContext
-
- private static final long serialVersionUID = 1L;
-
- ApplicationContext applicationContext;
-
- public SpringEnvironment openEnvironment() {
- return new SpringEnvironment(this);
- }
-
- public boolean has(String key) {
- return applicationContext.isSingleton(key);
- }
-
- public Object get(String key) {
- if (has(key)) {
- return applicationContext.getBean(key);
- }
- return null;
- }
-
- public <T> T get(Class<T> type) {
- String name = ReflectUtil.getUnqualifiedClassName(type);
- name = name.substring(0, 1).toLowerCase() + name.substring(1);
- return (T) get(name);
- }
-
- public Set<String> keys() {
- HashSet<String> keys = new HashSet<String>();
- for (String key : applicationContext.getBeanDefinitionNames()) {
- if (has(key)) {
- keys.add(key);
- }
- }
- return keys;
- }
-
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
-
- public void close() {
- }
-
- public String getName() {
- return null;
- }
-
- public Object set(String key, Object value) {
- return null;
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.cmd;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ExecutionImpl;
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/Command.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/Command.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/Command.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,10 +0,0 @@
-package org.jbpm.pvm.internal.cmd;
-
-import java.io.Serializable;
-
-import org.jbpm.pvm.env.Environment;
-
-public interface Command<T> extends Serializable {
-
- T execute(Environment environment) throws Exception;
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CommandService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,22 +0,0 @@
-package org.jbpm.pvm.internal.cmd;
-
-import org.jbpm.PvmException;
-
-/**
- * abstract extensible session facade. Developers can use this directly or
- * extend one of the implementations with custom methods.
- * Developers should be encouraged to use this interface as it will
- * be kept more stable then direct usage of the API (which is still
- * allowed).
- * All the method implementations should be based on commands.
- * Each of the method implementations will have a environment block.
- * Then the command is executed and the environment is passed into the
- * command.
- */
-public interface CommandService {
-
- /**
- * @throws PvmException if command throws an exception.
- */
- <T> T execute(Command<T> command);
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,6 +23,7 @@
import org.jbpm.ProcessDefinition;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.DeploymentImpl;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.deploy.DeployerManager;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,6 +23,7 @@
import org.jbpm.Execution;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.cmd;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.cmd;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.model.OpenProcessDefinition;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionNamesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionNamesCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionNamesCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -26,6 +26,7 @@
import java.util.Map;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,6 +21,8 @@
*/
package org.jbpm.pvm.internal.cmd;
+import org.jbpm.cmd.Command;
+
/** base class for commands that execute scalable queries.
*
* @author Tom Baeyens
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -25,6 +25,7 @@
import org.jbpm.Execution;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ExecutionImpl;
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Context;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.util.Closable;
@@ -36,10 +36,10 @@
private static final Log log = Log.getLog(PvmEnvironment.class.getName());
- protected PvmEnvironmentFactory pvmEnvironmentFactory;
+ protected JbpmConfiguration jbpmConfiguration;
- public PvmEnvironment(PvmEnvironmentFactory pvmEnvironmentFactory) {
- this.pvmEnvironmentFactory = pvmEnvironmentFactory;
+ public PvmEnvironment(JbpmConfiguration jbpmConfiguration) {
+ this.jbpmConfiguration = jbpmConfiguration;
}
public String toString() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.stream.StreamSource;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.WireContext;
@@ -70,10 +70,10 @@
Element documentElement = document.getDocumentElement();
// if the default environment factory was already set in the parse
- PvmEnvironmentFactory pvmEnvironmentFactory = (PvmEnvironmentFactory) parse.getDocumentObject();
- if (pvmEnvironmentFactory==null) {
- pvmEnvironmentFactory = new PvmEnvironmentFactory();
- parse.setDocumentObject(pvmEnvironmentFactory);
+ JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) parse.getDocumentObject();
+ if (jbpmConfiguration==null) {
+ jbpmConfiguration = new JbpmConfiguration();
+ parse.setDocumentObject(jbpmConfiguration);
}
WireDefinition environmentFactoryWireDefinition = getApplicationWireDefinition(documentElement, parse);
@@ -85,12 +85,12 @@
environmentFactoryWireContext.setClassLoader(classLoader);
// configure the default environment factory
- pvmEnvironmentFactory.setEnvironmentFactoryCtxWireContext(environmentFactoryWireContext);
- pvmEnvironmentFactory.setEnvironmentCtxWireDefinition(environmentWireDefinition);
+ jbpmConfiguration.setEnvironmentFactoryCtxWireContext(environmentFactoryWireContext);
+ jbpmConfiguration.setEnvironmentCtxWireDefinition(environmentWireDefinition);
- parse.setDocumentObject(pvmEnvironmentFactory);
+ parse.setDocumentObject(jbpmConfiguration);
- return pvmEnvironmentFactory;
+ return jbpmConfiguration;
}
WireDefinition getApplicationWireDefinition(Element documentElement, Parse parse) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/CommandMessage.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.job;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -3,8 +3,8 @@
import java.io.Serializable;
import java.util.Date;
+import org.jbpm.cmd.Command;
import org.jbpm.job.Job;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.wire.Descriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -28,9 +28,9 @@
import java.util.Date;
import java.util.List;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.JobImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/DispatcherThread.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,9 +24,9 @@
import java.util.Collection;
import java.util.Date;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
/** this thread is responsible for acquiring jobs in the jobImpl that need to be
* executed and then let the JobExecutor dispatch the acquired ids to one of the
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/ExecuteJobCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -25,12 +25,12 @@
import org.hibernate.Session;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.Transaction;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.job.JobImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/GetNextDueDateCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/GetNextDueDateCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/GetNextDueDateCmd.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,9 +23,9 @@
import java.util.Date;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.JobImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -28,11 +28,11 @@
import org.hibernate.Session;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.Transaction;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.job.JobImpl;
/**
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -31,9 +31,9 @@
import java.util.concurrent.BlockingQueue;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
/** manager for jobImpl execution threads and their configuration.
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorServlet.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -30,8 +30,8 @@
import javax.servlet.http.HttpServletResponse;
import org.jbpm.PvmException;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
/**
* starts the jobImpl executor on init and closes the
@@ -82,7 +82,7 @@
public void init() throws ServletException {
String configurationResource = getInitParameter("jbpm.configuration.resource", "jbpm.cfg.xml");
- EnvironmentFactory environmentFactory = new PvmEnvironmentFactory(configurationResource);
+ EnvironmentFactory environmentFactory = new JbpmConfiguration(configurationResource);
jobExecutor = environmentFactory.get(JobExecutor.class);
if (jobExecutor==null) {
throw new PvmException("no jobImpl executor configured in resource "+configurationResource);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorThread.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,8 +24,8 @@
import java.util.Collection;
import java.util.concurrent.BlockingQueue;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.CommandService;
/**
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -27,10 +27,10 @@
import org.jbpm.PvmException;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.Transaction;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.model.op.MoveToChildNode;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.listener.EventListener;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerSynchronization.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerSynchronization.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerSynchronization.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -25,11 +25,11 @@
import javax.transaction.Synchronization;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
import org.jbpm.pvm.env.Transaction;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.session.DbSession;
public class ExceptionHandlerSynchronization implements Synchronization, Command<Object> {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/CommandTransactionCallback.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.spring;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringCommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringCommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringCommandService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.internal.spring;
import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.springframework.orm.hibernate3.HibernateTransactionManager;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.transaction.support.TransactionTemplate;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.spring;
+import org.jbpm.cfg.SpringConfiguration;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.SpringEnvironmentFactory;
import org.jbpm.pvm.internal.env.BasicEnvironment;
import org.springframework.context.ApplicationContext;
@@ -37,9 +37,9 @@
protected ApplicationContext applicationContext;
- public SpringEnvironment(SpringEnvironmentFactory springEnvironmentFactory) {
- addContext(springEnvironmentFactory);
- addContext(new SpringEnvironmentContext(springEnvironmentFactory.getApplicationContext()));
+ public SpringEnvironment(SpringConfiguration springConfiguration) {
+ addContext(springConfiguration);
+ addContext(new SpringEnvironmentContext(springConfiguration.getApplicationContext()));
}
public ClassLoader getClassLoader() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.svc;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.job.MessageImpl;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,9 +22,9 @@
package org.jbpm.pvm.internal.svc;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.session.MessageSession;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationInterceptor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationInterceptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,8 +22,8 @@
package org.jbpm.pvm.internal.svc;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
/** performs an authorization check before the command is executed.
* @author Tom Baeyens
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationSession.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AuthorizationSession.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,7 +1,7 @@
package org.jbpm.pvm.internal.svc;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
public interface AuthorizationSession {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -27,7 +27,7 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,10 +24,10 @@
import java.util.List;
import org.jbpm.ManagementService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
import org.jbpm.job.Message;
import org.jbpm.job.Timer;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.GetMessagesCmd;
import org.jbpm.pvm.internal.cmd.GetTimersCmd;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -26,8 +26,8 @@
import org.jbpm.Deployment;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.DeploymentImpl;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionCmd;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.internal.svc;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
/**
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.svc;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
/** sets up an environment around the execution of the command.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/Interceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/Interceptor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/Interceptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.svc;
+import org.jbpm.cmd.CommandService;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.CommandService;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/RetryInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/RetryInterceptor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/RetryInterceptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,8 +22,8 @@
package org.jbpm.pvm.internal.svc;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.Command;
import org.hibernate.StaleStateException;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransactionInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransactionInterceptor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/StandardTransactionInterceptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,9 +22,9 @@
package org.jbpm.pvm.internal.tx;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.svc.Interceptor;
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -29,12 +29,12 @@
import java.util.Map;
import java.util.Set;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.log.Log;
import org.jbpm.pvm.activity.Activity;
import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
import org.jbpm.pvm.internal.util.Closable;
import org.jbpm.pvm.internal.util.DefaultObservable;
@@ -66,7 +66,7 @@
*
* <p>A WireContext is used often in combination with {@link Environment} to
* decouple the processDefinition virtual machine from its environment. In the
- * {@link PvmEnvironmentFactory}, both the environment-factory context and
+ * {@link JbpmConfiguration}, both the environment-factory 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 #create()} 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 PvmEnvironmentFactory#openEnvironment()
+ * @see JbpmConfiguration#openEnvironment()
*/
public WireContext(WireDefinition wireDefinition, String name, Environment environment, boolean delayCreate) {
this.wireDefinition = wireDefinition;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AsyncCommandServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AsyncCommandServiceBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AsyncCommandServiceBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.AsyncCommandService;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ExecutionServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ExecutionServiceBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ExecutionServiceBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.CommandExecutionService;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobTestHelperBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobTestHelperBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobTestHelperBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.wire.binding;
+import org.jbpm.cmd.CommandService;
import org.jbpm.job.JobTestHelper;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ManagementServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ManagementServiceBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ManagementServiceBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.CommandManagementService;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.CommandProcessService;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/StandardCommandServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/StandardCommandServiceBinding.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/StandardCommandServiceBinding.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.DefaultCommandService;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CommandServiceDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CommandServiceDescriptor.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CommandServiceDescriptor.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.Interceptor;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/Db.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/Db.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/Db.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,120 +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.test;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.MySQLDialect;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.mapping.ForeignKey;
-import org.hibernate.mapping.Table;
-import org.jbpm.pvm.env.EnvironmentFactory;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Db {
-
- private static final String CLEAN_SQL_KEY = "cleanSql";
-
- public static void clean(EnvironmentFactory environmentFactory) {
- SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
- String[] cleanSql = (String[]) environmentFactory.get(CLEAN_SQL_KEY);
-
- if (cleanSql == null) {
- Configuration configuration = environmentFactory.get(Configuration.class);
-
- SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
- Dialect dialect = sessionFactoryImplementor.getDialect();
-
- // loop over all foreign key constraints
- List<String> dropForeignKeysSql = new ArrayList<String>();
- List<String> createForeignKeysSql = new ArrayList<String>();
- Iterator<Table> iter = configuration.getTableMappings();
- while (iter.hasNext()) {
- Table table = (Table) iter.next();
- if (table.isPhysicalTable()) {
- String catalog = table.getCatalog();
- String schema = table.getSchema();
- Iterator<ForeignKey> subIter = table.getForeignKeyIterator();
- while (subIter.hasNext()) {
- ForeignKey fk = (ForeignKey) subIter.next();
- if (fk.isPhysicalConstraint()) {
- // collect the drop foreign key constraint sql
- dropForeignKeysSql.add(fk.sqlDropString(dialect, catalog, schema));
- // MySQLDialect creates an index for each foreign key.
- // see
- // http://opensource.atlassian.com/projects/hibernate/browse/HHH-2155
- // This index should be dropped or an error will be thrown during
- // the creation phase
- if (dialect instanceof MySQLDialect) {
- dropForeignKeysSql.add("alter table " + table.getName() + " drop key " + fk.getName());
- }
- // and collect the create foreign key constraint sql
- createForeignKeysSql.add(fk.sqlCreateString(dialect, sessionFactoryImplementor, catalog, schema));
- }
- }
- }
- }
-
- List<String> deleteSql = new ArrayList<String>();
- iter = configuration.getTableMappings();
- while (iter.hasNext()) {
- Table table = (Table) iter.next();
- if (table.isPhysicalTable()) {
- deleteSql.add("delete from " + table.getName());
- }
- }
-
- // glue
- // - drop foreign key constraints
- // - delete contents of all tables
- // - create foreign key constraints
- // together to form the clean script
- List<String> cleanSqlList = new ArrayList<String>();
- cleanSqlList.addAll(dropForeignKeysSql);
- cleanSqlList.addAll(deleteSql);
- cleanSqlList.addAll(createForeignKeysSql);
-
- cleanSql = (String[]) cleanSqlList.toArray(new String[cleanSqlList.size()]);
-
- environmentFactory.set(CLEAN_SQL_KEY, cleanSql);
- }
-
- Session session = sessionFactory.openSession();
- try {
- for (String query : cleanSql) {
- session.createSQLQuery(query).executeUpdate();
- }
- } finally {
- session.close();
- }
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/DbTestCase.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/DbTestCase.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,71 +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.test;
-
-import org.jbpm.ExecutionService;
-import org.jbpm.ManagementService;
-import org.jbpm.ProcessService;
-import org.jbpm.pvm.internal.cmd.CommandService;
-
-
-/** for tests that use persistence through a command service.
- *
- * The DB is cleaned inbetween tests. No environment is created.
- *
- * @author Tom Baeyens
- */
-public abstract class DbTestCase extends EnvironmentFactoryTestCase {
-
- protected CommandService commandService;
- protected ProcessService processService;
- protected ExecutionService executionService;
- protected ManagementService managementService;
-
- public DbTestCase() {
- super();
- }
-
- public DbTestCase(String configResource) {
- super(configResource);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- if (isEnvironmentFactoryCached()) {
- Db.clean(getEnvironmentFactory());
- }
-
- commandService = getEnvironmentFactory().get(CommandService.class);
- processService = getEnvironmentFactory().get(ProcessService.class);
- executionService = getEnvironmentFactory().get(ExecutionService.class);
- managementService = getEnvironmentFactory().get(ManagementService.class);
- }
-
- public void tearDown() throws Exception {
- commandService = null;
- processService = null;
- executionService = null;
- managementService = null;
- super.tearDown();
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,154 +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.test;
-
-import java.lang.reflect.Field;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.jbpm.Execution;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.model.OpenProcessDefinition;
-import org.jbpm.pvm.session.DbSession;
-import org.jbpm.pvm.session.PvmDbSession;
-
-
-/** for tests that use persistence inside environment blocks.
- *
- * An environment is opened in the setUp and closed in the tearDown.
- * DB is cleaned inbetween tests. Extra convenience methods for usage
- * inside an environment block are provided.
- *
- * @author Tom Baeyens
- */
-public class EnvironmentDbTestCase extends EnvironmentTestCase {
-
- Transaction transaction = null;
-
- public EnvironmentDbTestCase() {
- }
-
- public EnvironmentDbTestCase(String configResource) {
- super(configResource);
- }
-
- public void setUp() throws Exception {
- if (isEnvironmentFactoryCached()) {
- Db.clean(getEnvironmentFactory());
- }
- super.setUp();
- beginTransaction();
- }
-
- public void tearDown() throws Exception {
- commitTransaction();
- super.tearDown();
- }
-
- void beginTransaction() {
- Session session = environment.get(Session.class);
- transaction = session.beginTransaction();
- }
-
- void commitTransaction() {
- transaction.commit();
- transaction = null;
- }
-
- void rollbackTransaction() {
- transaction.rollback();
- transaction = null;
- }
-
- public DbSession getDbSession() {
- return environment.get(DbSession.class);
- }
-
- public void rollbackAndBeginNewTransaction() {
- rollbackTransaction();
- closeEnvironment();
- openEnvironment();
- beginTransaction();
- }
-
- public void newTransaction() {
- try {
- commitTransaction();
- closeEnvironment();
- } finally {
- openEnvironment();
- beginTransaction();
- }
- }
-
- public void beginCacheTest() {
- SessionFactory sessionFactory = environment.get(SessionFactory.class);
- if (sessionFactory != null) {
- log.debug("=================================================================");
- log.debug("Beginning of the cache test, no more sql query should be performed before the end of the test");
- log.debug("=================================================================");
-
- sessionFactory.getStatistics().clear();
- sessionFactory.getStatistics().setStatisticsEnabled(true);
- }
- }
-
- public void endCacheTest() {
- SessionFactory sessionFactory = environment.get(SessionFactory.class);
- if (sessionFactory != null) {
- assertEquals(0, sessionFactory.getStatistics().getEntityLoadCount());
- assertEquals(0, sessionFactory.getStatistics().getCollectionLoadCount());
- }
- }
-
- public ProcessDefinitionImpl reload(OpenProcessDefinition processDefinition) {
- environment.get(PvmDbSession.class).save(processDefinition);
- newTransaction();
- return environment.get(PvmDbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- }
-
- public <T> T reload(T object, Class<T> persistentClass) {
- environment.get(DbSession.class).save(object);
- newTransaction();
-
- Long dbid = null;
- try {
- Field dbidField = ReflectUtil.getField(persistentClass, "dbid");
- dbidField.setAccessible(true);
- dbid = (Long) dbidField.get(object);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return environment.get(DbSession.class).get(persistentClass, dbid);
- }
-
- public ExecutionImpl reload(Execution execution) {
- environment.get(PvmDbSession.class).save(execution);
- newTransaction();
- return environment.get(PvmDbSession.class).get(ExecutionImpl.class, execution.getDbid());
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,82 +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.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.PvmException;
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class EnvironmentFactoryTestCase extends JbpmTestCase {
-
- String configResource;
-
- static Map<String, EnvironmentFactory> environmentFactories = new HashMap<String, EnvironmentFactory>();
-
- public EnvironmentFactoryTestCase() {
- this("environment.cfg.xml");
- }
-
- public EnvironmentFactoryTestCase(String configResource) {
- this.configResource = configResource;
- }
-
- public EnvironmentFactory getEnvironmentFactory() {
- if (isEnvironmentFactoryCached()) {
- return environmentFactories.get(configResource);
- }
- return createEnvironmentFactory();
- }
-
- boolean isEnvironmentFactoryCached() {
- return environmentFactories.containsKey(configResource);
- }
-
- EnvironmentFactory createEnvironmentFactory() {
- return createEnvironmentFactory(configResource);
- }
-
- static EnvironmentFactory createEnvironmentFactory(String configResource) {
- try {
- log.debug("creating environment factory for ["+configResource+"]");
- EnvironmentFactory newEnvironmentFactory = new PvmEnvironmentFactory(configResource);
- environmentFactories.put(configResource, newEnvironmentFactory);
- return newEnvironmentFactory;
- } catch (Exception e) {
- throw new PvmException("Exception during creation of environment factory for "+configResource, e);
- }
- }
-
- static void closeEnvironmentFactory(String configResource) {
- EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
- if (environmentFactory!=null) {
- log.debug("closing environment factory for ["+configResource+"]");
- environmentFactory.close();
- }
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,63 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library 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
- * version 2.1 of the License.
- * This library 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
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.test;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Guillaume Porcher
- *
- */
-public class EnvironmentFactoryTestSetup extends TestSetup
-{
- private String configResource;
-
- public EnvironmentFactoryTestSetup(Test test)
- {
- this(test, "environment.cfg.xml");
- }
-
- public EnvironmentFactoryTestSetup(Class<?> testClass)
- {
- this(new TestSuite(testClass), "environment.cfg.xml");
- }
-
- public EnvironmentFactoryTestSetup(Test test, String configResource)
- {
- super(test);
- this.configResource = configResource;
- }
-
- public EnvironmentFactoryTestSetup(Class<?> testClass, String configResource)
- {
- super(new TestSuite(testClass));
- this.configResource = configResource;
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- EnvironmentFactoryTestCase.createEnvironmentFactory(configResource);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
- super.tearDown();
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentTestCase.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentTestCase.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,58 +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.test;
-
-import org.jbpm.pvm.env.Environment;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class EnvironmentTestCase extends EnvironmentFactoryTestCase {
-
- protected Environment environment;
-
- public EnvironmentTestCase() {
- }
-
- public EnvironmentTestCase(String configResource) {
- super(configResource);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- openEnvironment();
- }
-
- public void tearDown() throws Exception {
- closeEnvironment();
- super.tearDown();
- }
-
- void closeEnvironment() {
- environment.close();
- environment = null;
- }
-
- void openEnvironment() {
- environment = getEnvironmentFactory().openEnvironment();
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/JbpmTestCase.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/JbpmTestCase.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
-import org.jbpm.log.Jdk14LogFactory;
-import org.jbpm.log.Log;
-import org.jbpm.log.LogFormatter;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
-
-public abstract class JbpmTestCase extends TestCase {
-
- static {
- Jdk14LogFactory.initializeJdk14Logging();
- }
-
- static protected Log log = Log.getLog(JbpmTestCase.class.getName());
-
- public void setUp() throws Exception {
- assertNull(Environment.getCurrent());
- LogFormatter.resetIndentation();
- log.info("=== starting "+getName()+" =============================");
- }
-
- public void tearDown() throws Exception {
- log.info("=== ending "+getName()+" =============================\n");
- assertNull(Environment.getCurrent());
- }
-
- public void assertTextPresent(String expected, String value) {
- if ( (value==null)
- || (value.indexOf(expected)==-1)
- ) {
- throw new AssertionFailedError("expected presence of '"+expected+"' but was '"+value+"'");
- }
- }
-
- public static Environment openEnvironment(String xmlString) {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(xmlString);
- return environmentFactory.openEnvironment();
- }
-
- protected void runTest() throws Throwable {
- try {
- super.runTest();
- } catch (AssertionFailedError e) {
- log.error("");
- log.error("ASSERTION FAILURE: "+e.getMessage());
- log.error("");
- throw e;
- } catch (Throwable t) {
- t.printStackTrace();
- throw t;
- }
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -31,12 +31,12 @@
import junit.framework.Test;
import org.hibernate.Session;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.model.OpenProcessDefinition;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/BasicEnvironmentTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,10 +21,10 @@
*/
package org.jbpm.pvm.api.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.test.JbpmTestCase;
/**
@@ -34,7 +34,7 @@
public class BasicEnvironmentTest extends JbpmTestCase {
public void testBasicEnvironmentOperation() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='a' class='"+Object.class.getName()+"' />" +
@@ -77,7 +77,7 @@
}
public void testCurrentEnvironment(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory/>" +
" <environment/>" +
@@ -107,7 +107,7 @@
public void testUnexistingElement() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='a' class='"+Object.class.getName()+"' />" +
@@ -128,7 +128,7 @@
}
public void testNoBlockEnvironment(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory/>" +
"</contexts>"
@@ -149,7 +149,7 @@
}
public void testNoApplicationEnvironment(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment/>" +
"</contexts>"
@@ -171,7 +171,7 @@
}
public void testEmptyEnvironment(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment/>"
);
assertNotNull(environmentFactory);
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentClassLoaderTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.api.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.test.JbpmTestCase;
/**
@@ -35,7 +35,7 @@
}
public void testDefaultClassLoader() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment />"
);
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentSearchOrderTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.api.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -36,7 +36,7 @@
{
public void testEnvironmentDefaultSearchOrder() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='environment-factory-a' />" +
@@ -58,7 +58,7 @@
}
public void testEnvironmentGivenSearchOrder() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='environment-factory-a' />" +
@@ -82,7 +82,7 @@
}
public void testEnvironmentGivenSearchOrderUnexistingObject() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='environment-factory-a' />" +
@@ -108,7 +108,7 @@
public void testEnvironmentDefaultSearchOrderWithAddedContext() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='environment-factory-a' />" +
@@ -142,7 +142,7 @@
}
public void testEnvironmentGivenSearchOrderWithAddedContext() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='environment-factory-a' />" +
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/EnvironmentTypeLookupTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.api.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.test.JbpmTestCase;
/**
@@ -35,7 +35,7 @@
}
public void testApplicationTypeLookup() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object class='"+A.class.getName()+"' />" +
@@ -59,7 +59,7 @@
public void testBlockTypeLookup() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='distraction' />" +
@@ -83,7 +83,7 @@
public void testNonExistingTypeLookup() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <string name='a' value='A' />" +
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/env/NestedEnvironmentTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.api.env;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.test.JbpmTestCase;
/**
@@ -33,7 +33,7 @@
{
public void testNestedEnvironments() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='a' class='"+Object.class.getName()+"' />" +
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/spring/SpringTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.api.spring;
import org.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.test.JbpmTestCase;
import org.springframework.context.support.ClassPathXmlApplicationContext;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerConfiguration.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerConfiguration.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -3,8 +3,8 @@
import org.jbpm.ExecutionService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessService;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
/**
* @author Pascal Verdage
@@ -40,7 +40,7 @@
private synchronized static void initialize() {
if (!isInitialized) {
isInitialized = true;
- environmentFactory = new PvmEnvironmentFactory("org/jbpm/pvm/timer/environment.cfg.xml");
+ environmentFactory = new JbpmConfiguration("org/jbpm/pvm/timer/environment.cfg.xml");
processService = environmentFactory.get(ProcessService.class);
executionService = environmentFactory.get(ExecutionService.class);
managementService = environmentFactory.get(ManagementService.class);
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -29,9 +29,9 @@
import org.hibernate.Session;
import org.jbpm.PvmException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.Transaction;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.type.variable.StringVariable;
import org.jbpm.test.DbTestCase;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -53,7 +53,7 @@
processDefinition.setVersion(3);
processDefinition.setDeploymentTime(deploymentTime);
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
assertEquals("name", processDefinition.getName());
assertEquals("description", processDefinition.getDescription());
@@ -65,7 +65,7 @@
{
OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
assertNotNull(processDefinition);
List<Node> nodes = processDefinition.getNodes();
@@ -90,7 +90,7 @@
{
OpenProcessDefinition processDefinition = ProcessFactory.build().node("a").initial().node("b").node("c").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
Node initial = processDefinition.getInitial();
assertNotNull(initial);
@@ -109,14 +109,14 @@
OpenProcessDefinition processDefinition = ProcessFactory.build().compositeNode("top").initial().node("a").compositeNode("b").node("b1")
.node("b2").node("b3").compositeEnd().node("c").compositeEnd().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
assertNotNull(processDefinition);
Node initial = processDefinition.getInitial();
assertNotNull(initial);
assertEquals(initial, processDefinition.getNode("top"));
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
List<Node> nodes = processDefinition.getNodes();
assertNotNull(nodes);
@@ -138,7 +138,7 @@
assertEquals("b2", nodes.get(1).getName());
assertEquals("b3", nodes.get(2).getName());
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
Node node = processDefinition.findNode("b2");
assertNotNull(node);
@@ -154,7 +154,7 @@
.transition("toc").to("c").node("b").transition("toa").to("a").transition().to("b").transition("toc").to("c").node("c")
.transition().to("c").node("d").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
assertEquals("a", processDefinition.getNode("a").getDefaultTransition().getDestination().getName());
assertEquals("a", processDefinition.getNode("b").getDefaultTransition().getDestination().getName());
@@ -169,7 +169,7 @@
OpenProcessDefinition processDefinition = ProcessFactory.build().node().initial().transition().to("a").transition().to("b").node("a")
.node("b").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // / new transaction ////////////////////////////
assertNotNull(processDefinition);
Node node = processDefinition.getInitial();
@@ -205,7 +205,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().event(Event.PROCESS_BEGIN).listener("one")
.listener("two").event(Event.PROCESS_END).listener("three").listener("four").node().initial().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
EventImpl event = processDefinition.getEvent(Event.PROCESS_BEGIN);
List<EventListenerReference> listenerReferences = event.getListenerReferences();
@@ -223,7 +223,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().event(Event.NODE_BEGIN)
.listener("one").listener("two").event(Event.NODE_END).listener("three").listener("four").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
EventImpl event = processDefinition.getNode("a").getEvent(Event.NODE_BEGIN);
List<EventListenerReference> listenerReferences = event.getListenerReferences();
@@ -241,7 +241,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().transition().to("b")
.listener("one").listener("two").node("b").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
EventImpl event = processDefinition.getNode("a").getDefaultTransition().getEvent();
List<EventListenerReference> listenerReferences = event.getListenerReferences();
@@ -255,7 +255,7 @@
.exceptionHandler(IllegalArgumentException.class).listener("one").listener("two").exceptionHandlerEnd().exceptionHandler(
RuntimeException.class).listener("three").listener("four").exceptionHandlerEnd().node().initial().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getExceptionHandlers();
@@ -276,7 +276,7 @@
IllegalArgumentException.class).listener("one").listener("two").exceptionHandlerEnd().exceptionHandler(RuntimeException.class)
.listener("three").listener("four").exceptionHandlerEnd().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getNode("a").getExceptionHandlers();
@@ -296,7 +296,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().property("key1", "val1").property("key2",
"val2").node().initial().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
assertEquals("val1", processDefinition.getProperty("key1"));
assertEquals("val2", processDefinition.getProperty("key2"));
@@ -307,7 +307,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node().initial().property("key1", "val1")
.property("key2", "val2").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
Node node = processDefinition.getInitial();
assertEquals("val1", node.getProperty("key1"));
@@ -319,7 +319,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().node("a").initial().transition().to("a")
.property("key1", "val1").property("key2", "val2").done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
Transition transition = processDefinition.getInitial().getDefaultTransition();
assertEquals("val1", transition.getProperty("key1"));
@@ -331,7 +331,7 @@
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)ProcessFactory.build().event(Event.PROCESS_BEGIN).property("key1",
"val1").property("key2", "val2").node().initial().done();
- processDefinition = reload(processDefinition); // / new transaction ////////////////////////////
+ processDefinition = reload(processDefinition, ProcessDefinitionImpl.class); // / new transaction ////////////////////////////
EventImpl event = processDefinition.getEvent(Event.PROCESS_BEGIN);
assertEquals("val1", event.getProperty("key1"));
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -37,7 +37,7 @@
{
OpenProcessDefinition processDefinition = new ProcessDefinitionImpl();
- processDefinition = reload(processDefinition); // new transaction /////////
+ processDefinition = reload(processDefinition, OpenProcessDefinition.class); // new transaction /////////
ExecutionImpl execution = new ExecutionImpl();
execution.setKey("businessKey");
@@ -45,7 +45,7 @@
execution.setState("test");
execution.setPriority(42);
- execution = reload(execution); // new transaction /////////////////////////
+ execution = reload(execution, ExecutionImpl.class); // new transaction /////////////////////////
assertNotNull(execution);
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/type/VariableCustomTypeTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -79,7 +79,7 @@
ExecutionImpl execution = (ExecutionImpl)clientProcessDefinition.startProcessInstance();
- execution = reload(execution);
+ execution = reload(execution, ExecutionImpl.class);
Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.YEAR, 2007);
@@ -92,7 +92,7 @@
execution.setVariable("v", calendar.getTime());
- execution = reload(execution);
+ execution = reload(execution, ExecutionImpl.class);
Variable variable = execution.getVariableObject("v");
assertEquals(DateVariable.class, variable.getClass());
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/GroovyExpressionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,10 +21,10 @@
*/
package org.jbpm.pvm.internal.expr;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.samples.activities.WaitState;
@@ -41,7 +41,7 @@
}
public void dontTestGroovyExpression() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/JuelExpressionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,10 +21,10 @@
*/
package org.jbpm.pvm.internal.expr;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.samples.activities.WaitState;
@@ -37,7 +37,7 @@
public class JuelExpressionTest extends JbpmTestCase {
public void testJuelExpression() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <script-manager default-expression-language='juel'" +
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/ExclusiveTestCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -27,9 +27,9 @@
import java.util.Set;
import org.hibernate.Session;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailOnceTestCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.jobexecutor;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.CommentImpl;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/FailingTestCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.jobexecutor;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/GenerateExceptionTestCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,8 +21,8 @@
*/
package org.jbpm.pvm.internal.jobexecutor;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -16,10 +16,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.jbpm.cmd.Command;
import org.jbpm.job.Message;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.session.MessageSession;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -33,6 +33,7 @@
import org.hibernate.Session;
import org.jbpm.ProcessService;
+import org.jbpm.cmd.Command;
import org.jbpm.job.Job;
import org.jbpm.log.Log;
import org.jbpm.pvm.DeploymentImpl;
@@ -42,7 +43,6 @@
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/TestMessageCommand.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,9 +24,9 @@
import java.util.List;
import java.util.Random;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.internal.wire;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
@@ -76,7 +76,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -126,7 +126,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -160,7 +160,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -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 = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -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 = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -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 = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -320,7 +320,7 @@
}
public void testOtherWireScope() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='factory' class='"+Object.class.getName()+"' />" +
@@ -363,14 +363,14 @@
index++;
assertEquals("close", events.get(index).eventName);
- PvmEnvironmentFactory pvmEnvironmentFactory = (PvmEnvironmentFactory) environmentFactory;
- WireContext applicationWireContext = pvmEnvironmentFactory.getEnvironmentFactoryCtxWireContext();
+ JbpmConfiguration jbpmConfiguration = (JbpmConfiguration) environmentFactory;
+ WireContext applicationWireContext = jbpmConfiguration.getEnvironmentFactoryCtxWireContext();
assertEquals(applicationWireContext, events.get(index).source);
assertNull(events.get(index).info);
}
public void testOtherWireScopeWithEventFiltering() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='factory' class='"+Object.class.getName()+"' />" +
@@ -408,7 +408,7 @@
}
public void testUnexistingScope() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -437,7 +437,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
@@ -496,7 +496,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialization
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory />" +
" <environment>" +
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -16,9 +16,9 @@
import java.util.HashSet;
import java.util.Set;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.wire.WireContext;
/**
@@ -149,7 +149,7 @@
}
public void testHasOnEmptyEnv(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,8 +1,8 @@
package org.jbpm.pvm.internal.wire;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.wire.WireContext;
/**
@@ -12,7 +12,7 @@
public class EnvWireTest extends WireTestCase {
public void testEnvironmentWire(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -36,7 +36,7 @@
}
public void testEnvironmentFactoryWire(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -59,7 +59,7 @@
}
public void testContextRefEnvironmentWire(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -83,7 +83,7 @@
}
public void testContextRefEnvironmentFactoryWire(){
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory>" +
" <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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MethodSubscriptionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -1,8 +1,8 @@
package org.jbpm.pvm.internal.wire;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireException;
@@ -44,7 +44,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithNoArg() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -86,7 +86,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithBadName() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -123,7 +123,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithOneArg() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -170,7 +170,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithTwoArgs() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -230,7 +230,7 @@
* The recorder is eagerly initialized.
*/
public void testMethodWithThreeArgs() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -282,7 +282,7 @@
* Test subscription using a specified method and two objects.
*/
public void testMethodWithArgsAndMultipleObjectsSubcription() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -373,7 +373,7 @@
}
public void testMethodAndOverLoading() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -428,7 +428,7 @@
}
public void testMethodAndBadArg() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectSubscriptionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.wire;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireException;
@@ -38,7 +38,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is no eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -80,7 +80,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -126,7 +126,7 @@
// <subscribe objects='...' /> will use the object as the observable
// In this test, there is eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -193,7 +193,7 @@
}
public void testUnexistingObject() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -216,7 +216,7 @@
// <subscribe object='...' /> will use the object as the observable
// In this test, there is eager initialization
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -266,7 +266,7 @@
}
public void testNotObservableObject() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -288,7 +288,7 @@
}
public void testNotListener() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireEventsSubscriptionTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.wire;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.util.DefaultObservable;
import org.jbpm.pvm.internal.util.Observable;
import org.jbpm.pvm.internal.wire.WireObjectEventInfo;
@@ -40,7 +40,7 @@
// class Descriptor
public void testRegisterToAllDescriptors() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -82,7 +82,7 @@
}
public void testOneObjectDescriptor() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -139,7 +139,7 @@
}
public void testMultipleObjectDescriptors() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -215,7 +215,7 @@
}
public void testOneObjectDescriptorWithEventFilter() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
@@ -256,7 +256,7 @@
}
public void testMultipleObjectDescriptorsWithEventFilter() {
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
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 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/WireObservableTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,10 +23,10 @@
import java.util.List;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
import org.jbpm.pvm.internal.util.Listener;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.test.JbpmTestCase;
@@ -46,7 +46,7 @@
// <subscribe /> will use the scope as the observable
// In this test, there is no eager initialisation
- EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<environment-scopes>" +
" <environment-factory />" +
" <environment>" +
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ExamplesConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ExamplesConfiguration.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ExamplesConfiguration.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -24,8 +24,8 @@
import org.jbpm.ExecutionService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessService;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
/**
@@ -62,7 +62,7 @@
private synchronized static void initialize() {
if (!isInitialized) {
isInitialized = true;
- environmentFactory = new PvmEnvironmentFactory("environment.cfg.xml");
+ environmentFactory = new JbpmConfiguration("environment.cfg.xml");
processService = environmentFactory.get(ProcessService.class);
executionService = environmentFactory.get(ExecutionService.class);
managementService = environmentFactory.get(ManagementService.class);
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex13/EnvironmentTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex13/EnvironmentTest.java 2008-10-31 16:16:33 UTC (rev 2709)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex13/EnvironmentTest.java 2008-10-31 16:17:37 UTC (rev 2710)
@@ -23,16 +23,16 @@
import junit.framework.TestCase;
+import org.jbpm.cfg.JbpmConfiguration;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
/**
* @author Tom Baeyens
*/
public class EnvironmentTest extends TestCase {
- static EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(
+ static EnvironmentFactory environmentFactory = JbpmConfiguration.parseXmlString(
"<contexts>" +
" <environment-factory>" +
" <object name='book' class='org.jbpm.pvm.samples.ex13.Book' />" +
15 years, 6 months
JBoss JBPM SVN: r2709 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:16:33 -0400 (Fri, 31 Oct 2008)
New Revision: 2709
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/Command.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/CommandService.java
Removed:
jbpm4/trunk/modules/cts/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ResourceManager.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/ExecuteTimerCmd.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/LocalCommandExecutor.java
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/RemoteCommandExecutor.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/InsertPhraseCmd.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/RemovePhraseCmd.java
Log:
unification api proposals
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Configuration.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -1,7 +1,120 @@
+/*
+ * 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;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
-public abstract class Configuration {
+import org.xml.sax.InputSource;
- public abstract ProcessEngine buildProcessEngine();
+/**
+ * process engine configuration.
+ *
+ * @author Tom Baeyens
+ */
+public class Configuration {
+
+ static Map<String, String> implementationClassNames = null;
+
+ Configuration impl;
+
+ public Configuration() {
+ this(null);
+ }
+
+ public Configuration(String type) {
+ if (type==null) {
+ throw new PvmException("type is null");
+ }
+ String implementationClass = getImplementationClassName(type);
+ if (implementationClass==null) {
+ throw new PvmException("type is null");
+ }
+ if ("jbpm".equals(type)) {
+ impl = instantiate("org.jbpm.cfg.JbpmConfiguration");
+ }
+ }
+
+ private synchronized String getImplementationClassName(String type) {
+ if (implementationClassNames==null) {
+ implementationClassNames = new HashMap<String, String>();
+ // null represents the default configuration (== the JbpmConfiguration)
+ implementationClassNames.put(null, "org.jbpm.cfg.JbpmConfiguration");
+ // TODO
+ // implementationClasses.put("spring", "org.jbpm.cfg.SpringConfiguration");
+ // implementationClasses.put("mc", "org.jbpm.cfg.McConfiguration");
+ // implementationClasses.put("programatic", "org.jbpm.cfg.ProgramaticConfiguration");
+ }
+ String implementationClassName = implementationClassNames.get(type);
+ if (implementationClassName==null) {
+ implementationClassName = type;
+ }
+ return implementationClassName;
+ }
+
+ private Configuration instantiate(String className) {
+ ClassLoader classLoader = getClassLoader();
+ Configuration implementation;
+ try {
+ Class<?> implementationClass = classLoader.loadClass(className);
+ implementation = (Configuration) implementationClass.newInstance();
+ } catch (Exception e) {
+ throw new PvmException("couldn't instantiate configuration of type "+className, e);
+ }
+ return implementation;
+ }
+
+ protected ClassLoader getClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ public void setXmlString(String xmlString) {
+ impl.setXmlString(xmlString);
+ }
+
+ public void setResource(String resource) {
+ impl.setResource(resource);
+ }
+
+ public void setInputStream(InputStream inputStream) {
+ impl.setInputStream(inputStream);
+ }
+
+ public void setInputSource(InputSource inputSource) {
+ impl.setInputSource(inputSource);
+ }
+
+ public void setUrl(URL url) {
+ impl.setUrl(url);
+ }
+
+ public void setFile(File file) {
+ impl.setFile(file);
+ }
+
+ public ProcessEngine buildProcessEngine() {
+ return impl.buildProcessEngine();
+ }
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -1,3 +1,24 @@
+/*
+ * 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;
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ResourceManager.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ResourceManager.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ResourceManager.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -1,3 +1,24 @@
+/*
+ * 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;
/** can be used to provide transactional reasources
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -1,3 +1,24 @@
+/*
+ * 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;
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/Command.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/Command.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/Command.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/Command.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -0,0 +1,10 @@
+package org.jbpm.cmd;
+
+import java.io.Serializable;
+
+import org.jbpm.pvm.env.Environment;
+
+public interface Command<T> extends Serializable {
+
+ T execute(Environment environment) throws Exception;
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/Command.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/CommandService.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CommandService.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/CommandService.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/CommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -0,0 +1,22 @@
+package org.jbpm.cmd;
+
+import org.jbpm.PvmException;
+
+/**
+ * abstract extensible session facade. Developers can use this directly or
+ * extend one of the implementations with custom methods.
+ * Developers should be encouraged to use this interface as it will
+ * be kept more stable then direct usage of the API (which is still
+ * allowed).
+ * All the method implementations should be based on commands.
+ * Each of the method implementations will have a environment block.
+ * Then the command is executed and the environment is passed into the
+ * command.
+ */
+public interface CommandService {
+
+ /**
+ * @throws PvmException if command throws an exception.
+ */
+ <T> T execute(Command<T> command);
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/cmd/CommandService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -47,18 +47,18 @@
*
* @author Tom Baeyens
*/
-public abstract class EnvironmentFactory implements Context, Serializable {
+public interface EnvironmentFactory extends Context, Serializable {
/**
* open a new Environment. The client is responsible for
* closing the environment with {@link Environment#close()}.
*/
- public abstract Environment openEnvironment();
+ Environment openEnvironment();
/**
* closes this environment factory and cleans any allocated
* resources.
*/
- public abstract void close();
+ void close();
}
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandExecutorSLSB.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -30,11 +30,11 @@
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import org.jbpm.cfg.JbpmConfiguration;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.env.EnvironmentFactory;
-import org.jbpm.pvm.env.PvmEnvironmentFactory;
-import org.jbpm.pvm.internal.cmd.Command;
/**
* Stateless session command executor.
@@ -176,7 +176,7 @@
private static EnvironmentFactory parseConfig(String resource) {
log.debug("parsing configuration from " + resource);
- return new PvmEnvironmentFactory(resource);
+ return new JbpmConfiguration(resource);
}
private static void bind(Context context, EnvironmentFactory environmentFactory, String name) {
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/CommandReceiverMDB.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -40,8 +40,8 @@
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.jobexecutor.ExecuteJobCmd;
/**
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EnterpriseLocalCommandService.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -27,8 +27,8 @@
import javax.naming.NamingException;
import org.jbpm.PvmException;
-import org.jbpm.pvm.internal.cmd.Command;
-import org.jbpm.pvm.internal.cmd.CommandService;
+import org.jbpm.cmd.Command;
+import org.jbpm.cmd.CommandService;
/**
* Local, stateless session bean implementation of the command service.
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/ExecuteTimerCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/ExecuteTimerCmd.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/ExecuteTimerCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -23,9 +23,9 @@
import java.util.Date;
+import org.jbpm.cmd.Command;
import org.jbpm.log.Log;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.session.DbSession;
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/LocalCommandExecutor.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/LocalCommandExecutor.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/LocalCommandExecutor.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -21,7 +21,7 @@
*/
package org.jbpm.enterprise.internal.ejb;
-import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.cmd.Command;
/**
* EJB2 local interface for the command executor.
Modified: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/RemoteCommandExecutor.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/RemoteCommandExecutor.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/RemoteCommandExecutor.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -23,7 +23,7 @@
import java.rmi.RemoteException;
-import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.cmd.Command;
/**
* EJB2 remote interface for the command executor.
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/CommandReceiverTest.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -35,10 +35,10 @@
import org.apache.cactus.ServletTestCase;
+import org.jbpm.cmd.Command;
import org.jbpm.enterprise.internal.ejb.CommandReceiverMDB;
import org.jbpm.enterprise.test.custom.InsertPhraseCmd;
import org.jbpm.enterprise.test.custom.RemovePhraseCmd;
-import org.jbpm.pvm.internal.cmd.Command;
/**
* Server-side test for the {@linkplain CommandReceiverMDB command receiver}.
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/EnterpriseTimerSessionTest.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -29,13 +29,13 @@
import org.apache.cactus.ServletTestCase;
import org.jbpm.Execution;
+import org.jbpm.cmd.Command;
import org.jbpm.enterprise.internal.ejb.EnterpriseTimerSession;
import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
import org.jbpm.enterprise.test.custom.HappyActivity;
import org.jbpm.pvm.DeploymentImpl;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
import org.jbpm.pvm.internal.job.TimerImpl;
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -29,6 +29,7 @@
import javax.naming.InitialContext;
import org.apache.cactus.ServletTestCase;
+import org.jbpm.cmd.Command;
import org.jbpm.enterprise.internal.ejb.LocalCommandExecutor;
import org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome;
import org.jbpm.enterprise.internal.ejb.LocalTimer;
@@ -39,7 +40,6 @@
import org.jbpm.log.Log;
import org.jbpm.pvm.DeploymentImpl;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/InsertPhraseCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/InsertPhraseCmd.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/InsertPhraseCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -23,8 +23,8 @@
import java.sql.SQLException;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.session.DbSession;
/**
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/RemovePhraseCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/RemovePhraseCmd.java 2008-10-31 16:14:37 UTC (rev 2708)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/custom/RemovePhraseCmd.java 2008-10-31 16:16:33 UTC (rev 2709)
@@ -26,8 +26,8 @@
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
+import org.jbpm.cmd.Command;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.internal.cmd.Command;
/**
* @author Alejandro Guizar
15 years, 6 months
JBoss JBPM SVN: r2708 - in jbpm4/trunk/modules: test-pojo and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:14:37 -0400 (Fri, 31 Oct 2008)
New Revision: 2708
Added:
jbpm4/trunk/modules/test-pojo/
Modified:
jbpm4/trunk/modules/test-pojo/.classpath
jbpm4/trunk/modules/test-pojo/pom.xml
Log:
unification api proposals
Copied: jbpm4/trunk/modules/test-pojo (from rev 2701, jbpm4/trunk/modules/cts)
Property changes on: jbpm4/trunk/modules/test-pojo
___________________________________________________________________
Name: svn:ignore
+ target
.settings
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/test-pojo/.classpath
===================================================================
--- jbpm4/trunk/modules/cts/.classpath 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/test-pojo/.classpath 2008-10-31 16:14:37 UTC (rev 2708)
@@ -3,5 +3,5 @@
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="output" path="target/test-classes"/>
</classpath>
Modified: jbpm4/trunk/modules/test-pojo/pom.xml
===================================================================
--- jbpm4/trunk/modules/cts/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/test-pojo/pom.xml 2008-10-31 16:14:37 UTC (rev 2708)
@@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<name>jBPM 4 - CTS DB</name>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-cts</artifactId>
+ <artifactId>jbpm-test-pojo</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
15 years, 6 months
JBoss JBPM SVN: r2707 - in jbpm4/trunk/modules: cts-pojo and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:14:25 -0400 (Fri, 31 Oct 2008)
New Revision: 2707
Added:
jbpm4/trunk/modules/cts-pojo/
Removed:
jbpm4/trunk/modules/cts-pojo/
jbpm4/trunk/modules/cts-pojo/src/test/java/org/
jbpm4/trunk/modules/cts-pojo/src/test/resources/
Modified:
jbpm4/trunk/modules/cts-pojo/.classpath
jbpm4/trunk/modules/cts-pojo/pom.xml
Log:
unification api proposals
Copied: jbpm4/trunk/modules/cts-pojo (from rev 2701, jbpm4/trunk/modules/cts)
Property changes on: jbpm4/trunk/modules/cts-pojo
___________________________________________________________________
Name: svn:ignore
+ target
.settings
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/cts-pojo/.classpath
===================================================================
--- jbpm4/trunk/modules/cts/.classpath 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/cts-pojo/.classpath 2008-10-31 16:14:25 UTC (rev 2707)
@@ -3,5 +3,5 @@
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="output" path="target/test-classes"/>
</classpath>
Modified: jbpm4/trunk/modules/cts-pojo/pom.xml
===================================================================
--- jbpm4/trunk/modules/cts/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/cts-pojo/pom.xml 2008-10-31 16:14:25 UTC (rev 2707)
@@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<name>jBPM 4 - CTS DB</name>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-cts</artifactId>
+ <artifactId>jbpm-test-load</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
15 years, 6 months
JBoss JBPM SVN: r2706 - in jbpm4/trunk/modules: cts-pojo and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:13:59 -0400 (Fri, 31 Oct 2008)
New Revision: 2706
Added:
jbpm4/trunk/modules/cts-pojo/
Removed:
jbpm4/trunk/modules/cts-pojo/src/test/java/org/
jbpm4/trunk/modules/cts-pojo/src/test/resources/
Modified:
jbpm4/trunk/modules/cts-pojo/.classpath
jbpm4/trunk/modules/cts-pojo/pom.xml
Log:
unification api proposals
Copied: jbpm4/trunk/modules/cts-pojo (from rev 2701, jbpm4/trunk/modules/cts)
Property changes on: jbpm4/trunk/modules/cts-pojo
___________________________________________________________________
Name: svn:ignore
+ target
.settings
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/cts-pojo/.classpath
===================================================================
--- jbpm4/trunk/modules/cts/.classpath 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/cts-pojo/.classpath 2008-10-31 16:13:59 UTC (rev 2706)
@@ -3,5 +3,5 @@
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="output" path="target/test-classes"/>
</classpath>
Modified: jbpm4/trunk/modules/cts-pojo/pom.xml
===================================================================
--- jbpm4/trunk/modules/cts/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/cts-pojo/pom.xml 2008-10-31 16:13:59 UTC (rev 2706)
@@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<name>jBPM 4 - CTS DB</name>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-cts</artifactId>
+ <artifactId>jbpm-test-db</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
15 years, 6 months
JBoss JBPM SVN: r2705 - in jbpm4/trunk/modules: test-base and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 12:07:13 -0400 (Fri, 31 Oct 2008)
New Revision: 2705
Added:
jbpm4/trunk/modules/test-base/
jbpm4/trunk/modules/test-base/pom.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Removed:
jbpm4/trunk/modules/test-base/pom.xml
Log:
unification api proposals
Copied: jbpm4/trunk/modules/test-base (from rev 2701, jbpm4/trunk/modules/test)
Property changes on: jbpm4/trunk/modules/test-base
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/test-base/pom.xml
===================================================================
--- jbpm4/trunk/modules/test/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/test-base/pom.xml 2008-10-31 16:07:13 UTC (rev 2705)
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>jBPM 4 - Test</name>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-test</artifactId>
- <packaging>jar</packaging>
-
- <!-- Parent -->
- <parent>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-api</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </dependency>
- </dependencies>
-
- <!-- Plugins -->
- <build>
- <plugins>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
Copied: jbpm4/trunk/modules/test-base/pom.xml (from rev 2702, jbpm4/trunk/modules/test/pom.xml)
===================================================================
--- jbpm4/trunk/modules/test-base/pom.xml (rev 0)
+++ jbpm4/trunk/modules/test-base/pom.xml 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>jBPM 4 - Test</name>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-api</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-log</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ </dependency>
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <plugins>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/Db.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.MySQLDialect;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.mapping.ForeignKey;
+import org.hibernate.mapping.Table;
+import org.jbpm.pvm.env.EnvironmentFactory;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Db {
+
+ private static final String CLEAN_SQL_KEY = "cleanSql";
+
+ public static void clean(EnvironmentFactory environmentFactory) {
+ SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
+ String[] cleanSql = (String[]) environmentFactory.get(CLEAN_SQL_KEY);
+
+ if (cleanSql == null) {
+ Configuration configuration = environmentFactory.get(Configuration.class);
+
+ SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
+ Dialect dialect = sessionFactoryImplementor.getDialect();
+
+ // loop over all foreign key constraints
+ List<String> dropForeignKeysSql = new ArrayList<String>();
+ List<String> createForeignKeysSql = new ArrayList<String>();
+ Iterator<Table> iter = configuration.getTableMappings();
+ while (iter.hasNext()) {
+ Table table = (Table) iter.next();
+ if (table.isPhysicalTable()) {
+ String catalog = table.getCatalog();
+ String schema = table.getSchema();
+ Iterator<ForeignKey> subIter = table.getForeignKeyIterator();
+ while (subIter.hasNext()) {
+ ForeignKey fk = (ForeignKey) subIter.next();
+ if (fk.isPhysicalConstraint()) {
+ // collect the drop foreign key constraint sql
+ dropForeignKeysSql.add(fk.sqlDropString(dialect, catalog, schema));
+ // MySQLDialect creates an index for each foreign key.
+ // see
+ // http://opensource.atlassian.com/projects/hibernate/browse/HHH-2155
+ // This index should be dropped or an error will be thrown during
+ // the creation phase
+ if (dialect instanceof MySQLDialect) {
+ dropForeignKeysSql.add("alter table " + table.getName() + " drop key " + fk.getName());
+ }
+ // and collect the create foreign key constraint sql
+ createForeignKeysSql.add(fk.sqlCreateString(dialect, sessionFactoryImplementor, catalog, schema));
+ }
+ }
+ }
+ }
+
+ List<String> deleteSql = new ArrayList<String>();
+ iter = configuration.getTableMappings();
+ while (iter.hasNext()) {
+ Table table = (Table) iter.next();
+ if (table.isPhysicalTable()) {
+ deleteSql.add("delete from " + table.getName());
+ }
+ }
+
+ // glue
+ // - drop foreign key constraints
+ // - delete contents of all tables
+ // - create foreign key constraints
+ // together to form the clean script
+ List<String> cleanSqlList = new ArrayList<String>();
+ cleanSqlList.addAll(dropForeignKeysSql);
+ cleanSqlList.addAll(deleteSql);
+ cleanSqlList.addAll(createForeignKeysSql);
+
+ cleanSql = (String[]) cleanSqlList.toArray(new String[cleanSqlList.size()]);
+
+ environmentFactory.set(CLEAN_SQL_KEY, cleanSql);
+ }
+
+ Session session = sessionFactory.openSession();
+ try {
+ for (String query : cleanSql) {
+ session.createSQLQuery(query).executeUpdate();
+ }
+ } finally {
+ session.close();
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/DbTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import org.jbpm.ExecutionService;
+import org.jbpm.ManagementService;
+import org.jbpm.ProcessService;
+import org.jbpm.cmd.CommandService;
+
+
+/** for tests that use persistence through a command service.
+ *
+ * The DB is cleaned inbetween tests. No environment is created.
+ *
+ * @author Tom Baeyens
+ */
+public abstract class DbTestCase extends EnvironmentFactoryTestCase {
+
+ protected CommandService commandService;
+ protected ProcessService processService;
+ protected ExecutionService executionService;
+ protected ManagementService managementService;
+
+ public DbTestCase() {
+ super();
+ }
+
+ public DbTestCase(String configResource) {
+ super(configResource);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ if (isEnvironmentFactoryCached()) {
+ Db.clean(getEnvironmentFactory());
+ }
+
+ commandService = getEnvironmentFactory().get(CommandService.class);
+ processService = getEnvironmentFactory().get(ProcessService.class);
+ executionService = getEnvironmentFactory().get(ExecutionService.class);
+ managementService = getEnvironmentFactory().get(ManagementService.class);
+ }
+
+ public void tearDown() throws Exception {
+ commandService = null;
+ processService = null;
+ executionService = null;
+ managementService = null;
+ super.tearDown();
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import java.lang.reflect.Field;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.jbpm.Execution;
+import org.jbpm.pvm.model.OpenProcessDefinition;
+import org.jbpm.pvm.session.DbSession;
+import org.jbpm.pvm.session.PvmDbSession;
+
+
+/** for tests that use persistence inside environment blocks.
+ *
+ * An environment is opened in the setUp and closed in the tearDown.
+ * DB is cleaned inbetween tests. Extra convenience methods for usage
+ * inside an environment block are provided.
+ *
+ * @author Tom Baeyens
+ */
+public class EnvironmentDbTestCase extends EnvironmentTestCase {
+
+ Transaction transaction = null;
+
+ public EnvironmentDbTestCase() {
+ }
+
+ public EnvironmentDbTestCase(String configResource) {
+ super(configResource);
+ }
+
+ public void setUp() throws Exception {
+ if (isEnvironmentFactoryCached()) {
+ Db.clean(getEnvironmentFactory());
+ }
+ super.setUp();
+ beginTransaction();
+ }
+
+ public void tearDown() throws Exception {
+ commitTransaction();
+ super.tearDown();
+ }
+
+ void beginTransaction() {
+ Session session = environment.get(Session.class);
+ transaction = session.beginTransaction();
+ }
+
+ void commitTransaction() {
+ transaction.commit();
+ transaction = null;
+ }
+
+ void rollbackTransaction() {
+ transaction.rollback();
+ transaction = null;
+ }
+
+ public DbSession getDbSession() {
+ return environment.get(DbSession.class);
+ }
+
+ public void rollbackAndBeginNewTransaction() {
+ rollbackTransaction();
+ closeEnvironment();
+ openEnvironment();
+ beginTransaction();
+ }
+
+ public void newTransaction() {
+ try {
+ commitTransaction();
+ closeEnvironment();
+ } finally {
+ openEnvironment();
+ beginTransaction();
+ }
+ }
+
+ public void beginCacheTest() {
+ SessionFactory sessionFactory = environment.get(SessionFactory.class);
+ if (sessionFactory != null) {
+ log.debug("=================================================================");
+ log.debug("Beginning of the cache test, no more sql query should be performed before the end of the test");
+ log.debug("=================================================================");
+
+ sessionFactory.getStatistics().clear();
+ sessionFactory.getStatistics().setStatisticsEnabled(true);
+ }
+ }
+
+ public void endCacheTest() {
+ SessionFactory sessionFactory = environment.get(SessionFactory.class);
+ if (sessionFactory != null) {
+ assertEquals(0, sessionFactory.getStatistics().getEntityLoadCount());
+ assertEquals(0, sessionFactory.getStatistics().getCollectionLoadCount());
+ }
+ }
+
+ public <T> T reload(T object, Class<T> persistentClass) {
+ environment.get(DbSession.class).save(object);
+ newTransaction();
+
+ Long dbid = null;
+ try {
+ Field dbidField = persistentClass.getDeclaredField("dbid");
+ dbidField.setAccessible(true);
+ dbid = (Long) dbidField.get(object);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ new RuntimeException(e);
+ }
+
+ return environment.get(DbSession.class).get(persistentClass, dbid);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentDbTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.PvmException;
+import org.jbpm.pvm.env.EnvironmentFactory;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class EnvironmentFactoryTestCase extends JbpmTestCase {
+
+ String configResource;
+
+ static Map<String, EnvironmentFactory> environmentFactories = new HashMap<String, EnvironmentFactory>();
+
+ public EnvironmentFactoryTestCase() {
+ this("environment.cfg.xml");
+ }
+
+ public EnvironmentFactoryTestCase(String configResource) {
+ this.configResource = configResource;
+ }
+
+ public EnvironmentFactory getEnvironmentFactory() {
+ if (isEnvironmentFactoryCached()) {
+ return environmentFactories.get(configResource);
+ }
+ return createEnvironmentFactory();
+ }
+
+ boolean isEnvironmentFactoryCached() {
+ return environmentFactories.containsKey(configResource);
+ }
+
+ EnvironmentFactory createEnvironmentFactory() {
+ return createEnvironmentFactory(configResource);
+ }
+
+ static EnvironmentFactory createEnvironmentFactory(String configResource) {
+ try {
+ log.debug("creating environment factory for ["+configResource+"]");
+ EnvironmentFactory newEnvironmentFactory = new PvmEnvironmentFactory(configResource);
+ environmentFactories.put(configResource, newEnvironmentFactory);
+ return newEnvironmentFactory;
+ } catch (Exception e) {
+ throw new PvmException("Exception during creation of environment factory for "+configResource, e);
+ }
+ }
+
+ static void closeEnvironmentFactory(String configResource) {
+ EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
+ if (environmentFactory!=null) {
+ log.debug("closing environment factory for ["+configResource+"]");
+ environmentFactory.close();
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2007 Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library 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
+ * version 2.1 of the License.
+ * This library 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
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ **/
+package org.jbpm.test;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Guillaume Porcher
+ *
+ */
+public class EnvironmentFactoryTestSetup extends TestSetup
+{
+ private String configResource;
+
+ public EnvironmentFactoryTestSetup(Test test)
+ {
+ this(test, "environment.cfg.xml");
+ }
+
+ public EnvironmentFactoryTestSetup(Class<?> testClass)
+ {
+ this(new TestSuite(testClass), "environment.cfg.xml");
+ }
+
+ public EnvironmentFactoryTestSetup(Test test, String configResource)
+ {
+ super(test);
+ this.configResource = configResource;
+ }
+
+ public EnvironmentFactoryTestSetup(Class<?> testClass, String configResource)
+ {
+ super(new TestSuite(testClass));
+ this.configResource = configResource;
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ EnvironmentFactoryTestCase.createEnvironmentFactory(configResource);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ EnvironmentFactoryTestCase.closeEnvironmentFactory(configResource);
+ super.tearDown();
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentFactoryTestSetup.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentTestCase.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/EnvironmentTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentTestCase.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import org.jbpm.pvm.env.Environment;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class EnvironmentTestCase extends EnvironmentFactoryTestCase {
+
+ protected Environment environment;
+
+ public EnvironmentTestCase() {
+ }
+
+ public EnvironmentTestCase(String configResource) {
+ super(configResource);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ openEnvironment();
+ }
+
+ public void tearDown() throws Exception {
+ closeEnvironment();
+ super.tearDown();
+ }
+
+ void closeEnvironment() {
+ environment.close();
+ environment = null;
+ }
+
+ void openEnvironment() {
+ environment = getEnvironmentFactory().openEnvironment();
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/EnvironmentTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/test/JbpmTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2008-10-31 16:07:13 UTC (rev 2705)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+import org.jbpm.log.Jdk14LogFactory;
+import org.jbpm.log.Log;
+import org.jbpm.log.LogFormatter;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.env.EnvironmentFactory;
+import org.jbpm.pvm.env.PvmEnvironmentFactory;
+
+public abstract class JbpmTestCase extends TestCase {
+
+ static {
+ Jdk14LogFactory.initializeJdk14Logging();
+ }
+
+ static protected Log log = Log.getLog(JbpmTestCase.class.getName());
+
+ public void setUp() throws Exception {
+ assertNull(Environment.getCurrent());
+ LogFormatter.resetIndentation();
+ log.info("=== starting "+getName()+" =============================");
+ }
+
+ public void tearDown() throws Exception {
+ log.info("=== ending "+getName()+" =============================\n");
+ assertNull(Environment.getCurrent());
+ }
+
+ public void assertTextPresent(String expected, String value) {
+ if ( (value==null)
+ || (value.indexOf(expected)==-1)
+ ) {
+ throw new AssertionFailedError("expected presence of '"+expected+"' but was '"+value+"'");
+ }
+ }
+
+ public static Environment openEnvironment(String xmlString) {
+ EnvironmentFactory environmentFactory = PvmEnvironmentFactory.parseXmlString(xmlString);
+ return environmentFactory.openEnvironment();
+ }
+
+ protected void runTest() throws Throwable {
+ try {
+ super.runTest();
+ } catch (AssertionFailedError e) {
+ log.error("");
+ log.error("ASSERTION FAILURE: "+e.getMessage());
+ log.error("");
+ throw e;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw t;
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
___________________________________________________________________
Name: svn:mergeinfo
+
15 years, 6 months
JBoss JBPM SVN: r2704 - projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/ri/service/persistence.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-10-31 10:53:41 -0400 (Fri, 31 Oct 2008)
New Revision: 2704
Modified:
projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/ri/service/persistence/NodePersistenceTest.java
Log:
Remove hbn.init
Modified: projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/ri/service/persistence/NodePersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/ri/service/persistence/NodePersistenceTest.java 2008-10-31 13:42:21 UTC (rev 2703)
+++ projects/spec/trunk/modules/ri/src/test/java/org/jbpm/test/ri/service/persistence/NodePersistenceTest.java 2008-10-31 14:53:41 UTC (rev 2704)
@@ -74,7 +74,6 @@
try
{
T node = service.loadNode(session, nodeClass, nodeID);
- Hibernate.initialize(node);
return node;
}
finally
15 years, 6 months
JBoss JBPM SVN: r2703 - in projects/spec/trunk/modules: api/src/main/java/org/jbpm/api/runtime and 15 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-10-31 09:42:21 -0400 (Fri, 31 Oct 2008)
New Revision: 2703
Added:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/NodeNotFoundException.java
Removed:
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/SessionAssociation.java
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/ProcessNotFoundException.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/endevent/EndEventMessageTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewayMergeTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewayMergeTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewaySplitTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewayMergeTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewaySplitTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/process/ProcessPropertyTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/startevent/StartEventSignalTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/ReceiveTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/SendTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/TaskExecutionHandlerTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskCallbackTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/transaction/TxRequiredTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/simplemerge/SimpleMergeTest.java
projects/spec/trunk/modules/cts/src/test/resources/log4j.xml
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ExclusiveGatewayImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/GatewayImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RuntimeContext.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TransactionInterceptor.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/HibernatePersistenceServiceImpl.java
Log:
Associate persistence session with token
Added: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/NodeNotFoundException.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/NodeNotFoundException.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/NodeNotFoundException.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.api;
+
+
+// $Id$
+
+/**
+ * A RuntimeException that is when a node cannot be found in persistent storage.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Sep-2008
+ */
+@SuppressWarnings("serial")
+public class NodeNotFoundException extends BPMException
+{
+ public NodeNotFoundException(String message)
+ {
+ super(message);
+ }
+
+ public NodeNotFoundException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/NodeNotFoundException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/ProcessNotFoundException.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/ProcessNotFoundException.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/ProcessNotFoundException.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -33,13 +33,13 @@
@SuppressWarnings("serial")
public class ProcessNotFoundException extends BPMException
{
- public ProcessNotFoundException()
- {
- super();
- }
-
public ProcessNotFoundException(String message)
{
super(message);
}
+
+ public ProcessNotFoundException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
}
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/runtime/Token.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -23,6 +23,7 @@
// $Id$
+import org.hibernate.Session;
import org.jbpm.api.model.SequenceFlow;
/**
@@ -62,5 +63,10 @@
/**
* Get the current {@link SequenceFlow}
*/
- SequenceFlow getFlow();
+ SequenceFlow getSequenceFlow();
+
+ /**
+ * Get the associated persistence session
+ */
+ Session getSession();
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/endevent/EndEventMessageTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/endevent/EndEventMessageTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/endevent/EndEventMessageTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -54,7 +54,7 @@
proc.startProcess(att);
// Wait for the process to end
- proc.waitForEnd();
+ proc.waitForEnd(5000);
// Verify the result
Message endMessage = getMessages().get(0);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewayMergeTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewayMergeTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewayMergeTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -53,7 +53,7 @@
proc.startProcess();
// Wait for the process to end
- proc.waitForEnd();
+ proc.waitForEnd(5000);
// Verify the result
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -54,7 +54,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "5");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
assertEquals(1, endSignals.size());
@@ -69,7 +69,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "15");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
assertEquals(1, endSignals.size());
@@ -86,7 +86,7 @@
proc.startProcess(att);
try
{
- proc.waitForEnd();
+ proc.waitForEnd(5000);
fail("No gate defined for foo==10");
}
catch (RuntimeException rte)
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewayMergeTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewayMergeTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewayMergeTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -52,7 +52,7 @@
proc.startProcess();
// Wait for the process to end
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
assertEquals(2, endSignals.size());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewaySplitTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewaySplitTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/inclusive/InclusiveGatewaySplitTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -54,7 +54,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "5");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
assertEquals(2, endSignals.size());
@@ -68,7 +68,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "15");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
assertEquals(1, endSignals.size());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewayMergeTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewayMergeTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewayMergeTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -56,7 +56,7 @@
proc.startProcess();
// Wait for the process to end
- proc.waitForEnd();
+ proc.waitForEnd(5000);
// Verify the result
Message endMessage = getMessages().get(0);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewaySplitTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewaySplitTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/gateway/parallel/ParallelGatewaySplitTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -52,7 +52,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
// Validate received signals
List<Signal> signals = getSignals(SignalType.SYSTEM_END_EVENT_ENTER);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeInputSetTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -56,7 +56,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("frog", "kermit");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
Message endMessage = getMessages().get(0);
assertNotNull("EndMessage expected", endMessage);
@@ -74,7 +74,7 @@
try
{
- proc.waitForEnd();
+ proc.waitForEnd(5000);
}
catch (RuntimeException ex)
{
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodeOutputSetTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -54,7 +54,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
Message endMessage = getMessages().get(0);
assertNotNull("EndMessage expected", endMessage);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/node/NodePropertyTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -55,7 +55,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
Message endMessage = getMessages().get(0);
assertNotNull("EndMessage expected", endMessage);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/process/ProcessPropertyTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/process/ProcessPropertyTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/process/ProcessPropertyTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -60,7 +60,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
Message endMessage = getMessages().get(0);
assertNotNull("EndMessage expected", endMessage);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/service/process/ProcessServiceTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -100,7 +100,7 @@
{
// Start the process, which automatically adds it to the registry
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
}
finally
{
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/startevent/StartEventSignalTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/startevent/StartEventSignalTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/startevent/StartEventSignalTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -85,7 +85,7 @@
// Wait for the process to end
if (proc != null)
- proc.waitForEnd();
+ proc.waitForEnd(5000);
// Verify the result
Message endMessage = getMessages().get(0);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/ReceiveTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/ReceiveTaskTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/ReceiveTaskTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -104,7 +104,7 @@
msgService.sendMessage(procID, "TaskA", getMessage());
proc.startProcess();
- proc.waitForEnd(1000);
+ proc.waitForEnd(5000);
}
finally
{
@@ -146,7 +146,7 @@
try
{
proc.startProcess();
- proc.waitForEnd(1000);
+ proc.waitForEnd(5000);
}
finally
{
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/SendTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/SendTaskTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/SendTaskTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -53,7 +53,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "bar");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Message> messages = getMessages();
assertEquals(1, messages.size());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/TaskExecutionHandlerTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/TaskExecutionHandlerTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/TaskExecutionHandlerTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -52,7 +52,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd();
+ proc.waitForEnd(5000);
assertEquals("kermit", TaskExecutionHandler.procProp);
assertEquals("piggy", TaskExecutionHandler.taskProp);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskCallbackTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskCallbackTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskCallbackTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -59,7 +59,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "xxx");
proc.startProcess(att);
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Message> messages = getMessages();
assertEquals(1, messages.size());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/task/UserTaskTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -73,7 +73,7 @@
BasicAttachments att = new BasicAttachments();
att.addAttachment("foo", "xxx");
proc.startProcess(att);
- proc.waitForEnd(1000);
+ proc.waitForEnd(5000);
List<Message> messages = getMessages();
assertEquals(1, messages.size());
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/transaction/TxRequiredTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/transaction/TxRequiredTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/cts/transaction/TxRequiredTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -61,7 +61,7 @@
Process proc = procDef.newInstance();
proc.startProcess();
- proc.waitForEnd(1000);
+ proc.waitForEnd(5000);
}
protected ProcessDefinition getProcessDefinition() throws IOException
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/simplemerge/SimpleMergeTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/simplemerge/SimpleMergeTest.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/pattern/control/simplemerge/SimpleMergeTest.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -52,10 +52,10 @@
proc.startProcess();
// Wait for the process to end
- proc.waitForEnd();
+ proc.waitForEnd(5000);
List<Signal> endSignals = getSignals(Signal.SignalType.SYSTEM_END_EVENT_EXIT);
- assertEquals(2, endSignals.size());
+ assertEquals("Two end signals expected", 2, endSignals.size());
}
public ProcessDefinition getProcessDefinition() throws IOException
Modified: projects/spec/trunk/modules/cts/src/test/resources/log4j.xml
===================================================================
--- projects/spec/trunk/modules/cts/src/test/resources/log4j.xml 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/cts/src/test/resources/log4j.xml 2008-10-31 13:42:21 UTC (rev 2703)
@@ -35,9 +35,6 @@
<category name="org.hibernate">
<priority value="INFO" />
</category>
- <category name="org.hibernate.persister">
- <priority value="DEBUG" />
- </category>
<!-- ======================= -->
<!-- Setup the Root category -->
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ExclusiveGatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ExclusiveGatewayImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ExclusiveGatewayImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -97,7 +97,7 @@
if (outstandingFlows == null)
outstandingFlows = new HashSet<SequenceFlow>(inFlows);
- SequenceFlow flow = token.getFlow();
+ SequenceFlow flow = token.getSequenceFlow();
outstandingFlows.remove(flow);
}
@@ -124,7 +124,7 @@
public void execute(TokenExecutor tokenExecutor, Token token)
{
- Node sourceRef = token.getFlow().getSourceRef();
+ Node sourceRef = token.getSequenceFlow().getSourceRef();
// Schedule the first token that arrives
if (token == receivedTokens.get(0))
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/GatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/GatewayImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/GatewayImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -172,7 +172,7 @@
}
// Check that token from flow is valid
- SequenceFlow flow = token.getFlow();
+ SequenceFlow flow = token.getSequenceFlow();
if (expectedFlows.contains(flow) == false)
throw new IllegalStateException("Unexpected token from: " + flow);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/InclusiveGatewayImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -84,7 +84,7 @@
public void execute(TokenExecutor tokenExecutor, Token token)
{
MutableToken mutableToken = (MutableToken)token;
- Node sourceRef = token.getFlow().getSourceRef();
+ Node sourceRef = token.getSequenceFlow().getSourceRef();
log.debug("Propagate token comming from: " + sourceRef);
// Get the applicable gates
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ParallelGatewayImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -97,7 +97,7 @@
mergeTokens = new HashSet<Token>();
}
- SequenceFlow flow = token.getFlow();
+ SequenceFlow flow = token.getSequenceFlow();
outstandingFlows.remove(flow);
mergeTokens.add(token);
}
@@ -156,7 +156,7 @@
for(SequenceFlow auxGate : getGates())
{
SequenceFlow outFlow = auxGate;
- outToken = (MutableToken)outToken.copyToken();
+ outToken = outToken.copyToken();
tokenExecutor.create(outToken, outFlow);
outTokens.add(outToken);
}
@@ -199,7 +199,7 @@
private TokenImpl getMergedTokens()
{
- TokenImpl mergedToken = new TokenImpl(null);
+ TokenImpl mergedToken = new TokenImpl(getProcessEngine(), null);
for (Token auxToken : mergeTokens)
{
log.debug("mergeToken: " + auxToken);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -23,6 +23,7 @@
//$Id$
+import org.hibernate.Session;
import org.jbpm.api.model.Node;
import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.runtime.ExecutionContext;
@@ -43,7 +44,7 @@
{
this.delegateToken = token;
- Node targetRef = token.getFlow().getTargetRef();
+ Node targetRef = token.getSequenceFlow().getTargetRef();
ExecutionContext exContext = token.getExecutionContext();
this.delegateContext = new DelegatingExecutionContext(targetRef, exContext);
}
@@ -55,15 +56,15 @@
}
@Override
- public Token copyToken()
+ public MutableToken copyToken()
{
return delegateToken.copyToken();
}
@Override
- public SequenceFlow getFlow()
+ public SequenceFlow getSequenceFlow()
{
- return delegateToken.getFlow();
+ return delegateToken.getSequenceFlow();
}
@Override
@@ -85,9 +86,9 @@
}
@Override
- public void setFlow(SequenceFlow flow)
+ public void setSequenceFlow(SequenceFlow flow)
{
- delegateToken.setFlow(flow);
+ delegateToken.setSequenceFlow(flow);
}
@Override
@@ -96,9 +97,20 @@
delegateToken.setTokenStatus(status);
}
+ @Override
+ public Session getSession()
+ {
+ return delegateToken.getSession();
+ }
+
+ @Override
+ public void closeSession()
+ {
+ delegateToken.closeSession();
+ }
+
public String toString()
{
- Node node = getFlow().getTargetRef();
- return "[fo=" + node + ",ctx=" + getExecutionContext() + "]";
+ return delegateToken.toString();
}
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/MutableToken.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -27,25 +27,36 @@
import org.jbpm.api.runtime.Token;
/**
- * A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
+ * A mutable extension to the Token.
*
* @author Thomas.Diesler(a)jboss.com
* @since 20-Apr-2007
*/
public interface MutableToken extends Token
{
+ /**
+ * Set the token status
+ */
void setTokenStatus(TokenStatus status);
- void setFlow(SequenceFlow flow);
+ /**
+ * Set the current SequenceFlow
+ */
+ void setSequenceFlow(SequenceFlow flow);
/**
* Create a schallow copy of this Token.
* The content in the ExecutionContext will be copied by reference.
*/
- Token copyToken();
+ MutableToken copyToken();
/**
* Merge this Token with another token.
*/
void mergeToken(Token token);
+
+ /**
+ * Close the current session
+ */
+ void closeSession();
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RunnableToken.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -72,14 +72,14 @@
Process proc = rtProc.getProcess();
try
{
- SequenceFlow flow = token.getFlow();
+ SequenceFlow flow = token.getSequenceFlow();
if (flow == null)
throw new IllegalStateException("Cannot obtain initial flow");
while (continueTokenThread())
{
// Get the target node
- Node node = token.getFlow().getTargetRef();
+ Node node = token.getSequenceFlow().getTargetRef();
// Synchronize on the target Node
synchronized (node)
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RuntimeContext.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RuntimeContext.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/RuntimeContext.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -57,7 +57,7 @@
public Node getNode()
{
- return token.getFlow().getTargetRef();
+ return token.getSequenceFlow().getTargetRef();
}
public Token getToken()
Deleted: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/SessionAssociation.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/SessionAssociation.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/SessionAssociation.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -1,70 +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.ri.runtime;
-
-//$Id$
-
-import org.hibernate.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Associates the Hibernate session with the current thread
- *
- * @author thomas.diesler(a)jboss.com
- * @since 10-Oct-2008
- */
-public abstract class SessionAssociation
-{
- final static Logger log = LoggerFactory.getLogger(SessionAssociation.class);
-
- private static ThreadLocal<Session> sessionAssociation = new ThreadLocal<Session>();
-
- public static Session getSession()
- {
- return sessionAssociation.get();
- }
-
- public static Session setSession(Session session)
- {
- sessionAssociation.set(session);
- return session;
- }
-
- public static void closeSession(Session session)
- {
- if (session != getSession())
- throw new IllegalArgumentException("Not the associated session");
-
- // Close the session
- try
- {
- session.close();
- }
- catch (RuntimeException rte)
- {
- log.error("Cannot close the associated session", rte);
- }
-
- sessionAssociation.remove();
- }
-}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenExecutorImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -87,7 +87,7 @@
{
MutableToken mutableToken = (MutableToken)token;
mutableToken.setTokenStatus(TokenStatus.Created);
- mutableToken.setFlow(initialFlow);
+ mutableToken.setSequenceFlow(initialFlow);
log.debug("Create Token: " + token);
@@ -124,7 +124,7 @@
throw new IllegalStateException("Cannot move token in state: " + token.getTokenStatus());
MutableToken mutableToken = (MutableToken)token;
- mutableToken.setFlow(flow);
+ mutableToken.setSequenceFlow(flow);
}
}
@@ -145,6 +145,7 @@
log.debug("Destroy Token: " + token);
MutableToken mutableToken = (MutableToken)token;
mutableToken.setTokenStatus(TokenStatus.Destroyed);
+ mutableToken.closeSession();
runnableTokens.remove(token.getTokenID());
}
}
@@ -160,6 +161,7 @@
log.debug("Suspend Token: " + token);
MutableToken mutableToken = (MutableToken)token;
mutableToken.setTokenStatus(TokenStatus.Suspended);
+ mutableToken.closeSession();
// Release the thread for a suspended token
rtToken.releaseThread();
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -23,13 +23,16 @@
//$Id$
+import org.hibernate.Session;
import org.jboss.util.id.UID;
+import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.BasicExecutionContext;
import org.jbpm.api.runtime.ExecutionContext;
import org.jbpm.api.runtime.Token;
import org.jbpm.api.runtime.Attachments.Key;
+import org.jbpm.api.service.PersistenceService;
/**
* A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
@@ -49,60 +52,84 @@
private SequenceFlow flow;
private ExecutionContext context;
private TokenStatus status;
+ private ProcessEngine engine;
+ private Session session;
/**
* Construct a Token with given {@link Attachments}
*/
- public TokenImpl(Attachments att)
+ public TokenImpl(ProcessEngine engine, Attachments att)
{
this.context = new BasicExecutionContext(att);
this.id = new UID().toString();
this.status = TokenStatus.Created;
+ this.engine = engine;
}
+ @Override
public String getTokenID()
{
return id;
}
+ @Override
public TokenStatus getTokenStatus()
{
return status;
}
+ @Override
public void setTokenStatus(TokenStatus status)
{
this.status = status;
}
+ @Override
public ExecutionContext getExecutionContext()
{
return context;
}
- public SequenceFlow getFlow()
+ @Override
+ public SequenceFlow getSequenceFlow()
{
return flow;
}
- public void setFlow(SequenceFlow flow)
+ @Override
+ public void setSequenceFlow(SequenceFlow flow)
{
this.flow = flow;
}
- /**
- * Create a schallow copy of this Token.
- * <p/>
- * The content in the {@link ExecutionContext} will be copied by reference.
- */
- public Token copyToken()
+ @Override
+ public Session getSession()
{
- return new TokenImpl(context);
+ if (session == null)
+ {
+ PersistenceService service = engine.getService(PersistenceService.class);
+ session = service.createSession();
+ }
+ return session;
}
- /**
- * Merge this Token with another token.
- */
+ @Override
+ public void closeSession()
+ {
+ if (session != null)
+ {
+ session.close();
+ session = null;
+ }
+ }
+
+ @Override
+ public MutableToken copyToken()
+ {
+ return new TokenImpl(engine, context);
+ }
+
+ @Override
public void mergeToken(Token token)
{
ExecutionContext mergeContext = token.getExecutionContext();
@@ -119,6 +146,6 @@
public String toString()
{
- return "[sf=" + getFlow() + ",status=" + getTokenStatus() + ",ctx=" + getExecutionContext() + "]";
+ return "[sf=" + getSequenceFlow() + ",status=" + getTokenStatus() + ",ctx=" + getExecutionContext() + ",id=" + id + "]";
}
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TransactionInterceptor.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TransactionInterceptor.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TransactionInterceptor.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -27,6 +27,7 @@
import org.hibernate.Transaction;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.Node;
+import org.jbpm.api.runtime.Token;
import org.jbpm.api.service.PersistenceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,32 +48,34 @@
public void execute(RuntimeContext rtContext)
{
Node node = rtContext.getNode();
+ Token token = rtContext.getToken();
- PersistenceService service = getPersistenceService(node.getProcessEngine());
- Session session = SessionAssociation.setSession(service.createSession());
-
// Begin the Tx
+ Session session = token.getSession();
Transaction tx = session.beginTransaction();
try
{
// Load the node
+ PersistenceService service = getPersistenceService(node.getProcessEngine());
node = service.loadNode(session, node.getClass(), node.getKey());
// Call the next interceptor in the chain
rtContext.next();
- // Save the node
- service.saveNode(session, node);
-
- // Commit the Tx
- tx.commit();
+ // Save the node and commit the Tx
+ if (session.isOpen())
+ {
+ service.saveNode(session, node);
+ tx.commit();
+ }
}
catch (RuntimeException rte)
{
try
{
// Rollback the Tx
- tx.rollback();
+ if (session.isOpen())
+ tx.rollback();
}
catch (RuntimeException rbex)
{
@@ -80,12 +83,8 @@
}
throw rte;
}
- finally
- {
- SessionAssociation.closeSession(session);
- }
}
-
+
private PersistenceService getPersistenceService(ProcessEngine engine)
{
if (service == null)
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -122,9 +122,9 @@
boolean startProcessThread = (rtProc == null);
// Create initial Token
- TokenImpl initialToken = new TokenImpl(att);
+ TokenImpl initialToken = new TokenImpl(getProcessEngine(), att);
InitialFlow initialFlow = new InitialFlow(start);
- initialToken.setFlow(initialFlow);
+ initialToken.setSequenceFlow(initialFlow);
// Register the initial Token
rtProc = getRuntimeProcess(proc, true);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/HibernatePersistenceServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/HibernatePersistenceServiceImpl.java 2008-10-31 10:49:02 UTC (rev 2702)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/HibernatePersistenceServiceImpl.java 2008-10-31 13:42:21 UTC (rev 2703)
@@ -35,6 +35,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
+import org.jbpm.api.NodeNotFoundException;
import org.jbpm.api.ProcessNotFoundException;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.model.Node;
@@ -178,7 +179,7 @@
}
catch (ObjectNotFoundException ex)
{
- throw new ProcessNotFoundException("Cannot find process: " + procID);
+ throw new ProcessNotFoundException("Cannot find process: " + procID, ex);
}
finally
{
@@ -219,19 +220,19 @@
@Override
@SuppressWarnings("unchecked")
- public <T extends Node> T loadNode(Session session, Class<T> nodeImpl, ObjectName nodeID)
+ public <T extends Node> T loadNode(Session session, Class<T> nodeClass, ObjectName nodeID)
{
log.debug("START loadNode: " + nodeID);
T node = null;
try
{
Integer id = Integer.valueOf(nodeID.getKeyProperty("id"));
- node = (T)session.load(nodeImpl, id);
+ node = (T)session.load(nodeClass, id);
Hibernate.initialize(node);
}
catch (ObjectNotFoundException ex)
{
- throw new ProcessNotFoundException("Cannot find node: " + nodeID);
+ throw new NodeNotFoundException("Cannot find node: " + nodeID, ex);
}
log.debug("END loadNode: " + nodeID);
return node;
15 years, 6 months
JBoss JBPM SVN: r2702 - in jbpm4/trunk/modules: log/src/main/java/org/jbpm/log and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-10-31 06:49:02 -0400 (Fri, 31 Oct 2008)
New Revision: 2702
Added:
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14Log.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLog.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLogFactory.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFactory.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14Log.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14LogFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLog.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLogFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFormatter.java
Modified:
jbpm4/trunk/modules/log/
jbpm4/trunk/modules/log/pom.xml
jbpm4/trunk/modules/test/pom.xml
Log:
unification api proposals
Property changes on: jbpm4/trunk/modules/log
___________________________________________________________________
Name: svn:ignore
+ target
Modified: jbpm4/trunk/modules/log/pom.xml
===================================================================
--- jbpm4/trunk/modules/log/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/log/pom.xml 2008-10-31 10:49:02 UTC (rev 2702)
@@ -27,6 +27,10 @@
<!-- Dependencies -->
<dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
</dependencies>
<!-- Plugins -->
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,115 @@
+/*
+ * 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.log;
+
+import java.io.IOException;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.MemoryHandler;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ErrorTriggeredFileHandler extends Handler {
+
+ private static final int DEFAULT_SIZE = 500;
+ private static final Level DEFAULT_PUSH_LEVEL = Level.SEVERE;
+ private static final String DEFAULT_PATTERN = "%h/jbpm%u.log";
+
+ DecoratedMemoryHandler memoryHandler = null;
+ FileHandler fileHandler = null;
+
+ public ErrorTriggeredFileHandler() throws SecurityException, IOException {
+ fileHandler = getConfiguredTarget();
+ memoryHandler = new DecoratedMemoryHandler(fileHandler, getConfiguredSize(), getConfiguredPushLevel());
+ }
+
+ private static Level getConfiguredPushLevel() {
+ LogManager manager = LogManager.getLogManager();
+ String pushLevelText = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".push");
+ if (pushLevelText == null) {
+ return DEFAULT_PUSH_LEVEL;
+ }
+ try {
+ return Level.parse(pushLevelText.trim());
+ } catch (Exception ex) {
+ return DEFAULT_PUSH_LEVEL;
+ }
+ }
+
+ protected static int getConfiguredSize() {
+ LogManager manager = LogManager.getLogManager();
+ String sizeText = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".size");
+ if (sizeText == null) {
+ return DEFAULT_SIZE;
+ }
+ try {
+ return Integer.parseInt(sizeText.trim());
+ } catch (Exception ex) {
+ return DEFAULT_SIZE;
+ }
+ }
+
+ protected static FileHandler getConfiguredTarget() throws SecurityException, IOException {
+ LogManager manager = LogManager.getLogManager();
+ String pattern = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".pattern");
+ if (pattern == null) {
+ pattern = DEFAULT_PATTERN;
+ }
+ return new FileHandler(pattern);
+ }
+
+
+ public class DecoratedMemoryHandler extends MemoryHandler {
+ public DecoratedMemoryHandler(FileHandler target, int size, Level pushLevel) {
+ super(target, size, pushLevel);
+ }
+ public void push() {
+ fileHandler.setFormatter(new LogFormatter());
+ super.push();
+ LogRecord emptyLine = new LogRecord(Level.INFO, "");
+ emptyLine.setLoggerName("");
+ fileHandler.publish(emptyLine);
+ LogRecord line = new LogRecord(Level.INFO, "---- END OF TRIGGERED PUSH ---------------------------------------------------");
+ line.setLoggerName("");
+ fileHandler.publish(line);
+ fileHandler.publish(emptyLine);
+ fileHandler.publish(emptyLine);
+ }
+ }
+
+ public void close() throws SecurityException {
+ memoryHandler.close();
+ }
+
+ public void flush() {
+ memoryHandler.flush();
+ }
+
+ public void publish(LogRecord record) {
+ memoryHandler.publish(record);
+ }
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14Log.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14Log.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14Log.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14Log.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.log;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jbpm.log.Log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Jdk14Log extends Log {
+
+ Logger log;
+
+ public Jdk14Log(Logger logger) {
+ this.log = logger;
+ }
+
+ public void error(String msg) {
+ log.log(Level.SEVERE, msg);
+ }
+
+ public void error(String msg, Throwable exception) {
+ log.log(Level.SEVERE, msg, exception);
+ }
+
+ public boolean isInfoEnabled() {
+ return log.isLoggable(Level.INFO);
+ }
+
+ public void info(String msg) {
+ log.log(Level.INFO, msg);
+ }
+
+ public void info(String msg, Throwable exception) {
+ log.log(Level.INFO, msg, exception);
+ }
+
+ public boolean isDebugEnabled() {
+ return log.isLoggable(Level.FINE);
+ }
+
+ public void debug(String msg) {
+ log.log(Level.FINE, msg);
+ }
+
+ public void debug(String msg, Throwable exception) {
+ log.log(Level.FINE, msg, exception);
+ }
+
+ public boolean isTraceEnabled() {
+ return log.isLoggable(Level.FINEST);
+ }
+
+ public void trace(String msg) {
+ log.log(Level.FINEST, msg);
+ }
+
+ public void trace(String msg, Throwable exception) {
+ log.log(Level.FINEST, msg, exception);
+ }
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14Log.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14LogFactory.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,83 @@
+/*
+ * 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.log;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import org.jbpm.PvmException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Jdk14LogFactory implements LogFactory {
+
+ public Jdk14LogFactory() {
+ initializeJdk14Logging();
+ }
+
+ public Log getLog(String name) {
+ return new Jdk14Log(Logger.getLogger(name));
+ }
+
+ /** redirects commons logging to JDK 1.4 logging. This can be handy when
+ * you have log4j on the classpath, but still want to use the JDK logging. */
+ public static synchronized void redirectCommonsToJdk14() {
+ System.setProperty("org.apache.commons.logging.Log",
+ "org.apache.commons.logging.impl.Jdk14Logger" );
+ }
+
+ /** configures JDK 1.4 logging from the resource file <code>logging.properties</code> */
+ public static synchronized void initializeJdk14Logging() {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ InputStream inputStream = classLoader.getResourceAsStream("logging.properties");
+ try {
+ if (inputStream != null) {
+ LogManager.getLogManager().readConfiguration(inputStream);
+ }
+
+ String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging");
+ if ( (redirectCommons!=null)
+ && (! redirectCommons.equalsIgnoreCase("disabled"))
+ && (! redirectCommons.equalsIgnoreCase("off"))
+ && (! redirectCommons.equalsIgnoreCase("false"))
+ ) {
+ redirectCommonsToJdk14();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("couldn't initialize logging properly", e);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Jdk14LogFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,77 @@
+/*
+ * 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.log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class Log {
+
+ static LogFactory logFactory;
+
+ public static synchronized Log getLog(String name) {
+ if (logFactory==null) {
+
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+ // if logging.properties is available on the classpath
+ if (classLoader.getResource("logging.properties")!=null) {
+ logFactory = new Jdk14LogFactory();
+
+ // if log4j is available on the classpath
+ } else if (isLog4jAvailable(classLoader)) {
+ logFactory = new Log4jLogFactory();
+
+ } else {
+ logFactory = new Jdk14LogFactory();
+
+ }
+ }
+ return logFactory.getLog(name);
+ }
+
+ static boolean isLog4jAvailable(ClassLoader classLoader) {
+ try {
+ classLoader.loadClass("org.apache.log4j.LogManager");
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+
+ public abstract void error(String msg);
+ public abstract void error(String msg, Throwable exception);
+
+ public abstract boolean isInfoEnabled();
+ public abstract void info(String msg);
+ public abstract void info(String msg, Throwable exception);
+
+ public abstract boolean isDebugEnabled();
+ public abstract void debug(String msg);
+ public abstract void debug(String msg, Throwable exception);
+
+ public abstract boolean isTraceEnabled();
+ public abstract void trace(String msg);
+ public abstract void trace(String msg, Throwable exception);
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLog.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLog.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLog.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLog.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.log;
+
+/**
+ * @author Tom Baeyens
+ */
+public class Log4jLog extends Log {
+
+ org.apache.log4j.Logger log;
+
+ public Log4jLog(org.apache.log4j.Logger log) {
+ this.log = log;
+ }
+
+ public void error(String msg) {
+ log.error(msg);
+ }
+
+ public void error(String msg, Throwable exception) {
+ log.error(msg, exception);
+ }
+
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ public void info(String msg) {
+ log.info(msg);
+ }
+
+ public void info(String msg, Throwable exception) {
+ log.info(msg, exception);
+ }
+
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ public void debug(String msg) {
+ log.debug(msg);
+ }
+
+ public void debug(String msg, Throwable exception) {
+ log.debug(msg, exception);
+ }
+
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ public void trace(String msg) {
+ log.trace(msg);
+ }
+
+ public void trace(String msg, Throwable exception) {
+ log.trace(msg, exception);
+ }
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLog.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLogFactory.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLogFactory.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLogFactory.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,36 @@
+/*
+ * 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.log;
+
+import org.apache.log4j.LogManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Log4jLogFactory implements LogFactory {
+
+ public Log getLog(String name) {
+ return new Log4jLog(LogManager.getLogger(name));
+ }
+
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/Log4jLogFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFactory.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFactory.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFactory.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,32 @@
+/*
+ * 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.log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface LogFactory {
+
+ Log getLog(String name);
+
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java (from rev 2701, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFormatter.java)
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -0,0 +1,81 @@
+package org.jbpm.log;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import org.jbpm.pvm.internal.util.ReflectUtil;
+
+public class LogFormatter extends Formatter {
+
+ static final String NEWLINE = System.getProperty("line.separator");
+ static final DateFormat dateTimeFormat = new SimpleDateFormat("HH:mm:ss,SSS");
+ static final Map<Level, String> levels = new HashMap<Level, String>();
+ private static Map<Integer, Integer> indentations = new HashMap<Integer, Integer>();
+
+
+ static {
+ levels.put(Level.ALL, "ALL");
+ levels.put(Level.CONFIG, "CFG");
+ levels.put(Level.FINE, "FIN");
+ levels.put(Level.FINER, "FNR");
+ levels.put(Level.FINEST, "FST");
+ levels.put(Level.INFO, "INF");
+ levels.put(Level.OFF, "OFF");
+ levels.put(Level.SEVERE, "SEV");
+ levels.put(Level.WARNING, "WRN");
+ }
+
+ public String format(LogRecord logRecord) {
+ StringWriter msg = new StringWriter();
+ if (logRecord.getThrown()!=null) {
+ msg.append("### EXCEPTION ###########################################");
+ msg.append(NEWLINE);
+ }
+ msg.append(dateTimeFormat.format(new Date()));
+ msg.append(" ");
+ msg.append(levels.get(logRecord.getLevel()));
+ msg.append(" ");
+
+ int threadId = logRecord.getThreadID();
+ for (int i=0; i<getIndentation(threadId); i++) {
+ msg.append(" ");
+ }
+
+ msg.append("| [");
+
+ String loggerName = logRecord.getLoggerName();
+ msg.append(ReflectUtil.getUnqualifiedClassName(loggerName));
+
+ msg.append("] ");
+
+ msg.append(logRecord.getMessage());
+ if (logRecord.getThrown()!=null) {
+ msg.append(NEWLINE);
+ logRecord.getThrown().printStackTrace(new PrintWriter(msg));
+ msg.append("### EXCEPTION ###########################################");
+ }
+ msg.append(NEWLINE);
+ return msg.toString();
+ }
+
+ private int getIndentation(int threadId) {
+ Integer indentation = indentations.get(threadId);
+ if (indentation==null) {
+ indentation = indentations.size();
+ indentations.put(threadId, indentation);
+ }
+ return indentation;
+ }
+
+ public static void resetIndentation() {
+ indentations = new HashMap<Integer, Integer>();
+ }
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/log/LogFormatter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/ErrorTriggeredFileHandler.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,115 +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.log;
-
-import java.io.IOException;
-import java.util.logging.FileHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-import java.util.logging.MemoryHandler;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ErrorTriggeredFileHandler extends Handler {
-
- private static final int DEFAULT_SIZE = 500;
- private static final Level DEFAULT_PUSH_LEVEL = Level.SEVERE;
- private static final String DEFAULT_PATTERN = "%h/jbpm%u.log";
-
- DecoratedMemoryHandler memoryHandler = null;
- FileHandler fileHandler = null;
-
- public ErrorTriggeredFileHandler() throws SecurityException, IOException {
- fileHandler = getConfiguredTarget();
- memoryHandler = new DecoratedMemoryHandler(fileHandler, getConfiguredSize(), getConfiguredPushLevel());
- }
-
- private static Level getConfiguredPushLevel() {
- LogManager manager = LogManager.getLogManager();
- String pushLevelText = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".push");
- if (pushLevelText == null) {
- return DEFAULT_PUSH_LEVEL;
- }
- try {
- return Level.parse(pushLevelText.trim());
- } catch (Exception ex) {
- return DEFAULT_PUSH_LEVEL;
- }
- }
-
- protected static int getConfiguredSize() {
- LogManager manager = LogManager.getLogManager();
- String sizeText = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".size");
- if (sizeText == null) {
- return DEFAULT_SIZE;
- }
- try {
- return Integer.parseInt(sizeText.trim());
- } catch (Exception ex) {
- return DEFAULT_SIZE;
- }
- }
-
- protected static FileHandler getConfiguredTarget() throws SecurityException, IOException {
- LogManager manager = LogManager.getLogManager();
- String pattern = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".pattern");
- if (pattern == null) {
- pattern = DEFAULT_PATTERN;
- }
- return new FileHandler(pattern);
- }
-
-
- public class DecoratedMemoryHandler extends MemoryHandler {
- public DecoratedMemoryHandler(FileHandler target, int size, Level pushLevel) {
- super(target, size, pushLevel);
- }
- public void push() {
- fileHandler.setFormatter(new LogFormatter());
- super.push();
- LogRecord emptyLine = new LogRecord(Level.INFO, "");
- emptyLine.setLoggerName("");
- fileHandler.publish(emptyLine);
- LogRecord line = new LogRecord(Level.INFO, "---- END OF TRIGGERED PUSH ---------------------------------------------------");
- line.setLoggerName("");
- fileHandler.publish(line);
- fileHandler.publish(emptyLine);
- fileHandler.publish(emptyLine);
- }
- }
-
- public void close() throws SecurityException {
- memoryHandler.close();
- }
-
- public void flush() {
- memoryHandler.flush();
- }
-
- public void publish(LogRecord record) {
- memoryHandler.publish(record);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14Log.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14Log.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14Log.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -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.log;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jbpm.log.Log;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Jdk14Log extends Log {
-
- Logger log;
-
- public Jdk14Log(Logger logger) {
- this.log = logger;
- }
-
- public void error(String msg) {
- log.log(Level.SEVERE, msg);
- }
-
- public void error(String msg, Throwable exception) {
- log.log(Level.SEVERE, msg, exception);
- }
-
- public boolean isInfoEnabled() {
- return log.isLoggable(Level.INFO);
- }
-
- public void info(String msg) {
- log.log(Level.INFO, msg);
- }
-
- public void info(String msg, Throwable exception) {
- log.log(Level.INFO, msg, exception);
- }
-
- public boolean isDebugEnabled() {
- return log.isLoggable(Level.FINE);
- }
-
- public void debug(String msg) {
- log.log(Level.FINE, msg);
- }
-
- public void debug(String msg, Throwable exception) {
- log.log(Level.FINE, msg, exception);
- }
-
- public boolean isTraceEnabled() {
- return log.isLoggable(Level.FINEST);
- }
-
- public void trace(String msg) {
- log.log(Level.FINEST, msg);
- }
-
- public void trace(String msg, Throwable exception) {
- log.log(Level.FINEST, msg, exception);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14LogFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14LogFactory.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Jdk14LogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,83 +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.log;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import org.jbpm.PvmException;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Jdk14LogFactory implements LogFactory {
-
- public Jdk14LogFactory() {
- initializeJdk14Logging();
- }
-
- public Log getLog(String name) {
- return new Jdk14Log(Logger.getLogger(name));
- }
-
- /** redirects commons logging to JDK 1.4 logging. This can be handy when
- * you have log4j on the classpath, but still want to use the JDK logging. */
- public static synchronized void redirectCommonsToJdk14() {
- System.setProperty("org.apache.commons.logging.Log",
- "org.apache.commons.logging.impl.Jdk14Logger" );
- }
-
- /** configures JDK 1.4 logging from the resource file <code>logging.properties</code> */
- public static synchronized void initializeJdk14Logging() {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- InputStream inputStream = classLoader.getResourceAsStream("logging.properties");
- try {
- if (inputStream != null) {
- LogManager.getLogManager().readConfiguration(inputStream);
- }
-
- String redirectCommons = LogManager.getLogManager().getProperty("redirect.commons.logging");
- if ( (redirectCommons!=null)
- && (! redirectCommons.equalsIgnoreCase("disabled"))
- && (! redirectCommons.equalsIgnoreCase("off"))
- && (! redirectCommons.equalsIgnoreCase("false"))
- ) {
- redirectCommonsToJdk14();
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new PvmException("couldn't initialize logging properly", e);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,77 +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.log;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class Log {
-
- static LogFactory logFactory;
-
- public static synchronized Log getLog(String name) {
- if (logFactory==null) {
-
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
- // if logging.properties is available on the classpath
- if (classLoader.getResource("logging.properties")!=null) {
- logFactory = new Jdk14LogFactory();
-
- // if log4j is available on the classpath
- } else if (isLog4jAvailable(classLoader)) {
- logFactory = new Log4jLogFactory();
-
- } else {
- logFactory = new Jdk14LogFactory();
-
- }
- }
- return logFactory.getLog(name);
- }
-
- static boolean isLog4jAvailable(ClassLoader classLoader) {
- try {
- classLoader.loadClass("org.apache.log4j.LogManager");
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
-
- public abstract void error(String msg);
- public abstract void error(String msg, Throwable exception);
-
- public abstract boolean isInfoEnabled();
- public abstract void info(String msg);
- public abstract void info(String msg, Throwable exception);
-
- public abstract boolean isDebugEnabled();
- public abstract void debug(String msg);
- public abstract void debug(String msg, Throwable exception);
-
- public abstract boolean isTraceEnabled();
- public abstract void trace(String msg);
- public abstract void trace(String msg, Throwable exception);
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLog.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLog.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLog.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,78 +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.log;
-
-/**
- * @author Tom Baeyens
- */
-public class Log4jLog extends Log {
-
- org.apache.log4j.Logger log;
-
- public Log4jLog(org.apache.log4j.Logger log) {
- this.log = log;
- }
-
- public void error(String msg) {
- log.error(msg);
- }
-
- public void error(String msg, Throwable exception) {
- log.error(msg, exception);
- }
-
- public boolean isInfoEnabled() {
- return log.isInfoEnabled();
- }
-
- public void info(String msg) {
- log.info(msg);
- }
-
- public void info(String msg, Throwable exception) {
- log.info(msg, exception);
- }
-
- public boolean isDebugEnabled() {
- return log.isDebugEnabled();
- }
-
- public void debug(String msg) {
- log.debug(msg);
- }
-
- public void debug(String msg, Throwable exception) {
- log.debug(msg, exception);
- }
-
- public boolean isTraceEnabled() {
- return log.isTraceEnabled();
- }
-
- public void trace(String msg) {
- log.trace(msg);
- }
-
- public void trace(String msg, Throwable exception) {
- log.trace(msg, exception);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLogFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLogFactory.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/Log4jLogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -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.log;
-
-import org.apache.log4j.LogManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Log4jLogFactory implements LogFactory {
-
- public Log getLog(String name) {
- return new Log4jLog(LogManager.getLogger(name));
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFactory.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFactory.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,32 +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.log;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface LogFactory {
-
- Log getLog(String name);
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFormatter.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFormatter.java 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/log/LogFormatter.java 2008-10-31 10:49:02 UTC (rev 2702)
@@ -1,81 +0,0 @@
-package org.jbpm.log;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.jbpm.pvm.internal.util.ReflectUtil;
-
-public class LogFormatter extends Formatter {
-
- static final String NEWLINE = System.getProperty("line.separator");
- static final DateFormat dateTimeFormat = new SimpleDateFormat("HH:mm:ss,SSS");
- static final Map<Level, String> levels = new HashMap<Level, String>();
- private static Map<Integer, Integer> indentations = new HashMap<Integer, Integer>();
-
-
- static {
- levels.put(Level.ALL, "ALL");
- levels.put(Level.CONFIG, "CFG");
- levels.put(Level.FINE, "FIN");
- levels.put(Level.FINER, "FNR");
- levels.put(Level.FINEST, "FST");
- levels.put(Level.INFO, "INF");
- levels.put(Level.OFF, "OFF");
- levels.put(Level.SEVERE, "SEV");
- levels.put(Level.WARNING, "WRN");
- }
-
- public String format(LogRecord logRecord) {
- StringWriter msg = new StringWriter();
- if (logRecord.getThrown()!=null) {
- msg.append("### EXCEPTION ###########################################");
- msg.append(NEWLINE);
- }
- msg.append(dateTimeFormat.format(new Date()));
- msg.append(" ");
- msg.append(levels.get(logRecord.getLevel()));
- msg.append(" ");
-
- int threadId = logRecord.getThreadID();
- for (int i=0; i<getIndentation(threadId); i++) {
- msg.append(" ");
- }
-
- msg.append("| [");
-
- String loggerName = logRecord.getLoggerName();
- msg.append(ReflectUtil.getUnqualifiedClassName(loggerName));
-
- msg.append("] ");
-
- msg.append(logRecord.getMessage());
- if (logRecord.getThrown()!=null) {
- msg.append(NEWLINE);
- logRecord.getThrown().printStackTrace(new PrintWriter(msg));
- msg.append("### EXCEPTION ###########################################");
- }
- msg.append(NEWLINE);
- return msg.toString();
- }
-
- private int getIndentation(int threadId) {
- Integer indentation = indentations.get(threadId);
- if (indentation==null) {
- indentation = indentations.size();
- indentations.put(threadId, indentation);
- }
- return indentation;
- }
-
- public static void resetIndentation() {
- indentations = new HashMap<Integer, Integer>();
- }
-}
Modified: jbpm4/trunk/modules/test/pom.xml
===================================================================
--- jbpm4/trunk/modules/test/pom.xml 2008-10-31 10:28:46 UTC (rev 2701)
+++ jbpm4/trunk/modules/test/pom.xml 2008-10-31 10:49:02 UTC (rev 2702)
@@ -33,6 +33,11 @@
<version>${version}</version>
</dependency>
<dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-log</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
15 years, 6 months