JBoss JBPM SVN: r4198 - in jbpm4/branches/hbraun/modules: integration/jboss5/src/main/java/org/jbpm/integration/jboss5 and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-09 13:18:40 -0400 (Mon, 09 Mar 2009)
New Revision: 4198
Modified:
jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java
Log:
Use the 'java:/ProcessEngine' binding
Modified: jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
===================================================================
--- jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java 2009-03-09 17:16:37 UTC (rev 4197)
+++ jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java 2009-03-09 17:18:40 UTC (rev 4198)
@@ -50,7 +50,7 @@
try
{
InitialContext ctx = new InitialContext();
- this.processEngine = (ProcessEngine)ctx.lookup("java:/jbpm4");
+ this.processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
}
catch (Exception e)
{
Modified: jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java
===================================================================
--- jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java 2009-03-09 17:16:37 UTC (rev 4197)
+++ jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java 2009-03-09 17:18:40 UTC (rev 4198)
@@ -36,7 +36,7 @@
{
private static final Log log = Log.getLog(JBPMServiceImpl.class.getName());
- private final static String DEFAULT_JNDI_NAME = "java:/jbpm4";
+ private final static String DEFAULT_JNDI_NAME = "java:/ProcessEngine";
private ProcessEngine processEngine;
17 years, 2 months
JBoss JBPM SVN: r4197 - in jbpm4/branches/hbraun/modules: integration/jboss5/src/main/java/org/jbpm/integration/jboss5 and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-09 13:16:37 -0400 (Mon, 09 Mar 2009)
New Revision: 4197
Added:
jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineObjectFactory.java
jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineReference.java
Modified:
jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java
Log:
Added JNDI binding
Modified: jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java
===================================================================
--- jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
+++ jbpm4/branches/hbraun/modules/enterprise/src/main/java/org/jbpm/enterprise/mgmt/ProcessManagementImpl.java 2009-03-09 17:16:37 UTC (rev 4197)
@@ -30,6 +30,8 @@
import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.model.OpenExecution;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import java.util.*;
import java.io.InputStream;
@@ -42,8 +44,19 @@
public ProcessManagementImpl()
{
- JBPMService jbpmService = JBPMServiceLocator.locateService();
- this.processEngine = jbpmService.getProcessEngine();
+ //JBPMService jbpmService = JBPMServiceLocator.locateService();
+ //this.processEngine = jbpmService.getProcessEngine();
+
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ this.processEngine = (ProcessEngine)ctx.lookup("java:/jbpm4");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to lookup process engine");
+ }
+
}
public List<ProcessDefinitionRef> getProcessDefinitions()
Modified: jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java
===================================================================
--- jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
+++ jbpm4/branches/hbraun/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMServiceImpl.java 2009-03-09 17:16:37 UTC (rev 4197)
@@ -22,10 +22,13 @@
package org.jbpm.integration.jboss5;
import org.jbpm.integration.spi.JBPMService;
+import org.jbpm.integration.spi.ProcessEngineReference;
import org.jbpm.ProcessEngine;
import org.jbpm.Configuration;
import org.jbpm.internal.log.Log;
+import javax.naming.InitialContext;
+
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -33,12 +36,25 @@
{
private static final Log log = Log.getLog(JBPMServiceImpl.class.getName());
+ private final static String DEFAULT_JNDI_NAME = "java:/jbpm4";
+
private ProcessEngine processEngine;
public void start()
{
this.processEngine = new Configuration().buildProcessEngine();
- log.info("JBPMService started: " + this.processEngine);
+
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ ctx.bind(DEFAULT_JNDI_NAME, new ProcessEngineReference("default", this.processEngine));
+ log.info("ProcessEngine bound to: " + DEFAULT_JNDI_NAME);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to create JBPMService", e);
+ }
+
}
public void stop()
@@ -51,4 +67,5 @@
{
return this.processEngine;
}
+
}
Added: jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineObjectFactory.java
===================================================================
--- jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineObjectFactory.java (rev 0)
+++ jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineObjectFactory.java 2009-03-09 17:16:37 UTC (rev 4197)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.integration.spi;
+
+import org.jbpm.ProcessEngine;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+import java.util.Hashtable;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessEngineObjectFactory implements ObjectFactory
+{
+ public Object getObjectInstance(
+ Object obj, Name name,
+ Context nameCtx, Hashtable<?, ?> environment) throws Exception
+ {
+ if (obj instanceof Reference) {
+ Reference ref = (Reference)obj;
+ if (ref.getClassName().equals(ProcessEngine.class.getName())) {
+ RefAddr engineName = ref.get(ProcessEngineReference.ENGINE_NAME); // currently not used
+ return JBPMServiceLocator.locateService().getProcessEngine();
+ }
+ }
+
+ return null;
+ }
+}
Added: jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineReference.java
===================================================================
--- jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineReference.java (rev 0)
+++ jbpm4/branches/hbraun/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessEngineReference.java 2009-03-09 17:16:37 UTC (rev 4197)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.integration.spi;
+
+import org.jbpm.ProcessEngine;
+
+import javax.naming.Referenceable;
+import javax.naming.Reference;
+import javax.naming.NamingException;
+import javax.naming.StringRefAddr;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessEngineReference implements Referenceable
+{
+ private String name;
+ private transient ProcessEngine processEngine;
+ public static final String ENGINE_NAME = "process.engine.name";
+
+ public ProcessEngineReference(String name, ProcessEngine processEngine)
+ {
+ this.name = name;
+ this.processEngine = processEngine;
+ }
+
+ public Reference getReference() throws NamingException
+ {
+ return new Reference(
+ ProcessEngine.class.getName(),
+ new StringRefAddr(ProcessEngineReference.ENGINE_NAME, this.name),
+ ProcessEngineObjectFactory.class.getName(),
+ null
+ );
+ }
+}
17 years, 2 months
JBoss JBPM SVN: r4196 - in jbpm4/branches/tbaeyens/modules: distro/.settings and 14 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-09 12:32:17 -0400 (Mon, 09 Mar 2009)
New Revision: 4196
Removed:
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties
jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
jbpm4/branches/tbaeyens/modules/userguide/.settings/attachedFile.properties
Log:
work
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -70,8 +70,8 @@
Deployment addDirectoryCanonical(String directory);
Deployment addDirectory(File directory);
Deployment addDirectoryCanonical(File directory);
- Deployment addObject(String name, Object object);
-
+ Deployment addProcessDefinition(ProcessDefinition processDefinition);
+
Deployment setFileType(String fileName, String fileType);
Deployment deploy();
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -50,8 +50,9 @@
* Use {@link #saveTask(Task)} to persist the task. */
Task newTask(long parentTaskDbid);
- /** Saves the given task to persistent storage. */
- void saveTask(Task task);
+ /** Saves the given task to persistent storage.
+ * @return the taskDbid */
+ long saveTask(Task task);
/** Retrieves the task with the given identifier from persistent storage.
* If no task with the given identifier exists,
Modified: jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties 2009-03-09 16:32:17 UTC (rev 4196)
@@ -1,2 +1,2 @@
## index of importer -> set(imports)
-#Sat Mar 07 09:22:34 CET 2009
+#Mon Mar 09 08:59:42 CET 2009
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -80,9 +80,13 @@
.startActivity("end", new ObjectDescriptor(WaitState.class))
.endActivity()
.endProcess();
+
// deploy process
- environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
- processDefinition).deploy();
+ environment.get(ProcessService.class)
+ .createDeployment()
+ .addProcessDefinition(processDefinition)
+ .deploy();
+
processDefinitionId = processDefinition.getId();
}
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -130,8 +130,11 @@
public void testHappyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
- processDefinition).deploy();
+ environment.get(ProcessService.class)
+ .createDeployment()
+ .addProcessDefinition(processDefinition)
+ .deploy();
+
// start execution
Execution execution = environment.get(ExecutionService.class).startProcessInstanceById(
processDefinition.getId());
@@ -172,8 +175,11 @@
public void testNoisyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(NoisyListener.class.getName());
- environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
- processDefinition).deploy();
+ environment.get(ProcessService.class)
+ .createDeployment()
+ .addProcessDefinition(processDefinition)
+ .deploy();
+
// start execution
ExecutionService executionService = environment.get(ExecutionService.class);
ExecutionImpl execution = (ExecutionImpl) executionService.startProcessInstanceById(processDefinition
@@ -222,8 +228,11 @@
public void testCyclicTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(ProcessService.class).createDeployment().addObject(processDefinition.getName(),
- processDefinition).deploy();
+ environment.get(ProcessService.class)
+ .createDeployment()
+ .addProcessDefinition(processDefinition)
+ .deploy();
+
// start execution
ExecutionImpl execution = (ExecutionImpl) environment.get(ExecutionService.class)
.startProcessInstanceById(processDefinition.getId());
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.deploy;
+import org.jbpm.ProcessDefinition;
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.deploy.Deployer;
import org.jbpm.pvm.internal.svc.DeploymentImpl;
@@ -46,9 +47,11 @@
// so that other subsequent deployers can just use the dom
// instead of reparsing the whole jpdl.xml file
deployment.addDocument(fileName, parse.getDocument());
- // add the parsed process definition to the objects
+
+ // add the parsed process definition to the processDefinitions
// this is where the save process deployer will find it
- deployment.addObject(fileName, parse.getDocumentObject());
+ ProcessDefinition processDefinition = (ProcessDefinition) parse.getDocumentObject();
+ deployment.addProcessDefinition(processDefinition);
}
}
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml 2009-03-09 16:32:17 UTC (rev 4196)
@@ -18,12 +18,6 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCDEF_"
- foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
-
<set name="historyActivityInstances"
cascade="all">
<key>
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -21,11 +21,10 @@
*/
package org.jbpm.pvm.internal.cmd;
-import java.util.ArrayList;
import java.util.List;
-import org.jbpm.ProcessDefinition;
import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.deploy.DeployerManager;
@@ -54,14 +53,6 @@
// and handle the deployment
deployerManager.deploy(deployment);
- List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
- for (String objectName: deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- processDefinitions.add((ProcessDefinition) object);
- }
- }
-
- return processDefinitions;
+ return deployment.getProcessDefinitions();
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -21,10 +21,8 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.hibernate.Session;
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.task.Task;
@@ -36,30 +34,14 @@
private static final long serialVersionUID = 1L;
protected Long parentTaskDbid;
- protected Long executionDbid;
- public NewTaskCmd(Long parentTaskDbid, Long executionDbid) {
+ public NewTaskCmd(Long parentTaskDbid) {
this.parentTaskDbid = parentTaskDbid;
- this.executionDbid = executionDbid;
}
public Task execute(Environment environment) throws Exception {
- ExecutionImpl execution = null;
-
TaskImpl task = TaskImpl.create();
-
- if (executionDbid!=null) {
- Session session = environment.get(Session.class);
- execution = (ExecutionImpl) session.load(ExecutionImpl.class, executionDbid);
- task.setExecution(execution);
- }
-
- if (parentTaskDbid!=null) {
- Session session = environment.get(Session.class);
- TaskImpl parentTask = (TaskImpl) session.load(TaskImpl.class, parentTaskDbid);
- parentTask.addSubTask(task);
- }
-
+ task.setParentTaskDbid(parentTaskDbid);
return task;
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -29,7 +29,7 @@
/**
* @author Alejandro Guizar
*/
-public class SaveTaskCmd implements Command<Void> {
+public class SaveTaskCmd implements Command<Long> {
private static final long serialVersionUID = 1L;
@@ -39,11 +39,13 @@
this.task = task;
}
- public Void execute(Environment environment) throws Exception {
+ public Long execute(Environment environment) throws Exception {
TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+
+
taskDbSession.saveTask(task);
- return null;
+ return task.getDbid();
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.deploy;
import java.io.Serializable;
+import java.util.List;
import org.jbpm.ProcessDefinition;
import org.jbpm.client.ClientProcessDefinition;
@@ -56,15 +57,12 @@
return;
}
- for (String processSourceName : deployment.getObjectNames()) {
- Object object = deployment.getObject(processSourceName);
- if (object instanceof ProcessDefinition) {
- checkProcessDefinition(processSourceName, (ProcessDefinitionImpl)object, deployment, pvmDbSession);
- }
+ for (ProcessDefinition processDefinition : deployment.getProcessDefinitions()) {
+ checkProcessDefinition(processDefinition, deployment, pvmDbSession);
}
}
- public void checkProcessDefinition(String processSourceName, ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
+ public void checkProcessDefinition(ProcessDefinition processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
if ( (processDefinition.getName()==null)
|| ("".equals(processDefinition.getName()))
) {
@@ -72,12 +70,12 @@
return;
}
- checkKey(processSourceName, processDefinition, deployment, pvmDbSession);
- checkVersion(processSourceName, processDefinition, deployment, pvmDbSession);
- checkId(processSourceName, processDefinition, deployment, pvmDbSession);
+ checkKey((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
+ checkVersion((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
+ checkId((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
}
- protected void checkKey(String processSourceName, ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
+ protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
String name = processDefinition.getName();
String key = processDefinition.getKey();
if ( (key==null)
@@ -93,18 +91,18 @@
if ( (existingKey!=null)
&& (!existingKey.equals(key))
) {
- deployment.addProblem("invalid key '"+key+"' in process "+processSourceName+". Existing process has name '"+name+"' and key '"+existingKey+"'");
+ deployment.addProblem("invalid key '"+key+"' in process "+processDefinition.getName()+". Existing process has name '"+name+"' and key '"+existingKey+"'");
}
String existingName = pvmDbSession.findProcessDefinitionNameByKey(key);
if ( (existingName!=null)
&& (!existingName.equals(name))
) {
- deployment.addProblem("invalid name '"+name+"' in process "+processSourceName+". Existing process has name '"+existingName+"' and key '"+key+"'");
+ deployment.addProblem("invalid name '"+name+"' in process "+processDefinition.getName()+". Existing process has name '"+existingName+"' and key '"+key+"'");
}
}
- protected void checkVersion(String processSourceName, ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
+ protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
int version = processDefinition.getVersion();
String key = processDefinition.getKey();
if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
@@ -128,7 +126,7 @@
}
}
- protected void checkId(String processSourceName, ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
+ protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
String id = processDefinition.getId();
if (id==null) {
id = processDefinition.getKey()+":"+processDefinition.getVersion();
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -23,8 +23,8 @@
import java.io.InputStream;
import java.io.Serializable;
+import java.util.List;
-import org.jbpm.ProcessDefinition;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -52,24 +52,17 @@
return;
}
- ProcessDefinitionImpl lastProcessDefinition = null;
-
boolean deployedProcess = false;
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- deployedProcess = true;
- lastProcessDefinition = (ProcessDefinitionImpl) object;
-
- log.debug("saving process definition "+object);
- pvmDbSession.save(object);
- }
- }
-
- if (lastProcessDefinition!=null) {
+
+ List<ProcessDefinitionImpl> processDefinitions = (List)deployment.getProcessDefinitions();
+
+ for (ProcessDefinitionImpl processDefinition : processDefinitions) {
+ log.debug("saving process definition "+processDefinition);
+ deployedProcess = true;
+ pvmDbSession.save(processDefinition);
for (String fileName : deployment.getFileNames()) {
InputStream inputStream = deployment.getFile(fileName);
- lastProcessDefinition.addAttachment(fileName, inputStream);
+ processDefinition.addAttachment(fileName, inputStream);
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -41,6 +41,12 @@
public void saveTask(Task task) {
TaskImpl taskImpl = (TaskImpl) task;
+ if (taskImpl.getParentTaskDbid()!=null) {
+ TaskImpl parentTask = (TaskImpl) session.load(TaskImpl.class, taskImpl.getParentTaskDbid());
+ parentTask.addSubTask(taskImpl);
+ taskImpl.setParentTaskDbid(null);
+ }
+
if (! taskImpl.isPersisted()) {
Serializable dbid = session.save(taskImpl);
if (taskImpl.getId() == null) {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.history.model;
+import java.io.Serializable;
import java.util.Date;
import org.jbpm.history.HistoryActivityInstance;
@@ -32,8 +33,10 @@
*
* @author Tom Baeyens
*/
-public class HistoryActivityInstanceImpl implements HistoryActivityInstance {
+public class HistoryActivityInstanceImpl implements HistoryActivityInstance, Serializable {
+ private static final long serialVersionUID = 1L;
+
protected long dbid;
protected int dbversion;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.history.model;
+import java.io.Serializable;
import java.util.Date;
import java.util.Set;
@@ -33,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class HistoryProcessInstanceImpl implements HistoryProcessInstance {
+public class HistoryProcessInstanceImpl implements HistoryProcessInstance, Serializable {
protected long dbid;
protected int dbversion;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -41,6 +41,7 @@
import org.jbpm.ProcessDefinition;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
import org.jbpm.pvm.internal.stream.FileStreamInput;
import org.jbpm.pvm.internal.stream.InputStreamInput;
@@ -81,40 +82,14 @@
protected Map<String, Document> fileDocuments = new HashMap<String, Document>();
/** maps file names to file types */
protected Map<String, String> fileTypes = new HashMap<String,String>();
+ /** process definitions */
+ protected List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
- /** generic pool of objects.
- * 1) users can supply objects directly to a deployment like
- * e.g. ProcessDefinition's created by a factory
- * 2) deployers can create objects as a result from processing the files
- * in those cases the object names are typically identical to the file
- * names
- * 3) the save deployer will store all objects in the db.
- */
- protected Map<String, Object> objects;
-
- /* maps object names to object types */
- protected Map<String, Object> objectTypes;
-
- // TODO REMOVE
- protected ProcessDefinition processDefinition;
-
public DeploymentImpl(ProcessServiceImpl processServiceImpl) {
this.processServiceImpl = processServiceImpl;
this.problems = new ArrayList<ProblemImpl>();
}
- // TODO REMOVE
- public DeploymentImpl() {
- this.problems = new ArrayList<ProblemImpl>();
- }
-
- // TODO REMOVE replace with addObject
- public DeploymentImpl(ProcessDefinition processDefinition) {
- this.problems = new ArrayList<ProblemImpl>();
- setProcessDefinition(processDefinition);
- }
-
-
public Deployment addResource(String resource) {
addStreamSource(resource, new ResourceStreamInput(resource));
return this;
@@ -260,20 +235,6 @@
return files.keySet();
}
- public Object getObject(String name) {
- if (objects==null) {
- return null;
- }
- return objects.get(name);
- }
-
- public Set<String> getObjectNames() {
- if (objects==null) {
- return Collections.EMPTY_SET;
- }
- return objects.keySet();
- }
-
public Document getDocument(String name) {
if ( (fileDocuments!=null)
&& (fileDocuments.containsKey(name))
@@ -293,14 +254,6 @@
return null;
}
- public ProcessDefinition getProcessDefinition() {
- return processDefinition;
- }
-
- public void setProcessDefinition(ProcessDefinition processDefinition) {
- this.processDefinition = processDefinition;
- }
-
public String getName() {
return name;
}
@@ -309,32 +262,17 @@
return this;
}
- public Deployment addObject(String name, Object object) {
- if (objects==null) {
- objects = new HashMap<String, Object>();
- }
- objects.put(name, object);
+ public Deployment addProcessDefinition(ProcessDefinition processDefinition) {
+ processDefinitions.add(processDefinition);
return this;
}
public Deployment deploy() {
- processServiceImpl.deploy(this);
+ processDefinitions.addAll(processServiceImpl.deploy(this));
return this;
}
public List<ProcessDefinition> getProcessDefinitions() {
- List<ProcessDefinition> processDefinitions = null;
- if (objects!=null) {
- processDefinitions = new ArrayList<ProcessDefinition>();
- for (Object object: objects.values()) {
- if (object instanceof ProcessDefinition) {
- processDefinitions.add((ProcessDefinition) object);
- }
- }
- } else {
- processDefinitions = Collections.EMPTY_LIST;
- }
-
return processDefinitions;
}
@@ -378,15 +316,6 @@
return this;
}
- public Deployment addObject(String name, Object object, String objectType) {
- addObject(name, objectType);
- if (objectTypes==null) {
- objectTypes = new HashMap<String, Object>();
- }
- objectTypes.put(name, objectType);
- return this;
- }
-
public Deployment setFileType(String fileName, String fileType) {
if (fileTypes==null) {
fileTypes = new HashMap<String, String>();
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -88,11 +88,6 @@
return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
}
- public List<ProcessDefinition> deploy(OpenProcessDefinition processDefinition) {
- DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
- return commandService.execute(new DeployCmd(deploymentImpl));
- }
-
public CommandService getCommandService() {
return commandService;
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -81,6 +81,9 @@
protected TaskImpl superTask;
protected Set<TaskImpl> subTasks;
+ protected Long executionDbid;
+ protected Long parentTaskDbid;
+
protected TaskImpl() {
}
@@ -379,4 +382,16 @@
public Integer getProgress() {
return progress;
}
+ public Long getExecutionDbid() {
+ return executionDbid;
+ }
+ public void setExecutionDbid(Long executionDbid) {
+ this.executionDbid = executionDbid;
+ }
+ public Long getParentTaskDbid() {
+ return parentTaskDbid;
+ }
+ public void setParentTaskDbid(Long parentTaskDbid) {
+ this.parentTaskDbid = parentTaskDbid;
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -67,15 +67,15 @@
}
public Task newTask() {
- return commandService.execute(new NewTaskCmd(null, null));
+ return commandService.execute(new NewTaskCmd(null));
}
public Task getTask(long taskDbid) {
return commandService.execute(new GetTaskCmd(taskDbid));
}
- public void saveTask(Task task) {
- commandService.execute(new SaveTaskCmd((TaskImpl) task));
+ public long saveTask(Task task) {
+ return commandService.execute(new SaveTaskCmd((TaskImpl) task));
}
public void deleteTask(long taskDbid) {
@@ -135,7 +135,7 @@
}
public Task newTask(long parentTaskDbid) {
- return commandService.execute(new NewTaskCmd(parentTaskDbid, null));
+ return commandService.execute(new NewTaskCmd(parentTaskDbid));
}
public Comment addTaskComment(long taskDbid, String message) {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml 2009-03-09 16:32:17 UTC (rev 4196)
@@ -18,12 +18,6 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCDEF_"
- foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
-
<set name="historyActivityInstances"
cascade="all">
<key>
Modified: jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -171,13 +171,15 @@
return null;
}
- public void saveAndRegisterTask(Task task) {
- taskService.saveTask(task);
+ public long saveAndRegisterTask(Task task) {
+ long taskDbid = taskService.saveTask(task);
if (registeredTaskIds == null) {
registeredTaskIds = new ArrayList<Long>();
}
- registeredTaskIds.add(task.getDbid());
+ registeredTaskIds.add(taskDbid);
+
+ return taskDbid;
}
public HashSet<String> getActivityNames(String processInstanceId) {
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -41,8 +41,7 @@
Task task = taskService.newTask();
task.setName("clean da house");
- saveAndRegisterTask(task);
- long taskDbid = task.getDbid();
+ long taskDbid = saveAndRegisterTask(task);
// create 3 sub tasks:
// * clean da house
@@ -52,18 +51,15 @@
Task subTask = taskService.newTask(taskDbid);
subTask.setName("dishes");
- taskService.saveTask(subTask);
- long dishesTaskDbid = subTask.getDbid();
+ long dishesTaskDbid = taskService.saveTask(subTask);
subTask = taskService.newTask(taskDbid);
subTask.setName("laundry");
- taskService.saveTask(subTask);
- long laundryTaskDbid = subTask.getDbid();
+ long laundryTaskDbid = taskService.saveTask(subTask);
subTask = taskService.newTask(taskDbid);
subTask.setName("sweep floor");
- taskService.saveTask(subTask);
- long sweepFloorTaskDbid = subTask.getDbid();
+ long sweepFloorTaskDbid = taskService.saveTask(subTask);
// verify 3 sub tasks of clean da house
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -36,8 +36,7 @@
public void testComments() {
Task task = taskService.newTask();
task.setName("clean da house");
- taskService.saveTask(task);
- long taskDbid = task.getDbid();
+ long taskDbid = taskService.saveTask(task);
// what a party yesterday
// - what! you had a party while i was out ?!
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-03-09 16:32:17 UTC (rev 4196)
@@ -41,8 +41,7 @@
public void testSaveTask() {
Task task = taskService.newTask();
- saveAndRegisterTask(task);
- long taskDbid = task.getDbid();
+ long taskDbid = saveAndRegisterTask(task);
// task was made persistent
task = taskService.getTask(taskDbid);
assertNotNull("expected non-null task", task);
@@ -60,8 +59,7 @@
public void testDeleteTask() {
Task task = taskService.newTask();
- taskService.saveTask(task);
- long taskDbid = task.getDbid();
+ long taskDbid = taskService.saveTask(task);
// task was made persistent
assertNotNull("expected non-null task", taskService.getTask(taskDbid));
Modified: jbpm4/branches/tbaeyens/modules/userguide/.settings/attachedFile.properties
===================================================================
--- jbpm4/branches/tbaeyens/modules/userguide/.settings/attachedFile.properties 2009-03-09 00:08:33 UTC (rev 4195)
+++ jbpm4/branches/tbaeyens/modules/userguide/.settings/attachedFile.properties 2009-03-09 16:32:17 UTC (rev 4196)
@@ -1,2 +1,2 @@
## index of importer -> set(imports)
-#Thu Mar 05 09:01:39 CET 2009
+#Mon Mar 09 09:00:28 CET 2009
17 years, 2 months
JBoss JBPM SVN: r4195 - jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-08 20:08:33 -0400 (Sun, 08 Mar 2009)
New Revision: 4195
Modified:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.common.xml
Log:
have hibernate order updates to decrease deadlock occurrences
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.common.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.common.xml 2009-03-08 12:20:29 UTC (rev 4194)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.common.xml 2009-03-09 00:08:33 UTC (rev 4195)
@@ -6,7 +6,6 @@
<!-- JTA transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="jta.UserTransaction">UserTransaction</property>
==== JTA transaction properties (end) -->
<!-- CMT transaction properties (begin) ===
@@ -29,6 +28,10 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
+ <!-- order SQL inserts and updates, resulting in fewer transaction deadlocks -->
+ <property name="hibernate.order_inserts">true</property>
+ <property name="hibernate.order_updates">true</property>
+
<!-- ############################################ -->
<!-- # mapping files with external dependencies # -->
<!-- ############################################ -->
17 years, 2 months
JBoss JBPM SVN: r4194 - in jbpm4/branches/tbaeyens/modules: pvm/src/main/java/org/jbpm/pvm/internal/model and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-08 08:20:29 -0400 (Sun, 08 Mar 2009)
New Revision: 4194
Added:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/SerializingCommandService.java
Modified:
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceEndedSynchronization.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/ByteArrayStreamInput.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml
Log:
work
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-08 12:20:29 UTC (rev 4194)
@@ -11,7 +11,7 @@
<task-service />
<identity-service />
- <command-service>
+ <command-service serialize="true">
<retry-interceptor />
<environment-interceptor />
<standard-transaction-interceptor />
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceEndedSynchronization.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceEndedSynchronization.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessInstanceEndedSynchronization.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -21,6 +21,8 @@
*/
package org.jbpm.pvm.internal.model;
+import java.io.ObjectStreamException;
+
import javax.transaction.Status;
import javax.transaction.Synchronization;
@@ -61,4 +63,10 @@
pvmDbSession.deleteProcessInstance(processInstanceId, false);
return null;
}
+
+ protected Object writeReplace() throws ObjectStreamException {
+ this.commandService = null;
+ return this;
+ }
+
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -21,6 +21,8 @@
*/
package org.jbpm.pvm.internal.query;
+import java.io.ObjectStreamException;
+
import org.hibernate.Query;
import org.hibernate.Session;
import org.jbpm.cmd.Command;
@@ -95,4 +97,9 @@
orderByClause += ", " + clause;
}
}
+
+ protected Object writeReplace() throws ObjectStreamException {
+ this.commandService = null;
+ return this;
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/ByteArrayStreamInput.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/ByteArrayStreamInput.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/stream/ByteArrayStreamInput.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -23,14 +23,17 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.Serializable;
import org.jbpm.JbpmException;
/**
* @author Tom Baeyens
*/
-public class ByteArrayStreamInput extends StreamInput {
+public class ByteArrayStreamInput extends StreamInput implements Serializable {
+ private static final long serialVersionUID = 1L;
+
protected byte[] bytes;
/** @throws JbpmException if bytes is null */
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectStreamException;
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
@@ -38,6 +39,7 @@
import org.jbpm.Deployment;
import org.jbpm.JbpmException;
import org.jbpm.ProcessDefinition;
+import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
import org.jbpm.pvm.internal.stream.FileStreamInput;
@@ -405,4 +407,25 @@
}
return fileNames;
}
+
+ protected Object writeReplace() throws ObjectStreamException {
+ if (files!=null) {
+ Map<String, StreamInput> replacedFiles = new HashMap<String, StreamInput>();
+ for (Map.Entry<String, StreamInput> entry: files.entrySet()) {
+ byte[] bytes = IoUtil.readBytes(entry.getValue().openStream());
+ replacedFiles.put(entry.getKey(), new ByteArrayStreamInput(bytes));
+ }
+ files = replacedFiles;
+ }
+
+ processServiceImpl = null;
+
+ return this;
+ }
+
+ protected Object readResolve() throws ObjectStreamException {
+ processServiceImpl = Environment.getFromCurrent(ProcessServiceImpl.class);
+ return this;
+ }
+
}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/SerializingCommandService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/SerializingCommandService.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/SerializingCommandService.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.svc;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.internal.log.Log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SerializingCommandService extends DefaultCommandService {
+
+ private static final Log log = Log.getLog(SerializingCommandService.class.getName());
+
+ public <T> T execute(Command<T> command) {
+ log.info("serializing command "+command);
+ Command serializedCommand = (Command) serialize(command);
+ T returnValue = (T) super.execute(serializedCommand);
+ T serializedReturnValue = (T) serialize(returnValue);
+ return serializedReturnValue;
+ }
+
+ public Object serialize(Object o) {
+ try {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ } catch (Exception e) {
+ throw new JbpmException("serialization exception", e);
+ }
+ }
+}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.task;
+import java.io.ObjectStreamException;
import java.util.List;
import org.hibernate.Query;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java 2009-03-08 12:20:29 UTC (rev 4194)
@@ -26,6 +26,7 @@
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.svc.AsyncCommandService;
import org.jbpm.pvm.internal.svc.DefaultCommandService;
+import org.jbpm.pvm.internal.svc.SerializingCommandService;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.CommandServiceDescriptor;
@@ -66,6 +67,11 @@
}
protected CommandService getCommandService(Element element, Parse parse, Parser parser) {
+ if ( XmlUtil.attributeBoolean(element, "serialize", false, parse, Boolean.FALSE)) {
+
+ return new SerializingCommandService();
+ }
+
if ( XmlUtil.attributeBoolean(element, "async", false, parse, Boolean.FALSE)) {
AsyncCommandService asyncCommandService = new AsyncCommandService();
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-03-08 01:18:45 UTC (rev 4193)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-03-08 12:20:29 UTC (rev 4194)
@@ -11,7 +11,7 @@
<task-service />
<identity-service />
- <command-service>
+ <command-service serialize="true">
<retry-interceptor />
<environment-interceptor />
<standard-transaction-interceptor />
17 years, 2 months
JBoss JBPM SVN: r4193 - in jbpm3/branches/jbpm-3.2.5.SP/modules/core: src/main/java/org/jbpm/db and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-07 20:18:45 -0500 (Sat, 07 Mar 2009)
New Revision: 4193
Modified:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/SerializabilityTest.java
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/db/JbpmSchemaDbTest.java
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/jbpm1755/JBPM1755Test.java
Log:
JBPM-2086: merge r3931 from trunk; fix clean, drop, create schema with JbpmSchema
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml 2009-03-08 01:18:45 UTC (rev 4193)
@@ -235,12 +235,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
@@ -262,12 +256,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
@@ -289,14 +277,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- [JBPM-1166] SEAM timer transaction integration -->
- <exclude>org/jbpm/seam/JobExecutorCustomizationTest.java</exclude>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
@@ -318,12 +298,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
@@ -345,12 +319,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
- </excludes>
- </configuration>
</plugin>
</plugins>
</build>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2009-03-08 01:18:45 UTC (rev 4193)
@@ -79,12 +79,11 @@
Configuration configuration = dbPersistenceServiceFactory.getConfiguration();
JbpmSchema jbpmSchema = new JbpmSchema(configuration);
- Map<String, Integer> recordCountPerTable = jbpmSchema.getRecordCountPerTable();
- for (Map.Entry<String, Integer> entry : recordCountPerTable.entrySet()) {
+ Map<String, Long> rowsPerTable = jbpmSchema.getRowsPerTable();
+ for (Map.Entry<String, Long> entry : rowsPerTable.entrySet()) {
// String tableName = entry.getKey();
- Integer count = entry.getValue();
-
- if ((count == null) || (count != 0)) {
+ Long count = entry.getValue();
+ if (count != 0) {
hasLeftOvers = true;
// [JBPM-1812] Fix tests that don't cleanup the database
// Only uncomment this if you intend to fix it. Otherwise it just generates noise.
@@ -94,8 +93,7 @@
}
if (hasLeftOvers) {
- // TODO: JBPM-1781
- // jbpmSchema.cleanSchema();
+ jbpmSchema.cleanSchema();
}
}
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2009-03-08 01:18:45 UTC (rev 4193)
@@ -27,26 +27,25 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
-import java.io.Serializable;
import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.engine.Mapping;
-import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.Table;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.tool.hbm2ddl.TableMetadata;
@@ -56,16 +55,16 @@
/**
* utilities for the jBPM database schema.
*/
-public class JbpmSchema implements Serializable {
+public class JbpmSchema {
- private static final long serialVersionUID = 1L;
-
final Configuration configuration;
final Settings settings;
ConnectionProvider connectionProvider = null;
Connection connection = null;
+ final List<SQLException> exceptions = new ArrayList<SQLException>();
+
public JbpmSchema(Configuration configuration) {
this.configuration = configuration;
this.settings = configuration.buildSettings();
@@ -80,79 +79,65 @@
}
public String[] getCleanSql() {
- Dialect dialect = settings.getDialect();
- String catalog = settings.getDefaultCatalogName();
- String schema = settings.getDefaultSchemaName();
- Mapping mapping = configuration.buildMapping();
-
- // loop over all foreign key constraints
- List<String> dropForeignKeysSql = new ArrayList<String>();
- List<String> createForeignKeysSql = new ArrayList<String>();
- List<String> deleteSql = new ArrayList<String>();
-
- for (Iterator<?> ti = configuration.getTableMappings(); ti.hasNext();) {
- Table table = (Table) ti.next();
- if (!table.isPhysicalTable()) continue;
-
- for (Iterator<?> fki = table.getForeignKeyIterator(); fki.hasNext();) {
- ForeignKey fk = (ForeignKey) fki.next();
- if (!fk.isPhysicalConstraint()) continue;
-
- // collect the drop foreign key sql
- String sqlDropString = fk.sqlDropString(dialect, catalog, schema);
- dropForeignKeysSql.add(sqlDropString);
-
- // and collect the create foreign key sql
- String sqlCreateString = fk.sqlCreateString(dialect, mapping, catalog, schema);
- createForeignKeysSql.add(sqlCreateString);
- }
- 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
- return concat(dropForeignKeysSql, deleteSql, createForeignKeysSql);
+ return concat(getDropSql(), getCreateSql());
}
- private static String[] concat(List<?>... lists) {
- int length = 0;
- for (List<?> list : lists) {
- length += list.size();
- }
- String[] array = new String[length];
- int index = 0;
- for (List<?> list : lists) {
- for (Object element : list) {
- array[index++] = (String) element;
+ public Set<String> getJbpmTables() {
+ Set<String> jbpmTables = new HashSet<String>();
+ for (Iterator<?> i = configuration.getTableMappings(); i.hasNext();) {
+ Table table = (Table) i.next();
+ if (table.isPhysicalTable()) {
+ jbpmTables.add(table.getName());
}
}
- return array;
+ return jbpmTables;
}
- public List<String> getTableNames() {
- List<String> tableNames = new ArrayList<String>();
- for (Iterator<?> iter = configuration.getTableMappings(); iter.hasNext();) {
- Table table = (Table) iter.next();
- if (table.isPhysicalTable()) {
- tableNames.add(table.getName());
+ public Set<String> getExistingTables() {
+ try {
+ createConnection();
+ Set<String> existingTables = new HashSet<String>();
+
+ DatabaseMetaData metaData = connection.getMetaData();
+ boolean storesLowerCaseIdentifiers = metaData.storesLowerCaseIdentifiers();
+ ResultSet resultSet = metaData.getTables(settings.getDefaultCatalogName(),
+ settings.getDefaultSchemaName(), null, new String[] { "TABLE" });
+ try {
+ while (resultSet.next()) {
+ String tableName = resultSet.getString("TABLE_NAME");
+ if (storesLowerCaseIdentifiers) {
+ tableName = tableName.toUpperCase();
+ }
+ existingTables.add(tableName);
+ }
}
+ finally {
+ resultSet.close();
+ }
+ return existingTables;
}
- return tableNames;
+ catch (SQLException e) {
+ throw new JbpmException("could not get available table names", e);
+ }
+ finally {
+ closeConnection();
+ }
}
- public Map<String, Integer> getRecordCountPerTable() {
- Map<String, Integer> recordCounts = new HashMap<String, Integer>();
+ public Map<String, Long> getRowsPerTable() {
+ Map<String, Long> rowsPerTable = new HashMap<String, Long>();
try {
createConnection();
Statement statement = connection.createStatement();
- for (String tableName : getTableNames()) {
+ for (String tableName : getJbpmTables()) {
String sql = "SELECT COUNT(*) FROM " + tableName;
ResultSet resultSet = statement.executeQuery(sql);
- resultSet.next();
- recordCounts.put(tableName, resultSet.getInt(1));
+ if (!resultSet.next()) throw new JbpmException("empty result set: " + sql);
+
+ long count = resultSet.getLong(1);
+ if (resultSet.wasNull()) throw new JbpmException("count was null: " + sql);
+
+ rowsPerTable.put(tableName, count);
resultSet.close();
}
statement.close();
@@ -163,7 +148,7 @@
finally {
closeConnection();
}
- return recordCounts;
+ return rowsPerTable;
}
public void dropSchema() {
@@ -264,6 +249,10 @@
}
}
+ public List<SQLException> getExceptions() {
+ return exceptions;
+ }
+
private Table findTableMapping(String tableName) {
for (Iterator<?> i = configuration.getTableMappings(); i.hasNext();) {
Table table = (Table) i.next();
@@ -350,12 +339,20 @@
void execute(String... sqls) throws SQLException {
boolean showSql = settings.isShowSqlEnabled();
+ exceptions.clear();
try {
createConnection();
Statement statement = connection.createStatement();
for (String sql : sqls) {
if (showSql) System.out.println(sql);
- statement.executeUpdate(sql);
+ log.debug(sql);
+ try {
+ statement.executeUpdate(sql);
+ }
+ catch (SQLException e) {
+ exceptions.add(e);
+ log.debug(e.getMessage());
+ }
}
statement.close();
}
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/SerializabilityTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/SerializabilityTest.java 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/SerializabilityTest.java 2009-03-08 01:18:45 UTC (rev 4193)
@@ -24,10 +24,6 @@
import java.io.File;
import java.io.Serializable;
import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
import org.jbpm.file.def.FileDefinitionFileSystemConfigTest;
import org.jbpm.util.ClassLoaderUtil;
@@ -36,18 +32,18 @@
String testRootDir = FileDefinitionFileSystemConfigTest.class.getProtectionDomain().getCodeSource().getLocation().getFile().toString();
- static Set excusedClasses = new HashSet(Arrays.asList(new String[] {
+ static final String[] excusedClasses = {
"org.jbpm.ant",
"org.jbpm.context.exe.JbpmType",
"org.jbpm.db.hibernate.ConverterEnumType",
"org.jbpm.db.hibernate.Converters",
"org.jbpm.db.hibernate.JbpmNamingStrategy",
- "org.jbpm.db.jmx.JbpmService",
"org.jbpm.db.AbstractDbTestCase",
"org.jbpm.db.ContextSession",
"org.jbpm.db.FileSession",
"org.jbpm.db.GraphSession",
"org.jbpm.db.JbpmSession",
+ "org.jbpm.db.JbpmSchema",
"org.jbpm.db.JobSession",
"org.jbpm.db.LoggingSession",
"org.jbpm.db.SchedulerSession",
@@ -62,11 +58,9 @@
"org.jbpm.instantiation.ProcessClassLoader",
"org.jbpm.instantiation.XmlInstantiator",
"org.jbpm.JbpmConfiguration",
- "org.jbpm.jmx.JbpmService",
"org.jbpm.job.executor.JobExecutorThread",
"org.jbpm.job.executor.LockMonitorThread",
"org.jbpm.jpdl.convert.Converter",
- "org.jbpm.jpdl.convert.Converter$1",
"org.jbpm.graph.action.ActionTypes",
"org.jbpm.graph.node.Fork$ForkedToken",
"org.jbpm.graph.node.InterleaveStart$DefaultInterleaver",
@@ -80,12 +74,6 @@
"org.jbpm.jpdl.xml.JpdlXmlReader",
"org.jbpm.jpdl.xml.JpdlXmlWriter",
"org.jbpm.jpdl.el",
- "org.jbpm.scheduler.impl.Scheduler",
- "org.jbpm.scheduler.impl.Scheduler$HistoryListener",
- "org.jbpm.scheduler.impl.SchedulerMain$1",
- "org.jbpm.scheduler.impl.SchedulerMain$LogListener",
- "org.jbpm.scheduler.impl.SchedulerMain",
- "org.jbpm.scheduler.impl.SchedulerThread",
"org.jbpm.security.authenticator.JBossAuthenticator",
"org.jbpm.security.authenticator.JbpmDefaultAuthenticator",
"org.jbpm.security.authenticator.SubjectAuthenticator",
@@ -95,22 +83,14 @@
"org.jbpm.security.authorizer.RolesAuthorizer",
"org.jbpm.security.filter.JbpmAuthenticationFilter",
"org.jbpm.command.service.CommandServiceImpl",
- "org.jbpm.msg.jms.JmsCommandFactory",
- "org.jbpm.msg.jms.JmsMessageConstants",
- "org.jbpm.msg.jms.JmsMessageUtils",
- "org.jbpm.bpel.ant.DBSchemaTask",
- "org.jbpm.bpel.ant.ServiceGeneratorTask",
- "org.jbpm.bpel.ant.DeployProcessTask",
- "org.jbpm.bpel.",
"org.jbpm.sim.",
- "org.jbpm.jsf.",
"org.jbpm.util.Clock",
"org.jbpm.util.CustomLoaderObjectInputStream",
"org.jbpm.web.JobExecutorLauncher",
"org.jbpm.web.JbpmConfigurationCloser",
"org.jbpm.JbpmContextTestHelper",
"org.jbpm.EventCallback$1"
- }));
+ };
public void testForNonSerializableClasses() {
File jbpmRoot = new File(testRootDir+"../classes/");
@@ -139,7 +119,7 @@
}
private void assertSerializabilityOfClass(String className) {
- Class clazz = ClassLoaderUtil.loadClass(className);
+ Class<?> clazz = ClassLoaderUtil.loadClass(className);
if ( ! ( Serializable.class.isAssignableFrom(clazz)
|| Modifier.isAbstract(clazz.getModifiers())
@@ -152,15 +132,11 @@
}
boolean isExcused(String className) {
- boolean isExcused = false;
- Iterator iter = excusedClasses.iterator();
- while (iter.hasNext() && !isExcused) {
- String excusedClassName = (String) iter.next();
- if (className.startsWith(excusedClassName)) {
- isExcused = true;
- }
+ for (String excusedClassName : excusedClasses) {
+ if (className.startsWith(excusedClassName))
+ return true;
}
- return isExcused;
+ return false;
}
}
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/db/JbpmSchemaDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/db/JbpmSchemaDbTest.java 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/db/JbpmSchemaDbTest.java 2009-03-08 01:18:45 UTC (rev 4193)
@@ -21,6 +21,9 @@
*/
package org.jbpm.db;
+import java.util.Map;
+import java.util.Set;
+
import org.hibernate.cfg.Configuration;
import org.jbpm.AbstractJbpmTestCase;
@@ -30,26 +33,38 @@
* @author thomas.diesler(a)jboss.com
* @since 06-Nov-2008
*/
-public class JbpmSchemaDbTest extends AbstractJbpmTestCase
-{
- public void testCleanSchema()
- {
- Configuration config = new Configuration().configure();
- JbpmSchema jbpmSchema = new JbpmSchema(config);
- jbpmSchema.cleanSchema();
+public class JbpmSchemaDbTest extends AbstractJbpmTestCase {
+
+ JbpmSchema jbpmSchema;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ jbpmSchema = new JbpmSchema(new Configuration().configure());
}
-
- public void testDropSchema()
- {
- Configuration config = new Configuration().configure();
- JbpmSchema jbpmSchema = new JbpmSchema(config);
+
+ public void testCreateSchema() {
+ jbpmSchema.createSchema();
+ Set<String> existingTables = jbpmSchema.getExistingTables();
+ assert existingTables.containsAll(jbpmSchema.getJbpmTables()) : existingTables;
+ }
+
+ public void testDropSchema() {
jbpmSchema.dropSchema();
+ Set<String> existingTables = jbpmSchema.getExistingTables();
+ for (String jbpmTable : jbpmSchema.getJbpmTables()) {
+ assert !existingTables.contains(jbpmTable) : existingTables;
+ }
}
- public void testCreateSchema()
- {
- Configuration config = new Configuration().configure();
- JbpmSchema jbpmSchema = new JbpmSchema(config);
- jbpmSchema.createSchema();
+ public void testCleanSchema() {
+ jbpmSchema.cleanSchema();
+ Map<String, Long> rowsPerTable = jbpmSchema.getRowsPerTable();
+ Set<String> existingTables = jbpmSchema.getExistingTables();
+ assert existingTables.containsAll(rowsPerTable.keySet()) : existingTables;
+
+ for (long rowCount : rowsPerTable.values()) {
+ assertEquals(0, rowCount);
+ }
}
}
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/jbpm1755/JBPM1755Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/jbpm1755/JBPM1755Test.java 2009-03-07 20:51:46 UTC (rev 4192)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/jbpm1755/JBPM1755Test.java 2009-03-08 01:18:45 UTC (rev 4193)
@@ -25,12 +25,10 @@
protected void setUp() throws Exception {
super.setUp();
processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm1755/parallelprocess.xml");
- startJobExecutor();
}
@Override
protected void tearDown() throws Exception {
- stopJobExecutor();
graphSession.deleteProcessDefinition(processDefinition.getId());
EventCallback.clear();
super.tearDown();
@@ -65,9 +63,11 @@
commitAndCloseSession();
try {
+ startJobExecutor();
EventCallback.waitForEvent(processInstanceCount, Event.EVENTTYPE_PROCESS_END);
}
finally {
+ stopJobExecutor();
beginSessionTransaction();
}
17 years, 2 months
JBoss JBPM SVN: r4192 - jbpm3/tags.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-07 15:51:46 -0500 (Sat, 07 Mar 2009)
New Revision: 4192
Removed:
jbpm3/tags/jbpm-3.2.5.SP3/
Log:
wipe out premature 3.2.5.SP3 tag
17 years, 2 months
JBoss JBPM SVN: r4191 - jbpm4/branches/tbaeyens/modules/distro/src/main/resources/installer.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-07 09:27:34 -0500 (Sat, 07 Mar 2009)
New Revision: 4191
Modified:
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/installer/install-definition.xml
Log:
work
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/installer/install-definition.xml 2009-03-07 14:04:01 UTC (rev 4190)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/installer/install-definition.xml 2009-03-07 14:27:34 UTC (rev 4191)
@@ -196,25 +196,9 @@
<include name="jbpm-destinations-service.xml"/>
</fileset>
- <!-- Database configs to docs/examples/jbpm -->
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config" targetdir="${jbossInstallPath}/docs/examples/jbpm" override="true">
- <include name="hibernate.cfg.hsqldb.xml"/>
- <include name="hibernate.cfg.mysql.xml"/>
- <include name="hibernate.cfg.postgresql.xml"/>
- <include name="hibernate.cfg.oracle.xml"/>
- <include name="hibernate.cfg.sybase.xml"/>
- <include name="jbpm-hsqldb-ds.xml"/>
- <include name="jbpm-mysql-ds.xml"/>
- <include name="jbpm-postgresql-ds.xml"/>
- <include name="jbpm-oracle-ds.xml"/>
- <include name="jbpm-sybase-ds.xml"/>
- </fileset>
+ <!-- TODO: include the example configuration files -->
- <!-- Database Scripts / DDL -->
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-db"
- targetdir="${jbossInstallPath}/docs/examples/jbpm/database-scripts"
- override="true"
- includes="create/,drop/"/>
+ <!-- TODO: include the db scripts -->
<!--
==============================
@@ -316,29 +300,5 @@
</pack>
- <!--
- ==============================
- Optional Components
- ==============================
- <pack name="Optional Components" required="no" preselected="no">
- <description>Optional jBPM4 Components</description>
- </pack>
- -->
-
- <!-- JBoss-5.0.0
- <pack name="Download JBoss-5.0.0" required="no" parent="Optional Components" preselected="no">
- <description>Download and Install JBoss-5.0.0</description>
- http://jira.codehaus.org/browse/IZPACK-158
- <file src="@{resources.dir}/installer/download-helper.xml" targetdir="$INSTALL_PATH/Uninstaller"/>
- </pack>
- -->
-
- <!-- Eclipse-3.4.0 -->
- <!--pack name="Download Eclipse-3.4.0" required="no" parent="Optional Components" preselected="no">
- <description>Download and Install Eclipse-3.4.0</description>
- http://jira.codehaus.org/browse/IZPACK-158
- <file src="@{resources.dir}/installer/download-helper.xml" targetdir="$INSTALL_PATH/Uninstaller"/>
- </pack-->
-
</packs>
</installation>
\ No newline at end of file
17 years, 2 months
JBoss JBPM SVN: r4190 - in jbpm4/branches/tbaeyens/modules: jpdl/src/test/resources and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-07 09:04:01 -0500 (Sat, 07 Mar 2009)
New Revision: 4190
Modified:
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
Log:
work
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 13:16:05 UTC (rev 4189)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 14:04:01 UTC (rev 4190)
@@ -57,8 +57,7 @@
<!-- dynamic type mapping configuration -->
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
- <binding class="org.jbpm.pvm.internal.wire.binding.StandardCommandServiceBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AsyncCommandServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 13:16:05 UTC (rev 4189)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 14:04:01 UTC (rev 4190)
@@ -57,8 +57,7 @@
<!-- dynamic type mapping configuration -->
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
- <binding class="org.jbpm.pvm.internal.wire.binding.StandardCommandServiceBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AsyncCommandServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 13:16:05 UTC (rev 4189)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 14:04:01 UTC (rev 4190)
@@ -57,8 +57,7 @@
<!-- dynamic type mapping configuration -->
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
- <binding class="org.jbpm.pvm.internal.wire.binding.StandardCommandServiceBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AsyncCommandServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 13:16:05 UTC (rev 4189)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-03-07 14:04:01 UTC (rev 4190)
@@ -57,8 +57,7 @@
<!-- dynamic type mapping configuration -->
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
- <binding class="org.jbpm.pvm.internal.wire.binding.StandardCommandServiceBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AsyncCommandServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
17 years, 2 months
JBoss JBPM SVN: r4189 - in jbpm4/branches/tbaeyens/modules: distro/src/main/resources/config-tool/jbpm/cfg and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-07 08:16:05 -0500 (Sat, 07 Mar 2009)
New Revision: 4189
Added:
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.bindings.xml
Removed:
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.exclude.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.include.xml
Modified:
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/build.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/remote.command.service.xml
jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbRemoteCommandServiceBinding.java
jbpm4/branches/tbaeyens/modules/examples/pom.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java
Log:
work
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/build.xml 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/build.xml 2009-03-07 13:16:05 UTC (rev 4189)
@@ -63,7 +63,14 @@
</fileset>
</copy>
- <antcall target="internal.wire.bindings" />
+ <concat destfile="${config.files.dir}/jbpm.wire.bindings.xml">
+ <filelist dir=".">
+ <file name="jbpm/wire.bindings/part1.jbpm.wire.bindings.xml" />
+ <file name="jbpm/wire.bindings/jpdl.${jpdl}.xml"/>
+ <file name="jbpm/wire.bindings/part2.jbpm.wire.bindings.xml" />
+ </filelist>
+ </concat>
+
<antcall target="internal.jpdl.hibernate.mapping.files" />
<antcall target="internal.identity.config.files" />
<antcall target="internal.jdk.logging" />
@@ -71,6 +78,32 @@
<echo>Created jbpm configuration files in ${config.files.dir}</echo>
</target>
+ <target name="create.remote.configuration"
+ depends="internal.prepare"
+ description="creates a jbpm.cfg.xml that connects to a remote jboss">
+ <delete>
+ <fileset dir="${config.files.dir}">
+ <include name="jbpm.*.xml" />
+ </fileset>
+ </delete>
+ <concat destfile="${config.files.dir}/jbpm.wire.bindings.xml">
+ <filelist dir=".">
+ <file name="jbpm/wire.bindings/part1.jbpm.wire.bindings.xml" />
+ <file name="jbpm/wire.bindings/jpdl.${jpdl}.xml"/>
+ <file name="jbpm/wire.bindings/enterprise.bindings.xml"/>
+ <file name="jbpm/wire.bindings/part2.jbpm.wire.bindings.xml" />
+ </filelist>
+ </concat>
+ <concat destfile="${config.files.dir}/jbpm.cfg.xml">
+ <filelist dir="${resolved.dir}">
+ <file name="jbpm/cfg/part1.jbpm.cfg.xml" />
+ <file name="jbpm/cfg/identity.service.${identity}.jbpm.cfg.xml" />
+ <file name="jbpm/cfg/remote.command.service.xml" />
+ </filelist>
+ </concat>
+ <echo>Created remote jbpm configuration files in ${config.files.dir}</echo>
+ </target>
+
<target name="create.db.scripts"
depends="create.configuration.files"
description="create ddl scripts for creating the db">
@@ -104,24 +137,6 @@
quiet="yes" />
</target>
- <target name="create.remote.configuration"
- depends="internal.prepare"
- description="creates a jbpm.cfg.xml that connects to a remote jboss">
- <delete>
- <fileset dir="${config.files.dir}">
- <include name="jbpm.*.xml" />
- </fileset>
- </delete>
- <antcall target="internal.wire.bindings" />
- <concat destfile="${config.files.dir}/jbpm.cfg.xml">
- <filelist dir="${resolved.dir}">
- <file name="jbpm/cfg/part1.jbpm.cfg.xml" />
- <file name="jbpm/cfg/identity.service.${identity}.jbpm.cfg.xml" />
- <file name="jbpm/cfg/remote.command.service.xml" />
- </filelist>
- </concat>
- </target>
-
<target name="db.create"
depends="create.db.scripts, internal.load.hibernate.properties"
description="creates the db tables in the database">
@@ -163,16 +178,6 @@
<!-- internal targets -->
- <target name="internal.wire.bindings">
- <concat destfile="${config.files.dir}/jbpm.wire.bindings.xml">
- <filelist dir=".">
- <file name="jbpm/wire.bindings/part1.jbpm.wire.bindings.xml" />
- <file name="jbpm/wire.bindings/jpdl.${jpdl}.xml"/>
- <file name="jbpm/wire.bindings/part2.jbpm.wire.bindings.xml" />
- </filelist>
- </concat>
- </target>
-
<target name="internal.load.hibernate.properties">
<copy file="${resolved.dir}/hibernate/jdbc/${database}.xml"
tofile="${tmp.dir}/hibernate.properties" />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/remote.command.service.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/remote.command.service.xml 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/remote.command.service.xml 2009-03-07 13:16:05 UTC (rev 4189)
@@ -1,9 +1,10 @@
- <command-service initial-context-factory="org.jboss.naming.NamingContextFactory"
- provider-url="jnp://@jboss.bind.address@"
- url-pkg-prefixes="org.jboss.naming rg.jnp.interfaces">
+ <ejb-remote-command-service
+ initial-context-factory="org.jnp.interfaces.NamingContextFactory"
+ provider-url="jnp://@jboss.bind.address@"
+ url-pkg-prefixes="org.jboss.naming:org.jnp.interfaces">
<retry-interceptor />
- </command-service>
+ </ejb-remote-command-service>
</process-engine-context>
</jbpm-configuration>
Copied: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.bindings.xml (from rev 4188, jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.include.xml)
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.bindings.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.bindings.xml 2009-03-07 13:16:05 UTC (rev 4189)
@@ -0,0 +1,3 @@
+ <binding class="org.jbpm.enterprise.internal.wire.binding.EjbTimerSessionBinding" />
+ <binding class="org.jbpm.enterprise.internal.wire.binding.EjbLocalCommandServiceBinding" />
+ <binding class="org.jbpm.enterprise.internal.wire.binding.EjbRemoteCommandServiceBinding" />
Property changes on: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.bindings.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.exclude.xml
===================================================================
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.include.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.include.xml 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/enterprise.include.xml 2009-03-07 13:16:05 UTC (rev 4189)
@@ -1,3 +0,0 @@
- <binding class="org.jbpm.enterprise.internal.wire.binding.EjbTimerSessionBinding" />
- <binding class="org.jbpm.enterprise.internal.wire.binding.EjbLocalCommandServiceBinding" />
- <binding class="org.jbpm.enterprise.internal.wire.binding.EjbRemoteCommandServiceBinding" />
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-03-07 13:16:05 UTC (rev 4189)
@@ -29,12 +29,15 @@
import org.jbpm.JbpmException;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
+import org.jbpm.internal.log.Log;
/**
* @author Tom Baeyens
*/
public class EjbRemoteCommandService implements CommandService {
+
+ private static final Log log = Log.getLog(EjbRemoteCommandService.class.getName());
protected String initialContextFactory;
protected String providerUrl;
@@ -57,7 +60,9 @@
env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
try {
+ log.debug("creating initial context with env "+env);
InitialContext initialContext = new InitialContext(env);
+ log.debug("looking up "+jndiName);
RemoteCommandExecutorHome remoteCommandExecutorHome = (RemoteCommandExecutorHome) initialContext.lookup(jndiName);
RemoteCommandExecutor remoteCommandExecutor = remoteCommandExecutorHome.create();
Object result = remoteCommandExecutor.execute(command);
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbRemoteCommandServiceBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbRemoteCommandServiceBinding.java 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/EjbRemoteCommandServiceBinding.java 2009-03-07 13:16:05 UTC (rev 4189)
@@ -47,7 +47,7 @@
String jndiName = XmlUtil.attribute(element, "jndi-name", false, parse, "jbpm/CommandExecutor");
EjbRemoteCommandService ejbRemoteCommandService = new EjbRemoteCommandService(initialContextFactory, providerUrl, urlPkgPrefixes, jndiName);
- Descriptor descriptor = new ProvidedObjectDescriptor(ejbRemoteCommandService);
+ Descriptor descriptor = new ProvidedObjectDescriptor(ejbRemoteCommandService, true);
return descriptor;
}
Modified: jbpm4/branches/tbaeyens/modules/examples/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/pom.xml 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/examples/pom.xml 2009-03-07 13:16:05 UTC (rev 4189)
@@ -106,6 +106,18 @@
<name>jboss.bind.address</name>
</property>
</activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-enterprise</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.client</groupId>
+ <artifactId>jbossall-client</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-03-07 13:16:05 UTC (rev 4189)
@@ -344,7 +344,7 @@
parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" "+attributeName+"=\"...\" is required");
}
- return null;
+ return defaultValue;
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java 2009-03-07 11:05:49 UTC (rev 4188)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CommandServiceBinding.java 2009-03-07 13:16:05 UTC (rev 4189)
@@ -24,7 +24,6 @@
import java.util.List;
import org.jbpm.cmd.CommandService;
-import org.jbpm.enterprise.internal.ejb.EjbRemoteCommandService;
import org.jbpm.pvm.internal.svc.AsyncCommandService;
import org.jbpm.pvm.internal.svc.DefaultCommandService;
import org.jbpm.pvm.internal.util.XmlUtil;
17 years, 2 months