JBoss JBPM SVN: r4339 - jbpm4/branches/ainze.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-03-26 17:44:53 -0400 (Thu, 26 Mar 2009)
New Revision: 4339
Modified:
jbpm4/branches/ainze/pom.xml
Log:
lowered spring version, added commons-lang
Modified: jbpm4/branches/ainze/pom.xml
===================================================================
--- jbpm4/branches/ainze/pom.xml 2009-03-26 20:53:33 UTC (rev 4338)
+++ jbpm4/branches/ainze/pom.xml 2009-03-26 21:44:53 UTC (rev 4339)
@@ -36,6 +36,7 @@
<module>modules/pvm</module>
<module>modules/jpdl</module>
<module>modules/db</module>
+ <module>modules/spring</module>
<module>modules/examples</module>
<module>modules/test-db</module>
<module>modules/test-pojo</module>
@@ -46,6 +47,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<apache.ant.version>1.7.0</apache.ant.version>
<cactus.version>13-1.7.1</cactus.version>
+ <commons-lang.version>2.4</commons-lang.version>
<gwt.console.version>1.0.0-SNAPSHOT</gwt.console.version>
<hibernate.version>3.2.6.ga</hibernate.version>
<hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
@@ -60,7 +62,7 @@
<junit.version>3.8.1</junit.version>
<log4j.version>1.2.14</log4j.version>
<servlet-api.version>2.5</servlet-api.version>
- <spring.version>2.5.4</spring.version>
+ <spring.version>2.0.8</spring.version>
<stax.api.version>1.0.1</stax.api.version>
<woodstox.version>3.2.6</woodstox.version>
<!-- Database Driver Versions -->
@@ -190,6 +192,11 @@
<artifactId>cactus</artifactId>
<version>${cactus.version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
15 years, 1 month
JBoss JBPM SVN: r4338 - in jbpm4/branches/tbaeyens/modules: api/src/main/java/org/jbpm/session and 11 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 16:53:33 -0400 (Thu, 26 Mar 2009)
New Revision: 4338
Added:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
Removed:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessService.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
Log:
revisiting deployment
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -58,10 +58,6 @@
/** deletes process definition, the existing executions and the history. */
void deleteProcessDefinitionCascade(String processDefinitionId);
- /** retrieves an attachment of a process definition */
- byte[] getAttachment(String processDefinitionId, String name);
-
-
/** provide a userId that will be used in the next method invocation
* on this service by this thread. */
void setUserId(String userId);
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.io.InputStream;
/**
@@ -32,6 +33,6 @@
void deleteDeployment(long deploymentDbid);
- byte[] getResource(long deploymentDbid, String resourceName);
+ InputStream getResourceAsStream(long deploymentDbid, String resourceName);
}
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -21,6 +21,7 @@
*/
package org.jbpm.session;
+import java.io.InputStream;
import java.util.List;
import org.jbpm.Deployment;
@@ -31,11 +32,13 @@
*/
public interface RepositorySession {
+ long deploy(Deployment deployment);
+
Object getObject(long deploymentDbid, String objectName);
- long deploy(Deployment deployment);
-
List<String> findObjectNames(String propertyKey, String propertyValue);
List<String> findObjectPropertyValues(String objectName, String propertyKey);
Object findObjectByPropertyValue(String propertyKey, String propertyValue);
+
+ InputStream getResourceAsStream(long deploymentDbid, String resourceName);
}
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -22,12 +22,10 @@
package org.jbpm.examples.hql;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.jbpm.Execution;
+import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -37,22 +35,33 @@
public class HqlTest extends JbpmTestCase {
public void testHql() {
+ // add task laundry
+ Task task = taskService.newTask();
+ task.setName("laundry");
+ taskService.saveTask(task);
+
+ // add task dishes
+ task = taskService.newTask();
+ task.setName("dishes");
+ taskService.saveTask(task);
+
+ // add task iron
+ task = taskService.newTask();
+ task.setName("iron");
+ taskService.saveTask(task);
+
deployJpdlResource("org/jbpm/examples/hql/process.jpdl.xml");
Execution execution = executionService.startProcessInstanceByKey("Hql");
String executionId = execution.getId();
- Set<String> variableNames = executionService.getVariableNames(executionId);
- Map<String, Object> variables = executionService.getVariables(executionId, variableNames);
-
- Map<String, Object> expectedVariables = new HashMap<String, Object>();
- List<String> activityNames = new ArrayList<String>();
- activityNames.add("get process names");
- activityNames.add("count activities");
- expectedVariables.put("activities with o", activityNames);
-
- expectedVariables.put("activities", new Long(4));
-
- assertEquals(expectedVariables, variables);
+ List<String> expectedTaskNames = new ArrayList<String>();
+ expectedTaskNames.add("dishes");
+ expectedTaskNames.add("iron");
+ Object taskNames = executionService.getVariable(executionId, "tasknames with i");
+ assertEquals(expectedTaskNames, taskNames);
+
+ Object activities = executionService.getVariable(executionId, "tasks");
+ assertEquals("3", activities.toString());
}
}
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -25,6 +25,7 @@
import java.util.List;
import org.jbpm.Execution;
+import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -34,19 +35,33 @@
public class SqlTest extends JbpmTestCase {
public void testSql() {
+ // add task laundry
+ Task task = taskService.newTask();
+ task.setName("laundry");
+ taskService.saveTask(task);
+
+ // add task dishes
+ task = taskService.newTask();
+ task.setName("dishes");
+ taskService.saveTask(task);
+
+ // add task iron
+ task = taskService.newTask();
+ task.setName("iron");
+ taskService.saveTask(task);
+
deployJpdlResource("org/jbpm/examples/sql/process.jpdl.xml");
Execution execution = executionService.startProcessInstanceByKey("Sql");
String executionId = execution.getId();
- List<String> expectedActivityNames = new ArrayList<String>();
- expectedActivityNames.add("get process names");
- expectedActivityNames.add("count activities");
- Object activityNames = executionService.getVariable(executionId, "activities with o");
- assertEquals(expectedActivityNames, activityNames);
+ List<String> expectedTaskNames = new ArrayList<String>();
+ expectedTaskNames.add("dishes");
+ expectedTaskNames.add("iron");
+ Object taskNames = executionService.getVariable(executionId, "tasknames with i");
+ assertEquals(expectedTaskNames, taskNames);
- Object activities = executionService.getVariable(executionId, "activities");
- assertEquals("4", activities.toString());
+ Object activities = executionService.getVariable(executionId, "tasks");
+ assertEquals("3", activities.toString());
}
-
}
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml 2009-03-26 20:53:33 UTC (rev 4338)
@@ -3,30 +3,30 @@
<process name="Hql" xmlns="http://jbpm.org/4/jpdl">
<start g="17,20,48,48">
- <transition to="get process names" />
+ <transition to="get task names" />
</start>
- <hql name="get process names"
- var="activities with o"
+ <hql name="get task names"
+ var="tasknames with i"
g="96,16,115,52">
<query>
- select activity.name
- from org.jbpm.pvm.internal.model.ActivityImpl as activity
- where activity.name like :activityName
+ select task.name
+ from org.jbpm.pvm.internal.task.TaskImpl as task
+ where task.name like :taskName
</query>
<parameters>
- <string name="activityName" value="%o%" />
+ <string name="taskName" value="%i%" />
</parameters>
- <transition to="count activities" />
+ <transition to="count tasks" />
</hql>
- <hql name="count activities"
- var="activities"
+ <hql name="count tasks"
+ var="tasks"
unique="true"
g="243,16,95,52">
<query>
select count(*)
- from org.jbpm.pvm.internal.model.ActivityImpl
+ from org.jbpm.pvm.internal.task.TaskImpl
</query>
<transition to="wait" />
</hql>
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-03-26 20:53:33 UTC (rev 4338)
@@ -3,30 +3,30 @@
<process name="Sql" xmlns="http://jbpm.org/4/jpdl">
<start g="16,20,48,48">
- <transition to="get process names" />
+ <transition to="get task names" />
</start>
- <sql name="get process names"
- var="activities with o"
+ <sql name="get task names"
+ var="tasknames with i"
g="96,16,126,52">
<query>
select NAME_
- from JBPM_ACTIVITY
- where NAME_ like :activityName
+ from JBPM_TASK
+ where NAME_ like :name
</query>
<parameters>
- <string name="activityName" value="%o%" />
+ <string name="name" value="%i%" />
</parameters>
- <transition to="count activities" />
+ <transition to="count tasks" />
</sql>
- <sql name="count activities"
- var="activities"
+ <sql name="count tasks"
+ var="tasks"
unique="true"
g="254,16,92,52">
<query>
select count(*)
- from JBPM_ACTIVITY
+ from JBPM_TASK
</query>
<transition to="wait" />
</sql>
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -45,6 +45,7 @@
public SwimlaneDefinitionImpl createSwimlaneDefinition(String name) {
SwimlaneDefinitionImpl swimlaneDefinition = new SwimlaneDefinitionImpl();
+ swimlaneDefinition.setName(name);
swimlaneDefinitions.put(name, swimlaneDefinition);
return swimlaneDefinition;
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -47,37 +47,34 @@
public void deploy(DeploymentImpl deployment) {
for (String resourceName: deployment.getResourceNames()) {
- InputStream inputStream = deployment.getResourceAsStream(resourceName);
- Parse parse = jpdlParser.createParse();
- parse.setProblems(deployment.getProblems());
- parse.setInputStream(inputStream);
- parse.execute();
-
- JpdlProcessDefinition processDefinition =
- (JpdlProcessDefinition) parse.getDocumentObject();
+ if (resourceName.endsWith(".jpdl.xml")) {
+ InputStream inputStream = deployment.getResourceAsStream(resourceName);
+ Parse parse = jpdlParser.createParse();
+ parse.setProblems(deployment.getProblems());
+ parse.setInputStream(inputStream);
+ parse.execute();
+ JpdlProcessDefinition processDefinition = (JpdlProcessDefinition) parse.getDocumentObject();
+ if ((processDefinition != null) && (processDefinition.getName() != null)) {
+ String processDefinitionName = processDefinition.getName();
- if ( (processDefinition!=null)
- && (processDefinition.getName()!=null)
- ) {
- String processDefinitionName = processDefinition.getName();
+ processDefinition.setDeploymentDbid(deployment.getDbid());
- processDefinition.setDeploymentDbid(deployment.getDbid());
-
- String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
- if (key!=null) {
- String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
- processDefinition.setId(id);
- processDefinition.setKey(key);
- deployment.addObject(processDefinitionName, processDefinition);
-
- } else {
- checkKey(processDefinition, deployment);
- checkId(processDefinition, deployment);
+ String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
+ if (key != null) {
+ String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
+ processDefinition.setId(id);
+ processDefinition.setKey(key);
+ deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+ } else {
+ checkKey(processDefinition, deployment);
+ checkId(processDefinition, deployment);
+
+ deployment.addObject(processDefinitionName, processDefinition);
+ deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+ }
}
}
}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cmd;
-
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.session.PvmDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GetAttachment extends AbstractCommand<byte[]> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionId;
- protected String name;
-
- public GetAttachment(String processDefinitionId, String name) {
- this.processDefinitionId = processDefinitionId;
- this.name = name;
- }
-
- public byte[] execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- ClientProcessDefinition processDefinition = pvmDbSession.findProcessDefinitionById(processDefinitionId);
- return processDefinition.getAttachment(name);
- }
-
-}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -0,0 +1,50 @@
+/*
+ * 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.cmd;
+
+import java.io.InputStream;
+
+import org.jbpm.env.Environment;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GetResourceAsStream extends AbstractCommand<InputStream> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long deploymentDbid;
+ protected String resourceName;
+
+ public GetResourceAsStream(long deploymentDbid, String resourceName) {
+ this.deploymentDbid = deploymentDbid;
+ this.resourceName = resourceName;
+ }
+
+ public InputStream execute(Environment environment) {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ InputStream resourceStream = repositorySession.getResourceAsStream(deploymentDbid, resourceName);
+ return resourceStream;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -1016,10 +1016,7 @@
}
public String getActivityName() {
- if (getActivity()!=null) {
- return getActivity().getName();
- }
- return null;
+ return activityName;
}
public ProcessDefinitionImpl getProcessDefinition() {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -21,9 +21,12 @@
*/
package org.jbpm.pvm.internal.repository;
+import java.io.InputStream;
+
import org.jbpm.Deployment;
import org.jbpm.RepositoryService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.GetResourceAsStream;
/**
* @author Tom Baeyens
@@ -39,7 +42,7 @@
public void deleteDeployment(long deploymentDbid) {
}
- public byte[] getResource(long deploymentDbid, String resource) {
- return null;
+ public InputStream getResourceAsStream(long deploymentDbid, String resource) {
+ return commandService.execute(new GetResourceAsStream(deploymentDbid, resource));
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.repository;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -65,6 +66,10 @@
return deploymentImpl.getDbid();
}
+
+ public DeploymentImpl getDeployment(long deploymentDbid) {
+ return (DeploymentImpl) session.get(DeploymentImpl.class, deploymentDbid);
+ }
public Object getObject(long deploymentDbid, String objectName) {
Object object = repositoryCache.get(deploymentDbid, objectName);
@@ -121,4 +126,12 @@
" and deploymentProperty.key = '"+key+"' "
).list();
}
+
+ public InputStream getResourceAsStream(long deploymentDbid, String resourceName) {
+ DeploymentImpl deployment = getDeployment(deploymentDbid);
+ if (deployment==null) {
+ throw new JbpmException("deployment "+deploymentDbid+" doesn't exist");
+ }
+ return deployment.getResourceAsStream(resourceName);
+ }
}
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-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -34,7 +34,7 @@
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionByIdCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionKeysCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionsByKeyCmd;
-import org.jbpm.pvm.internal.cmd.GetAttachment;
+import org.jbpm.pvm.internal.cmd.GetResourceAsStream;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
@@ -73,10 +73,6 @@
commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId, true, true));
}
- public byte[] getAttachment(String processDefinitionId, String name) {
- return commandService.execute(new GetAttachment(processDefinitionId, name));
- }
-
public ProcessDefinitionQuery createProcessDefinitionQuery() {
return new ProcessDefinitionQueryImpl(commandService);
}
Added: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.process;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+
+import org.jbpm.JbpmException;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentResourcesTest extends JbpmTestCase {
+
+ public void testProcessWithNameOnly() {
+ byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
+ byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
+
+ long deploymentDbid =
+ processService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml",
+ "<process name='Insurance claim'>" +
+ " <start />" +
+ "</process>")
+ .addResourceFromInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
+ .addResourceFromInputStream("other attachment", new ByteArrayInputStream(otherBytes))
+ .deploy();
+
+ registerDeployment(deploymentDbid);
+
+ InputStream stream = repositoryService.getResourceAsStream(deploymentDbid, "a lot of attachment");
+ byte[] retrievedLotOfBytes = readBytes(stream);
+ assertNotNull(retrievedLotOfBytes);
+ assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
+
+ stream = repositoryService.getResourceAsStream(deploymentDbid, "other attachment");
+ byte[] retrievedOtherBytes = readBytes(stream);
+ assertNotNull(retrievedOtherBytes);
+ assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
+ }
+
+ protected String generateString(String base, int multiplier) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i=0; i<multiplier; i++) {
+ buffer.append(base);
+ }
+ String string = buffer.toString();
+ return string;
+ }
+
+ public static byte[] readBytes(InputStream inputStream) {
+ byte[] bytes = null;
+ if (inputStream==null) {
+ throw new JbpmException("inputStream is null");
+ }
+ try {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ transfer(inputStream, outputStream);
+ bytes = outputStream.toByteArray();
+ outputStream.close();
+ return bytes;
+ } catch (IOException e) {
+ throw new JbpmException("couldn't read bytes from inputStream", e);
+ }
+ }
+ public static int transfer(InputStream in, OutputStream out) {
+ int total = 0;
+ byte[] buffer = new byte[4096];
+ try {
+ int bytesRead = in.read( buffer );
+ while ( bytesRead != -1 ) {
+ out.write( buffer, 0, bytesRead );
+ total += bytesRead;
+ bytesRead = in.read( buffer );
+ }
+ return total;
+ } catch (IOException e) {
+ throw new JbpmException("couldn't write bytes to output stream", e);
+ }
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-26 19:23:55 UTC (rev 4337)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-26 20:53:33 UTC (rev 4338)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.process;
-
-import java.io.ByteArrayInputStream;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessAttachmentsTest extends JbpmTestCase {
-
- public void testProcessWithNameOnly() {
- byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
- byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
-
- long deploymentDbid =
- processService.createDeployment()
- .addResourceFromString("xmlstring.jpdl.xml",
- "<process name='Insurance claim'>" +
- " <start />" +
- "</process>")
- .addResourceFromInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
- .addResourceFromInputStream("other attachment", new ByteArrayInputStream(otherBytes))
- .deploy();
-
- registerDeployment(deploymentDbid);
-
- byte[] retrievedLotOfBytes = repositoryService.getResource(deploymentDbid, "a lot of attachment");
- assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
-
- byte[] retrievedOtherBytes = repositoryService.getResource(deploymentDbid, "other attachment");
- assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
- }
-
- protected String generateString(String base, int multiplier) {
- StringBuffer buffer = new StringBuffer();
- for (int i=0; i<multiplier; i++) {
- buffer.append(base);
- }
- String string = buffer.toString();
- return string;
- }
-}
15 years, 1 month
JBoss JBPM SVN: r4337 - in jbpm4/branches/tbaeyens/modules: pvm/src/test/resources and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 15:23:55 -0400 (Thu, 26 Mar 2009)
New Revision: 4337
Added:
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
Log:
revisiting deployment
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 19:23:55 UTC (rev 4337)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+ <!-- ### Deployment ##################################################### -->
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ table="JBPM_DEPLOYMENT">
+
+ <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME_" />
+ <property name="timestamp" column="TIMESTAMP_" />
+
+ <map name="resources" cascade="all-delete-orphan">
+ <key foreign-key="FK_LOB_DEPLOYMENT">
+ <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+ </map>
+
+ <set name="objectProperties"
+ table="JBPM_DEPLOYPROPS"
+ cascade="all">
+ <key column="DEPLOYMENT_" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
+ </set>
+
+ </class>
+
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <many-to-one name="deployment"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ column="DEPLOYMENT_"
+ foreign-key="FK_DEPLPROP_DEPL"
+ index="IDX_DEPLPROP_DEPL" />
+ <property name="objectName" column="OBJNAME_" />
+ <property name="key" column="KEY_" />
+ <property name="value" column="VALUE_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 19:23:55 UTC (rev 4337)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+ <!-- ### Deployment ##################################################### -->
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ table="JBPM_DEPLOYMENT">
+
+ <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME_" />
+ <property name="timestamp" column="TIMESTAMP_" />
+
+ <map name="resources" cascade="all-delete-orphan">
+ <key foreign-key="FK_LOB_DEPLOYMENT">
+ <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+ </map>
+
+ <set name="objectProperties"
+ table="JBPM_DEPLOYPROPS"
+ cascade="all">
+ <key column="DEPLOYMENT_" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
+ </set>
+
+ </class>
+
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <many-to-one name="deployment"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ column="DEPLOYMENT_"
+ foreign-key="FK_DEPLPROP_DEPL"
+ index="IDX_DEPLPROP_DEPL" />
+ <property name="objectName" column="OBJNAME_" />
+ <property name="key" column="KEY_" />
+ <property name="value" column="VALUE_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 19:23:55 UTC (rev 4337)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+ <!-- ### Deployment ##################################################### -->
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ table="JBPM_DEPLOYMENT">
+
+ <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME_" />
+ <property name="timestamp" column="TIMESTAMP_" />
+
+ <map name="resources" cascade="all-delete-orphan">
+ <key foreign-key="FK_LOB_DEPLOYMENT">
+ <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+ </map>
+
+ <set name="objectProperties"
+ table="JBPM_DEPLOYPROPS"
+ cascade="all">
+ <key column="DEPLOYMENT_" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
+ </set>
+
+ </class>
+
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <many-to-one name="deployment"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ column="DEPLOYMENT_"
+ foreign-key="FK_DEPLPROP_DEPL"
+ index="IDX_DEPLPROP_DEPL" />
+ <property name="objectName" column="OBJNAME_" />
+ <property name="key" column="KEY_" />
+ <property name="value" column="VALUE_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 1 month
JBoss JBPM SVN: r4336 - in jbpm4/branches/tbaeyens/modules: api/src/main/java/org/jbpm/session and 11 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 15:16:56 -0400 (Thu, 26 Mar 2009)
New Revision: 4336
Added:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
Removed:
jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java
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/xml/ParseJpdlBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.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/Deployer.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.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/repository/DeployExecutionService.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.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/wire/binding/AssignFileTypesBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
Log:
revisiting deployment
Added: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryService {
+
+ Deployment createDeployment();
+
+ void deleteDeployment(long deploymentDbid);
+
+ byte[] getResource(long deploymentDbid, String resourceName);
+
+}
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,41 @@
+/*
+ * 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.session;
+
+import java.util.List;
+
+import org.jbpm.Deployment;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositorySession {
+
+ Object getObject(long deploymentDbid, String objectName);
+
+ long deploy(Deployment deployment);
+
+ List<String> findObjectNames(String propertyKey, String propertyValue);
+ List<String> findObjectPropertyValues(String objectName, String propertyKey);
+ Object findObjectByPropertyValue(String propertyKey, String propertyValue);
+}
Property changes on: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+ <!-- ### Deployment ##################################################### -->
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ table="JBPM_DEPLOYMENT">
+
+ <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME_" />
+ <property name="timestamp" column="TIMESTAMP_" />
+
+ <map name="resources" cascade="all-delete-orphan">
+ <key foreign-key="FK_LOB_DEPLOYMENT">
+ <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+ </map>
+
+ <set name="objectProperties"
+ table="JBPM_DEPLOYPROPS"
+ cascade="all">
+ <key column="DEPLOYMENT_" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
+ </set>
+
+ </class>
+
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <many-to-one name="deployment"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ column="DEPLOYMENT_"
+ foreign-key="FK_DEPLPROP_DEPL"
+ index="IDX_DEPLPROP_DEPL" />
+ <property name="objectName" column="OBJNAME_" />
+ <property name="key" column="KEY_" />
+ <property name="value" column="VALUE_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml (rev 0)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+
+ <!-- ### Deployment ##################################################### -->
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ table="JBPM_DEPLOYMENT">
+
+ <!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME_" />
+ <property name="timestamp" column="TIMESTAMP_" />
+
+ <map name="resources" cascade="all-delete-orphan">
+ <key foreign-key="FK_LOB_DEPLOYMENT">
+ <column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
+ </key>
+ <map-key type="string" column="NAME_" />
+ <one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
+ </map>
+
+ <set name="objectProperties"
+ table="JBPM_DEPLOYPROPS"
+ cascade="all">
+ <key column="DEPLOYMENT_" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
+ </set>
+
+ </class>
+
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <many-to-one name="deployment"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
+ column="DEPLOYMENT_"
+ foreign-key="FK_DEPLPROP_DEPL"
+ index="IDX_DEPLPROP_DEPL" />
+ <property name="objectName" column="OBJNAME_" />
+ <property name="key" column="KEY_" />
+ <property name="value" column="VALUE_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+/**
+ * Retains with a deployer for undeployment calls.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class DeploymentRef
+{
+ private long deploymentDbid;
+ private String location;
+
+ public DeploymentRef(long deploymentDbid, String location)
+ {
+ this.deploymentDbid = deploymentDbid;
+ this.location = location;
+ }
+
+ public String toString()
+ {
+ return "DeploymentRef {dbid="+deploymentDbid+", location="+location+"}";
+ }
+
+ public long getDeploymentDbid()
+ {
+ return deploymentDbid;
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,61 +0,0 @@
-/*
- * 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;
-
-/**
- * Retains with a deployer for undeployment calls.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public final class ProcessDeploymentRef
-{
- private String processId;
- private int version;
- private String location;
-
- public ProcessDeploymentRef(String processId, int version, String location)
- {
- this.processId = processId;
- this.version = version;
- this.location = location;
- }
-
- public String toString()
- {
- return "ProcessDeploymentRef {id="+processId+", version="+version+", location="+location+"}";
- }
-
- public String getProcessId()
- {
- return processId;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public String getLocation()
- {
- return location;
- }
-}
Deleted: 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-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.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;
-import org.jbpm.pvm.internal.xml.Parse;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ParseJpdlDeployer implements Deployer {
-
- static JpdlParser jpdlParser = new JpdlParser();
-
- public void deploy(DeploymentImpl deployment) {
- for (String fileName: deployment.getFileNamesForType("jpdl")) {
- // parse them
- Parse parse = jpdlParser.createParse();
- parse.setProblems(deployment.getProblems());
- parse.setInputStream(deployment.getFile(fileName));
- parse.execute();
-
- // add the parsed xml dom to the deployment documents
- // 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 processDefinitions
- // this is where the save process deployer will find it
- ProcessDefinition processDefinition = (ProcessDefinition) parse.getDocumentObject();
- deployment.addProcessDefinition(processDefinition);
- }
- }
-}
Added: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,44 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import org.jbpm.jpdl.internal.repository.JpdlDeployer;
+import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployerBinding extends WireDescriptorBinding {
+
+ public JpdlDeployerBinding() {
+ super("jpdl-deployer");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(JpdlDeployer.class);
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.xml;
-
-import org.jbpm.jpdl.internal.deploy.ParseJpdlDeployer;
-import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ParseJpdlBinding extends WireDescriptorBinding {
-
- public ParseJpdlBinding() {
- super("parse-jpdl");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- return new ObjectDescriptor(ParseJpdlDeployer.class);
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class AssignFileTypeDeployer implements Deployer, Serializable {
-
- /* maps extensions to file types */
- Map<String, String> fileTypes = new HashMap<String, String>();
-
- private static final long serialVersionUID = 1L;
-
- public void deploy(DeploymentImpl deployment) {
- for (String fileName: deployment.getFileNames()) {
- for (String extension: fileTypes.keySet()) {
- if (fileName.endsWith(extension)) {
- String fileType = fileTypes.get(extension);
- deployment.setFileType(fileName, fileType);
- break;
- }
- }
- }
- }
-
- public void addFileType(String extension, String fileType) {
- fileTypes.put(extension, fileType);
- }
-
- public String toString() {
- return "assign-file-type";
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import java.io.Serializable;
-
-import org.jbpm.JbpmException;
-import org.jbpm.Problem;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CheckProblemsDeployer implements Deployer, Serializable {
-
- private static final Log log = Log.getLog(CheckProblemsDeployer.class.getName());
- private static final long serialVersionUID = 1L;
-
- public void deploy(DeploymentImpl deployment) {
- if (deployment.hasProblems()) {
- for (Problem problem: deployment.getProblems()) {
- Throwable cause = problem.getCause();
- if (cause!=null) {
- log.debug("deployment exception", cause);
- }
- }
- throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
- }
- }
-
- public String toString() {
- return "check-problems";
- }
-}
Deleted: 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-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import java.io.Serializable;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.pvm.internal.wire.binding.CheckProcessBinding;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class CheckProcessDeployer implements Deployer, Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(CheckProcessDeployer.class.getName());
-
- protected boolean assignVersion = true;
- protected boolean assignKey = true;
-
- public void deploy(DeploymentImpl deployment) {
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- deployment.addProblem("environment is required by deployer "+CheckProcessBinding.TAG);
- return;
- }
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- if (pvmDbSession==null) {
- deployment.addProblem(PvmDbSession.class.getName()+" is required in the environment by deployer "+CheckProcessBinding.TAG);
- return;
- }
-
- for (ProcessDefinition processDefinition : deployment.getProcessDefinitions()) {
- checkProcessDefinition(processDefinition, deployment, pvmDbSession);
- }
- }
-
- public void checkProcessDefinition(ProcessDefinition processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
- if ( (processDefinition.getName()==null)
- || ("".equals(processDefinition.getName()))
- ) {
- // A problem was already added by the JpdlParser
- return;
- }
-
- checkKey((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
- checkVersion((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
- checkId((ProcessDefinitionImpl)processDefinition, deployment, pvmDbSession);
- }
-
- protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
- String name = processDefinition.getName();
- String key = processDefinition.getKey();
- if ( (key==null)
- && assignKey
- ) {
- // replace any non-word character with an underscore
- key = name.replaceAll("\\W", "_");
-
- processDefinition.setKey(key);
- }
-
- String existingKey = pvmDbSession.findProcessDefinitionKeyByName(name);
- if ( (existingKey!=null)
- && (!existingKey.equals(key))
- ) {
- 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 "+processDefinition.getName()+". Existing process has name '"+existingName+"' and key '"+key+"'");
- }
- }
-
- protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
- int version = processDefinition.getVersion();
- String key = processDefinition.getKey();
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && ! assignVersion
- ) {
- deployment.addProblem("no version specified in process definition "+key);
- }
-
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && assignVersion
- ) {
- ClientProcessDefinition latestDeployedVersion = pvmDbSession.findLatestProcessDefinitionByKey(key);
- if (latestDeployedVersion!=null) {
- version = latestDeployedVersion.getVersion() + 1;
- } else {
- version = 1;
- }
- log.debug("assigning version "+version+" to process definition "+key);
- processDefinition.setVersion(version);
-
- }
- }
-
- protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment, PvmDbSession pvmDbSession) {
- String id = processDefinition.getId();
- if (id==null) {
- id = processDefinition.getKey()+"-"+processDefinition.getVersion();
- log.trace("created id '"+id+"' for "+processDefinition);
- processDefinition.setId(id);
- }
-
- if (pvmDbSession.findProcessDefinitionById(id) != null) {
- deployment.addProblem("process '" + id + "' already exists");
- }
- }
-
- public void setAssignVersion(boolean assignVersion) {
- this.assignVersion = assignVersion;
- }
-
- public void setAssignKey(boolean assignKey) {
- this.assignKey = assignKey;
- }
-
- public String toString() {
- return "check-process";
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployer {
-
- void deploy(DeploymentImpl deployment);
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.JbpmException;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-
-/** manages sequences of deployers for multiple process languages.
- *
- * <p>Each process language has a language-id. In a deployment a language-id can
- * be given. This deployer manager will be able to find a sequence of deployers
- * based on the language-id.
- * </p>
- *
- * <p>Also, an extension can be associated to a process language. In that case
- * the deployer manager can find the deployer sequence based on the
- * extension of the deployed file name.
- * </p>
- *
- * @author Tom Baeyens
- */
-public class DeployerManager {
-
- private static final Log log = Log.getLog(DeployerManager.class.getName());
-
- /** configurable list of deployers */
- protected List<Deployer> deployers = new ArrayList<Deployer>();
-
- public void deploy(DeploymentImpl deployment) {
- if (deployment==null) {
- throw new JbpmException("deployment is null");
- }
-
- for (Deployer deployer: deployers) {
- if (log.isTraceEnabled()) log.trace("applying deployer "+deployer+" to "+deployment);
- deployer.deploy(deployment);
- }
- }
-
- public void setDeployers(List<Deployer> deployers) {
- this.deployers = deployers;
- }
-}
Deleted: 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-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.List;
-
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class SaveDeployer implements Deployer, Serializable {
-
- private static final long serialVersionUID = 1L;
- private static Log log = Log.getLog(SaveDeployer.class.getName());
-
- public void deploy(DeploymentImpl deployment) {
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- deployment.addProblem("environment is required by "+getClass().getName());
- return;
- }
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- if (pvmDbSession==null) {
- deployment.addProblem(PvmDbSession.class.getName()+" is required in the environment by "+getClass().getName());
- return;
- }
-
- boolean deployedProcess = false;
-
- 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);
- processDefinition.addAttachment(fileName, inputStream);
- }
- }
-
- if (!deployedProcess) {
- log.info("no process definition in "+deployment);
- }
- }
-
- public String toString() {
- return "save";
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import org.jbpm.Execution;
-import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployExecutionService extends ExecutionServiceImpl {
-
- public Execution startProcessInstanceByKey(String processDefinitionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import java.util.Map;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.cmd.VariablesCmd;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionKey;
- protected String executionKey;
-
- public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
- if (processDefinitionKey==null) {
- throw new JbpmException("processDefinitionKey is null");
- }
- this.processDefinitionKey = processDefinitionKey;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- ClientProcessDefinition processDefinition = null;
-
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- processDefinition = (ClientProcessDefinition) repositorySession
- .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
-
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- Session session = Environment.getFromCurrent(Session.class);
- session.save(processInstance);
- return processInstance;
- }
-
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository.api;
-
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.pvm.internal.stream.StreamInput;
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployment {
-
- void setName(String name);
-
- Deployment addStreamInput(String name, StreamInput streamInput);
- Deployment addZipInputStream(ZipInputStream zipInputStream);
-
- /** @return deploymentId */
- long deploy();
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository.api;
-
-import java.io.InputStream;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryService {
-
- public abstract Deployment createDeployment();
-
- public abstract void deleteDeployment(long deploymentDbid);
-
- public abstract InputStream getResource(String deploymentId, String resource);
-
-}
\ No newline at end of file
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository.api;
-
-import java.util.List;
-
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositorySession {
-
- Object getObject(long deploymentDbid, String objectName);
-
- long deploy(DeploymentImpl deployment);
-
- List<String> findObjectNames(String propertyKey, String propertyValue);
- List<String> findObjectPropertyValues(String objectName, String propertyKey);
- Object findObjectByPropertyValue(String propertyKey, String propertyValue);
-}
Deleted: 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-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,365 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.svc;
-
-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;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.Deployment;
-import org.jbpm.JbpmException;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
-import org.jbpm.pvm.internal.stream.FileStreamInput;
-import org.jbpm.pvm.internal.stream.InputStreamInput;
-import org.jbpm.pvm.internal.stream.ResourceStreamInput;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.stream.StringStreamInput;
-import org.jbpm.pvm.internal.stream.UrlStreamInput;
-import org.jbpm.pvm.internal.util.IoUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.jbpm.pvm.internal.xml.ProblemImpl;
-import org.jbpm.pvm.internal.xml.ProblemList;
-import org.w3c.dom.Document;
-
-
-/** a deployment unit, containing all information in source format from which
- * a process definition will be created and stored in the process repository.
- *
- * For more info, see Deployment.
- *
- * @author Tom Baeyens
- */
-public class DeploymentImpl extends ProblemList implements Deployment, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = Log.getLog(DeploymentImpl.class.getName());
-
- private static final Parser parser = new Parser();
-
- protected ProcessServiceImpl processServiceImpl;
-
- protected String name;
- protected long timestamp;
-
- /** maps file names to stream source */
- protected Map<String, StreamInput> files = new HashMap<String,StreamInput>();
- /** maps file names to dom so that duplicate xml parsing can be avoided. */
- 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>();
-
- public DeploymentImpl(ProcessServiceImpl processServiceImpl) {
- this.processServiceImpl = processServiceImpl;
- this.problems = new ArrayList<ProblemImpl>();
- }
-
- public Deployment addResource(String resource) {
- addStreamSource(resource, new ResourceStreamInput(resource));
- return this;
- }
-
- public Deployment addFile(File file) {
- addStreamSource(file.getAbsolutePath(), new FileStreamInput(file));
- return this;
- }
-
- public Deployment addUrl(URL url) {
- addStreamSource(url.toString(), new UrlStreamInput(url));
- return this;
- }
-
- public Deployment addInputStream(String name, InputStream inputStream) {
- addStreamSource(name, new InputStreamInput(inputStream));
- return this;
- }
-
- public Deployment addString(String name, String string) {
- addStreamSource(name, new StringStreamInput(string));
- return this;
- }
-
- public Deployment addArchiveResource(String resource) {
- this.name = resource;
- ResourceStreamInput streamSource = new ResourceStreamInput(resource);
- addStreamSource(resource, streamSource);
- return this;
- }
-
- public Deployment addArchiveFile(File file) {
- addStreamSource(file.getAbsolutePath(), new FileStreamInput(file));
- return this;
- }
-
- public Deployment addArchiveUrl(URL url) {
- addStreamSource(url.toString(), new UrlStreamInput(url));
- return this;
- }
-
- public Deployment addArchive(ZipInputStream zipInputStream) {
- try {
- ZipEntry zipEntry = zipInputStream.getNextEntry();
- while(zipEntry!=null) {
- String entryName = zipEntry.getName();
- byte[] bytes = IoUtil.readBytes(zipInputStream);
- if (bytes!=null) {
- addStreamSource(entryName, new ByteArrayStreamInput(bytes));
- }
- zipEntry = zipInputStream.getNextEntry();
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't read zip archive", e);
- }
- return this;
- }
-
- /** recursively adds all files in a directory using the relative file names */
- public Deployment addDirectory(String directory) {
- if (directory==null) {
- throw new JbpmException("directory is null");
- }
- addDirectory(new File(directory), "", false);
- return this;
- }
-
- /** recursively adds all files in a directory using the canonical file names */
- public Deployment addDirectoryCanonical(String directory) {
- if (directory==null) {
- throw new JbpmException("directory is null");
- }
- addDirectory(new File(directory), "", true);
- return this;
- }
-
- /** recursively adds all files in a directory using the relative file names */
- public Deployment addDirectory(File directory) {
- addDirectory(directory, "", false);
- return this;
- }
-
- /** recursively adds all files in a directory using the canonical file names */
- public Deployment addDirectoryCanonical(File directory) {
- addDirectory(directory, "", true);
- return this;
- }
-
- protected Deployment addDirectory(File directory, String relativeDirectoryName, boolean canonicalPathNames) {
- if (directory==null) {
- throw new JbpmException("directory is null");
- }
- if (!directory.isDirectory()) {
- throw new JbpmException(directory.getAbsolutePath()+" is not a directory");
- }
-
- File[] files = directory.listFiles();
- if (files!=null) {
- for (File file: files) {
- String relativeFileName = (canonicalPathNames ? null : relativeDirectoryName+"/"+file.getName());
- if (file.isFile()) {
- if (canonicalPathNames) {
- try {
- addStreamSource(file.getCanonicalPath(), new FileStreamInput(file));
- } catch (IOException e) {
- throw new JbpmException("can't get canonical path name for "+file);
- }
- } else {
- addStreamSource(relativeFileName, new FileStreamInput(file));
- }
- } else if (file.isDirectory()) {
- addDirectory(file, relativeFileName, canonicalPathNames);
- }
- }
- }
- return this;
- }
-
- protected Deployment addStreamSource(String name, StreamInput streamSource) {
- if (this.name==null) {
- this.name = name;
- }
- if (files==null) {
- files = new HashMap<String, StreamInput>();
- }
- files.put(name, streamSource);
- return this;
- }
-
- public InputStream getFile(String name) {
- if (files==null) {
- return null;
- }
- StreamInput streamSource = files.get(name);
- return (streamSource!=null ? streamSource.openStream() : null);
- }
-
- public Set<String> getFileNames() {
- if (files==null) {
- return Collections.EMPTY_SET;
- }
- return files.keySet();
- }
-
- public Document getDocument(String name) {
- if ( (fileDocuments!=null)
- && (fileDocuments.containsKey(name))
- ) {
- return fileDocuments.get(name);
- }
- if ( (files!=null)
- && (files.containsKey(name))
- ) {
- InputStream fileStream = getFile(name);
- return parser.createParse()
- .setInputStream(fileStream)
- .execute()
- .checkProblems("deployment file "+name)
- .getDocument();
- }
- return null;
- }
-
- public String getName() {
- return name;
- }
- public Deployment setName(String name) {
- this.name = name;
- return this;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public Deployment setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- return this;
- }
-
- public Deployment addProcessDefinition(ProcessDefinition processDefinition) {
- processDefinitions.add(processDefinition);
- return this;
- }
-
- public Deployment deploy() {
- processDefinitions = processServiceImpl.deploy(this);
- return this;
- }
-
- public List<ProcessDefinition> getProcessDefinitions() {
- return processDefinitions;
- }
-
- // error logging ////////////////////////////////////////////////////////////
-
- public class DeploymentParse {
- String name;
- Parse parse;
- public DeploymentParse(String name, Parse parse) {
- this.name = name;
- this.parse = parse;
- }
- }
-
- public String toString() {
- if (name!=null) {
- return "deployment("+name+")";
- }
- return "deployment";
- }
-
- public void addDocument(String name, Document document) {
- if (fileDocuments==null) {
- fileDocuments = new HashMap<String, Document>();
- }
- fileDocuments.put(name, document);
- }
-
- /** throws an exception with appropriate message in case the parse contains
- * errors or fatal errors. This method also logs the problems with severity
- * 'warning'. */
- public Deployment checkProblems() {
- if (hasProblems()) {
- String problemsText = getProblemsText();
- if (problemsText!=null) {
- String errorMsg = "problems during deployment of "+this+":"+problemsText;
- log.info(errorMsg);
- throw new JbpmException(errorMsg);
- }
- }
- return this;
- }
-
- public Deployment setFileType(String fileName, String fileType) {
- if (fileTypes==null) {
- fileTypes = new HashMap<String, String>();
- }
- fileTypes.put(fileName, fileType);
- return this;
- }
-
- public List<String> getFileNamesForType(String type) {
- if (type==null) {
- throw new JbpmException("type is null");
- }
- List<String> fileNames = new ArrayList<String>();
- for (String fileName: fileTypes.keySet()) {
- if (fileTypes.get(fileName).equals(type)) {
- fileNames.add(fileName);
- }
- }
- 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()) {
- if (! (entry.getValue() instanceof ByteArrayStreamInput)) {
- byte[] bytes = IoUtil.readBytes(entry.getValue().openStream());
- replacedFiles.put(entry.getKey(), new ByteArrayStreamInput(bytes));
- }
- }
- files = replacedFiles;
- }
-
- processServiceImpl = null;
-
- return this;
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import java.util.List;
-
-import org.jbpm.pvm.internal.deploy.AssignFileTypeDeployer;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AssignFileTypesBinding extends WireDescriptorBinding {
-
- private static final String ASSIGN_FILE_TYPE = "assign-file-type";
-
- public AssignFileTypesBinding() {
- super(ASSIGN_FILE_TYPE);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- AssignFileTypeDeployer assignFileTypeDeployer = new AssignFileTypeDeployer();
-
- List<Element> fileElements = XmlUtil.elements(element, "file");
- if (fileElements.isEmpty()) {
- parse.addProblem("no files in "+ASSIGN_FILE_TYPE);
- } else {
- for(Element fileTypeElement : fileElements) {
- String extension = XmlUtil.attribute(fileTypeElement, "extension", true, parse);
- String type = XmlUtil.attribute(fileTypeElement, "type", true, parse);
- if ( (extension!=null)
- && (type!=null)
- ) {
- assignFileTypeDeployer.addFileType(extension, type);
- }
- }
- }
-
- ProvidedObjectDescriptor providedObjectDescriptor = new ProvidedObjectDescriptor(assignFileTypeDeployer);
-
- return providedObjectDescriptor;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CheckProblemsDeployer;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CheckProblemsBinding extends WireDescriptorBinding {
-
- public CheckProblemsBinding() {
- super("check-problems");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CheckProblemsDeployer checkProblemsDeployer = new CheckProblemsDeployer();
- return new ProvidedObjectDescriptor(checkProblemsDeployer);
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CheckProcessDeployer;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/** parses a descriptor creating a {@link CheckProcessDeployer version verification deployer}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class CheckProcessBinding extends WireDescriptorBinding {
-
- public static final String TAG = "check-process";
-
- public CheckProcessBinding() {
- super(TAG);
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CheckProcessDeployer checkProcessDeployer = new CheckProcessDeployer();
-
- Boolean assignVersion = XmlUtil.attributeBoolean(element, "assign-version", false, parse, null);
- if (assignVersion!=null) {
- checkProcessDeployer.setAssignVersion(assignVersion);
- }
-
- Boolean assignKey = XmlUtil.attributeBoolean(element, "assign-key", false, parse, null);
- if (assignKey!=null) {
- checkProcessDeployer.setAssignKey(assignKey);
- }
-
- return new ProvidedObjectDescriptor(checkProcessDeployer);
- }
-}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.repository.RepositoryCacheImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryCacheBinding extends WireDescriptorBinding {
+
+ public RepositoryCacheBinding() {
+ super("repository-cache");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor(RepositoryCacheImpl.class);
+ objectDescriptor.setAutoWireEnabled(true);
+ return objectDescriptor;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.repository.RepositoryServiceImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceBinding extends WireDescriptorBinding {
+
+ public RepositoryServiceBinding() {
+ super("repository-service");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor(RepositoryServiceImpl.class);
+ objectDescriptor.setAutoWireEnabled(true);
+ return objectDescriptor;
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -0,0 +1,46 @@
+/*
+ * 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.wire.binding;
+
+import org.jbpm.pvm.internal.repository.RepositorySessionImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositorySessionBinding extends WireDescriptorBinding {
+
+ public RepositorySessionBinding() {
+ super("repository-session");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor(RepositorySessionImpl.class);
+ objectDescriptor.setAutoWireEnabled(true);
+ return objectDescriptor;
+ }
+
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.SaveDeployer;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/** parses a descriptor for creating a {@link SaveDeployer} deployer.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class SaveBinding extends WireDescriptorBinding {
-
- public SaveBinding() {
- super("save");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- SaveDeployer saveDeployer = new SaveDeployer();
- return new ProvidedObjectDescriptor(saveDeployer);
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2009-03-26 16:05:51 UTC (rev 4335)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2009-03-26 19:16:56 UTC (rev 4336)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.descriptor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.deploy.Deployer;
-import org.jbpm.pvm.internal.deploy.DeployerManager;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployerManagerDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- /** the list of descriptors for building the list of deployers */
- protected List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
-
- public Object construct(WireContext wireContext) {
- return new DeployerManager();
- }
-
- public void initialize(Object object, WireContext wireContext) {
- DeployerManager deployerManager = (DeployerManager) object;
-
- List<Deployer> deployers = new ArrayList<Deployer>();
- for (Descriptor deployerDescriptor: deployerDescriptors) {
- Deployer deployer = (Deployer) wireContext.create(deployerDescriptor, true);
- deployers.add(deployer);
- }
-
- deployerManager.setDeployers(deployers);
- }
-
- public Class< ? > getType(WireDefinition wireDefinition) {
- return DeployerManager.class;
- }
-
- public void setDeployerDescriptors(List<Descriptor> deployerDescriptors) {
- this.deployerDescriptors = deployerDescriptors;
- }
-}
15 years, 1 month
JBoss JBPM SVN: r4335 - in jbpm4/branches/tbaeyens/modules: deployment and 25 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 12:05:51 -0400 (Thu, 26 Mar 2009)
New Revision: 4335
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java
jbpm4/branches/tbaeyens/modules/deployment/
jbpm4/branches/tbaeyens/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
jbpm4/branches/tbaeyens/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
jbpm4/branches/tbaeyens/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
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/StartExecutionInLatestCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.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/wire/binding/DeployerManagerBinding.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.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/process/ProcessAttachmentsTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.history.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
Log:
deployment and repository
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/Deployment.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,64 +21,31 @@
*/
package org.jbpm;
-import java.io.File;
import java.io.InputStream;
-import java.io.Serializable;
import java.net.URL;
-import java.util.List;
import java.util.zip.ZipInputStream;
+import org.jbpm.client.ClientProcessDefinition;
-/** a deployment unit, containing all information in source format from which
- * a process definition will be created and stored in the process repository.
- *
- * <p>A deployment takes a bunch of files as input. Files must have a name
- * and optionally they can have a type. During deployment, the type can be
- * deducted from the filename automatically. Use the <code>addXxxx</code>-methods
- * to add files to the deployment. Use {@link #setFileType(String, String)} to
- * set the file type programmatically.
- * </p>
- *
- * <p>The deployment also manages a map of objects. The deployers will typically
- * generate those objects based on the corresponding file contents. E.g. the
- * jpdl deployer will produce a <code>order.jpdl.xml</code>
- * {@link ProcessDefinition}-object from the <code>order.jpdl.xml</code> file.
- * </p>
- *
- * <p>Typically, a deployer will save the created objects into the database.
- * </p>
- *
- * <p>Users can also supply objects programmatically with {@link #addObject(String, Object)}.
- * </p>
- *
+/**
* @author Tom Baeyens
*/
-public interface Deployment extends Serializable {
+public interface Deployment {
+ String getName();
Deployment setName(String name);
+
+ long getTimestamp();
Deployment setTimestamp(long timestamp);
- Deployment addResource(String resource);
- Deployment addFile(File file);
- Deployment addUrl(URL url);
- Deployment addInputStream(String name, InputStream inputStream);
- Deployment addString(String name, String string);
- Deployment addArchiveResource(String resource);
- Deployment addArchiveFile(File file);
- Deployment addArchiveUrl(URL url);
- Deployment addArchive(ZipInputStream zipInputStream);
- Deployment addDirectory(String directory);
- Deployment addDirectoryCanonical(String directory);
- Deployment addDirectory(File directory);
- Deployment addDirectoryCanonical(File directory);
- Deployment addProcessDefinition(ProcessDefinition processDefinition);
+ Deployment addResourceFromString(String resourceName, String string);
+ Deployment addResourceFromInputStream(String resourceName, InputStream inputStream);
+ Deployment addResourceFromClasspath(String resourceName);
+ Deployment addResourceFromUrl(URL url);
+ Deployment addResourcesFromZipInputStream(ZipInputStream zipInputStream);
+
+ /** @return deploymentId */
+ long deploy();
- Deployment setFileType(String fileName, String fileType);
-
- Deployment deploy();
-
- /** the deployed process definitions. */
- List<ProcessDefinition> getProcessDefinitions();
- /** the problems encountered during deployment */
- List<Problem> getProblems();
+ Deployment addProcessDefinition(ClientProcessDefinition processDefinition);
}
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -30,9 +30,14 @@
public interface ProcessEngine {
/** the {@link ProcessService process service} that provides access
- * to the process repository. */
+ * to the process repository.
+ * @deprecated */
ProcessService getProcessService();
+ /** the {@link RepositoryService repository service} that provides access
+ * to the process repository. */
+ RepositoryService getRepositoryService();
+
/** the {@link ExecutionService execution service} that provides access
* to the runtime executions repository. */
ExecutionService getExecutionService();
Property changes on: jbpm4/branches/tbaeyens/modules/deployment
___________________________________________________________________
Name: svn:ignore
+ target
Modified: jbpm4/branches/tbaeyens/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -33,10 +33,10 @@
import org.jbpm.ManagementService;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
-import org.jbpm.pvm.internal.repository.api.RepositoryService;
import org.jbpm.pvm.internal.stream.StringStreamInput;
import org.jbpm.task.Task;
import org.jbpm.test.BaseJbpmTestCase;
@@ -138,7 +138,7 @@
public void deployJpdlXmlString(String jpdlXmlString) {
long deploymentDbid =
repositoryService.createDeployment()
- .addStreamInput("xmlstring.jpdl.xml", new StringStreamInput(jpdlXmlString))
+ .addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString)
.deploy();
registerDeployment(deploymentDbid);
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,4 +1,4 @@
- <mapping resource="jbpm.definition.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,5 +1,2 @@
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <parse-jpdl />
+ <jpdl-deployer />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,6 +4,8 @@
<process-engine-context>
+ <repository-service />
+ <repository-cache />
<process-service />
<execution-service />
<history-service />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,8 +1,6 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,6 +1,3 @@
- <check-process />
- <check-problems />
- <save />
</deployer-manager>
<script-manager default-expression-language="juel"
@@ -30,6 +27,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,2 +1,2 @@
<!-- jpdl bindings -->
- <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -50,6 +50,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
@@ -65,13 +67,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryCacheBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- interceptors -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -23,7 +23,7 @@
ExecutionService executionService = processEngine.getExecutionService();
Deployment deployment = processService.createDeployment();
- deployment.addResource("org/jbpm/examples/services/process.jpdl.xml");
+ deployment.addResourceFromClasspath("org/jbpm/examples/services/process.jpdl.xml");
deployment.deploy();
Execution processInstance = executionService.startProcessInstanceByKey("simple");
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,6 +4,8 @@
<process-engine-context>
+ <repository-service />
+ <repository-cache />
<process-service />
<execution-service />
<history-service />
@@ -18,20 +20,12 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <parse-jpdl />
- <check-process />
- <check-problems />
- <save />
+ <jpdl-deployer />
</deployer-manager>
<script-manager default-expression-language="juel"
@@ -61,6 +55,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -15,7 +15,7 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.history.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -50,6 +50,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
@@ -65,13 +67,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryCacheBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- interceptors -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
@@ -88,6 +88,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.EnlistBinding" />
<!-- jpdl bindings -->
- <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
</wire-bindings>
Modified: jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -162,12 +162,10 @@
public void deploy(String fileName, String contentType, InputStream deployment)
{
- List<ProcessDefinition> definitions =
this.processEngine.getProcessService()
.createDeployment()
- .addInputStream(fileName, deployment)
- .deploy()
- .getProcessDefinitions();
+ .addResourceFromInputStream(fileName, deployment)
+ .deploy();
}
}
Modified: jbpm4/branches/tbaeyens/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -27,7 +27,7 @@
import org.jboss.deployment.SubDeployerSupport;
import org.jbpm.integration.spi.DeploymentAdaptor;
import org.jbpm.integration.spi.JBPMDeploymentMetaData;
-import org.jbpm.integration.spi.ProcessDeploymentRef;
+import org.jbpm.integration.spi.DeploymentRef;
import org.jbpm.internal.log.Log;
import java.util.List;
@@ -37,7 +37,7 @@
/**
* An AS 4.2.x deployer for jBPM4 process archives.
* Delegates to {@link org.jbpm.integration.spi.DeploymentAdaptor}.
- * The deployer retains a {@link org.jbpm.integration.spi.ProcessDeploymentRef}
+ * The deployer retains a {@link org.jbpm.integration.spi.DeploymentRef}
* for subsequent undeployment calls.
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -105,7 +105,7 @@
{
log.info("Deploy " + rootDeployment.url);
- List<ProcessDeploymentRef> allProcessRefs = new ArrayList<ProcessDeploymentRef>();
+ List<DeploymentRef> deploymentRefs = new ArrayList<DeploymentRef>();
Iterator iterator = rootDeployment.subDeployments.iterator();
while(iterator.hasNext())
@@ -116,12 +116,12 @@
md.setWatch(rootDeployment.watch);
md.setProcessDescriptor(subDeployment.url);
- List<ProcessDeploymentRef> subDeploymentRefs = null;
+ DeploymentRef deploymentRef;
try
{
- subDeploymentRefs = adaptor.deploy(md);
- allProcessRefs.addAll(subDeploymentRefs);
+ deploymentRef = adaptor.deploy(md);
+ deploymentRefs.add(deploymentRef);
}
catch (Throwable t)
{
@@ -129,7 +129,7 @@
}
}
- rootDeployment.context.put(CONTEXT_REFERENCE, allProcessRefs);
+ rootDeployment.context.put(CONTEXT_REFERENCE, deploymentRefs);
}
}
@@ -151,17 +151,17 @@
{
log.info("Undeploy " + rootDeployment.url);
- List<ProcessDeploymentRef> processRefs = (List<ProcessDeploymentRef>)
+ List<DeploymentRef> deploymentRefs = (List<DeploymentRef>)
rootDeployment.context.get(CONTEXT_REFERENCE);
- if(null==processRefs)
+ if(null==deploymentRefs)
{
log.info("Failed to retrieve process reference information. " +
"Ignore undepoyment call: "+ rootDeployment.url);
return;
}
- adaptor.undeploy(processRefs);
+ adaptor.undeploy(deploymentRefs);
}
}
}
Modified: jbpm4/branches/tbaeyens/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -27,15 +27,16 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jbpm.integration.spi.DeploymentAdaptor;
import org.jbpm.integration.spi.JBPMDeploymentMetaData;
-import org.jbpm.integration.spi.ProcessDeploymentRef;
+import org.jbpm.integration.spi.DeploymentRef;
import org.jbpm.internal.log.Log;
+import java.util.ArrayList;
import java.util.List;
/**
* An AS 5.0.x deployer for jBPM4 process archives.
* Delegates to {@link org.jbpm.integration.spi.DeploymentAdaptor}.
- * The deployer retains a {@link org.jbpm.integration.spi.ProcessDeploymentRef}
+ * The deployer retains a {@link org.jbpm.integration.spi.DeploymentRef}
* for subsequent undeployment calls.
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -63,9 +64,9 @@
try
{
- List<ProcessDeploymentRef> processRefs = adaptor.deploy(deployment);
+ DeploymentRef deploymentRef = adaptor.deploy(deployment);
// TODO: mark the process 'ready', classloader assoc
- unit.addAttachment("jbpm.deployer.reference", processRefs);
+ unit.addAttachment("jbpm.deployment.ref", deploymentRef);
}
catch (Throwable t)
{
@@ -78,15 +79,18 @@
{
log.info("Undeploy "+deployment);
- List<ProcessDeploymentRef> processRefs =
- (List<ProcessDeploymentRef>)unit.getAttachment("jbpm.deployer.reference");
+ DeploymentRef deploymentRef =
+ (DeploymentRef)unit.getAttachment("jbpm.deployment.ref");
- if(null==processRefs)
+ if(null==deploymentRef)
{
log.info("Failed to retrieve process reference information. Ignore undepoyment call: "+ deployment);
return;
}
+
+ List<DeploymentRef> deploymentRefs = new ArrayList<DeploymentRef>();
+ deploymentRefs.add(deploymentRef);
- adaptor.undeploy(processRefs);
+ adaptor.undeploy(deploymentRefs);
}
}
Modified: jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,18 +21,17 @@
*/
package org.jbpm.integration.spi;
-import org.jbpm.Deployment;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.ProcessService;
-import org.jbpm.internal.log.Log;
+import java.io.File;
+import java.util.List;
import javax.naming.InitialContext;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
+import org.jbpm.internal.log.Log;
+
/**
* Adopts AS 4 and AS 5 deployer invocations to jBPM invocations.
*
@@ -42,7 +41,7 @@
{
private static final Log log = Log.getLog(DeploymentAdaptor.class.getName());
- public List<ProcessDeploymentRef> deploy(JBPMDeploymentMetaData deploymentMetData)
+ public DeploymentRef deploy(JBPMDeploymentMetaData deploymentMetData)
{
JBPMService jbpmService = JBPMServiceLocator.locateService();
@@ -57,35 +56,20 @@
// deploy to process engine
ProcessService processService = jbpmService.getProcessEngine().getProcessService();
- String pathToDeployment = deploymentMetData.getWatch().getPath();
- File deploymentFile = new File(pathToDeployment);
+ String deploymentName = deploymentMetData.getWatch().getPath();
+ File deploymentFile = new File(deploymentName);
- Deployment dpl = processService.createDeployment()
- .addUrl(deploymentMetData.getProcessDescriptor())
+ long deploymentDbid = processService.createDeployment()
+ .addResourceFromUrl(deploymentMetData.getProcessDescriptor())
.setTimestamp(deploymentFile.lastModified())
- .setName(deploymentMetData.getWatch().getPath());
+ .setName(deploymentName)
+ .deploy();
+
+ DeploymentRef deploymentRef = new DeploymentRef(deploymentDbid, deploymentName);
- List<ProcessDefinition> processesInScope =
- dpl
- .deploy()
- .getProcessDefinitions();
-
- // pass reference to the deployment unit for undeployment
- List<ProcessDeploymentRef> processRefs = new ArrayList<ProcessDeploymentRef>();
- for(ProcessDefinition pd : processesInScope)
- {
- ProcessDeploymentRef ref = new ProcessDeploymentRef(
- pd.getId(),
- pd.getVersion(),
- deploymentMetData.getWatch().getPath()
- );
- processRefs.add(ref);
- }
-
tx.commit();
- return processRefs;
-
+ return deploymentRef;
}
catch(Throwable e)
{
@@ -103,7 +87,7 @@
}
- public void undeploy(List<ProcessDeploymentRef> processRefs)
+ public void undeploy(List<DeploymentRef> deploymentRefs)
{
UserTransaction tx = null;
@@ -111,28 +95,27 @@
{
JBPMService jbpmService = JBPMServiceLocator.locateService();
- ProcessService processService = jbpmService.getProcessEngine().getProcessService();
+ RepositoryService repositoryService = jbpmService.getProcessEngine().getRepositoryService();
InitialContext ctx = new InitialContext();
tx = (UserTransaction)ctx.lookup("UserTransaction");
tx.begin();
-
- for(ProcessDeploymentRef ref : processRefs)
- {
+
+ for (DeploymentRef deploymentRef: deploymentRefs) {
// if the physical artifact has been removed the process can be deleted
- File deploymentArtifact = new File(ref.getLocation());
+ File deploymentArtifact = new File(deploymentRef.getLocation());
if(!deploymentArtifact.exists())
{
- log.info("The deployment artifact for process '"+ref+" has been deleted."+
+ log.info("The deployment artifact for process '"+deploymentRef+" has been deleted."+
" The process definition will be removed.");
- processService.deleteProcessDefinition(ref.getProcessId());
+ repositoryService.deleteDeployment(deploymentRef.getDeploymentDbid());
}
else
{
// TODO: if the file remains, mark the process as 'shutdown'
- log.info("The deployment artifact for process '"+ref+"' retains. " +
+ log.info("The deployment artifact for process '"+deploymentRef+"' retains. " +
"Keep process definition.");
}
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -31,8 +31,8 @@
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.repository.Deployer;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.session.RepositorySession;
/**
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,6 +4,8 @@
<process-engine-context>
+ <repository-service />
+ <repository-cache />
<process-service />
<execution-service />
<history-service />
@@ -18,20 +20,12 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <parse-jpdl />
- <check-process />
- <check-problems />
- <save />
+ <jpdl-deployer />
</deployer-manager>
<script-manager default-expression-language="juel"
@@ -61,6 +55,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -15,7 +15,7 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.history.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -50,6 +50,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
@@ -65,13 +67,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryCacheBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- interceptors -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
@@ -88,6 +88,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.EnlistBinding" />
<!-- jpdl bindings -->
- <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
</wire-bindings>
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -25,7 +25,6 @@
import java.io.InputStream;
import java.net.URL;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.jbpm.Configuration;
@@ -35,6 +34,7 @@
import org.jbpm.ManagementService;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
import org.jbpm.TaskService;
import org.jbpm.env.Context;
import org.jbpm.env.Environment;
@@ -163,6 +163,9 @@
public IdentityService getIdentityService() {
return environmentFactoryCtxWireContext.get(IdentityService.class);
}
+ public RepositoryService getRepositoryService() {
+ return environmentFactoryCtxWireContext.get(RepositoryService.class);
+ }
public static EnvironmentFactory parseXmlString(String xmlString) {
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration();
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,38 +21,42 @@
*/
package org.jbpm.pvm.internal.cmd;
-import java.util.List;
-
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;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.session.RepositorySession;
+
/**
* @author Tom Baeyens
*/
-public class DeployCmd extends AbstractCommand<List<ProcessDefinition>> {
+public class DeployCmd implements Command<Long> {
private static final long serialVersionUID = 1L;
-
- protected DeploymentImpl deployment;
+ private static Log log = Log.getLog(DeployCmd.class.getName());
+
+ DeploymentImpl deployment;
+
public DeployCmd(DeploymentImpl deployment) {
this.deployment = deployment;
}
- public List<ProcessDefinition> execute(Environment environment) throws Exception {
- DeployerManager deployerManager = environment.get(DeployerManager.class);
- if (deployerManager==null) {
- throw new JbpmException("no "+DeployerManager.class.getName()+" configured");
+ public Long execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ long deploymentDbid = repositorySession.deploy(deployment);
+
+ if (deployment.hasProblems()) {
+ String problemsText = deployment.getProblemsText();
+ if (problemsText!=null) {
+ String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
+ log.info(errorMsg);
+ throw new JbpmException(errorMsg);
+ }
}
-
- // let the process parser managemer determine the process language
- // and handle the deployment
- deployerManager.deploy(deployment);
- return deployment.getProcessDefinitions();
+ return deploymentDbid;
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -1,78 +1,80 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cmd;
-
-import java.util.Map;
-
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.session.PvmDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionKey;
- protected String executionKey;
-
- public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
- if (processDefinitionKey==null) {
- throw new JbpmException("processDefinitionKey is null");
- }
- this.processDefinitionKey = processDefinitionKey;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ClientProcessDefinition processDefinition = null;
-
- processDefinition = pvmDbSession.findLatestProcessDefinitionByKey(processDefinitionKey);
-
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- pvmDbSession.save(processInstance);
- return processInstance;
- }
-
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
+/*
+ * 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.cmd;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionKey;
+ protected String executionKey;
+
+ public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+ if (processDefinitionKey==null) {
+ throw new JbpmException("processDefinitionKey is null");
+ }
+ this.processDefinitionKey = processDefinitionKey;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ ClientProcessDefinition processDefinition = null;
+
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ processDefinition = (ClientProcessDefinition) repositorySession
+ .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
+
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
+ }
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+ return processInstance;
+ }
+
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -68,10 +68,10 @@
import org.jbpm.pvm.internal.model.op.ProceedToDestination;
import org.jbpm.pvm.internal.model.op.Signal;
import org.jbpm.pvm.internal.model.op.TakeTransition;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
import org.jbpm.session.MessageSession;
+import org.jbpm.session.RepositorySession;
/**
* @author Tom Baeyens
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -25,7 +25,8 @@
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.session.RepositorySession;
/**
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -24,6 +24,7 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.ObjectStreamException;
+import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -32,12 +33,18 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import org.jbpm.Deployment;
import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.repository.api.Deployment;
import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
+import org.jbpm.pvm.internal.stream.InputStreamInput;
+import org.jbpm.pvm.internal.stream.ResourceStreamInput;
import org.jbpm.pvm.internal.stream.StreamInput;
+import org.jbpm.pvm.internal.stream.StringStreamInput;
+import org.jbpm.pvm.internal.stream.UrlStreamInput;
import org.jbpm.pvm.internal.util.IoUtil;
import org.jbpm.pvm.internal.xml.ProblemList;
@@ -50,11 +57,9 @@
protected long dbid;
protected String name;
protected long timestamp;
-
protected Map<String, Lob> resources;
protected CommandService commandService;
-
protected Map<String, Object> objects;
protected Set<DeploymentProperty> objectProperties;
@@ -68,32 +73,25 @@
public long deploy() {
return commandService.execute(new DeployCmd(this));
}
- public void setName(String name) {
- this.name = name;
- }
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
+ public Deployment addResourceFromClasspath(String resourceName) {
+ addResourceFromStreamInput(resourceName, new ResourceStreamInput(resourceName));
+ return this;
}
- public Deployment addStreamInput(String name, StreamInput streamInput) {
- if (resources==null) {
- resources = new HashMap<String, Lob>();
- }
- byte[] bytes = IoUtil.readBytes(streamInput.openStream());
- Lob lob = new Lob(bytes);
- resources.put(name, lob);
+ public Deployment addResourceFromString(String resourceName, String text) {
+ addResourceFromStreamInput(resourceName, new StringStreamInput(text));
return this;
}
-
- public Deployment addZipInputStream(ZipInputStream zipInputStream) {
+
+ public Deployment addResourcesFromZipInputStream(ZipInputStream zipInputStream) {
try {
ZipEntry zipEntry = zipInputStream.getNextEntry();
while(zipEntry!=null) {
String entryName = zipEntry.getName();
byte[] bytes = IoUtil.readBytes(zipInputStream);
if (bytes!=null) {
- addStreamInput(entryName, new ByteArrayStreamInput(bytes));
+ addResourceFromStreamInput(entryName, new ByteArrayStreamInput(bytes));
}
zipEntry = zipInputStream.getNextEntry();
}
@@ -102,7 +100,27 @@
}
return this;
}
-
+
+ public Deployment addResourceFromInputStream(String resourceName, InputStream inputStream) {
+ addResourceFromStreamInput(resourceName, new InputStreamInput(inputStream));
+ return this;
+ }
+
+ public Deployment addResourceFromUrl(URL url) {
+ addResourceFromStreamInput(url.toString(), new UrlStreamInput(url));
+ return this;
+ }
+
+ public Deployment addResourceFromStreamInput(String name, StreamInput streamInput) {
+ if (resources==null) {
+ resources = new HashMap<String, Lob>();
+ }
+ byte[] bytes = IoUtil.readBytes(streamInput.openStream());
+ Lob lob = new Lob(bytes);
+ resources.put(name, lob);
+ return this;
+ }
+
public Set<String> getResourceNames() {
if (resources==null) {
return Collections.EMPTY_SET;
@@ -156,16 +174,29 @@
public long getDbid() {
return dbid;
}
+ public Map<String, Object> getObjects() {
+ return objects;
+ }
+ public Set<DeploymentProperty> getObjectProperties() {
+ return objectProperties;
+ }
public String getName() {
return name;
}
+ public DeploymentImpl setName(String name) {
+ this.name = name;
+ return this;
+ }
public long getTimestamp() {
return timestamp;
}
- public Map<String, Object> getObjects() {
- return objects;
+ public DeploymentImpl setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ return this;
}
- public Set<DeploymentProperty> getObjectProperties() {
- return objectProperties;
+
+
+ public Deployment addProcessDefinition(ClientProcessDefinition processDefinition) {
+ throw new UnsupportedOperationException("implement me");
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,11 +21,9 @@
*/
package org.jbpm.pvm.internal.repository;
-import java.io.InputStream;
-
+import org.jbpm.Deployment;
+import org.jbpm.RepositoryService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.repository.api.Deployment;
-import org.jbpm.pvm.internal.repository.api.RepositoryService;
/**
* @author Tom Baeyens
@@ -38,10 +36,10 @@
return new DeploymentImpl(commandService);
}
- public void deleteDeployment(long deploymentdbid) {
+ public void deleteDeployment(long deploymentDbid) {
}
- public InputStream getResource(String deploymentId, String resource) {
+ public byte[] getResource(long deploymentDbid, String resource) {
return null;
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -25,10 +25,11 @@
import java.util.List;
import org.hibernate.Session;
+import org.jbpm.Deployment;
import org.jbpm.JbpmException;
import org.jbpm.Problem;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
+import org.jbpm.session.RepositorySession;
/**
* @author Tom Baeyens
@@ -41,28 +42,28 @@
RepositoryCache repositoryCache;
DeployerManager deployerManager;
- public long deploy(DeploymentImpl deployment) {
- session.save(deployment);
+ public long deploy(Deployment deployment) {
+ DeploymentImpl deploymentImpl = (DeploymentImpl) deployment;
+ session.save(deploymentImpl);
- deployment.setTimestamp(System.currentTimeMillis());
- deployment.setProblems(new ArrayList<Problem>());
+ deploymentImpl.setProblems(new ArrayList<Problem>());
- deployerManager.deploy(deployment);
+ deployerManager.deploy(deploymentImpl);
- if (deployment.hasProblems()) {
- for (Problem problem: deployment.getProblems()) {
+ if (deploymentImpl.hasProblems()) {
+ for (Problem problem: deploymentImpl.getProblems()) {
Throwable cause = problem.getCause();
if (cause!=null) {
log.debug("deployment exception", cause);
}
}
- throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
+ throw new JbpmException("problems during deployment: "+deploymentImpl.getProblemsText());
} else {
- repositoryCache.set(deployment.getDbid(), deployment.getObjects());
+ repositoryCache.set(deploymentImpl.getDbid(), deploymentImpl.getObjects());
}
- return deployment.getDbid();
+ return deploymentImpl.getDbid();
}
public Object getObject(long deploymentDbid, String objectName) {
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -36,6 +36,7 @@
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionsByKeyCmd;
import org.jbpm.pvm.internal.cmd.GetAttachment;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
/** {@link ProcessService} implementation that delegates execution of the
* methods to a {@link CommandService}.
@@ -45,7 +46,7 @@
public class ProcessServiceImpl extends AbstractServiceImpl implements ProcessService {
public Deployment createDeployment() {
- return new DeploymentImpl(this);
+ return new DeploymentImpl(commandService);
}
public List<String> findProcessDefinitionKeys() {
@@ -80,7 +81,7 @@
return new ProcessDefinitionQueryImpl(commandService);
}
- public List<ProcessDefinition> deploy(Deployment deployment) {
+ public Long deploy(Deployment deployment) {
return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,14 +21,9 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.deploy.DeployerManager;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.DeployerManagerDescriptor;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.repository.DeployerManager;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -49,24 +44,12 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- DeployerManagerDescriptor descriptor = new DeployerManagerDescriptor();
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor(DeployerManager.class);
- List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
- descriptor.setDeployerDescriptors(deployerDescriptors);
+ ListBinding listBinding = new ListBinding();
+ ListDescriptor listDescriptor = (ListDescriptor) listBinding.parse(element, parse, parser);
+ objectDescriptor.addInjection("deployers", listDescriptor);
- List<Element> deployerElements = XmlUtil.elements(element);
- for (Element deployerElement: deployerElements) {
- Descriptor deployerDescriptor = (Descriptor) parser
- .parseElement(deployerElement,
- parse,
- WireParser.CATEGORY_DESCRIPTOR);
- deployerDescriptors.add(deployerDescriptor);
- }
-
- if (deployerDescriptors.isEmpty()) {
- parse.addProblem("no deployers defined for "+DEPLOYER_MANAGER_TAG);
- }
-
- return descriptor;
+ return objectDescriptor;
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -30,7 +30,7 @@
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -52,6 +52,9 @@
log.debug("Apply " + this.getClass().getName());
PolicyEvaluation evaluation = new PolicyEvaluation();
+
+ /*
+ TODO
for (String fileName: deployment.getFileNamesForType("jpdl"))
{
@@ -137,7 +140,9 @@
}
}
+ */
+
return evaluation;
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,7 +28,7 @@
import org.jbpm.Problem;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
/** list of problems. Base class for {@link Parse}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -21,7 +21,6 @@
*/
package org.jbpm.pvm.internal.execution;
-import org.jbpm.Deployment;
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
import org.jbpm.ProcessService;
@@ -30,8 +29,6 @@
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.pvm.internal.svc.ProcessServiceImpl;
import org.jbpm.pvm.test.EnvironmentFactoryTestCase;
/**
@@ -52,9 +49,10 @@
.endActivity()
.endProcess();
- Deployment deployment = new DeploymentImpl((ProcessServiceImpl) processService);
- deployment.addProcessDefinition(processDefinition);
- deployment.deploy();
+ processService
+ .createDeployment()
+ .addProcessDefinition(processDefinition)
+ .deploy();
}
public void testStartProcessInstance() {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,6 +4,8 @@
<process-engine-context>
+ <repository-service />
+ <repository-cache />
<process-service />
<execution-service />
<history-service />
@@ -18,16 +20,11 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
<deployer-manager>
- <check-process />
- <check-problems />
- <save />
</deployer-manager>
<script-manager default-expression-language="juel"
@@ -57,6 +54,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -15,7 +15,7 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.history.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -50,6 +50,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
@@ -65,13 +67,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryCacheBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- interceptors -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -31,9 +31,9 @@
import org.jbpm.HistoryService;
import org.jbpm.IdentityService;
import org.jbpm.ManagementService;
-import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
@@ -68,6 +68,7 @@
protected static ProcessEngine processEngine = null;
+ protected static RepositoryService repositoryService;
protected static ProcessService processService;
protected static ExecutionService executionService;
protected static ManagementService managementService;
@@ -77,9 +78,9 @@
protected static CommandService commandService;
- /** registered process definitions will be deleted automatically in the tearDown.
- * This is a convenience function as each test is expected to clean up the DB. */
- protected List<ProcessDefinition> registeredProcessDefinitions;
+ /** registered deployments. registered deployments will be deleted automatically
+ * in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
+ protected List<Long> registeredDeployments;
/** registered tasks will be deleted automatically in the tearDown.
* This is a convenience function as each test is expected to clean up the DB. */
protected List<Long> registeredTaskIds;
@@ -102,6 +103,7 @@
processEngine = configuration.buildProcessEngine();
+ repositoryService = processEngine.get(RepositoryService.class);
processService = processEngine.getProcessService();
executionService = processEngine.getExecutionService();
historyService = processEngine.getHistoryService();
@@ -113,9 +115,9 @@
}
protected void tearDown() throws Exception {
- if (registeredProcessDefinitions!=null) {
- for (ProcessDefinition processDefinition : registeredProcessDefinitions) {
- processService.deleteProcessDefinitionCascade(processDefinition.getId());
+ if (registeredDeployments!=null) {
+ for (Long deploymentDbid : registeredDeployments) {
+ repositoryService.deleteDeployment(deploymentDbid);
}
}
@@ -130,50 +132,32 @@
super.tearDown();
}
- public ProcessDefinition deployJpdlXmlString(String jpdlXmlString) {
- List<ProcessDefinition> deployedProcessDefinitions =
- processService.createDeployment()
- .addString("xmlstring.jpdl.xml", jpdlXmlString)
- .deploy()
- .getProcessDefinitions();
+ public void deployJpdlXmlString(String jpdlXmlString) {
+ long deploymentDbid =
+ repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString)
+ .deploy();
- return registerDeployedProcessDefinitions(deployedProcessDefinitions);
+ registerDeployment(deploymentDbid);
}
+
+ public void deployJpdlResource(String resource) {
+ long deploymentDbid =
+ repositoryService.createDeployment()
+ .addResourceFromClasspath(resource)
+ .deploy();
- public ProcessDefinition deployJpdlResource(String resource) {
- List<ProcessDefinition> deployedProcessDefinitions =
- processService.createDeployment()
- .addResource(resource)
- .deploy()
- .getProcessDefinitions();
-
- return registerDeployedProcessDefinitions(deployedProcessDefinitions);
+ registerDeployment(deploymentDbid);
}
- protected ProcessDefinition addDeployedProcessDefinition(ProcessDefinition deployedProcessDefinition) {
- if (registeredProcessDefinitions==null) {
- registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
+ protected void registerDeployment(long deploymentDbid) {
+ if (registeredDeployments==null) {
+ registeredDeployments = new ArrayList<Long>();
}
- registeredProcessDefinitions.add(deployedProcessDefinition);
-
- return deployedProcessDefinition;
+ registeredDeployments.add(deploymentDbid);
}
- protected ProcessDefinition registerDeployedProcessDefinitions(List<ProcessDefinition> deployedProcessDefinitions) {
- if (registeredProcessDefinitions==null) {
- registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
- }
-
- registeredProcessDefinitions.addAll(deployedProcessDefinitions);
-
- if (deployedProcessDefinitions.size()>=1) {
- return deployedProcessDefinitions.get(0);
- }
-
- return null;
- }
-
public long saveAndRegisterTask(Task task) {
long taskDbid = taskService.saveTask(task);
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -38,22 +38,22 @@
byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
- List<ProcessDefinition> deployedProcessDefinitions =
+ long deploymentDbid =
processService.createDeployment()
- .addString("xmlstring.jpdl.xml",
+ .addResourceFromString("xmlstring.jpdl.xml",
"<process name='Insurance claim'>" +
" <start />" +
"</process>")
- .addInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
- .addInputStream("other attachment", new ByteArrayInputStream(otherBytes))
- .deploy()
- .getProcessDefinitions();
- ProcessDefinition processDefinition = registerDeployedProcessDefinitions(deployedProcessDefinitions);
+ .addResourceFromInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
+ .addResourceFromInputStream("other attachment", new ByteArrayInputStream(otherBytes))
+ .deploy();
+
+ registerDeployment(deploymentDbid);
- byte[] retrievedLotOfBytes = processService.getAttachment(processDefinition.getId(), "a lot of attachment");
+ byte[] retrievedLotOfBytes = repositoryService.getResource(deploymentDbid, "a lot of attachment");
assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
- byte[] retrievedOtherBytes = processService.getAttachment(processDefinition.getId(), "other attachment");
+ byte[] retrievedOtherBytes = repositoryService.getResource(deploymentDbid, "other attachment");
assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-26 16:05:51 UTC (rev 4335)
@@ -36,11 +36,13 @@
public class ProcessServiceTest extends JbpmTestCase {
public void testProcessWithNameOnly() {
- ProcessDefinition processDefinition = deployJpdlXmlString(
+ deployJpdlXmlString(
"<process name='Insurance claim'>" +
" <start />" +
"</process>"
);
+
+ ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("Insurance_claim");
assertNotNull(processDefinition);
assertEquals("Insurance claim", processDefinition.getName());
@@ -140,7 +142,7 @@
public void testDeleteProcessDefinition() {
processService.createDeployment()
- .addString("xmlstring.jpdl.xml",
+ .addResourceFromString("xmlstring.jpdl.xml",
"<process name='deleteme' version='33'>" +
" <start />" +
"</process>")
@@ -155,7 +157,7 @@
public void testDeleteProcessDefinitionAndInstances() {
processService.createDeployment()
- .addString("xmlstring.jpdl.xml",
+ .addResourceFromString("xmlstring.jpdl.xml",
"<process name='deleteme' version='33'>" +
" <start>" +
" <transition to='w' />" +
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,6 +4,8 @@
<process-engine-context>
+ <repository-service />
+ <repository-cache />
<process-service />
<execution-service />
<history-service />
@@ -18,20 +20,12 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <parse-jpdl />
- <check-process />
- <check-problems />
- <save />
+ <jpdl-deployer />
</deployer-manager>
<script-manager default-expression-language="juel"
@@ -61,6 +55,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -15,7 +15,7 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.history.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
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-26 10:51:12 UTC (rev 4334)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-03-26 16:05:51 UTC (rev 4335)
@@ -50,6 +50,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.HistorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
@@ -65,13 +67,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.RepositoryCacheBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- interceptors -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentInterceptorBinding" />
@@ -88,6 +88,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.EnlistBinding" />
<!-- jpdl bindings -->
- <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
</wire-bindings>
15 years, 1 month
JBoss JBPM SVN: r4334 - jbpm4/branches.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 06:51:12 -0400 (Thu, 26 Mar 2009)
New Revision: 4334
Added:
jbpm4/branches/tbaeyens/
Log:
creating tbaeyens branch
Copied: jbpm4/branches/tbaeyens (from rev 4333, jbpm4/trunk)
15 years, 1 month
JBoss JBPM SVN: r4333 - jbpm4/trunk/modules/deployment.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 06:50:30 -0400 (Thu, 26 Mar 2009)
New Revision: 4333
Removed:
jbpm4/trunk/modules/deployment/target/
Log:
deleting target directory in deployment
15 years, 1 month
JBoss JBPM SVN: r4332 - jbpm4/branches.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 06:48:43 -0400 (Thu, 26 Mar 2009)
New Revision: 4332
Removed:
jbpm4/branches/tbaeyens/
Log:
deleting personal tbaeyens branch
15 years, 1 month
JBoss JBPM SVN: r4331 - in jbpm4/trunk/modules: deployment/src/main/java/org/jbpm/cmd and 10 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-26 06:38:38 -0400 (Thu, 26 Mar 2009)
New Revision: 4331
Added:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
Removed:
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
Modified:
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
Log:
revisiting deployment
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.api;
-
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.pvm.internal.stream.StreamInput;
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployment {
-
- void setName(String name);
-
- Deployment addStreamInput(String name, StreamInput streamInput);
- Deployment addZipInputStream(ZipInputStream zipInputStream);
-
- /** @return deploymentId */
- long deploy();
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.api;
-
-import java.io.InputStream;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryService {
-
- public abstract Deployment createDeployment();
-
- public abstract void deleteDeployment(long deploymentDbid);
-
- public abstract InputStream getResource(String deploymentId, String resource);
-
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.api;
-
-import java.util.List;
-
-import org.jbpm.pvm.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositorySession {
-
- Object getObject(long deploymentDbid, String objectName);
-
- long deploy(DeploymentImpl deployment);
-
- List<String> findObjectNames(String propertyKey, String propertyValue);
- List<String> findObjectPropertyValues(String objectName, String propertyKey);
- Object findObjectByPropertyValue(String propertyKey, String propertyValue);
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.cmd;
-
-import java.util.Map;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.cmd.VariablesCmd;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionKey;
- protected String executionKey;
-
- public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
- if (processDefinitionKey==null) {
- throw new JbpmException("processDefinitionKey is null");
- }
- this.processDefinitionKey = processDefinitionKey;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- ClientProcessDefinition processDefinition = null;
-
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- processDefinition = (ClientProcessDefinition) repositorySession
- .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
-
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- Session session = Environment.getFromCurrent(Session.class);
- session.save(processInstance);
- return processInstance;
- }
-
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.jbpm.api.RepositorySession;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.Deployer;
-import org.jbpm.pvm.DeploymentImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.xml.Parse;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlDeployer implements Deployer {
-
- private static Log log = Log.getLog(JpdlDeployer.class.getName());
-
- static JpdlParser jpdlParser = new JpdlParser();
-
- public void deploy(DeploymentImpl deployment) {
-
- for (String resourceName: deployment.getResourceNames()) {
- InputStream inputStream = deployment.getResourceAsStream(resourceName);
-
- Parse parse = jpdlParser.createParse();
- parse.setProblems(deployment.getProblems());
- parse.setInputStream(inputStream);
- parse.execute();
-
- JpdlProcessDefinition processDefinition =
- (JpdlProcessDefinition) parse.getDocumentObject();
-
- if ( (processDefinition!=null)
- && (processDefinition.getName()!=null)
- ) {
- String processDefinitionName = processDefinition.getName();
-
- processDefinition.setDeploymentDbid(deployment.getDbid());
-
- String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
- if (key!=null) {
- String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
- processDefinition.setId(id);
- processDefinition.setKey(key);
-
- } else {
- checkKey(processDefinition, deployment);
- checkId(processDefinition, deployment);
-
- deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
- }
- }
- }
- }
-
- protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- String processDefinitionName = processDefinition.getName();
- String processDefinitionKey = processDefinition.getKey();
-
- // if no key was specified in the jpdl process file
- if (processDefinitionKey==null) {
- // derive the key from the name
- // replace any non-word character with an underscore
- processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
- processDefinition.setKey(processDefinitionKey);
- }
-
- RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
- if ( (!existingKeys.isEmpty())
- && existingKeys.get(0).equals(processDefinitionKey)
- ) {
- deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
- }
-
- List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
- if ( (!existingNames.isEmpty())
- && existingNames.get(0).equals(processDefinitionName)
- ) {
- deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
- }
- }
-
- protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- String id = processDefinition.getId();
- if (id==null) {
- id = processDefinition.getKey()+"-"+deployment.getDbid();
- log.trace("created id '"+id+"' for "+processDefinition);
- processDefinition.setId(id);
- }
-
- RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
- deployment.addProblem("process '" + id + "' already exists");
- }
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import org.jbpm.JbpmException;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployCmd implements Command<Long> {
-
- private static final long serialVersionUID = 1L;
-
- private static Log log = Log.getLog(DeployCmd.class.getName());
-
- DeploymentImpl deployment;
-
- public DeployCmd(DeploymentImpl deployment) {
- this.deployment = deployment;
- }
-
- public Long execute(Environment environment) throws Exception {
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- long deploymentDbid = repositorySession.deploy(deployment);
-
- if (deployment.hasProblems()) {
- String problemsText = deployment.getProblemsText();
- if (problemsText!=null) {
- String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
- log.info(errorMsg);
- throw new JbpmException(errorMsg);
- }
- }
-
- return deploymentDbid;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployer {
-
- void deploy(DeploymentImpl deployment);
-
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.util.List;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployerManager {
-
- List<Deployer> deployers;
-
- public Object deploy(DeploymentImpl deployment) {
- for (Deployer deployer: deployers) {
- deployer.deploy(deployment);
- }
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.ObjectStreamException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.JbpmException;
-import org.jbpm.api.Deployment;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.util.IoUtil;
-import org.jbpm.pvm.internal.xml.ProblemList;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeploymentImpl extends ProblemList implements Deployment {
-
- protected long dbid;
- protected String name;
- protected long timestamp;
-
- protected Map<String, Lob> resources;
-
- protected CommandService commandService;
-
- protected Map<String, Object> objects;
- protected Set<DeploymentProperty> objectProperties;
-
- public DeploymentImpl() {
- }
-
- public DeploymentImpl(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public long deploy() {
- return commandService.execute(new DeployCmd(this));
- }
- public void setName(String name) {
- this.name = name;
- }
-
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public Deployment addStreamInput(String name, StreamInput streamInput) {
- if (resources==null) {
- resources = new HashMap<String, Lob>();
- }
- byte[] bytes = IoUtil.readBytes(streamInput.openStream());
- Lob lob = new Lob(bytes);
- resources.put(name, lob);
- return this;
- }
-
- public Deployment addZipInputStream(ZipInputStream zipInputStream) {
- try {
- ZipEntry zipEntry = zipInputStream.getNextEntry();
- while(zipEntry!=null) {
- String entryName = zipEntry.getName();
- byte[] bytes = IoUtil.readBytes(zipInputStream);
- if (bytes!=null) {
- addStreamInput(entryName, new ByteArrayStreamInput(bytes));
- }
- zipEntry = zipInputStream.getNextEntry();
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't read zip archive", e);
- }
- return this;
- }
-
- public Set<String> getResourceNames() {
- if (resources==null) {
- return Collections.EMPTY_SET;
- }
- return resources.keySet();
- }
-
- public InputStream getResourceAsStream(String resourceName) {
- if (resources!=null) {
- Lob lob = resources.get(resourceName);
- if (lob!=null) {
- byte[] bytes = lob.extractBytes();
- return new ByteArrayInputStream(bytes);
- }
- }
- return null;
- }
-
- public void addObject(String objectName, Object object) {
- if (objects==null) {
- objects = new HashMap<String, Object>();
- }
- objects.put(objectName, object);
- }
-
- public void addObjectProperty(String objectName, String key, String value) {
- if (objectProperties==null) {
- objectProperties = new HashSet<DeploymentProperty>();
- }
- objectProperties.add(new DeploymentProperty(this, objectName, key, value));
- }
-
- public String getObjectProperty(String objectName, String key) {
- if (objectProperties!=null) {
- for (DeploymentProperty deploymentProperty: objectProperties) {
- if ( (deploymentProperty.getObjectName().equals(objectName))
- && (deploymentProperty.getKey().equals(key))
- ) {
- return deploymentProperty.getValue();
- }
- }
- }
- return null;
- }
-
- protected Object writeReplace() throws ObjectStreamException {
- commandService = null;
- return this;
- }
-
- public long getDbid() {
- return dbid;
- }
- public String getName() {
- return name;
- }
- public long getTimestamp() {
- return timestamp;
- }
- public Map<String, Object> getObjects() {
- return objects;
- }
- public Set<DeploymentProperty> getObjectProperties() {
- return objectProperties;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.io.Serializable;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeploymentProperty implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- long dbid;
- protected DeploymentImpl deployment;
- protected String objectName;
- protected String key;
- protected String value;
-
- public DeploymentProperty() {
- }
-
- public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
- this.deployment = deployment;
- this.objectName = objectName;
- this.key = key;
- this.value = value;
- }
-
- public String toString() {
- return "{"+objectName+","+key+","+value+"}";
- }
-
- public String getObjectName() {
- return objectName;
- }
- public String getKey() {
- return key;
- }
- public String getValue() {
- return value;
- }
- public DeploymentImpl getDeployment() {
- return deployment;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.util.Map;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryCache {
-
- void set(long deploymentdbid, Map<String, Object> deployedObjects);
- Object get(long deploymentDbid, String objectName);
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * @author Tom Baeyens
- */
-public class RepositoryCacheImpl implements RepositoryCache {
-
- Map<Long, Map<String, Object>> deployments = new HashMap<Long, Map<String,Object>>();
-
- public Object get(long deploymentDbid, String objectName) {
- Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
- if (deploymentObjects==null) {
- return null;
- }
- return deploymentObjects.get(objectName);
- }
-
- public void set(long deploymentDbid, Map<String, Object> objects) {
- Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
- if (deploymentObjects==null) {
- deploymentObjects = new HashMap<String, Object>();
- deployments.put(deploymentDbid, deploymentObjects);
- }
- for (String objectName: objects.keySet()) {
- Object object = deploymentObjects.get(objectName);
- deploymentObjects.put(objectName, object);
- }
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.io.InputStream;
-
-import org.jbpm.api.Deployment;
-import org.jbpm.api.RepositoryService;
-import org.jbpm.cmd.CommandService;
-
-/**
- * @author Tom Baeyens
- */
-public class RepositoryServiceImpl implements RepositoryService {
-
- CommandService commandService;
-
- public Deployment createDeployment() {
- return new DeploymentImpl(commandService);
- }
-
- public void deleteDeployment(long deploymentdbid) {
- }
-
- public InputStream getResource(String deploymentId, String resource) {
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.JbpmException;
-import org.jbpm.Problem;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.internal.log.Log;
-
-/**
- * @author Tom Baeyens
- */
-public class RepositorySessionImpl implements RepositorySession {
-
- private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
-
- Session session;
- RepositoryCache repositoryCache;
- DeployerManager deployerManager;
-
- public long deploy(DeploymentImpl deployment) {
- session.save(deployment);
-
- deployment.setTimestamp(System.currentTimeMillis());
- deployment.setProblems(new ArrayList<Problem>());
-
- deployerManager.deploy(deployment);
-
- if (deployment.hasProblems()) {
- for (Problem problem: deployment.getProblems()) {
- Throwable cause = problem.getCause();
- if (cause!=null) {
- log.debug("deployment exception", cause);
- }
- }
- throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
- } else {
-
- repositoryCache.set(deployment.getDbid(), deployment.getObjects());
- }
-
- return deployment.getDbid();
- }
-
- public Object getObject(long deploymentDbid, String objectName) {
- Object object = repositoryCache.get(deploymentDbid, objectName);
- if (object!=null) {
- log.trace("repository cache hit");
-
- } else {
- log.trace("loading deployment "+deploymentDbid+" from db");
- DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
- deploy(deployment);
-
- object = repositoryCache.get(deploymentDbid, objectName);
-
- if (object==null) {
- throw new JbpmException("deployment "+deploymentDbid+" doesn't contain object "+objectName);
- }
- }
- return object;
- }
-
- public Object findObjectByPropertyValue(String key, String value) {
- DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
- "select deploymentProperty " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' " +
- "order by deploymentProperty.deployment.timestamp desc "
- ).uniqueResult();
-
- if (deploymentProperty!=null) {
- long deploymentDbid = deploymentProperty.getDeployment().getDbid();
- String objectName = deploymentProperty.getObjectName();
-
- return getObject(deploymentDbid, objectName);
- }
-
- return null;
- }
-
- public List<String> findObjectNames(String key, String value) {
- return session.createQuery(
- "select distinct deploymentProperty.objectName " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' "
- ).list();
- }
-
- public List<String> findObjectPropertyValues(String objectName, String key) {
- return session.createQuery(
- "select distinct deploymentProperty.value " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.objectName = '"+objectName+"' " +
- " and deploymentProperty.key = '"+key+"' "
- ).list();
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.tmp;
-
-import org.jbpm.Execution;
-import org.jbpm.cmd.StartExecutionInLatestCmd;
-import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployExecutionService extends ExecutionServiceImpl {
-
- public Execution startProcessInstanceByKey(String processDefinitionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.tmp;
-
-import org.jbpm.pvm.internal.svc.ProcessServiceImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class DeployProcessService extends ProcessServiceImpl {
-}
Modified: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -34,9 +34,9 @@
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
import org.jbpm.TaskService;
-import org.jbpm.api.RepositoryService;
import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.repository.api.RepositoryService;
import org.jbpm.pvm.internal.stream.StringStreamInput;
import org.jbpm.task.Task;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -22,6 +22,8 @@
package org.jbpm.deploy.test;
import org.jbpm.Execution;
+import org.jbpm.pvm.internal.repository.RepositoryCache;
+import org.jbpm.pvm.internal.repository.RepositoryCacheImpl;
/**
@@ -35,13 +37,31 @@
" <start>" +
" <transition to='a' />" +
" </start>" +
- " <state name='a' />" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to='c' />" +
+ " </state>" +
+ " <state name='c' />" +
"</process>"
);
Execution execution = executionService.startProcessInstanceByKey("ICL");
+ String executionId = execution.getId();
assertNotNull(execution);
assertEquals("a", execution.getActivityName());
+
+ execution = executionService.signalExecutionById(executionId);
+
+ assertEquals("b", execution.getActivityName());
+
+ RepositoryCache repositoryCache = processEngine.get(RepositoryCache.class);
+ repositoryCache.clear();
+
+ execution = executionService.signalExecutionById(executionId);
+
+ assertEquals("c", execution.getActivityName());
}
}
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,10 +4,10 @@
<process-engine-context>
- <object class="org.jbpm.pvm.RepositoryServiceImpl" auto-wire="true" />
- <object class="org.jbpm.pvm.RepositoryCacheImpl" />
+ <object class="org.jbpm.pvm.internal.repository.RepositoryServiceImpl" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.RepositoryCacheImpl" />
- <object class="org.jbpm.tmp.DeployExecutionService" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.DeployExecutionService" auto-wire="true" />
<process-service />
<history-service />
@@ -23,16 +23,14 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
- <object class="org.jbpm.pvm.DeployerManager">
+ <object class="org.jbpm.pvm.internal.repository.DeployerManager">
<field name="deployers">
<list>
- <object class="org.jbpm.jpdl.JpdlDeployer" />
+ <object class="org.jbpm.jpdl.internal.repository.JpdlDeployer" />
</list>
</field>
</object>
@@ -65,7 +63,7 @@
<transaction-context>
<transaction />
- <object class="org.jbpm.pvm.RepositorySessionImpl" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.RepositorySessionImpl" auto-wire="true" />
<pvm-db-session />
<job-db-session />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -15,7 +15,6 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,7 +4,7 @@
<hibernate-mapping default-access="field">
<!-- ### Deployment ##################################################### -->
- <class name="org.jbpm.pvm.DeploymentImpl"
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
table="JBPM_DEPLOYMENT">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -26,17 +26,17 @@
table="JBPM_DEPLOYPROPS"
cascade="all">
<key column="DEPLOYMENT_" />
- <one-to-many class="org.jbpm.pvm.DeploymentProperty" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
</set>
</class>
- <class name="org.jbpm.pvm.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
<many-to-one name="deployment"
- class="org.jbpm.pvm.DeploymentImpl"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
column="DEPLOYMENT_"
foreign-key="FK_DEPLPROP_DEPL"
index="IDX_DEPLPROP_DEPL" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,127 @@
+/*
+ * 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.jpdl.internal.repository;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.Deployer;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+import org.jbpm.pvm.internal.xml.Parse;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployer implements Deployer {
+
+ private static Log log = Log.getLog(JpdlDeployer.class.getName());
+
+ static JpdlParser jpdlParser = new JpdlParser();
+
+ public void deploy(DeploymentImpl deployment) {
+
+ for (String resourceName: deployment.getResourceNames()) {
+ InputStream inputStream = deployment.getResourceAsStream(resourceName);
+
+ Parse parse = jpdlParser.createParse();
+ parse.setProblems(deployment.getProblems());
+ parse.setInputStream(inputStream);
+ parse.execute();
+
+ JpdlProcessDefinition processDefinition =
+ (JpdlProcessDefinition) parse.getDocumentObject();
+
+ if ( (processDefinition!=null)
+ && (processDefinition.getName()!=null)
+ ) {
+ String processDefinitionName = processDefinition.getName();
+
+ processDefinition.setDeploymentDbid(deployment.getDbid());
+
+ String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
+ if (key!=null) {
+ String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
+ processDefinition.setId(id);
+ processDefinition.setKey(key);
+ deployment.addObject(processDefinitionName, processDefinition);
+
+ } else {
+ checkKey(processDefinition, deployment);
+ checkId(processDefinition, deployment);
+
+ deployment.addObject(processDefinitionName, processDefinition);
+ deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+ }
+ }
+ }
+ }
+
+ protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ String processDefinitionName = processDefinition.getName();
+ String processDefinitionKey = processDefinition.getKey();
+
+ // if no key was specified in the jpdl process file
+ if (processDefinitionKey==null) {
+ // derive the key from the name
+ // replace any non-word character with an underscore
+ processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+ processDefinition.setKey(processDefinitionKey);
+ }
+
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
+ if ( (!existingKeys.isEmpty())
+ && existingKeys.get(0).equals(processDefinitionKey)
+ ) {
+ deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
+
+ List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
+ if ( (!existingNames.isEmpty())
+ && existingNames.get(0).equals(processDefinitionName)
+ ) {
+ deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
+ }
+
+ protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ String id = processDefinition.getId();
+ if (id==null) {
+ id = processDefinition.getKey()+"-"+deployment.getDbid();
+ log.trace("created id '"+id+"' for "+processDefinition);
+ processDefinition.setId(id);
+ }
+
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
+ deployment.addProblem("process '" + id + "' already exists");
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -69,7 +69,7 @@
return activity;
}
- public Activity findActivity(String activityName) {
+ public ActivityImpl findActivity(String activityName) {
if (activityName==null) {
if (name==null) {
return this;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -112,10 +112,10 @@
return ((getActivitiesMap()!=null) && (activitiesMap.containsKey(activityName)));
}
- public Activity findActivity(String activityName) {
+ public ActivityImpl findActivity(String activityName) {
if (activities!=null) {
for(ActivityImpl n : activities) {
- Activity activity = n.findActivity(activityName);
+ ActivityImpl activity = n.findActivity(activityName);
if (activity!=null) {
return activity;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -68,6 +68,7 @@
import org.jbpm.pvm.internal.model.op.ProceedToDestination;
import org.jbpm.pvm.internal.model.op.Signal;
import org.jbpm.pvm.internal.model.op.TakeTransition;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
import org.jbpm.session.MessageSession;
@@ -105,10 +106,12 @@
/** a unique id for this execution. */
protected String id;
- protected ProcessDefinitionImpl processDefinition;
+ protected String processDefinitionId;
+ private ProcessDefinitionImpl processDefinition;
/** current activity */
- protected ActivityImpl activity;
+ protected String activityName;
+ private ActivityImpl activity;
/** are concurrent executions that related to this execution. */
protected Collection<ExecutionImpl> executions;
@@ -171,8 +174,8 @@
// construction /////////////////////////////////////////////////////////////
public void initializeProcessInstance(ProcessDefinitionImpl processDefinition, String key) {
- this.processDefinition = processDefinition;
- this.activity = (ActivityImpl) processDefinition.getInitial();
+ setProcessDefinition(processDefinition);
+ setActivity ( (ActivityImpl) processDefinition.getInitial() );
this.processInstance = this;
this.state = STATE_CREATED;
this.key = key;
@@ -193,8 +196,8 @@
ExecutionImpl scopedExecution = initializeScopes();
fireHistoryEvent(new ProcessInstanceStart());
- fire(Event.START, processDefinition);
- if (activity!=null) {
+ fire(Event.START, getProcessDefinition());
+ if (getActivity()!=null) {
scopedExecution.performAtomicOperation(EXECUTE_ACTIVITY);
}
}
@@ -202,7 +205,7 @@
protected ExecutionImpl initializeScopes() {
LinkedList<ActivityImpl> enteredActivities = new LinkedList<ActivityImpl>();
- ActivityImpl initial = processDefinition.getInitial();
+ ActivityImpl initial = getProcessDefinition().getInitial();
ExecutionImpl scopedExecution = null;
if (initial!=null) {
@@ -215,8 +218,8 @@
scopedExecution = this;
- initializeVariables(processDefinition, this);
- initializeTimers(processDefinition);
+ initializeVariables(getProcessDefinition(), this);
+ initializeTimers(getProcessDefinition());
for (ActivityImpl enteredActivity: enteredActivities) {
if (enteredActivity.isLocalScope()) {
@@ -318,7 +321,7 @@
} else { // this is a process instance
fireHistoryEvent(new ProcessInstanceEnd());
- fire(Event.END, processDefinition);
+ fire(Event.END, getProcessDefinition());
if (superProcessExecution!=null) {
log.trace(toString()+" signals super process execution");
superProcessExecution.signal();
@@ -380,8 +383,8 @@
public void signal(String signal, Map<String, Object> parameters) {
checkLock();
- if (activity!=null) {
- performAtomicOperation(new Signal(signal, parameters, activity));
+ if (getActivity()!=null) {
+ performAtomicOperation(new Signal(signal, parameters, getActivity()));
} else if (transition!=null) {
performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION);
} else {
@@ -409,21 +412,21 @@
/** @see Execution#takeDefaultTransition() */
public void takeDefaultTransition() {
- TransitionImpl defaultTransition = activity.getDefaultTransition();
+ TransitionImpl defaultTransition = getActivity().getDefaultTransition();
if (defaultTransition==null) {
- throw new JbpmException("there is no default transition in "+activity);
+ throw new JbpmException("there is no default transition in "+getActivity());
}
take(defaultTransition);
}
/** @see Execution#take(String) */
public void take(String transitionName) {
- if (activity==null) {
+ if (getActivity()==null) {
throw new JbpmException(toString()+" is not positioned in activity");
}
TransitionImpl transition = findTransition(transitionName);
if (transition==null) {
- throw new JbpmException("there is no transition "+transitionName+" in "+activity);
+ throw new JbpmException("there is no transition "+transitionName+" in "+getActivity());
}
take(transition);
}
@@ -450,12 +453,12 @@
/** @see Execution#execute(String) */
public void execute(String activityName) {
- if (activity==null) {
+ if (getActivity()==null) {
throw new JbpmException("activity is null");
}
- Activity nestedActivity = activity.getActivity(activityName);
+ Activity nestedActivity = getActivity().getActivity(activityName);
if (nestedActivity==null) {
- throw new JbpmException("activity "+activityName+" doesn't exist in "+activity);
+ throw new JbpmException("activity "+activityName+" doesn't exist in "+getActivity());
}
execute(nestedActivity);
}
@@ -492,7 +495,7 @@
// there is no default transition and that there is a
// parent activity of the current activity
} else {
- ActivityImpl parentActivity = activity.getParentActivity();
+ ActivityImpl parentActivity = getActivity().getParentActivity();
// if there is a parent activity
if (parentActivity!=null) {
@@ -530,7 +533,7 @@
}
// move the execution to the destination
- activity = destination;
+ setActivity(destination);
transition = null;
transitionOrigin = null;
}
@@ -771,9 +774,9 @@
// create child execution
ExecutionImpl childExecution = newChildExecution();
- childExecution.processDefinition = this.processDefinition;
+ childExecution.setProcessDefinition(getProcessDefinition());
+ childExecution.setActivity(getActivity());
childExecution.processInstance = this.processInstance;
- childExecution.activity = this.activity;
childExecution.state = STATE_ACTIVE;
childExecution.name = name;
log.debug("creating "+childExecution);
@@ -784,7 +787,7 @@
IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false);
if (keyGenerator!=null) {
- childExecution.id = keyGenerator.createId(processDefinition, this, childExecution);
+ childExecution.id = keyGenerator.createId(getProcessDefinition(), this, childExecution);
}
return childExecution;
@@ -910,15 +913,6 @@
}
}
- // activity name ////////////////////////////////////////////////////////////////
-
- public String getActivityName() {
- if (activity==null) {
- return null;
- }
- return activity.getName();
- }
-
////////////////////////////////////////////////////////////////////////////////
public void fireHistoryEvent(HistoryEvent historyEvent) {
@@ -949,11 +943,11 @@
* of the current activity. This method allows process languages to overwrite this default
* implementation of the transition lookup by transitionName.*/
protected TransitionImpl findTransition(String transitionName) {
- return activity.findOutgoingTransition(transitionName);
+ return getActivity().findOutgoingTransition(transitionName);
}
protected TransitionImpl findDefaultTransition() {
- return activity.findDefaultTransition();
+ return getActivity().findDefaultTransition();
}
// history //////////////////////////////////////////////////////////////////
@@ -1000,7 +994,51 @@
public boolean equals(Object o) {
return EqualsUtil.equals(this, o);
}
+
+ // special getters and setters /////////////////////////////////////////////////
+
+ public ActivityImpl getActivity() {
+ if ( (activity==null)
+ && (activityName!=null)
+ ) {
+ activity = getProcessDefinition().findActivity(activityName);
+ }
+ return activity;
+ }
+
+ public void setActivity(ActivityImpl activity) {
+ this.activity = activity;
+ if (activity!=null) {
+ this.activityName = activity.getName();
+ } else {
+ this.activityName = null;
+ }
+ }
+ public String getActivityName() {
+ if (getActivity()!=null) {
+ return getActivity().getName();
+ }
+ return null;
+ }
+
+ public ProcessDefinitionImpl getProcessDefinition() {
+ if ( (processDefinition==null)
+ && (processDefinitionId!=null)
+ ) {
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ processDefinition = (ProcessDefinitionImpl) repositorySession.findObjectByPropertyValue("jpdl.id", processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("couldn't find process definition "+processDefinitionId+" in the repository");
+ }
+ }
+ return processDefinition;
+ }
+ public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
+ this.processDefinition = processDefinition;
+ this.processDefinitionId = processDefinition.getId();
+ }
+
// getters and setters /////////////////////////////////////////////////////////
public boolean isProcessInstance() {
@@ -1032,9 +1070,6 @@
public int getPriority() {
return priority;
}
- public ProcessDefinitionImpl getProcessDefinition() {
- return processDefinition;
- }
public TransitionImpl getTransition() {
return transition;
}
@@ -1098,9 +1133,6 @@
public void setPreviousTransition(Transition previousTransition) {
this.previousTransition = previousTransition;
}
- public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
- this.processDefinition = processDefinition;
- }
public ExecutionImpl getSuperProcessExecution() {
return superProcessExecution;
}
@@ -1113,12 +1145,6 @@
public void setSubProcessInstance(ExecutionImpl subProcessExecution) {
this.subProcessInstance = subProcessExecution;
}
- public ActivityImpl getActivity() {
- return activity;
- }
- public void setActivity(ActivityImpl activity) {
- this.activity = activity;
- }
public void setKey(String key) {
this.key = key;
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -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.repository;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployCmd implements Command<Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(DeployCmd.class.getName());
+
+ DeploymentImpl deployment;
+
+ public DeployCmd(DeploymentImpl deployment) {
+ this.deployment = deployment;
+ }
+
+ public Long execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ long deploymentDbid = repositorySession.deploy(deployment);
+
+ if (deployment.hasProblems()) {
+ String problemsText = deployment.getProblemsText();
+ if (problemsText!=null) {
+ String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
+ log.info(errorMsg);
+ throw new JbpmException(errorMsg);
+ }
+ }
+
+ return deploymentDbid;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.repository;
+
+import org.jbpm.Execution;
+import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployExecutionService extends ExecutionServiceImpl {
+
+ public Execution startProcessInstanceByKey(String processDefinitionKey) {
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,33 @@
+/*
+ * 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.repository;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployer {
+
+ void deploy(DeploymentImpl deployment);
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,40 @@
+/*
+ * 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.repository;
+
+import java.util.List;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployerManager {
+
+ List<Deployer> deployers;
+
+ public Object deploy(DeploymentImpl deployment) {
+ for (Deployer deployer: deployers) {
+ deployer.deploy(deployment);
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,171 @@
+/*
+ * 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.repository;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.ObjectStreamException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.repository.api.Deployment;
+import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
+import org.jbpm.pvm.internal.stream.StreamInput;
+import org.jbpm.pvm.internal.util.IoUtil;
+import org.jbpm.pvm.internal.xml.ProblemList;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentImpl extends ProblemList implements Deployment {
+
+ protected long dbid;
+ protected String name;
+ protected long timestamp;
+
+ protected Map<String, Lob> resources;
+
+ protected CommandService commandService;
+
+ protected Map<String, Object> objects;
+ protected Set<DeploymentProperty> objectProperties;
+
+ public DeploymentImpl() {
+ }
+
+ public DeploymentImpl(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ public long deploy() {
+ return commandService.execute(new DeployCmd(this));
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Deployment addStreamInput(String name, StreamInput streamInput) {
+ if (resources==null) {
+ resources = new HashMap<String, Lob>();
+ }
+ byte[] bytes = IoUtil.readBytes(streamInput.openStream());
+ Lob lob = new Lob(bytes);
+ resources.put(name, lob);
+ return this;
+ }
+
+ public Deployment addZipInputStream(ZipInputStream zipInputStream) {
+ try {
+ ZipEntry zipEntry = zipInputStream.getNextEntry();
+ while(zipEntry!=null) {
+ String entryName = zipEntry.getName();
+ byte[] bytes = IoUtil.readBytes(zipInputStream);
+ if (bytes!=null) {
+ addStreamInput(entryName, new ByteArrayStreamInput(bytes));
+ }
+ zipEntry = zipInputStream.getNextEntry();
+ }
+ } catch (Exception e) {
+ throw new JbpmException("couldn't read zip archive", e);
+ }
+ return this;
+ }
+
+ public Set<String> getResourceNames() {
+ if (resources==null) {
+ return Collections.EMPTY_SET;
+ }
+ return resources.keySet();
+ }
+
+ public InputStream getResourceAsStream(String resourceName) {
+ if (resources!=null) {
+ Lob lob = resources.get(resourceName);
+ if (lob!=null) {
+ byte[] bytes = lob.extractBytes();
+ return new ByteArrayInputStream(bytes);
+ }
+ }
+ return null;
+ }
+
+ public void addObject(String objectName, Object object) {
+ if (objects==null) {
+ objects = new HashMap<String, Object>();
+ }
+ objects.put(objectName, object);
+ }
+
+ public void addObjectProperty(String objectName, String key, String value) {
+ if (objectProperties==null) {
+ objectProperties = new HashSet<DeploymentProperty>();
+ }
+ objectProperties.add(new DeploymentProperty(this, objectName, key, value));
+ }
+
+ public String getObjectProperty(String objectName, String key) {
+ if (objectProperties!=null) {
+ for (DeploymentProperty deploymentProperty: objectProperties) {
+ if ( (deploymentProperty.getObjectName().equals(objectName))
+ && (deploymentProperty.getKey().equals(key))
+ ) {
+ return deploymentProperty.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Object writeReplace() throws ObjectStreamException {
+ commandService = null;
+ return this;
+ }
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getName() {
+ return name;
+ }
+ public long getTimestamp() {
+ return timestamp;
+ }
+ public Map<String, Object> getObjects() {
+ return objects;
+ }
+ public Set<DeploymentProperty> getObjectProperties() {
+ return objectProperties;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,66 @@
+/*
+ * 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.repository;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentProperty implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ long dbid;
+ protected DeploymentImpl deployment;
+ protected String objectName;
+ protected String key;
+ protected String value;
+
+ public DeploymentProperty() {
+ }
+
+ public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
+ this.deployment = deployment;
+ this.objectName = objectName;
+ this.key = key;
+ this.value = value;
+ }
+
+ public String toString() {
+ return "{"+objectName+","+key+","+value+"}";
+ }
+
+ public String getObjectName() {
+ return objectName;
+ }
+ public String getKey() {
+ return key;
+ }
+ public String getValue() {
+ return value;
+ }
+ public DeploymentImpl getDeployment() {
+ return deployment;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.repository;
+
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryCache {
+
+ void set(long deploymentdbid, Map<String, Object> deployedObjects);
+ Object get(long deploymentDbid, String objectName);
+ void clear();
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.repository;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryCacheImpl implements RepositoryCache {
+
+ Map<Long, Map<String, Object>> deployments = new HashMap<Long, Map<String,Object>>();
+
+ public Object get(long deploymentDbid, String objectName) {
+ Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
+ if (deploymentObjects==null) {
+ return null;
+ }
+ return deploymentObjects.get(objectName);
+ }
+
+ public void set(long deploymentDbid, Map<String, Object> objects) {
+ Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
+ if (deploymentObjects==null) {
+ deploymentObjects = new HashMap<String, Object>();
+ deployments.put(deploymentDbid, deploymentObjects);
+ }
+ for (String objectName: objects.keySet()) {
+ Object object = objects.get(objectName);
+ deploymentObjects.put(objectName, object);
+ }
+ }
+
+ public void clear() {
+ deployments = new HashMap<Long, Map<String,Object>>();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.repository;
+
+import java.io.InputStream;
+
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.repository.api.Deployment;
+import org.jbpm.pvm.internal.repository.api.RepositoryService;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceImpl implements RepositoryService {
+
+ CommandService commandService;
+
+ public Deployment createDeployment() {
+ return new DeploymentImpl(commandService);
+ }
+
+ public void deleteDeployment(long deploymentdbid) {
+ }
+
+ public InputStream getResource(String deploymentId, String resource) {
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,123 @@
+/*
+ * 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.repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.Problem;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositorySessionImpl implements RepositorySession {
+
+ private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
+
+ Session session;
+ RepositoryCache repositoryCache;
+ DeployerManager deployerManager;
+
+ public long deploy(DeploymentImpl deployment) {
+ session.save(deployment);
+
+ deployment.setTimestamp(System.currentTimeMillis());
+ deployment.setProblems(new ArrayList<Problem>());
+
+ deployerManager.deploy(deployment);
+
+ if (deployment.hasProblems()) {
+ for (Problem problem: deployment.getProblems()) {
+ Throwable cause = problem.getCause();
+ if (cause!=null) {
+ log.debug("deployment exception", cause);
+ }
+ }
+ throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
+ } else {
+
+ repositoryCache.set(deployment.getDbid(), deployment.getObjects());
+ }
+
+ return deployment.getDbid();
+ }
+
+ public Object getObject(long deploymentDbid, String objectName) {
+ Object object = repositoryCache.get(deploymentDbid, objectName);
+ if (object!=null) {
+ log.trace("repository cache hit");
+
+ } else {
+ log.trace("loading deployment "+deploymentDbid+" from db");
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
+ deploy(deployment);
+
+ object = repositoryCache.get(deploymentDbid, objectName);
+
+ if (object==null) {
+ throw new JbpmException("deployment "+deploymentDbid+" doesn't contain object "+objectName);
+ }
+ }
+ return object;
+ }
+
+ public Object findObjectByPropertyValue(String key, String value) {
+ DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
+ "select deploymentProperty " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.key = '"+key+"' " +
+ " and deploymentProperty.value = '"+value+"' " +
+ "order by deploymentProperty.deployment.timestamp desc "
+ ).uniqueResult();
+
+ if (deploymentProperty!=null) {
+ long deploymentDbid = deploymentProperty.getDeployment().getDbid();
+ String objectName = deploymentProperty.getObjectName();
+
+ return getObject(deploymentDbid, objectName);
+ }
+
+ return null;
+ }
+
+ public List<String> findObjectNames(String key, String value) {
+ return session.createQuery(
+ "select distinct deploymentProperty.objectName " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.key = '"+key+"' " +
+ " and deploymentProperty.value = '"+value+"' "
+ ).list();
+ }
+
+ public List<String> findObjectPropertyValues(String objectName, String key) {
+ return session.createQuery(
+ "select distinct deploymentProperty.value " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.objectName = '"+objectName+"' " +
+ " and deploymentProperty.key = '"+key+"' "
+ ).list();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.repository;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.cmd.VariablesCmd;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionKey;
+ protected String executionKey;
+
+ public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+ if (processDefinitionKey==null) {
+ throw new JbpmException("processDefinitionKey is null");
+ }
+ this.processDefinitionKey = processDefinitionKey;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ ClientProcessDefinition processDefinition = null;
+
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ processDefinition = (ClientProcessDefinition) repositorySession
+ .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
+
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
+ }
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+ return processInstance;
+ }
+
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,40 @@
+/*
+ * 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.repository.api;
+
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.pvm.internal.stream.StreamInput;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployment {
+
+ void setName(String name);
+
+ Deployment addStreamInput(String name, StreamInput streamInput);
+ Deployment addZipInputStream(ZipInputStream zipInputStream);
+
+ /** @return deploymentId */
+ long deploy();
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,38 @@
+/*
+ * 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.repository.api;
+
+import java.io.InputStream;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryService {
+
+ public abstract Deployment createDeployment();
+
+ public abstract void deleteDeployment(long deploymentDbid);
+
+ public abstract InputStream getResource(String deploymentId, String resource);
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,41 @@
+/*
+ * 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.repository.api;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositorySession {
+
+ Object getObject(long deploymentDbid, String objectName);
+
+ long deploy(DeploymentImpl deployment);
+
+ List<String> findObjectNames(String propertyKey, String propertyValue);
+ List<String> findObjectPropertyValues(String objectName, String propertyKey);
+ Object findObjectByPropertyValue(String propertyKey, String propertyValue);
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 1 month
JBoss JBPM SVN: r4330 - jbpm4/trunk/modules/examples.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-26 06:28:42 -0400 (Thu, 26 Mar 2009)
New Revision: 4330
Modified:
jbpm4/trunk/modules/examples/pom.xml
Log:
Disable remote example execution
Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml 2009-03-25 21:58:50 UTC (rev 4329)
+++ jbpm4/trunk/modules/examples/pom.xml 2009-03-26 10:28:42 UTC (rev 4330)
@@ -98,7 +98,7 @@
</build>
</profile>
- <!-- -Djboss.bind.address -->
+ <!-- -Djboss.bind.address
<profile>
<id>use.jboss.directly</id>
<activation>
@@ -149,7 +149,7 @@
</plugin>
</plugins>
</build>
- </profile>
+ </profile -->
</profiles>
15 years, 1 month