Author: tom.baeyens(a)jboss.com
Date: 2009-03-30 13:03:18 -0400 (Mon, 30 Mar 2009)
New Revision: 4359
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/RepositoryService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
Removed:
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.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/StartExecutionInLatestCmd.java
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
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
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/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.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/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/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
Log:
replaced ProcessService with RepositoryService
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -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/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-03-30 17:03:18
UTC (rev 4359)
@@ -31,8 +31,6 @@
String PROPERTY_KEY = "key";
- ExecutionQuery processDefinitionNameLike(String processDefinitionName);
- ExecutionQuery processDefinitionKeyLike(String processDefinitionKey);
ExecutionQuery processDefinitionId(String processDefinitionId);
ExecutionQuery processInstanceId(String processInstanceId);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -30,12 +30,6 @@
*/
public interface ProcessDefinition extends Serializable {
- /** the optional package name of this process. This can be used to create
- * hierarchy of process categories for easy lookup. This is a
- * similar way of grouping and creating a structure as in Java.
- * We recommend the same conventions as with Java package names. */
- String getPackageName();
-
/** the short display name given to this process definition.
* Multiple process definitions can have the same as long
* as they are given a different {@link #version}. */
@@ -53,9 +47,8 @@
* represents the sequence number for process definitions with
* the same {@link ObservableElement#getId() name}. */
int getVersion();
-
- /** the description name given to this process definition.
- * Multiple process definitions can have the same */
- String getDescription();
-
+
+ /** references the deployment in which this process definition is
+ * deployed. */
+ long getDeploymentDbid();
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -28,17 +28,23 @@
*/
public interface ProcessDefinitionQuery {
- String PROPERTY_NAME = "name";
- String PROPERTY_KEY = "key";
- String PROPERTY_PACKAGENAME = "packageName";
- String PROPERTY_VERSION = "version";
- String PROPERTY_DEPLOYMENTTIME = "deploymentTime";
+ String PROPERTY_ID = "idProperty.stringValue";
+ String PROPERTY_KEY = "keyProperty.stringValue";
+ String PROPERTY_NAME = "idProperty.objectName";
+ String PROPERTY_VERSION = "versionProperty.longValue";
+ String PROPERTY_DEPLOYMENT_TIMESTAMP = "deployment.timestamp";
+ ProcessDefinitionQuery id(String id);
+ ProcessDefinitionQuery key(String key);
ProcessDefinitionQuery nameLike(String name);
- ProcessDefinitionQuery keyLike(String key);
+ ProcessDefinitionQuery name(String name);
+ ProcessDefinitionQuery deploymentDbid(long deploymentDbid);
ProcessDefinitionQuery orderAsc(String property);
ProcessDefinitionQuery orderDesc(String property);
+
+ ProcessDefinitionQuery page(int firstResult, int maxResults);
List<ProcessDefinition> execute();
+ ProcessDefinition uniqueResult();
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-30 17:03:18
UTC (rev 4359)
@@ -29,9 +29,9 @@
*/
public interface ProcessEngine {
- /** the {@link ProcessService process service} that provides access
+ /** the {@link RepositoryService repository service} that provides access
* to the process repository. */
- ProcessService getProcessService();
+ RepositoryService getRepositoryService();
/** the {@link ExecutionService execution service} that provides access
* to the runtime executions repository. */
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessService.java 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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);
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/RepositoryService.java (from rev
4355, jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/RepositoryService.java
(rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
+
+import java.io.InputStream;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryService {
+
+ Deployment createDeployment();
+
+ void deleteDeployment(long deploymentDbid);
+ void deleteDeploymentCascade(long deploymentDbid);
+
+ InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+
+ ProcessDefinitionQuery createProcessDefinitionQuery();
+
+}
Property changes on:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/RepositoryService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.Execution;
import org.jbpm.client.ClientExecution;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.job.Job;
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
(rev 0)
+++
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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.session;
+
+import java.io.InputStream;
+
+import org.jbpm.Deployment;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.client.ClientProcessDefinition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositorySession {
+
+ long deploy(Deployment deployment);
+
+ Object getObject(long deploymentDbid, String objectName);
+
+ InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+
+ ProcessDefinitionQuery createProcessDefinitionQuery();
+
+ ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId);
+}
Property changes on:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
@@ -72,7 +72,6 @@
protected static ProcessEngine processEngine = null;
protected static RepositoryService repositoryService;
- protected static ProcessService processService;
protected static ExecutionService executionService;
protected static ManagementService managementService;
protected static TaskService taskService;
@@ -107,7 +106,6 @@
processEngine = configuration.buildProcessEngine();
repositoryService = processEngine.get(RepositoryService.class);
- processService = processEngine.getProcessService();
executionService = processEngine.getExecutionService();
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
@@ -138,7 +136,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/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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,22 +348,4 @@
]]>
</query>
- <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 name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.history.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.jpdl.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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
Copied:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
(from rev 4355,
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml)
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
(rev 0)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,50 @@
+<?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="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ <property name="taskDefinitionName"
column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +167,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/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.references/pvm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/jpdl.deployers.include.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,5 +1,2 @@
<deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <parse-jpdl />
+ <jpdl-deployer />
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part1.jbpm.cfg.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -4,7 +4,8 @@
<process-engine-context>
- <process-service />
+ <repository-service />
+ <repository-cache />
<execution-service />
<history-service />
<management-service />
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part2.jbpm.cfg.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/jpdl.include.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,2 +1,2 @@
<!-- jpdl bindings -->
- <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
===================================================================
---
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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"
/>
@@ -59,19 +61,16 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
<binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding"
/>
<binding
class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<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/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
===================================================================
---
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -28,7 +28,7 @@
import junit.framework.Test;
import org.jbpm.ExecutionService;
-import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
@@ -36,7 +36,7 @@
import org.jbpm.enterprise.internal.custom.WaitState;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.session.DbSession;
@@ -82,7 +82,7 @@
.endProcess();
// deploy process
- environment.get(ProcessService.class)
+ environment.get(RepositoryService.class)
.createDeployment()
.addProcessDefinition(processDefinition)
.deploy();
@@ -118,7 +118,7 @@
public void testSchedule() throws CreateException {
// start an execution
environment.get(CommandService.class).execute(
- new StartExecutionCmd(processDefinitionId, null, null));
+ new StartProcessInstanceCmd(processDefinitionId, null, null));
// wait for activity to execute
Date executionDate = HappyListener.waitFor();
Modified:
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
===================================================================
---
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -31,6 +31,7 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
import org.jbpm.ProcessService;
+import org.jbpm.RepositoryService;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
@@ -130,7 +131,7 @@
public void testHappyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(ProcessService.class)
+ environment.get(RepositoryService.class)
.createDeployment()
.addProcessDefinition(processDefinition)
.deploy();
@@ -175,7 +176,7 @@
public void testNoisyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(NoisyListener.class.getName());
- environment.get(ProcessService.class)
+ environment.get(RepositoryService.class)
.createDeployment()
.addProcessDefinition(processDefinition)
.deploy();
@@ -228,7 +229,7 @@
public void testCyclicTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(ProcessService.class)
+ environment.get(RepositoryService.class)
.createDeployment()
.addProcessDefinition(processDefinition)
.deploy();
Modified:
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java
===================================================================
---
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,9 +21,11 @@
*/
package org.jbpm.test.deployer;
+import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
import org.jbpm.ProcessDefinition;
+import org.jbpm.RepositoryService;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -56,10 +58,12 @@
tx.begin();
ProcessEngine processEngine =
(ProcessEngine)ctx.lookup("java:/ProcessEngine");
- ProcessService processService = processEngine.getProcessService();
+ RepositoryService repositoryService = processEngine.getRepositoryService();
- ProcessDefinition def =
- processService.findLatestProcessDefinitionByKey(JBPM_DEPLOYER_TEST_V5);
+ ProcessDefinition def = repositoryService.createProcessDefinitionQuery()
+ .key(JBPM_DEPLOYER_TEST_V5)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .uniqueResult();
tx.commit();
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
===================================================================
---
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java
===================================================================
---
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ProcessEngineTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,51 +1,42 @@
package org.jbpm.examples.services;
+import junit.framework.TestCase;
+
import org.jbpm.Configuration;
-import org.jbpm.Deployment;
-import org.jbpm.Execution;
import org.jbpm.ExecutionService;
+import org.jbpm.HistoryService;
+import org.jbpm.ManagementService;
import org.jbpm.ProcessEngine;
-import org.jbpm.ProcessService;
-import org.jbpm.test.BaseJbpmTestCase;
+import org.jbpm.RepositoryService;
+import org.jbpm.TaskService;
-/** example on how to create process engine objects starting from a configuration
+/** shows explicitely the part of the API that is
+ * provided by JbpmTestCase as a convenience.
*
- * @author Koen Aers
+ * @author Koen Aers, Tom Baeyens
*/
-public class ProcessEngineTest extends BaseJbpmTestCase {
+public class ProcessEngineTest extends TestCase {
- /** creation of a process engine with the default configuration */
- public void testDefaultProcessEngine() {
+ public void testBasicApiUsage() {
+ // create a configuration
Configuration configuration = new Configuration();
+ // build a process engine from a configuration
ProcessEngine processEngine = configuration.buildProcessEngine();
- ProcessService processService = processEngine.getProcessService();
+
+ // Obtain the services from the process engine
+ // ProcessEngine and Services are to be used as singletons. (ie they are
threadsafe)
+ RepositoryService repositoryService = processEngine.getRepositoryService();
ExecutionService executionService = processEngine.getExecutionService();
+ TaskService taskService = processEngine.getTaskService();
+ HistoryService historyService = processEngine.getHistoryService();
+ ManagementService managementService = processEngine.getManagementService();
- Deployment deployment = processService.createDeployment();
- deployment.addResource("org/jbpm/examples/services/process.jpdl.xml");
- deployment.deploy();
-
- Execution processInstance =
executionService.startProcessInstanceByKey("simple");
- executionService.signalExecutionById(processInstance.getId());
- assertEquals("state", processInstance.getActivityName());
-
- }
+ // Deploying a process
+ long deploymentDbid = repositoryService.createDeployment()
+
.addResourceFromClasspath("org/jbpm/examples/services/process.jpdl.xml")
+ .deploy();
- /** creation of a process engine with a custom configuration */
- public void testCustomProcessEngineCreation() {
- Configuration configuration = new Configuration().setXmlString(
- "<jbpm-configuration>" +
- " <process-engine-context>" +
- " <process-service />" +
- " </process-engine-context>" +
- "</jbpm-configuration>");
- ProcessEngine processEngine = configuration.buildProcessEngine();
-
- // All services but the process service are created with the above configuration
- assertNotNull(processEngine);
- assertNotNull(processEngine.getProcessService());
- assertNull(processEngine.getTaskService());
+ repositoryService.deleteDeployment(deploymentDbid);
}
-
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
===================================================================
---
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -4,7 +4,8 @@
<process-engine-context>
- <process-service />
+ <repository-service />
+ <repository-cache />
<execution-service />
<history-service />
<management-service />
@@ -18,20 +19,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 +54,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.execution.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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,22 +348,4 @@
]]>
</query>
- <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 name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/examples/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.history.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.history.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/examples/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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
Copied: jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml (from rev
4355,
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
(rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,50 @@
+<?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="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ <property name="taskDefinitionName"
column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +167,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/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.wire.bindings.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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"
/>
@@ -59,19 +61,16 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
<binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding"
/>
<binding
class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<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 +87,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/trunk/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/hql/process.jpdl.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
---
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,39 +21,41 @@
*/
package org.jbpm.integration.console;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.jboss.bpm.console.client.model.ParticipantRef;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.model.ParticipantRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
+import org.jbpm.ProcessDefinition;
import org.jbpm.model.OpenExecution;
-import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.model.Transition;
-import org.jbpm.task.*;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.task.GroupRef;
+import org.jbpm.task.IdentityRef;
+import org.jbpm.task.Participation;
+import org.jbpm.task.Task;
+import org.jbpm.task.UserRef;
-import java.util.Date;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collection;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class ModelAdaptor
{
- public static ProcessDefinitionRef adoptDefinition(OpenProcessDefinition p0)
+ public static ProcessDefinitionRef adoptDefinition(ProcessDefinition
processDefinition)
{
ProcessDefinitionRef def = new ProcessDefinitionRef();
- def.setId( p0.getId() );
- def.setName(p0.getName());
- def.setVersion(p0.getVersion());
-
- def.setKey( p0.getKey() );
- def.setDescription(p0.getDescription());
- def.setPackageName(p0.getPackageName());
+ def.setId( processDefinition.getId() );
+ def.setName(processDefinition.getName());
+ def.setVersion(processDefinition.getVersion());
+ def.setKey( processDefinition.getKey() );
+ // def.setDescription(p0.getDescription());
+ // def.setPackageName(p0.getPackageName());
return def;
Modified:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
---
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,19 +21,21 @@
*/
package org.jbpm.integration.console;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
-import org.jbpm.*;
+import org.jbpm.Execution;
+import org.jbpm.ExecutionQuery;
+import org.jbpm.ExecutionService;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.RepositoryService;
import org.jbpm.model.OpenExecution;
-import org.jbpm.model.OpenProcessDefinition;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -44,20 +46,15 @@
{
List<ProcessDefinitionRef> results = new
ArrayList<ProcessDefinitionRef>();
- ProcessService processService = this.processEngine.getProcessService();
- List<String> keys = processService.findProcessDefinitionKeys();
- Set<ProcessDefinition> definitions = new HashSet<ProcessDefinition>();
- for(String key : keys)
- {
- definitions.addAll(
- processService.findProcessDefinitionsByKey(key)
- );
- }
-
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ List<ProcessDefinition> definitions =
repositoryService.createProcessDefinitionQuery()
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .execute();
+
// adopt ProcessDefinition to console model
- for(ProcessDefinition p0 : definitions)
+ for(ProcessDefinition processDefinition : definitions)
{
- results.add( ModelAdaptor.adoptDefinition((OpenProcessDefinition)p0) );
+ results.add( ModelAdaptor.adoptDefinition(processDefinition) );
}
return results;
@@ -66,15 +63,22 @@
public ProcessDefinitionRef getProcessDefinition(String procDefId)
{
- ProcessService processService = this.processEngine.getProcessService();
- ProcessDefinition p0 = processService.findProcessDefinitionById(procDefId);
- return ModelAdaptor.adoptDefinition((OpenProcessDefinition)p0);
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ return ModelAdaptor.adoptDefinition(processDefinition);
}
public List<ProcessDefinitionRef> removeProcessDefinition(String procDefId)
{
- ProcessService processService = this.processEngine.getProcessService();
- processService.deleteProcessDefinitionCascade(procDefId);
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ if (processDefinition!=null) {
+ repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentDbid());
+ }
return getProcessDefinitions();
}
@@ -162,13 +166,10 @@
public void deploy(String fileName, String contentType, InputStream deployment)
{
- List<ProcessDefinition> definitions =
- this.processEngine.getProcessService()
+ this.processEngine.getRepositoryService()
.createDeployment()
- .addInputStream(fileName, deployment)
- .deploy()
- .getProcessDefinitions();
-
+ .addResourceFromInputStream(fileName, deployment)
+ .deploy();
}
}
Modified:
jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
===================================================================
---
jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java
===================================================================
---
jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/jboss5/src/main/java/org/jbpm/integration/jboss5/JBPMDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
===================================================================
---
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,18 +21,16 @@
*/
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.RepositoryService;
+import org.jbpm.internal.log.Log;
+
/**
* Adopts AS 4 and AS 5 deployer invocations to jBPM invocations.
*
@@ -42,7 +40,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();
@@ -56,36 +54,21 @@
tx.begin();
// deploy to process engine
- ProcessService processService =
jbpmService.getProcessEngine().getProcessService();
- String pathToDeployment = deploymentMetData.getWatch().getPath();
- File deploymentFile = new File(pathToDeployment);
+ RepositoryService repositoryService =
jbpmService.getProcessEngine().getRepositoryService();
+ String deploymentName = deploymentMetData.getWatch().getPath();
+ File deploymentFile = new File(deploymentName);
- Deployment dpl = processService.createDeployment()
- .addUrl(deploymentMetData.getProcessDescriptor())
+ long deploymentDbid = repositoryService.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 +86,7 @@
}
- public void undeploy(List<ProcessDeploymentRef> processRefs)
+ public void undeploy(List<DeploymentRef> deploymentRefs)
{
UserTransaction tx = null;
@@ -111,28 +94,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.");
}
}
Copied:
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java)
===================================================================
---
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
(rev 0)
+++
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentRef.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java
===================================================================
---
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/ProcessDeploymentRef.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
- }
-}
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,13 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-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;
@@ -46,68 +41,9 @@
public Object parse(Element element, Parse parse, Parser parser) {
TaskActivity taskActivity = new TaskActivity();
- TaskDefinitionImpl taskDefinition = parseTaskDefinition(element, parse, parser);
+ TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse,
parser);
taskActivity.setTaskDefinition(taskDefinition);
-
+
return taskActivity;
}
-
- public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse,
Parser parser) {
- TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
-
- taskDefinition.setName(XmlUtil.attribute(element, "name"));
-
- String swimlaneName = XmlUtil.attribute(element, "swimlane");
- if (swimlaneName!=null) {
- JpdlProcessDefinition jpdlProcessDefinition =
parse.findObject(JpdlProcessDefinition.class);
- SwimlaneDefinitionImpl swimlaneDefinition =
jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
- if (swimlaneDefinition!=null) {
- taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
- } else {
- parse.addProblem("swimlane "+swimlaneName+" not declared");
- }
- }
-
- Element taskHandlerElement = XmlUtil.element(element, "task-handler");
- if (taskHandlerElement!=null) {
- ObjectDescriptor objectDescriptor =
JpdlParser.parseObjectDescriptor(taskHandlerElement, parse);
- taskDefinition.setTaskHandlerDescriptor(objectDescriptor);
- }
-
- parseAssignmentAttributes(element, taskDefinition, parse);
-
- return taskDefinition;
- }
-
- public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl
assignableDefinition, Parse parse) {
- Element descriptionElement = XmlUtil.element(element, "description");
- if (descriptionElement!=null) {
- String description = XmlUtil.getContentText(descriptionElement);
- assignableDefinition.setDescription(description);
- }
-
- Element assignmentHandlerElement = XmlUtil.element(element,
"assignment-handler");
- if (assignmentHandlerElement!=null) {
- ObjectDescriptor objectDescriptor =
JpdlParser.parseObjectDescriptor(assignmentHandlerElement, parse);
- assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
- }
-
- String assigneeExpression = XmlUtil.attribute(element, "assignee");
- assignableDefinition.setAssigneeExpression(assigneeExpression);
-
- String assigneeExpressionLanguage = XmlUtil.attribute(element,
"assignee-lang");
- assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
-
- String candidateUsersExpression = XmlUtil.attribute(element,
"candidate-users");
- assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
-
- String candidateUsersExpressionLanguage = XmlUtil.attribute(element,
"candidate-users-lang");
-
assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
-
- String candidateGroupsExpression = XmlUtil.attribute(element,
"candidate-groups");
- assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
-
- String candidateGroupsExpressionLanguage = XmlUtil.attribute(element,
"candidate-groups-lang");
-
assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
- }
}
Deleted:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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);
- }
- }
-}
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -45,6 +45,7 @@
public SwimlaneDefinitionImpl createSwimlaneDefinition(String name) {
SwimlaneDefinitionImpl swimlaneDefinition = new SwimlaneDefinitionImpl();
+ swimlaneDefinition.setName(name);
swimlaneDefinitions.put(name, swimlaneDefinition);
return swimlaneDefinition;
}
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -24,6 +24,8 @@
import java.io.InputStream;
import java.util.List;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
@@ -31,8 +33,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;
/**
@@ -42,42 +44,47 @@
private static Log log = Log.getLog(JpdlDeployer.class.getName());
+ public static final String KEY_ID = "id";
+ public static final String KEY_KEY = "key";
+ public static final String KEY_VERSION = "version";
+
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 (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);
+ if (deployment.hasObjectProperties(processDefinitionName)) {
+ String key = (String) deployment.getObjectProperty(processDefinitionName,
KEY_KEY);
+ String id = (String) deployment.getObjectProperty(processDefinitionName,
KEY_ID);
+ String version = (String) deployment.getObjectProperty(processDefinitionName,
KEY_VERSION);
+ processDefinition.setId(id);
+ processDefinition.setKey(key);
+ processDefinition.setVersion(Integer.parseInt(version));
+ } else {
+ checkKey(processDefinition, deployment);
+ checkVersion(processDefinition, deployment);
+ checkId(processDefinition, deployment);
+
+ deployment.addObjectProperty(processDefinitionName, KEY_KEY,
processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, KEY_VERSION, new
Long(processDefinition.getVersion()));
+ deployment.addObjectProperty(processDefinitionName, KEY_ID,
processDefinition.getId());
+ }
+
deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObjectProperty(processDefinitionName, "jpdl.key",
processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "jpdl.id",
processDefinition.getId());
}
}
}
@@ -96,32 +103,65 @@
}
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<ProcessDefinition> existingProcesses =
repositorySession.createProcessDefinitionQuery()
+ .name(processDefinitionName)
+ .execute();
+
+ for (ProcessDefinition existingProcess: existingProcesses) {
+ if (!processDefinitionKey.equals(existingProcess.getKey())) {
+ 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+"'");
+ existingProcesses = repositorySession.createProcessDefinitionQuery()
+ .key(processDefinitionKey)
+ .execute();
+
+ for (ProcessDefinition existingProcess: existingProcesses) {
+ if (!processDefinitionName.equals(existingProcess.getName())) {
+ 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);
+ id = processDefinition.getKey()+"-"+processDefinition.getVersion();
+ if (log.isTraceEnabled()) log.trace("created id '"+id+"' for
"+processDefinition);
processDefinition.setId(id);
}
RepositorySession repositorySession =
Environment.getFromCurrent(RepositorySession.class);
- if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
+ ProcessDefinition existingProcessDefinition =
repositorySession.createProcessDefinitionQuery()
+ .id(id)
+ .uniqueResult();
+ if (existingProcessDefinition != null) {
deployment.addProblem("process '" + id + "' already
exists");
}
}
+
+ protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl
deployment) {
+ int version = processDefinition.getVersion();
+ String key = processDefinition.getKey();
+ if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
+ RepositorySession repositorySession =
Environment.getFromCurrent(RepositorySession.class);
+
+ ProcessDefinition latestDeployedVersion = repositorySession
+ .createProcessDefinitionQuery()
+ .key(key)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0, 1)
+ .uniqueResult();
+
+ if (latestDeployedVersion!=null) {
+ version = latestDeployedVersion.getVersion() + 1;
+ } else {
+ version = 1;
+ }
+ if (log.isTraceEnabled()) log.trace("assigning version "+version+"
to process definition "+key);
+ processDefinition.setVersion(version);
+ }
+ }
}
Copied:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java)
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
(rev 0)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlDeployerBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -30,10 +30,12 @@
import org.jbpm.activity.ActivityBehaviour;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlActivityBinding;
-import org.jbpm.jpdl.internal.activity.TaskBinding;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -132,7 +134,7 @@
if (swimlaneName!=null) {
SwimlaneDefinitionImpl swimlaneDefinition =
processDefinition.createSwimlaneDefinition(swimlaneName);
- TaskBinding.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition,
parse);
+ JpdlParser.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition,
parse);
}
}
@@ -173,6 +175,73 @@
return processDefinition;
}
+ public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl
assignableDefinition, Parse parse) {
+ Element descriptionElement = XmlUtil.element(element, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ assignableDefinition.setDescription(description);
+ }
+
+ Element assignmentHandlerElement = XmlUtil.element(element,
"assignment-handler");
+ if (assignmentHandlerElement!=null) {
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement,
parse);
+ assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
+ }
+
+ String assigneeExpression = XmlUtil.attribute(element, "assignee");
+ assignableDefinition.setAssigneeExpression(assigneeExpression);
+
+ String assigneeExpressionLanguage = XmlUtil.attribute(element,
"assignee-lang");
+ assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+
+ String candidateUsersExpression = XmlUtil.attribute(element,
"candidate-users");
+ assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
+
+ String candidateUsersExpressionLanguage = XmlUtil.attribute(element,
"candidate-users-lang");
+
assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+
+ String candidateGroupsExpression = XmlUtil.attribute(element,
"candidate-groups");
+ assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+
+ String candidateGroupsExpressionLanguage = XmlUtil.attribute(element,
"candidate-groups-lang");
+
assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
+ }
+
+ public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse,
Parser parser) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+
+ String taskName = XmlUtil.attribute(element, "name");
+ taskDefinition.setName(taskName);
+
+ ProcessDefinitionImpl processDefinition =
parse.findObject(ProcessDefinitionImpl.class);
+ if (processDefinition.getTaskDefinition(taskName)!=null) {
+ parse.addProblem("duplicate task name "+taskName);
+ } else {
+ processDefinition.addTaskDefinitionImpl(taskDefinition);
+ }
+
+ String swimlaneName = XmlUtil.attribute(element, "swimlane");
+ if (swimlaneName!=null) {
+ JpdlProcessDefinition jpdlProcessDefinition =
parse.findObject(JpdlProcessDefinition.class);
+ SwimlaneDefinitionImpl swimlaneDefinition =
jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+ if (swimlaneDefinition!=null) {
+ taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
+ } else {
+ parse.addProblem("swimlane "+swimlaneName+" not declared");
+ }
+ }
+
+ Element taskHandlerElement = XmlUtil.element(element, "task-handler");
+ if (taskHandlerElement!=null) {
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(taskHandlerElement,
parse);
+ taskDefinition.setTaskHandlerDescriptor(objectDescriptor);
+ }
+
+ JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
+
+ return taskDefinition;
+ }
+
public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
ObjectDescriptor objectDescriptor = new ObjectDescriptor();
Deleted:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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);
- }
-
-}
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-30 15:42:32 UTC (rev
4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-30 17:03:18 UTC (rev
4359)
@@ -4,7 +4,8 @@
<process-engine-context>
- <process-service />
+ <repository-service />
+ <repository-cache />
<execution-service />
<history-service />
<management-service />
@@ -18,20 +19,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 +54,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.execution.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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,22 +348,4 @@
]]>
</query>
- <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 name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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/trunk/modules/jpdl/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.history.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.history.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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/jpdl/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -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
Copied: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml (from rev
4355, jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
(rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,50 @@
+<?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="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -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,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ <property name="taskDefinitionName"
column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +167,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/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.wire.bindings.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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"
/>
@@ -59,19 +61,16 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
<binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding"
/>
<binding
class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<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 +87,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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
@@ -154,15 +154,15 @@
public ManagementService getManagementService() {
return environmentFactoryCtxWireContext.get(ManagementService.class);
}
- public ProcessService getProcessService() {
- return environmentFactoryCtxWireContext.get(ProcessService.class);
- }
public TaskService getTaskService() {
return environmentFactoryCtxWireContext.get(TaskService.class);
}
public 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();
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,88 @@
+/*
+ * 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.List;
+
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.RepositoryCache;
+import org.jbpm.session.PvmDbSession;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteDeploymentCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ long deploymentDbid;
+ boolean cascade;
+
+ public DeleteDeploymentCmd(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ }
+
+ public DeleteDeploymentCmd(long deploymentDbid, boolean cascade) {
+ this.deploymentDbid = deploymentDbid;
+ this.cascade = cascade;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ List<ProcessDefinition> processDefinitions =
repositorySession.createProcessDefinitionQuery()
+ .deploymentDbid(deploymentDbid)
+ .execute();
+
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+
+ for (ProcessDefinition processDefinition: processDefinitions) {
+ String processDefinitionId = processDefinition.getId();
+ List<String> processInstanceIds =
pvmDbSession.findProcessInstanceIds(processDefinitionId);
+ if (cascade) {
+ for (String processInstanceId: processInstanceIds) {
+ pvmDbSession.deleteProcessInstance(processInstanceId, false);
+ }
+ } else {
+ if (!processInstanceIds.isEmpty()) {
+ throw new JbpmException("cannot delete deployment
"+deploymentDbid+": still executions for "+processDefinition+":
"+processInstanceIds);
+ }
+ }
+ }
+
+ Session session = environment.get(Session.class);
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class,
deploymentDbid);
+ session.delete(deployment);
+
+ RepositoryCache repositoryCache = environment.get(RepositoryCache.class);
+ repositoryCache.set(deploymentDbid, null);
+
+ return null;
+ }
+
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
}
}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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);
- }
-
-}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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 GetResourceAsStreamCmd extends AbstractCommand<InputStream> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long deploymentDbid;
+ protected String resourceName;
+
+ public GetResourceAsStreamCmd(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;
+ }
+}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.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 StartExecutionCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionId;
- protected String executionKey;
-
- public StartExecutionCmd(String processDefinitionId, Map<String, Object>
variables, String executionKey) {
- this.processDefinitionId = processDefinitionId;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ClientProcessDefinition processDefinition = null;
-
- processDefinition = pvmDbSession.findProcessDefinitionById(processDefinitionId);
- if (processDefinition==null) {
- throw new JbpmException("no process definition with id
'"+processDefinitionId+"'");
- }
-
- ClientProcessInstance processInstance =
processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- pvmDbSession.save(processInstance);
- return processInstance;
- }
-
- public String getProcessDefinitionKey() {
- return processDefinitionId;
- }
- public void setProcessDefinitionKey(String processDefinitionKey) {
- this.processDefinitionId = processDefinitionKey;
- }
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.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;
- }
-}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,82 @@
+/*
+ * 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.PvmDbSession;
+import org.jbpm.session.RepositorySession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartProcessInstanceCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionId;
+ protected String executionKey;
+
+ public StartProcessInstanceCmd(String processDefinitionId, Map<String, Object>
variables, String executionKey) {
+ this.processDefinitionId = processDefinitionId;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+
+ ClientProcessDefinition processDefinition = (ClientProcessDefinition)
+ repositorySession.loadProcessDefinitionById(processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with id
'"+processDefinitionId+"'");
+ }
+
+ ClientProcessInstance processInstance =
processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+
+ return processInstance;
+ }
+
+ public String getProcessDefinitionKey() {
+ return processDefinitionId;
+ }
+ public void setProcessDefinitionKey(String processDefinitionKey) {
+ this.processDefinitionId = processDefinitionKey;
+ }
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,86 @@
+/*
+ * 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.ProcessDefinitionQuery;
+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 StartProcessInstanceInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionKey;
+ protected String executionKey;
+
+ public StartProcessInstanceInLatestCmd(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.createProcessDefinitionQuery()
+ .key(processDefinitionKey)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0, 1)
+ .uniqueResult();
+
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key
'"+processDefinitionKey+"'");
+ }
+
+ processDefinition =
repositorySession.loadProcessDefinitionById(processDefinition.getId());
+
+ 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/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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";
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -208,7 +208,12 @@
public List<String> findProcessInstanceIds(String processDefinitionId) {
// query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
- Query query = session.getNamedQuery("findProcessInstanceIds");
+ Query query = session.createQuery(
+ "select processInstance.id " +
+ "from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance " +
+ "where processInstance.processDefinitionId = :processDefinitionId " +
+ " and processInstance.parent is null"
+ );
query.setString("processDefinitionId", processDefinitionId);
return query.list();
}
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-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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
@@ -1016,10 +1016,7 @@
}
public String getActivityName() {
- if (getActivity()!=null) {
- return getActivity().getName();
- }
- return null;
+ return activityName;
}
public ProcessDefinitionImpl getProcessDefinition() {
@@ -1027,7 +1024,7 @@
&& (processDefinitionId!=null)
) {
RepositorySession repositorySession =
Environment.getFromCurrent(RepositorySession.class);
- processDefinition = (ProcessDefinitionImpl)
repositorySession.findObjectByPropertyValue("jpdl.id", processDefinitionId);
+ processDefinition = (ProcessDefinitionImpl)
repositorySession.loadProcessDefinitionById(processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("couldn't find process definition
"+processDefinitionId+" in the repository");
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -35,6 +35,7 @@
import org.jbpm.model.IdGenerator;
import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.IoUtil;
/**
@@ -72,6 +73,8 @@
/** the activity which is executed when the process starts */
protected ActivityImpl initial;
+ protected Map<String, TaskDefinitionImpl> taskDefinitions;
+
/** the attachments */
protected Map<String, Lob> attachments;
@@ -127,6 +130,22 @@
public IdGenerator getIdGenerator() {
return Environment.getFromCurrent(IdGenerator.class, false);
}
+
+ // task definitions /////////////////////////////////////////////////////////
+
+ public void addTaskDefinitionImpl(TaskDefinitionImpl taskDefinition) {
+ if (taskDefinitions==null) {
+ taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
+ }
+ taskDefinitions.put(taskDefinition.getName(), taskDefinition);
+ }
+
+ public TaskDefinitionImpl getTaskDefinition(String name) {
+ if (taskDefinitions!=null) {
+ return taskDefinitions.get(name);
+ }
+ return null;
+ }
// attachments //////////////////////////////////////////////////////////////
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -22,9 +22,11 @@
package org.jbpm.pvm.internal.query;
import java.io.ObjectStreamException;
+import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.jbpm.ProcessDefinition;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
import org.jbpm.env.Environment;
@@ -37,6 +39,7 @@
private static final long serialVersionUID = 1L;
+ protected Session session;
protected CommandService commandService;
protected String orderByClause = null;
protected Page page = null;
@@ -46,6 +49,10 @@
this.commandService = commandService;
}
+ public AbstractQuery(Session session) {
+ this.session = session;
+ }
+
protected abstract void applyParameters(Query query);
public abstract String hql();
@@ -53,20 +60,31 @@
/* reuse by copy and paste:
* (return type can't be changed)
public ConcreteQuery page(int firstResult, int maxResults) {
- this.page = new Page{firstResult, maxResults};
+ this.page = new Page(firstResult, maxResults);
return this;
}
*/
+ public List execute() {
+ if (commandService!=null) {
+ return (List) commandService.execute(this);
+ }
+ return (List) execute(session);
+ }
+
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
+ return execute(session);
+ }
+
+ public Object execute(Session session) {
String hql = hql();
Query query = session.createQuery(hql);
applyParameters(query);
applyPage(query);
return query.list();
}
-
+
protected void appendWhereClause(String whereClause, StringBuffer hql) {
if (isWhereAdded) {
hql.append(" and ");
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -39,8 +39,6 @@
private static final long serialVersionUID = 1L;
protected boolean onlyProcessInstances;
- protected String processDefinitionNameLike;
- protected String processDefinitionKeyLike;
protected String processDefinitionId;
protected String processInstanceId;
@@ -80,17 +78,9 @@
}
if (processDefinitionId!=null) {
- appendWhereClause("execution.processDefinition.id =
'"+processDefinitionId+"' ", hql);
+ appendWhereClause("execution.processDefinitionId =
'"+processDefinitionId+"' ", hql);
}
- if (processDefinitionNameLike!=null) {
- appendWhereClause("execution.processDefinition.name like
'"+processDefinitionNameLike+"' ", hql);
- }
-
- if (processDefinitionKeyLike!=null) {
- appendWhereClause("execution.processDefinition.key like
'"+processDefinitionKeyLike+"' ", hql);
- }
-
appendOrderByClause(hql);
return hql.toString();
@@ -114,16 +104,6 @@
return this;
}
- public ExecutionQuery processDefinitionKeyLike(String processDefinitionKey) {
- this.processDefinitionKeyLike = processDefinitionKey;
- return this;
- }
-
- public ExecutionQuery processDefinitionNameLike(String processDefinitionName) {
- this.processDefinitionNameLike = processDefinitionName;
- return this;
- }
-
public ExecutionQuery page(int firstResult, int maxResults) {
this.page = new Page(firstResult, maxResults);
return this;
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,13 +21,19 @@
*/
package org.jbpm.pvm.internal.query;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentProperty;
/**
@@ -37,34 +43,98 @@
private static final long serialVersionUID = 1L;
- private static final String NEWLINE = System.getProperty("line.separator");
-
+ protected String id;
+ protected String key;
protected String nameLike;
- protected String keyLike;
+ protected String name;
+ protected Long deploymentDbid;
public ProcessDefinitionQueryImpl(CommandService commandService) {
super(commandService);
}
- public List<ProcessDefinition> execute() {
- return (List) commandService.execute(this);
+ public ProcessDefinitionQueryImpl(Session session) {
+ super(session);
}
+ public ProcessDefinition uniqueResult() {
+ List<ProcessDefinition> list = execute();
+ if (list.isEmpty()) {
+ return null;
+ }
+ if (list.size()>1) {
+ throw new JbpmException("result not unique: "+list.size());
+ }
+ return list.get(0);
+ }
+
+ public Object execute(Session session) {
+ List<Map<String, Object>> propertyMaps = (List<Map<String,
Object>>) super.execute(session);
+
+ List<ProcessDefinition> processDefinitions = new
ArrayList<ProcessDefinition>();
+ for (Map<String, Object> properties: propertyMaps) {
+ ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
+ processDefinition.setName((String)properties.get("name"));
+ processDefinition.setKey((String)properties.get("key"));
+ processDefinition.setId((String)properties.get("id"));
+
processDefinition.setDeploymentDbid((Long)properties.get("deploymentDbid"));
+ Long versionLong = (Long)properties.get("version");
+ processDefinition.setVersion(versionLong.intValue());
+
+ processDefinitions.add(processDefinition);
+ }
+
+ return processDefinitions;
+ }
+
public String hql() {
StringBuffer hql = new StringBuffer();
- hql.append("select pd ");
+ hql.append("select new map( idProperty.objectName as name, " +
+ "idProperty.stringValue as id," +
+ "idProperty.deployment.dbid as deploymentDbid, " +
+ "keyProperty.stringValue as key, " +
+ "versionProperty.longValue as version ) ");
hql.append("from ");
- hql.append(ProcessDefinitionImpl.class.getName());
- hql.append(" as pd ");
+ hql.append(DeploymentImpl.class.getName());
+ hql.append(" as deployment, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as idProperty, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as keyProperty, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as versionProperty ");
+
+ appendWhereClause("idProperty.key = 'id'", hql);
+ appendWhereClause("idProperty.deployment = deployment ", hql);
+ appendWhereClause("keyProperty.key = 'key' ", hql);
+ appendWhereClause("keyProperty.objectName = idProperty.objectName ", hql);
+ appendWhereClause("keyProperty.deployment = deployment ", hql);
+
+ appendWhereClause("versionProperty.key = 'version' ", hql);
+ appendWhereClause("versionProperty.objectName = idProperty.objectName ",
hql);
+ appendWhereClause("versionProperty.deployment = deployment ", hql);
+
+ if (id!=null) {
+ appendWhereClause("idProperty.stringValue = '"+id+"'",
hql);
+ }
+
if (nameLike!=null) {
- appendWhereClause("pd.name like '"+nameLike+"'", hql);
+ appendWhereClause("idProperty.objectName like '"+nameLike+"'
", hql);
}
- if (keyLike!=null) {
- appendWhereClause("pd.key like '"+keyLike+"'", hql);
+ if (name!=null) {
+ appendWhereClause("idProperty.objectName = '"+nameLike+"'
", hql);
}
+
+ if (key!=null) {
+ appendWhereClause("keyProperty.stringValue = '"+key+"'
", hql);
+ }
+ if (deploymentDbid!=null) {
+ appendWhereClause("idProperty.deployment.dbid = "+deploymentDbid+"
", hql);
+ }
+
appendOrderByClause(hql);
return hql.toString();
@@ -73,23 +143,43 @@
protected void applyParameters(Query query) {
}
+ public ProcessDefinitionQuery id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public ProcessDefinitionQuery key(String key) {
+ this.key = key;
+ return this;
+ }
+
public ProcessDefinitionQuery nameLike(String name) {
this.nameLike = name;
return this;
}
- public ProcessDefinitionQuery keyLike(String key) {
- this.keyLike = key;
+ public ProcessDefinitionQuery name(String name) {
+ this.name = name;
return this;
}
+ public ProcessDefinitionQuery deploymentDbid(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ return this;
+ }
+
public ProcessDefinitionQuery orderAsc(String property) {
- addOrderByClause("pd."+property+" asc");
+ addOrderByClause(property+" asc");
return this;
}
public ProcessDefinitionQuery orderDesc(String property) {
- addOrderByClause("pd."+property+" desc");
+ addOrderByClause(property+" desc");
return this;
}
+
+ public ProcessDefinitionQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
}
Deleted:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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.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;
- }
-}
Deleted:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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));
- }
-}
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -31,10 +31,9 @@
List<Deployer> deployers;
- public Object deploy(DeploymentImpl deployment) {
+ public void deploy(DeploymentImpl deployment) {
for (Deployer deployer: deployers) {
deployer.deploy(deployment);
}
- return null;
}
}
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
@@ -128,14 +146,16 @@
objects.put(objectName, object);
}
- public void addObjectProperty(String objectName, String key, String value) {
+ public void addObjectProperty(String objectName, String key, Object value) {
if (objectProperties==null) {
objectProperties = new HashSet<DeploymentProperty>();
}
- objectProperties.add(new DeploymentProperty(this, objectName, key, value));
+ DeploymentProperty deploymentProperty = new DeploymentProperty(this, objectName,
key);
+ deploymentProperty.setValue(value);
+ objectProperties.add(deploymentProperty);
}
- public String getObjectProperty(String objectName, String key) {
+ public Object getObjectProperty(String objectName, String key) {
if (objectProperties!=null) {
for (DeploymentProperty deploymentProperty: objectProperties) {
if ( (deploymentProperty.getObjectName().equals(objectName))
@@ -148,6 +168,17 @@
return null;
}
+ public boolean hasObjectProperties(String objectName) {
+ if (objectProperties!=null) {
+ for (DeploymentProperty deploymentProperty: objectProperties) {
+ if (deploymentProperty.getObjectName().equals(objectName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
protected Object writeReplace() throws ObjectStreamException {
commandService = null;
return this;
@@ -156,16 +187,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/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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -23,7 +23,9 @@
import java.io.Serializable;
+import org.jbpm.JbpmException;
+
/**
* @author Tom Baeyens
*/
@@ -35,20 +37,20 @@
protected DeploymentImpl deployment;
protected String objectName;
protected String key;
- protected String value;
+ protected String stringValue;
+ protected Long longValue;
public DeploymentProperty() {
}
- public DeploymentProperty(DeploymentImpl deployment, String objectName, String key,
String value) {
+ public DeploymentProperty(DeploymentImpl deployment, String objectName, String key) {
this.deployment = deployment;
this.objectName = objectName;
this.key = key;
- this.value = value;
}
public String toString() {
- return "{"+objectName+","+key+","+value+"}";
+ return
"{"+objectName+","+key+","+(stringValue!=null?stringValue:longValue)+"}";
}
public String getObjectName() {
@@ -57,10 +59,39 @@
public String getKey() {
return key;
}
- public String getValue() {
- return value;
- }
public DeploymentImpl getDeployment() {
return deployment;
}
+ public String getStringValue() {
+ return stringValue;
+ }
+ public Long getLongValue() {
+ return longValue;
+ }
+ public void setStringValue(String stringValue) {
+ this.stringValue = stringValue;
+ }
+ public void setLongValue(Long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setValue(Object value) {
+ if (value==null) {
+ stringValue = null;
+ longValue = null;
+ } else if (value instanceof String) {
+ stringValue = (String)value;
+ } else if (value instanceof Long) {
+ longValue = (Long)value;
+ } else {
+ throw new JbpmException("value type "+value.getClass().getName()+"
not supported (only string and long)");
+ }
+ }
+
+ public Object getValue() {
+ if (stringValue!=null) {
+ return stringValue;
+ }
+ return longValue;
+ }
}
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -41,15 +41,19 @@
}
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);
+ if (objects==null) {
+ deployments.put(deploymentDbid, null);
+ } else {
+ 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);
+ }
}
- for (String objectName: objects.keySet()) {
- Object object = objects.get(objectName);
- deploymentObjects.put(objectName, object);
- }
}
public void clear() {
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -23,9 +23,13 @@
import java.io.InputStream;
+import org.jbpm.Deployment;
+import org.jbpm.ProcessDefinitionQuery;
+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;
+import org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd;
+import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
+import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
* @author Tom Baeyens
@@ -38,10 +42,20 @@
return new DeploymentImpl(commandService);
}
- public void deleteDeployment(long deploymentdbid) {
+ public void deleteDeployment(long deploymentDbid) {
+ commandService.execute(new DeleteDeploymentCmd(deploymentDbid));
}
-
- public InputStream getResource(String deploymentId, String resource) {
- return null;
+
+ public void deleteDeploymentCascade(long deploymentDbid) {
+ commandService.execute(new DeleteDeploymentCmd(deploymentDbid, true));
}
+
+ public InputStream getResourceAsStream(long deploymentDbid, String resource) {
+ return commandService.execute(new GetResourceAsStreamCmd(deploymentDbid, resource));
+ }
+
+ public ProcessDefinitionQuery createProcessDefinitionQuery() {
+ return new ProcessDefinitionQueryImpl(commandService);
+ }
+
}
Modified:
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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -21,14 +21,18 @@
*/
package org.jbpm.pvm.internal.repository;
+import java.io.InputStream;
import java.util.ArrayList;
-import java.util.List;
import org.hibernate.Session;
+import org.jbpm.Deployment;
import org.jbpm.JbpmException;
import org.jbpm.Problem;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.repository.api.RepositorySession;
+import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
+import org.jbpm.session.RepositorySession;
/**
* @author Tom Baeyens
@@ -37,33 +41,37 @@
private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
- Session session;
- RepositoryCache repositoryCache;
- DeployerManager deployerManager;
+ protected Session session;
+ protected RepositoryCache repositoryCache;
+ protected 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 DeploymentImpl getDeployment(long deploymentDbid) {
+ return (DeploymentImpl) session.get(DeploymentImpl.class, deploymentDbid);
+ }
public Object getObject(long deploymentDbid, String objectName) {
Object object = repositoryCache.get(deploymentDbid, objectName);
@@ -83,41 +91,36 @@
}
return object;
}
+
+ 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);
+ }
- public Object findObjectByPropertyValue(String key, String value) {
+ // queries //////////////////////////////////////////////////////////////////
+
+ public ProcessDefinitionQuery createProcessDefinitionQuery() {
+ return new ProcessDefinitionQueryImpl(session);
+ }
+
+ public ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId) {
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();
+ "where deploymentProperty.key = 'id' " +
+ " and deploymentProperty.stringValue =
'"+processDefinitionId+"' "
+ ).setMaxResults(1).uniqueResult();
if (deploymentProperty!=null) {
long deploymentDbid = deploymentProperty.getDeployment().getDbid();
String objectName = deploymentProperty.getObjectName();
- return getObject(deploymentDbid, objectName);
+ return (ClientProcessDefinition) 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/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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/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 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
- }
-
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -37,8 +37,8 @@
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SignalCmd;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
-import org.jbpm.pvm.internal.cmd.StartExecutionInLatestCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd;
import org.jbpm.pvm.internal.query.ExecutionQueryImpl;
@@ -48,35 +48,35 @@
public class ExecutionServiceImpl extends AbstractServiceImpl implements ExecutionService
{
public Execution startProcessInstanceById(String processDefinitionId){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, null,
null));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null,
null));
}
public Execution startProcessInstanceById(String processDefinitionId, String
executionKey) {
- return commandService.execute(new StartExecutionCmd(processDefinitionId, null,
executionKey));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null,
executionKey));
}
public Execution startProcessInstanceById(String processDefinitionId, Map<String,
Object> variables){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, variables,
null));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId,
variables, null));
}
public Execution startProcessInstanceById(String processDefinitionId, Map<String,
Object> variables, String executionKey){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, variables,
executionKey));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId,
variables, executionKey));
}
public Execution startProcessInstanceByKey(String processDefinitionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey,
null, null));
+ return commandService.execute(new
StartProcessInstanceInLatestCmd(processDefinitionKey, null, null));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String,
Object> variables){
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey,
variables, null));
+ return commandService.execute(new
StartProcessInstanceInLatestCmd(processDefinitionKey, variables, null));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, String
executionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey,
null, executionKey));
+ return commandService.execute(new
StartProcessInstanceInLatestCmd(processDefinitionKey, null, executionKey));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String,
Object> variables, String executionKey){
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey,
variables, executionKey));
+ return commandService.execute(new
StartProcessInstanceInLatestCmd(processDefinitionKey, variables, executionKey));
}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,86 +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.util.List;
-
-import org.jbpm.Deployment;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.ProcessDefinitionQuery;
-import org.jbpm.ProcessService;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.cmd.DeleteProcessDefinitionCmd;
-import org.jbpm.pvm.internal.cmd.DeployCmd;
-import org.jbpm.pvm.internal.cmd.FindLatestProcessDefinitionByKeyCmd;
-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.query.ProcessDefinitionQueryImpl;
-
-/** {@link ProcessService} implementation that delegates execution of the
- * methods to a {@link CommandService}.
- *
- * @author Tom Baeyens
- */
-public class ProcessServiceImpl extends AbstractServiceImpl implements ProcessService {
-
- public Deployment createDeployment() {
- return new DeploymentImpl(this);
- }
-
- public List<String> findProcessDefinitionKeys() {
- return commandService.execute(new FindProcessDefinitionKeysCmd());
- }
-
- public ProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey)
{
- return commandService.execute(new
FindLatestProcessDefinitionByKeyCmd(processDefinitionKey));
- }
-
- public List<ProcessDefinition> findProcessDefinitionsByKey(String
processDefinitionName) {
- return (List)commandService.execute(new
FindProcessDefinitionsByKeyCmd(processDefinitionName));
- }
-
- public ProcessDefinition findProcessDefinitionById(String processDefinitionId) {
- return commandService.execute(new
FindProcessDefinitionByIdCmd(processDefinitionId));
- }
-
- public void deleteProcessDefinition(String processDefinitionId) {
- commandService.execute(new DeleteProcessDefinitionCmd(processDefinitionId));
- }
-
- public void deleteProcessDefinitionCascade(String processDefinitionId) {
- 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);
- }
-
- public List<ProcessDefinition> deploy(Deployment deployment) {
- return commandService.execute(new DeployCmd((DeploymentImpl)deployment));
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -39,6 +39,7 @@
import org.jbpm.pvm.internal.history.events.TaskStart;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -87,7 +88,9 @@
protected String state;
+ protected String taskDefinitionName;
protected TaskDefinitionImpl taskDefinition;
+
protected ExecutionImpl execution;
protected ExecutionImpl processInstance;
protected SwimlaneImpl swimlane;
@@ -350,7 +353,7 @@
}
public TaskHandler getTaskHandler() {
- if ( (taskDefinition==null)
+ if ( (getTaskDefinition()==null)
|| (taskDefinition.getTaskHandlerDescriptor()==null)
) {
return DEFAULT_TASK_HANDLER;
@@ -360,6 +363,26 @@
return taskHandler;
}
+ // special getters and setters //////////////////////////////////////////////
+
+ public TaskDefinitionImpl getTaskDefinition() {
+ if ( (taskDefinition==null)
+ && (taskDefinitionName!=null)
+ && (execution!=null)
+ ) {
+ ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
+ taskDefinition = processDefinition.getTaskDefinition(taskDefinitionName);
+ }
+
+ return taskDefinition;
+ }
+
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ this.taskDefinition = taskDefinition;
+ this.taskDefinitionName = taskDefinition.getName();
+ }
+
+
// getters and setters //////////////////////////////////////////////////////
public long getDbid() {
@@ -467,11 +490,6 @@
public void setSignalling(boolean isSignalling) {
this.isSignalling = isSignalling;
}
- public TaskDefinitionImpl getTaskDefinition() {
- return taskDefinition;
- }
- public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
- this.taskDefinition = taskDefinition;
- }
+
}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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);
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
}
}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ProcessServiceBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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.cmd.CommandService;
-import org.jbpm.pvm.internal.svc.ProcessServiceImpl;
-import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
-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 ProcessServiceBinding extends WireDescriptorBinding {
-
- public ProcessServiceBinding() {
- super("process-service");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor descriptor = new ObjectDescriptor(ProcessServiceImpl.class);
- descriptor.addInjection("commandService", new
ContextTypeRefDescriptor(CommandService.class));
- return descriptor;
- }
-}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryServiceBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositorySessionBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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);
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SavePolicy.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/VersionTimestampPolicy.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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;
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -297,7 +297,7 @@
if (autoWireValue!=null) {
try {
- log.debug("auto wiring field "+fieldName+" in
"+name);
+ if (log.isTraceEnabled()) log.trace("auto wiring field
"+fieldName+" in "+name);
ReflectUtil.set(field, object, autoWireValue);
} catch (JbpmException e) {
if(e.getCause() instanceof IllegalArgumentException) {
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -36,20 +36,6 @@
*/
public class BuilderTest extends BaseJbpmTestCase {
- public void testBuilderProcessDefinitionProperties() {
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("p")
- .key("k")
- .version(5)
- .description("the description")
- .endProcess();
-
- assertEquals("p", processDefinition.getName());
- assertEquals("k", processDefinition.getKey());
- assertEquals(5, processDefinition.getVersion());
- assertEquals("the description", processDefinition.getDescription());
- }
-
public void testBuilderInitialActivity() {
ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
.startProcess("p")
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,614 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library is free software; you can redistribute it and/or modify it under the
terms
- * of the GNU Lesser General Public License as published by the Free Software Foundation
- * version 2.1 of the License.
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
- * See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License along with
this
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.model.Transition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Guillaume Porcher
- *
- */
-public class ProcessCacheDbTest extends EnvironmentDbTestCase {
-
- /**
- * Defines a simple process: only activities. persists it.
- */
- public void testCacheProcessDefinitionActivities() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- pvmDbSession.save(processDefinition);
-
- environment.get(Session.class).flush();
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- pvmDbSession = environment.get(PvmDbSession.class);
- processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- beginCacheTest(); // /////////////
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- pvmDbSession = environment.get(PvmDbSession.class);
- processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only activities. persists it.
- */
- public void testCacheProcessDefinitionActivityOrder() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- DbSession dbSession = environment.get(DbSession.class);
- dbSession.save(processDefinition);
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
-
- activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- // Pass a to the end -> activity order is "b,c,a"
- activities.add(activities.remove(0));
-
- activities = processDefinition.getActivities();
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
- beginCacheTest(); // /////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- endCacheTest(); // //////////////
- }
-
- /**
- * Test processDefinition initial activity
- */
- public void testCacheProcessDefinitionInitialActivity() {
- ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
- ActivityImpl activity = (ActivityImpl) processDefinition.createActivity();
- activity.setName("initial activity");
- activity.setDescription("very important activity");
-
- processDefinition.setInitial(activity);
-
- environment.get(DbSession.class).save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- ProcessDefinitionImpl p =
environment.get(DbSession.class).get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(p);
-
- ActivityImpl n = p.getInitial();
-
- assertNotNull(n);
- assertEquals(activity.getName(), n.getName());
- assertEquals(activity.getDescription(), n.getDescription());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- p = environment.get(DbSession.class).get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(p);
-
- n = p.getInitial();
-
- assertNotNull(n);
- assertEquals(activity.getName(), n.getName());
- assertEquals(activity.getDescription(), n.getDescription());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only nested activities. persists it, reloads it and
- * tries to access the nested activities
- */
- public void testCacheProcessDefinitionNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- assertNotNull(p.getInitial().getActivity("a"));
- assertNotNull(p.getInitial().getActivity("b"));
- assertNotNull(p.getInitial().getActivity("c"));
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // /////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- assertNotNull(p.getInitial().getActivity("a"));
- assertNotNull(p.getInitial().getActivity("b"));
- assertNotNull(p.getInitial().getActivity("c"));
-
- endCacheTest(); // ////////
- }
-
- /**
- * Defines a process with nested activities with nested activities. persists it,
reloads
- * it and tries to access the nested activities
- */
- public void testCacheProcessDefinitionNestedNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .startActivity("a")
- .startActivity("aa")
- .endActivity()
- .startActivity("ab")
- .endActivity()
- .startActivity("ac")
- .endActivity()
- .endActivity()
- .startActivity("b")
- .startActivity("ba")
- .endActivity()
- .startActivity("bb")
- .endActivity()
- .startActivity("bc")
- .endActivity()
- .endActivity()
- .startActivity("c")
- .startActivity("ca")
- .endActivity()
- .startActivity("cb")
- .endActivity()
- .startActivity("cc")
- .endActivity()
- .endActivity()
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- ClientProcessDefinition p = persistenceSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- Activity n = p.getInitial().getActivity("a");
- assertNotNull(n);
- List<Activity> l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("aa", l.get(0).getName());
- assertEquals("ab", l.get(1).getName());
- assertEquals("ac", l.get(2).getName());
-
- n = p.getInitial().getActivity("b");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ba", l.get(0).getName());
- assertEquals("bb", l.get(1).getName());
- assertEquals("bc", l.get(2).getName());
-
- n = p.getInitial().getActivity("c");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ca", l.get(0).getName());
- assertEquals("cb", l.get(1).getName());
- assertEquals("cc", l.get(2).getName());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- p = persistenceSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- n = p.getInitial().getActivity("a");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("aa", l.get(0).getName());
- assertEquals("ab", l.get(1).getName());
- assertEquals("ac", l.get(2).getName());
-
- n = p.getInitial().getActivity("b");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ba", l.get(0).getName());
- assertEquals("bb", l.get(1).getName());
- assertEquals("bc", l.get(2).getName());
-
- n = p.getInitial().getActivity("c");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ca", l.get(0).getName());
- assertEquals("cb", l.get(1).getName());
- assertEquals("cc", l.get(2).getName());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only activities and default transitions. persists it,
- * reloads and navigates through the transitions.
- */
- public void testCacheDefaultTransition() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .endActivity()
- .startActivity("a")
- .transition("b")
- .endActivity()
- .startActivity("b")
- .transition("c")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- DbSession testSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Activity activity = p.getInitial();
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("a"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("b"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
- assertEquals(p.getActivity("c"), activity);
- assertNull(activity.getDefaultTransition());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- testSession = (DbSession) environment.get(DbSession.class);
-
- p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- activity = p.getInitial();
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("a"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("b"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
- assertEquals(p.getActivity("c"), activity);
- assertNull(activity.getDefaultTransition());
-
- endCacheTest(); // //////////
- }
-
- /**
- * Defines a simple process: only activities and transitions. persists it, reloads
- * and navigates through the transitions.
- */
- public void testCacheTwoTransitions() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .transition("b")
- .endActivity()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- DbSession testSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Activity activity = p.getInitial();
- List<Transition> l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- Activity a = p.getActivity("a");
- assertNotNull(a);
-
- Activity b = p.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- List<Transition> la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- List<Transition> lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- testSession = (DbSession) environment.get(DbSession.class);
- beginCacheTest(); // ///////
-
- p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class,
processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- activity = p.getInitial();
- l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- a = p.getActivity("a");
- assertNotNull(a);
-
- b = p.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
-
- endCacheTest(); // ////////
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,486 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library is free software; you can redistribute it and/or modify it under the
terms
- * of the GNU Lesser General Public License as published by the Free Software Foundation
- * version 2.1 of the License.
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
- * See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License along with
this
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.model.Event;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.model.Transition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.EventListenerReference;
-import org.jbpm.pvm.internal.model.ExceptionHandlerImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Charles Souillard
- * @author Guillaume Porcher
- */
-public class ProcessDefinitionDbTest extends EnvironmentDbTestCase {
-
- public void testProcessDefinitionBasicProperties() {
- Date deploymentTime = new Date();
-
- ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
- processDefinition.setName("name");
- processDefinition.setDescription("description");
- processDefinition.setVersion(3);
- processDefinition.setDeploymentTime(deploymentTime);
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("name", processDefinition.getName());
- assertEquals("description", processDefinition.getDescription());
- assertEquals(3, processDefinition.getVersion());
- assertEquals(deploymentTime, processDefinition.getDeploymentTime());
- }
-
- public void testProcessDefinitionActivities() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
- }
-
- public void testInitialActivity() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity initial = processDefinition.getInitial();
- assertNotNull(initial);
-
- // check that the initial activity is still in the list of activities
- assertSame(processDefinition.getActivity("a"), initial);
- // check that the initial activity is not two times in the list of activities
- assertEquals(3, processDefinition.getActivities().size());
- }
-
- public void testProcessDefinitionNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("top")
- .initial()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .startActivity("b1")
- .endActivity()
- .startActivity("b2")
- .endActivity()
- .startActivity("b3")
- .endActivity()
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- Activity initial = processDefinition.getInitial();
- assertNotNull(initial);
- assertEquals(initial, processDefinition.getActivity("top"));
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals("expected size 1. activity list was: " +
activities.toString(), 1, activities.size());
- Activity top = activities.get(0);
- assertNotNull(top);
-
- activities = top.getActivities();
- assertNotNull(activities);
- assertEquals("expected size 3. activity list was: " +
activities.toString(), 3, activities.size());
- assertEquals("a", activities.get(0).getName());
- assertEquals("b", activities.get(1).getName());
- assertEquals("c", activities.get(2).getName());
-
- activities =
processDefinition.getActivity("top").getActivity("b").getActivities();
- assertNotNull(activities);
- assertEquals("expected size 3. activity list was: " +
activities.toString(), 3, activities.size());
- assertEquals("b1", activities.get(0).getName());
- assertEquals("b2", activities.get(1).getName());
- assertEquals("b3", activities.get(2).getName());
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity activity = processDefinition.findActivity("b2");
- assertNotNull(activity);
- assertEquals("b", activity.getParent().getName());
- assertEquals("top", activity.getParent().getParent().getName());
- }
-
- public void testDefaultTransition() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .transition("a")
- .transition("b", "tob")
- .transition("c", "toc")
- .endActivity()
- .startActivity("b")
- .transition("a", "toa")
- .transition("b")
- .transition("c", "toc")
- .endActivity()
- .startActivity("c")
- .transition("c")
- .endActivity()
- .startActivity("d")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("a",
processDefinition.getActivity("a").getDefaultTransition().getDestination().getName());
- assertEquals("a",
processDefinition.getActivity("b").getDefaultTransition().getDestination().getName());
- assertEquals("c",
processDefinition.getActivity("c").getDefaultTransition().getDestination().getName());
- assertNull(processDefinition.getActivity("d").getDefaultTransition());
- }
-
- public void testTwoTransitionsWithoutAName() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .transition("b")
- .endActivity()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- Activity activity = processDefinition.getInitial();
- List<Transition> l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- Activity a = processDefinition.getActivity("a");
- assertNotNull(a);
-
- Activity b = processDefinition.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- List<Transition> la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- List<Transition> lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
- }
-
- public void testEventsOnProcessDefinition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startEvent(Event.START)
- .listener("one")
- .listener("two")
- .endEvent()
- .startEvent(Event.END)
- .listener("three")
- .listener("four")
- .endEvent()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getEvent(Event.START);
- List<EventListenerReference> listenerReferences =
event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
-
- event = processDefinition.getEvent(Event.END);
- listenerReferences = event.getListenerReferences();
- assertEquals("three", listenerReferences.get(0).getExpression());
- assertEquals("four", listenerReferences.get(1).getExpression());
- }
-
- public void testEventsOnActivity() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startEvent(Event.START)
- .listener("one")
- .listener("two")
- .endEvent()
- .startEvent(Event.END)
- .listener("three")
- .listener("four")
- .endEvent()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event =
processDefinition.getActivity("a").getEvent(Event.START);
- List<EventListenerReference> listenerReferences =
event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
-
- event = processDefinition.getActivity("a").getEvent(Event.END);
- listenerReferences = event.getListenerReferences();
- assertEquals("three", listenerReferences.get(0).getExpression());
- assertEquals("four", listenerReferences.get(1).getExpression());
- }
-
- public void testListenersOnTransition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startFlow("b")
- .listener("one")
- .listener("two")
- .endFlow()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event =
processDefinition.getActivity("a").getDefaultTransition().getEvent();
- List<EventListenerReference> listenerReferences =
event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
- }
-
- public void testExceptionHandlersOnProcessDefinition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startExceptionHandler(IllegalArgumentException.class)
- .listener("one")
- .listener("two")
- .endExceptionHandler()
- .startExceptionHandler(RuntimeException.class)
- .listener("three")
- .listener("four")
- .endExceptionHandler()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<ExceptionHandlerImpl> exceptionHandlers =
processDefinition.getExceptionHandlers();
-
- ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
- assertEquals(IllegalArgumentException.class.getName(),
exceptionHandler.getExceptionClassName());
- assertEquals("one",
exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("two",
exceptionHandler.getEventListenerReferences().get(1).getExpression());
-
- exceptionHandler = exceptionHandlers.get(1);
- assertEquals(RuntimeException.class.getName(),
exceptionHandler.getExceptionClassName());
- assertEquals("three",
exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("four",
exceptionHandler.getEventListenerReferences().get(1).getExpression());
- }
-
- public void testExceptionHandlersOnActivity() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startExceptionHandler(IllegalArgumentException.class)
- .listener("one")
- .listener("two")
- .endExceptionHandler()
- .startExceptionHandler(RuntimeException.class)
- .listener("three")
- .listener("four")
- .endExceptionHandler()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<ExceptionHandlerImpl> exceptionHandlers =
processDefinition.getActivity("a").getExceptionHandlers();
-
- ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
- assertEquals(IllegalArgumentException.class.getName(),
exceptionHandler.getExceptionClassName());
- assertEquals("one",
exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("two",
exceptionHandler.getEventListenerReferences().get(1).getExpression());
-
- exceptionHandler = exceptionHandlers.get(1);
- assertEquals(RuntimeException.class.getName(),
exceptionHandler.getExceptionClassName());
- assertEquals("three",
exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("four",
exceptionHandler.getEventListenerReferences().get(1).getExpression());
- }
-
- public void testProcessDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .property("key1", "val1")
- .property("key2", "val2")
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("val1", processDefinition.getProperty("key1"));
- assertEquals("val2", processDefinition.getProperty("key2"));
- }
-
- public void testActivityDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .property("key1", "val1")
- .property("key2", "val2")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity activity = processDefinition.getInitial();
- assertEquals("val1", activity.getProperty("key1"));
- assertEquals("val2", activity.getProperty("key2"));
- }
-
- public void testTransitionDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startFlow("a")
- .property("key1", "val1")
- .property("key2", "val2")
- .endFlow()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Transition transition = processDefinition.getInitial().getDefaultTransition();
- assertEquals("val1", transition.getProperty("key1"));
- assertEquals("val2", transition.getProperty("key2"));
- }
-
- public void testEventDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .startEvent(Event.START)
- .property("key1", "val1")
- .property("key2", "val2")
- .endEvent()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getEvent(Event.START);
- assertEquals("val1", event.getProperty("key1"));
- assertEquals("val2", event.getProperty("key2"));
- }
-
- public void testProcessDefinitionAttachments() {
-
- if (true) {
- System.err.print("FIXME: JBPM-1972 finish process attachments");
- return;
- }
-
- StringBuffer text = new StringBuffer();
- for (int i=0; i<500; i++) {
- text.append("This is a lot of bytes! ");
- }
- byte[] bytes = text.toString().getBytes();
-
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
ProcessDefinitionBuilder
- .startProcess()
- .attachment("msgbytes", bytes)
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- byte[] retrievedBytes = processDefinition.getAttachment("msgbytes");
- // assertTrue(Arrays.equals(bytes, retrievedBytes));
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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.db.model;
-
-import org.hibernate.SessionFactory;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class SessionFactoryDbTest extends EnvironmentDbTestCase
-{
-
- public void testSessionFactory()
- {
- environment.get(SessionFactory.class);
- }
-
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,600 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library is free software; you can redistribute it and/or modify it under the
terms
- * of the GNU Lesser General Public License as published by the Free Software Foundation
- * version 2.1 of the License.
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
- * See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License along with
this
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.model.WireProperties;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ByteDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.CharacterDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.DoubleDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FloatDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.MapDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.NullDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.SetDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ShortDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
-import org.jbpm.pvm.internal.wire.operation.FieldOperation;
-import org.jbpm.pvm.internal.wire.operation.PropertyOperation;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Guillaume Porcher
- *
- * This class uses process annotations to test wire descriptors
- * persistence
- */
-public class WireDbTest extends EnvironmentDbTestCase {
-
- public void testCharacterDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- CharacterDescriptor descriptor = new CharacterDescriptor();
- descriptor.setName("n");
- descriptor.setValue('c');
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (CharacterDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals('c', descriptor.construct(null));
- }
-
- public void testByteDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ByteDescriptor descriptor = new ByteDescriptor();
- descriptor.setName("n");
- descriptor.setValue((byte) 6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ByteDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((byte) 6, descriptor.construct(null));
- }
-
- public void testClassDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ClassDescriptor descriptor = new ClassDescriptor();
- descriptor.setName("n");
- descriptor.setClassName(EventImpl.class.getName());
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ClassDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(EventImpl.class, WireContext.create(descriptor));
- }
-
- public void testDoubleDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- DoubleDescriptor descriptor = new DoubleDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6.666);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (DoubleDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6.666, descriptor.construct(null));
- }
-
- public void testFalseDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- FalseDescriptor descriptor = new FalseDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (FalseDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(Boolean.FALSE, descriptor.construct(null));
- }
-
- public void testFloatDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- FloatDescriptor descriptor = new FloatDescriptor();
- descriptor.setName("n");
- descriptor.setValue((float) 6.666);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (FloatDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((float) 6.666, descriptor.construct(null));
- }
-
- public void testIntegerDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- IntegerDescriptor descriptor = new IntegerDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (IntegerDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6, descriptor.construct(null));
- }
-
- public void testLongDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- LongDescriptor descriptor = new LongDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6L);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (LongDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6L, descriptor.construct(null));
- }
-
- public void testNullDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- NullDescriptor descriptor = new NullDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (NullDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertNull(descriptor.construct(null));
- }
-
- public void testShortDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ShortDescriptor descriptor = new ShortDescriptor();
- descriptor.setName("n");
- descriptor.setValue((short) 6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ShortDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((short) 6, descriptor.construct(null));
- }
-
- public void testStringDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- StringDescriptor descriptor = new StringDescriptor();
- descriptor.setName("n");
- descriptor.setValue("s");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (StringDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals("s", descriptor.construct(null));
- }
-
- public void testTrueDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- TrueDescriptor descriptor = new TrueDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (TrueDescriptor) dbSession.get(AbstractDescriptor.class,
descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(Boolean.TRUE, descriptor.construct(null));
- }
-
- public void testRefDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- WireProperties configurations = new WireProperties();
-
- StringDescriptor referencedDescriptor = new StringDescriptor();
- referencedDescriptor.setName("referenced");
- referencedDescriptor.setValue("text");
- configurations.add(referencedDescriptor);
-
- ReferenceDescriptor descriptor = new ReferenceDescriptor();
- descriptor.setName("reference");
- descriptor.setValue("referenced");
- configurations.add(descriptor);
-
- dbSession.save(configurations);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- configurations = dbSession.get(WireProperties.class, configurations.getDbid());
-
- assertNotNull(configurations);
- assertEquals("text", configurations.get("reference"));
- }
-
- /**
- * Check that list descriptors are persisted
- */
- public void testListDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> listValues = new ArrayList<Descriptor>();
- listValues.add(stringD);
- listValues.add(string2D);
-
- ListDescriptor listD = new ListDescriptor();
- listD.setName("list");
- listD.setValueDescriptors(listValues);
- listD.setClassName(LinkedList.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(listD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- List<String> result = (List<String>) p.getProperty("list");
- assertNotNull(result);
- assertEquals(2, result.size());
- assertEquals("value", result.get(0));
- assertEquals("value2", result.get(1));
-
- assertTrue(result instanceof LinkedList);
- }
-
- /**
- * Check that set descriptors are persisted
- */
- public void testSetDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> listValues = new ArrayList<Descriptor>();
- listValues.add(stringD);
- listValues.add(string2D);
-
- SetDescriptor setD = new SetDescriptor();
- setD.setName("set");
- setD.setValueDescriptors(listValues);
- setD.setClassName(TreeSet.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(setD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Set<String> result = (Set<String>) p.getProperty("set");
- assertNotNull(result);
- assertTrue(result.contains("value"));
- assertTrue(result.contains("value2"));
- assertEquals(2, result.size());
-
- assertTrue(result instanceof TreeSet);
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testMapDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor keyD = new StringDescriptor();
- keyD.setValue("key");
-
- StringDescriptor key2D = new StringDescriptor();
- key2D.setValue("key2");
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> mapKeys = new ArrayList<Descriptor>();
- mapKeys.add(keyD);
- mapKeys.add(key2D);
-
- List<Descriptor> mapValues = new ArrayList<Descriptor>();
- mapValues.add(stringD);
- mapValues.add(string2D);
-
- MapDescriptor mapD = new MapDescriptor();
- mapD.setName("map");
- mapD.setValueDescriptors(mapValues);
- mapD.setKeyDescriptors(mapKeys);
- mapD.setClassName(TreeMap.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(mapD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Map<String, String> result = (Map<String, String>)
p.getProperty("map");
- assertNotNull(result);
- assertEquals(2, result.size());
- assertEquals("value", result.get("key"));
- assertEquals("value2", result.get("key2"));
-
- assertTrue(result instanceof TreeMap);
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testObjectDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDefault = new ObjectDescriptor();
- objDefault.setName("objectByEmptyConstr");
- objDefault.setClassName(Object.class.getName());
-
- ObjectDescriptor objConstr = new ObjectDescriptor();
- objConstr.setName("objectByConstr");
- objConstr.setClassName(Integer.class.getName());
-
- ArgDescriptor argObjConstr = new ArgDescriptor();
- argObjConstr.setTypeName(int.class.getName());
- IntegerDescriptor argObjConstrVal = new IntegerDescriptor();
- argObjConstrVal.setValue(42);
- argObjConstr.setDescriptor(argObjConstrVal);
-
- objConstr.addArgDescriptor(argObjConstr);
-
- ObjectDescriptor objStaticMethod = new ObjectDescriptor();
- objStaticMethod.setName("objectByStaticMethod");
- objStaticMethod.setClassName(Integer.class.getName());
- objStaticMethod.setMethodName("signum");
- ArgDescriptor argStaticMethod = new ArgDescriptor();
- argStaticMethod.setTypeName(int.class.getName());
- IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
- argStaticMethodValue.setValue(42);
- argStaticMethod.setDescriptor(argStaticMethodValue);
-
- objStaticMethod.addArgDescriptor(argStaticMethod);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDefault)
- .property(objConstr)
- .property(objStaticMethod)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("objectByEmptyConstr"));
- assertEquals(42, p.getProperty("objectByConstr"));
- assertTrue(p.getProperty("objectByConstr") instanceof Integer);
-
- assertEquals(1, p.getProperty("objectByStaticMethod"));
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testFieldOperation() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDescr = new
ObjectDescriptor(VariableDefinitionImpl.class.getName());
- objDescr.setName("object");
-
- FieldOperation fieldOp = new FieldOperation();
- fieldOp.setFieldName("name");
-
- StringDescriptor varNameDescriptor = new StringDescriptor();
- varNameDescriptor.setValue("varName");
-
- fieldOp.setDescriptor(varNameDescriptor);
-
- objDescr.addOperation(fieldOp);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDescr)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("object"));
- assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
- assertEquals("varName", ((VariableDefinitionImpl)
p.getProperty("object")).getName());
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testPropertyOperation() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDescr = new ObjectDescriptor();
- objDescr.setName("object");
- objDescr.setClassName(VariableDefinitionImpl.class.getName());
-
- PropertyOperation propertyOp = new PropertyOperation();
- propertyOp.setPropertyName("name");
-
- StringDescriptor varNameDescriptor = new StringDescriptor();
- varNameDescriptor.setValue("varName");
-
- propertyOp.setDescriptor(varNameDescriptor);
-
- objDescr.addOperation(propertyOp);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDescr)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition)
dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("object"));
- assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
- assertEquals("varName", ((VariableDefinitionImpl)
p.getProperty("object")).getName());
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,108 +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.db.model;
-
-import org.hibernate.Session;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class WireTest extends EnvironmentDbTestCase
-{
-
- public void testObjectDescriptor()
- {
- DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
-
- ObjectDescriptor objStaticMethod = new ObjectDescriptor();
- objStaticMethod.setName("objectByStaticMethod");
- objStaticMethod.setClassName(Integer.class.getName());
- objStaticMethod.setMethodName("signum");
- ArgDescriptor argStaticMethod = new ArgDescriptor();
- argStaticMethod.setTypeName(int.class.getName());
- IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
- argStaticMethodValue.setValue(42);
- argStaticMethod.setDescriptor(argStaticMethodValue);
-
- objStaticMethod.addArgDescriptor(argStaticMethod);
-
- persistenceSession.save(argStaticMethodValue);
- environment.get(Session.class).flush();
-
- persistenceSession.save(objStaticMethod);
- environment.get(Session.class).flush();
-
- persistenceSession.save(objStaticMethod);
- environment.get(Session.class).flush();
-
- }
-
- /*
- * public void testObjectDescriptor() { DbSession persistenceSession = (DbSession)
environment.get(DbSession.class);
- * assertNotNull(persistenceSession);
- *
- * ObjectDescriptor objDefault = new ObjectDescriptor();
objDefault.setName("objectByEmptyConstr");
- * objDefault.setClassName(Object.class.getName());
- *
- * ObjectDescriptor objConstr = new ObjectDescriptor();
objConstr.setName("objectByConstr");
- * objConstr.setClassName(Integer.class.getName());
- *
- * ArgDescriptor argObjConstr = new ArgDescriptor();
argObjConstr.setTypeName(int.class.getName()); IntegerDescriptor
- * argObjConstrVal = new IntegerDescriptor(); argObjConstrVal.setValue(42);
- * argObjConstr.setDescriptor(argObjConstrVal);
- *
- * objConstr.addArgDescriptor(argObjConstr);
- *
- * ObjectDescriptor objStaticMethod = new ObjectDescriptor();
objStaticMethod.setName("objectByStaticMethod");
- * objStaticMethod.setClassName(Integer.class.getName());
objStaticMethod.setMethodName("signum"); ArgDescriptor
- * argStaticMethod = new ArgDescriptor();
argStaticMethod.setTypeName(int.class.getName()); IntegerDescriptor
- * argStaticMethodValue = new IntegerDescriptor(); argStaticMethodValue.setValue(42);
- * argStaticMethod.setDescriptor(argStaticMethodValue);
- *
- * objStaticMethod.addArgDescriptor(argStaticMethod);
- *
- * ProcessDefinition processDefinition = ProcessFactory.build()
.configuration(objDefault) .configuration(objConstr)
- * .configuration(objStaticMethod) .done();
- *
- * persistenceSession.save(processDefinition);
- *
- * newTransaction();
- *
- * DbSession testSession = (DbSession) environment.get(DbSession.class);
- *
- * ProcessDefinition p = (ProcessDefinition)
testSession.get(ProcessDefinitionImpl.class,
- * processDefinition.getDbid());
- *
- * assertNotNull(p); assertNotSame(processDefinition, p);
- *
- * assertNotNull(p.getConfigurations());
assertNotNull(p.getConfigurations().get("objectByEmptyConstr"));
- * assertEquals(42 , p.getConfigurations().get("objectByConstr"));
- * assertTrue(p.getConfigurations().get("objectByConstr") instanceof
Integer);
- *
- * assertEquals(1, p.getConfigurations().get("objectByStaticMethod")); }
- */
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,72 +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.execution;
-
-import org.jbpm.Deployment;
-import org.jbpm.Execution;
-import org.jbpm.ExecutionService;
-import org.jbpm.ProcessService;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.activities.AutomaticActivity;
-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;
-
-/**
- * @author Tom Baeyens
- */
-public class PvmProcessExecutionTest extends EnvironmentFactoryTestCase {
-
- public void testDeploy() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ProcessService processService = environmentFactory.get(ProcessService.class);
-
- ClientProcessDefinition processDefinition =
ProcessDefinitionBuilder.startProcess("test")
- .startActivity("start", WaitState.class)
- .initial()
- .transition("end", "end")
- .endActivity()
- .startActivity("end", AutomaticActivity.class)
- .endActivity()
- .endProcess();
-
- Deployment deployment = new DeploymentImpl((ProcessServiceImpl) processService);
- deployment.addProcessDefinition(processDefinition);
- deployment.deploy();
- }
-
- public void testStartProcessInstance() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution = executionService.startProcessInstanceById("test-1",
"request17");
- }
-
- public void testResumeProcessInstance() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution =
executionService.signalExecutionById("test.request17", "end");
- }
-
-}
\ No newline at end of file
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,102 +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.jobexecutor;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.activities.AutomaticActivity;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AsyncContinuationsTest extends JbpmTestCase {
-
- public void testContinuations() {
- deployProcess();
-
- Execution execution =
executionService.startProcessInstanceByKey("continuations");
-
- assertEquals("start", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("a", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("b", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("c", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
-
- assertNull(executionService.findExecution(execution.getId()));
- }
-
- public void deployProcess() {
- commandService.execute(new Command<Object>() {
- public Object execute(Environment environment) throws Exception {
- OpenProcessDefinition processDefinition =
ProcessDefinitionBuilder.startProcess("continuations")
- .key("continuations")
- .startActivity("start", AutomaticActivity.class)
- .initial()
- .asyncExecute()
- .transition("a")
- .endActivity()
- .startActivity("a", AutomaticActivity.class)
- .asyncExecute()
- .transition("b")
- .endActivity()
- .startActivity("b", AutomaticActivity.class)
- .asyncExecute()
- .transition("c")
- .endActivity()
- .startActivity("c", AutomaticActivity.class)
- .asyncExecute()
- .transition("end")
- .endActivity()
- .startActivity("end", AutomaticActivity.class)
- .endActivity()
- .endProcess();
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- return null;
- }
- });
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.variables;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.activities.WaitState;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.type.Variable;
-import org.jbpm.pvm.internal.type.variable.DateVariable;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-
-/**
- * @author Guillaume Porcher
- */
-public class CustomTypeVariableTest extends EnvironmentDbTestCase {
-
- private static final String ENVIRONMENT_CFG_XML =
"org/jbpm/pvm/variables/custom.types.jbpm.cfg.xml";
-
- public CustomTypeVariableTest() {
- super(ENVIRONMENT_CFG_XML);
- }
-
- public void testDateVariable() {
- ClientProcessDefinition clientProcessDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity(
- new ObjectDescriptor(WaitState.class)
- )
- .initial()
- .endActivity()
- .endProcess();
-
- getDbSession().save(clientProcessDefinition);
-
- ExecutionImpl execution = (ExecutionImpl)
clientProcessDefinition.startProcessInstance();
-
- execution = reload(execution, ExecutionImpl.class);
-
- Calendar calendar = new GregorianCalendar();
- calendar.set(Calendar.YEAR, 2007);
- calendar.set(Calendar.MONTH, 10); // (10 == november)
- calendar.set(Calendar.DAY_OF_MONTH, 22);
- calendar.set(Calendar.HOUR_OF_DAY, 15);
- calendar.set(Calendar.MINUTE, 28);
- calendar.set(Calendar.SECOND, 57);
- calendar.set(Calendar.MILLISECOND, 374);
-
- execution.setVariable("v", calendar.getTime());
-
- execution = reload(execution, ExecutionImpl.class);
-
- Variable variable = execution.getVariableObject("v");
- assertEquals(DateVariable.class, variable.getClass());
-
- assertEquals(calendar.getTime(), execution.getVariable("v"));
- }
-
-}
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-30 15:42:32 UTC (rev
4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-03-30 17:03:18 UTC (rev
4359)
@@ -4,7 +4,8 @@
<process-engine-context>
- <process-service />
+ <repository-service />
+ <repository-cache />
<execution-service />
<history-service />
<management-service />
@@ -18,16 +19,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 +53,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.execution.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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,22 +348,4 @@
]]>
</query>
- <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 name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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/trunk/modules/pvm/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.history.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.history.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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_" />
Copied: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml (from rev 4355,
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
(rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -0,0 +1,50 @@
+<?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="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -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,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ <property name="taskDefinitionName"
column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +167,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/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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"
/>
@@ -59,19 +61,16 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
<binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding"
/>
<binding
class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<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/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
===================================================================
---
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -58,14 +58,14 @@
static protected Log log = Log.getLog(BaseJbpmTestCase.class.getName());
protected void setUp() throws Exception {
- assertNull(Environment.getCurrent());
+ assertNull("there is already an environment open",
Environment.getCurrent());
LogFormatter.resetIndentation();
log.debug("=== starting "+getName()+"
=============================");
}
protected void tearDown() throws Exception {
log.debug("=== ending "+getName()+"
=============================\n");
- assertNull(Environment.getCurrent());
+ assertNull("there is still an environment open",
Environment.getCurrent());
}
public void assertTextPresent(String expected, String value) {
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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,7 +68,7 @@
protected static ProcessEngine processEngine = null;
- protected static ProcessService processService;
+ protected static RepositoryService repositoryService;
protected static ExecutionService executionService;
protected static ManagementService managementService;
protected static TaskService taskService;
@@ -77,9 +77,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,7 +102,7 @@
processEngine = configuration.buildProcessEngine();
- processService = processEngine.getProcessService();
+ repositoryService = processEngine.get(RepositoryService.class);
executionService = processEngine.getExecutionService();
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
@@ -113,9 +113,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.deleteDeploymentCascade(deploymentDbid);
}
}
@@ -130,48 +130,32 @@
super.tearDown();
}
- public ProcessDefinition deployJpdlXmlString(String jpdlXmlString) {
- List<ProcessDefinition> deployedProcessDefinitions =
- processService.createDeployment()
- .addString("xmlstring.jpdl.xml", jpdlXmlString)
- .deploy()
- .getProcessDefinitions();
+ public long deployJpdlXmlString(String jpdlXmlString) {
+ long deploymentDbid =
+ repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString)
+ .deploy();
- return registerDeployedProcessDefinitions(deployedProcessDefinitions);
- }
-
- public ProcessDefinition deployJpdlResource(String resource) {
- List<ProcessDefinition> deployedProcessDefinitions =
- processService.createDeployment()
- .addResource(resource)
- .deploy()
- .getProcessDefinitions();
+ registerDeployment(deploymentDbid);
- return registerDeployedProcessDefinitions(deployedProcessDefinitions);
+ return deploymentDbid;
}
+
+ public void deployJpdlResource(String resource) {
+ long deploymentDbid =
+ repositoryService.createDeployment()
+ .addResourceFromClasspath(resource)
+ .deploy();
- protected ProcessDefinition addDeployedProcessDefinition(ProcessDefinition
deployedProcessDefinition) {
- if (registeredProcessDefinitions==null) {
- registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
- }
-
- registeredProcessDefinitions.add(deployedProcessDefinition);
-
- return deployedProcessDefinition;
+ registerDeployment(deploymentDbid);
}
- protected ProcessDefinition
registerDeployedProcessDefinitions(List<ProcessDefinition>
deployedProcessDefinitions) {
- if (registeredProcessDefinitions==null) {
- registeredProcessDefinitions = new ArrayList<ProcessDefinition>();
+ protected void registerDeployment(long deploymentDbid) {
+ if (registeredDeployments==null) {
+ registeredDeployments = new ArrayList<Long>();
}
- registeredProcessDefinitions.addAll(deployedProcessDefinitions);
-
- if (deployedProcessDefinitions.size()>=1) {
- return deployedProcessDefinitions.get(0);
- }
-
- return null;
+ registeredDeployments.add(deploymentDbid);
}
public long saveAndRegisterTask(Task task) {
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -48,7 +48,7 @@
.setXmlString(
"<jbpm-configuration>" +
" <process-engine-context>" +
- " <process-service />" +
+ " <repository-service />" +
" <execution-service />" +
" <management-service />" +
" </process-engine-context>" +
@@ -56,7 +56,6 @@
)
.buildProcessEngine();
assertNotNull(processEngine);
- assertNotNull(processEngine.getProcessService());
assertNotNull(processEngine.getExecutionService());
assertNotNull(processEngine.getManagementService());
}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -175,8 +175,6 @@
"</process>"
);
- ProcessDefinition processDefinition =
processService.findProcessDefinitionsByKey("ICL").get(0);
-
// start an execution for the process with the given id
Execution execution = executionService.startProcessInstanceById("ICL-1");
assertNotNull(execution);
Copied:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java)
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
(rev 0)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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 =
+ repositoryService.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/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessAttachmentsTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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();
-
- List<ProcessDefinition> deployedProcessDefinitions =
- processService.createDeployment()
- .addString("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);
-
- byte[] retrievedLotOfBytes = processService.getAttachment(processDefinition.getId(),
"a lot of attachment");
- assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
-
- byte[] retrievedOtherBytes = processService.getAttachment(processDefinition.getId(),
"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;
- }
-}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -34,7 +34,7 @@
public class ProcessDefinitionQueryTest extends JbpmTestCase {
public void testQueryProcessDefinitionsEmpty() {
- List<ProcessDefinition> processDefinitions = processService
+ List<ProcessDefinition> processDefinitions = repositoryService
.createProcessDefinitionQuery()
.execute();
@@ -72,7 +72,7 @@
"</process>"
);
- List<ProcessDefinition> processDefinitions =
processService.createProcessDefinitionQuery()
+ List<ProcessDefinition> processDefinitions =
repositoryService.createProcessDefinitionQuery()
.nameLike("%make%")
.orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
.execute();
@@ -125,15 +125,14 @@
"</process>"
);
- List<ProcessDefinition> processDefinitions =
processService.createProcessDefinitionQuery()
- .keyLike("make%")
- .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
- .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ List<ProcessDefinition> processDefinitions =
repositoryService.createProcessDefinitionQuery()
+ .nameLike("make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_ID)
.execute();
- assertEquals("make_friends-3", processDefinitions.get(0).getId());
+ assertEquals("make_friends-1", processDefinitions.get(0).getId());
assertEquals("make_friends-2", processDefinitions.get(1).getId());
- assertEquals("make_friends-1", processDefinitions.get(2).getId());
+ assertEquals("make_friends-3", processDefinitions.get(2).getId());
assertEquals("make_print-1", processDefinitions.get(3).getId());
}
}
Deleted:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -1,356 +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.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessServiceTest extends JbpmTestCase {
-
- public void testProcessWithNameOnly() {
- ProcessDefinition processDefinition = deployJpdlXmlString(
- "<process name='Insurance claim'>" +
- " <start />" +
- "</process>"
- );
-
- assertNotNull(processDefinition);
- assertEquals("Insurance claim", processDefinition.getName());
- assertEquals("Insurance_claim", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("Insurance_claim-1", processDefinition.getId());
- }
-
- public void testProcessWithNameAndKey() {
- deployJpdlXmlString(
- "<process name='Insurance claim' key='ICL'>" +
- " <start />" +
- "</process>"
- );
-
- ProcessDefinition processDefinition =
processService.findLatestProcessDefinitionByKey("ICL");
-
- assertNotNull(processDefinition);
- assertEquals("Insurance claim", processDefinition.getName());
- assertEquals("ICL", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("ICL-1", processDefinition.getId());
- }
-
- // interface methods ////////////////////////////////////////////////////////
-
- public void testFindProcessDefinitionKeys() {
- deployMultipleVersionsOfProcesses();
-
- List<String> processKeys = processService.findProcessDefinitionKeys();
-
- List<String> expected = new ArrayList<String>();
- expected.add("nuclear_fusion");
- expected.add("publish_book");
- expected.add("ultimate_seduction");
-
- assertEquals(expected, processKeys);
- }
-
-
- public void testFindProcessByKey() {
- deployJpdlXmlString(
- "<process name='Name with spaces'>" +
- " <start />" +
- "</process>"
- );
-
- ProcessDefinition processDefinition =
processService.findLatestProcessDefinitionByKey("Name_with_spaces");
- assertNotNull(processDefinition);
- assertEquals("Name with spaces", processDefinition.getName());
- assertEquals("Name_with_spaces", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("Name_with_spaces-1", processDefinition.getId());
- }
-
- public void testFindProcessDefinitions() {
- deployMultipleVersionsOfProcesses();
-
- List<ProcessDefinition> processDefinitions =
processService.findProcessDefinitionsByKey("nuclear_fusion");
- assertNotNull(processDefinitions);
-
- assertEquals("expected 3 but was " + processDefinitions.size() + ":
" + processDefinitions, 3, processDefinitions.size());
- assertEquals("nuclear fusion", processDefinitions.get(0).getName());
- assertEquals(3, processDefinitions.get(0).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(1).getName());
- assertEquals(2, processDefinitions.get(1).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(2).getName());
- assertEquals(1, processDefinitions.get(2).getVersion());
- }
-
- public void testFindLatestProcessDefinition() {
- deployMultipleVersionsOfProcesses();
-
- ProcessDefinition retrieved =
processService.findLatestProcessDefinitionByKey("nuclear_fusion");
- assertNotNull(retrieved);
-
- assertEquals(3, retrieved.getVersion());
- assertEquals("nuclear fusion", retrieved.getName());
- assertEquals("nuclear_fusion", retrieved.getKey());
- }
-
- public void testFindProcessDefinitionById() {
- deployJpdlXmlString(
- "<process name='given' version='33'>" +
- " <start />" +
- "</process>"
- );
-
- // load it
- ProcessDefinition processDefinition =
processService.findProcessDefinitionById("given-33");
- assertNotNull(processDefinition);
- assertEquals("given", processDefinition.getName());
- assertEquals(33, processDefinition.getVersion());
- }
-
- public void testDeleteProcessDefinition() {
- processService.createDeployment()
- .addString("xmlstring.jpdl.xml",
- "<process name='deleteme' version='33'>" +
- " <start />" +
- "</process>")
- .deploy();
-
- // delete it
- processService.deleteProcessDefinition("deleteme-33");
-
- // check if the db is empty
- assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
- }
-
- public void testDeleteProcessDefinitionAndInstances() {
- processService.createDeployment()
- .addString("xmlstring.jpdl.xml",
- "<process name='deleteme' version='33'>" +
- " <start>" +
- " <transition to='w' />" +
- " </start>" +
- " <state name='w' />" +
- "</process>")
- .deploy();
-
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
-
- // delete it all
- processService.deleteProcessDefinitionCascade("deleteme-33");
-
- // check if the db is empty
- assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
- assertEquals(0, executionService.createExecutionQuery().execute().size());
- }
-
- public void testDeleteProcessDefinitionButNotInstances() {
- deployJpdlXmlString(
- "<process name='deleteme' version='33'>" +
- " <start>" +
- " <transition to='w' />" +
- " </start>" +
- " <state name='w' />" +
- "</process>"
- );
-
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
-
- // delete it all
- try {
- processService.deleteProcessDefinition("deleteme-33");
- fail("expected exception");
- } catch (JbpmException e) {
- assertTextPresent("still 4 process instances for process definition
deleteme-33", e.getMessage());
- }
- }
-
- // various other aspects ////////////////////////////////////////////////////
-
- public void testAutomaticVersioning() {
- deployJpdlXmlString(
- "<process name='versionme'>" +
- " <start />" +
- "</process>"
- );
-
- // look it up again
- List<ProcessDefinition> processDefinitions =
processService.findProcessDefinitionsByKey("versionme");
- assertNotNull(processDefinitions);
- // verify that there is only one
- assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
- ProcessDefinition processDefinition = processDefinitions.get(0);
- // and check that automatically assigned version starts with 1
- assertEquals(1, processDefinition.getVersion());
-
- deployJpdlXmlString(
- "<process name='versionme'>" +
- " <start />" +
- "</process>"
- );
-
- // look them up again
- processDefinitions =
processService.findProcessDefinitionsByKey("versionme");
- // verify that there is only one
- assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
- // and check that automatically assigned version starts with 1
- assertEquals(2, processDefinitions.get(0).getVersion());
- assertEquals(1, processDefinitions.get(1).getVersion());
- }
-
- public void testUserProvidedVersion() {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
-
- // load it
- List<ProcessDefinition> processDefinitions =
processService.findProcessDefinitionsByKey("takethis");
- assertNotNull(processDefinitions);
- assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
- ProcessDefinition processDefinition = processDefinitions.get(0);
- // verify that the user specified version was used
- // (and not overwritten by an automatically assigned versioning)
- assertEquals(234, processDefinition.getVersion());
- }
-
- public void testDuplicateUserProvidedVersion() {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
-
- try {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
- fail("expected exception");
- } catch (JbpmException e) {
- assertTextPresent("process 'takethis-234' already exists",
e.getMessage());
- }
- }
-
- /**
- * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the
processes 'ultimate seduction' and
- * 'publish book'
- */
- void deployMultipleVersionsOfProcesses() {
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='publish book'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
- }
-
- public void testMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start>" +
- " <transition to='end' />" +
- " </start>" +
- " <end name='end' />" +
- "</process>"
- );
-
- Execution execution =
executionService.startProcessInstanceByKey("minimal");
-
- assertEquals("end", execution.getActivityName());
- assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
- }
-
- public void testMostMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start />" +
- "</process>"
- );
-
- Execution execution =
executionService.startProcessInstanceByKey("minimal");
-
- assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
- }
-}
Copied:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
(from rev 4355,
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java)
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
(rev 0)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,379 @@
+/*
+ * 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.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceTest extends JbpmTestCase {
+
+ public void testProcessWithNameOnly() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .key("Insurance_claim")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Insurance claim", processDefinition.getName());
+ assertEquals("Insurance_claim", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("Insurance_claim-1", processDefinition.getId());
+ }
+
+ public void testProcessWithNameAndKey() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .key("ICL")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Insurance claim", processDefinition.getName());
+ assertEquals("ICL", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("ICL-1", processDefinition.getId());
+ }
+
+ // interface methods ////////////////////////////////////////////////////////
+
+ public void testFindProcessByKey() {
+ deployJpdlXmlString(
+ "<process name='Name with spaces'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .key("Name_with_spaces")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Name with spaces", processDefinition.getName());
+ assertEquals("Name_with_spaces", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("Name_with_spaces-1", processDefinition.getId());
+ }
+
+ public void testFindProcessDefinitions() {
+ deployMultipleVersionsOfProcesses();
+
+ List<ProcessDefinition> processDefinitions =
repositoryService.createProcessDefinitionQuery()
+ .key("nuclear_fusion")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+ assertNotNull(processDefinitions);
+
+ assertEquals("expected 3 but was " + processDefinitions.size() + ":
" + processDefinitions, 3, processDefinitions.size());
+ assertEquals("nuclear fusion", processDefinitions.get(0).getName());
+ assertEquals(3, processDefinitions.get(0).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(1).getName());
+ assertEquals(2, processDefinitions.get(1).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(2).getName());
+ assertEquals(1, processDefinitions.get(2).getVersion());
+ }
+
+ public void testFindLatestProcessDefinition() {
+ deployMultipleVersionsOfProcesses();
+
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .key("nuclear_fusion")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+ assertNotNull(processDefinition);
+
+ assertEquals(3, processDefinition.getVersion());
+ assertEquals("nuclear fusion", processDefinition.getName());
+ assertEquals("nuclear_fusion", processDefinition.getKey());
+ }
+
+ public void testFindProcessDefinitionById() {
+ deployJpdlXmlString(
+ "<process name='given' version='33'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // load it
+ ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
+ .id("given-33")
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("given", processDefinition.getName());
+ assertEquals(33, processDefinition.getVersion());
+ }
+
+ public void testDeleteDeployment() {
+ long deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start />" +
+ "</process>")
+ .deploy();
+
+ // delete it
+ repositoryService.deleteDeployment(deploymentDbid);
+
+ // check if the db is empty
+ assertEquals(0, repositoryService.createProcessDefinitionQuery().execute().size());
+ }
+
+ public void testDeleteProcessDefinitionAndInstances() {
+ long deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <transition to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>")
+ .deploy();
+
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+
+ // delete it all
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ // check if the db is empty
+ assertEquals(0, repositoryService.createProcessDefinitionQuery().execute().size());
+ assertEquals(0, executionService.createExecutionQuery().execute().size());
+ }
+
+ public void testDeleteProcessDefinitionButNotInstances() {
+ long deploymentDbid = deployJpdlXmlString(
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <transition to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+
+ // delete it all
+ try {
+ repositoryService.deleteDeployment(deploymentDbid);
+ fail("expected exception");
+ } catch (JbpmException e) {
+ assertTextPresent("cannot delete deployment", e.getMessage());
+ assertTextPresent("still executions for process(deleteme): ",
e.getMessage());
+ }
+ }
+
+ // various other aspects ////////////////////////////////////////////////////
+
+ public void testAutomaticVersioning() {
+ deployJpdlXmlString(
+ "<process name='versionme'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // look it up again
+ List<ProcessDefinition> processDefinitions =
repositoryService.createProcessDefinitionQuery()
+ .key("versionme")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ assertNotNull(processDefinitions);
+ // verify that there is only one
+ assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+ ProcessDefinition processDefinition = processDefinitions.get(0);
+ // and check that automatically assigned version starts with 1
+ assertEquals(1, processDefinition.getVersion());
+
+ deployJpdlXmlString(
+ "<process name='versionme'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // look them up again
+ processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .key("versionme")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ // verify that there is only one
+ assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
+ // and check that automatically assigned version starts with 1
+ assertEquals(2, processDefinitions.get(0).getVersion());
+ assertEquals(1, processDefinitions.get(1).getVersion());
+ }
+
+ public void testUserProvidedVersion() {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // load it
+ List<ProcessDefinition> processDefinitions =
repositoryService.createProcessDefinitionQuery()
+ .key("takethis")
+ .execute();
+
+ assertNotNull(processDefinitions);
+ assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+ ProcessDefinition processDefinition = processDefinitions.get(0);
+ // verify that the user specified version was used
+ // (and not overwritten by an automatically assigned versioning)
+ assertEquals(234, processDefinition.getVersion());
+ }
+
+ public void testDuplicateUserProvidedVersion() {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ try {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+ fail("expected exception");
+ } catch (JbpmException e) {
+ assertTextPresent("process 'takethis-234' already exists",
e.getMessage());
+ }
+ }
+
+ /**
+ * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the
processes 'ultimate seduction' and
+ * 'publish book'
+ */
+ void deployMultipleVersionsOfProcesses() {
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='publish book'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+ }
+
+ public void testMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start>" +
+ " <transition to='end' />" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Execution execution =
executionService.startProcessInstanceByKey("minimal");
+
+ assertEquals("end", execution.getActivityName());
+ assertTrue(execution.isEnded());
+ assertFalse(execution.isActive());
+ }
+
+ public void testMostMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ Execution execution =
executionService.startProcessInstanceByKey("minimal");
+
+ assertTrue(execution.isEnded());
+ assertFalse(execution.isActive());
+ }
+}
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-03-30 15:42:32 UTC
(rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-03-30 17:03:18 UTC
(rev 4359)
@@ -4,7 +4,8 @@
<process-engine-context>
- <process-service />
+ <repository-service />
+ <repository-cache />
<execution-service />
<history-service />
<management-service />
@@ -18,20 +19,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 +54,7 @@
<transaction-context>
<transaction />
+ <repository-session />
<pvm-db-session />
<job-db-session />
<task-db-session />
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.execution.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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,22 +348,4 @@
]]>
</query>
- <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 name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/trunk/modules/test-db/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.history.hbm.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.history.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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/test-db/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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
Copied: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml (from rev
4355, jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
(rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -0,0 +1,50 @@
+<?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="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-30 15:42:32
UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-30 17:03:18
UTC (rev 4359)
@@ -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,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ <property name="taskDefinitionName"
column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +167,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/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-03-30
15:42:32 UTC (rev 4358)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.wire.bindings.xml 2009-03-30
17:03:18 UTC (rev 4359)
@@ -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"
/>
@@ -59,19 +61,16 @@
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
<binding class="org.jbpm.pvm.internal.wire.binding.CommandServiceBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.ProcessServiceBinding"
/>
<binding
class="org.jbpm.pvm.internal.wire.binding.ExecutionServiceBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<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 +87,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/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
===================================================================
---
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2009-03-30
15:42:32 UTC (rev 4358)
+++
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2009-03-30
17:03:18 UTC (rev 4359)
@@ -32,7 +32,7 @@
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -119,7 +119,7 @@
public Object execute(Environment environment) throws Exception {
MessageSession messageSession = environment.get(MessageSession.class);
for (int i = 0; i < nbrOfTestExecutions; i++) {
- Execution execution = new StartExecutionCmd("excl:1", null,
"execution-" + i).execute(environment);
+ Execution execution = new StartProcessInstanceCmd("excl:1", null,
"execution-" + i).execute(environment);
for (int j = 0; j < nbrOfTestMessagesPerExecution; j++) {
CommandMessage exclusiveTestMessage =
ExclusiveTestCommand.createMessage(execution);