JBoss JBPM SVN: r3164 - projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-02 10:41:16 -0500 (Tue, 02 Dec 2008)
New Revision: 3164
Added:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java
Log:
Use interfaces for services
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java 2008-12-02 15:41:16 UTC (rev 3164)
@@ -0,0 +1,53 @@
+/*
+ * 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.jboss.bpm.api.service;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.bpm.api.deployment.Deployment;
+import org.jboss.bpm.api.model.ProcessDefinition;
+
+/**
+ * The DeploymentService creates, deployes and undeployes ProcessDefinitions.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Sep-2008
+ */
+public interface DeploymentService
+{
+ /**
+ * Create a Deployment from the given URL
+ */
+ Deployment createDeployment(URL depURL);
+
+ /**
+ * Deploy a ProcessDefinition to the ProcessDefinitionService.
+ */
+ ProcessDefinition deploy(Deployment deployment);
+
+ /**
+ * Undeploy a ProcessDefinition from the ProcessDefinitionService.
+ */
+ boolean undeploy(Deployment dep);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 5 months
JBoss JBPM SVN: r3163 - projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-02 10:40:44 -0500 (Tue, 02 Dec 2008)
New Revision: 3163
Removed:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java
Log:
Use interfaces for services
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java 2008-12-02 15:38:37 UTC (rev 3162)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DeploymentService.java 2008-12-02 15:40:44 UTC (rev 3163)
@@ -1,64 +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.jboss.bpm.api.service;
-
-//$Id$
-
-import java.net.URL;
-
-import org.jboss.bpm.api.deployment.Deployment;
-import org.jboss.bpm.api.model.ProcessDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The DeploymentService is the entry point to deploy and undeploy ProcessDefinitions.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 28-Nov-2008
- */
-public abstract class DeploymentService extends AbstractService
-{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(DeploymentService.class);
-
- // Hide public constructor
- protected DeploymentService()
- {
- }
-
- /**
- * Creates a deployment from a URL
- */
- public abstract Deployment createDeployment(URL deploymentURL);
-
-
- /**
- * Deploy the Deployment to the engine.
- */
- public abstract ProcessDefinition deploy(Deployment dep);
-
- /**
- * Undeploy the Deployment from the engine.
- */
- public abstract boolean undeploy(Deployment dep);
-}
\ No newline at end of file
15 years, 5 months
JBoss JBPM SVN: r3162 - in projects/spec/trunk/modules: api/src/main/java/org/jboss/bpm/api/service and 21 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-02 10:38:37 -0500 (Tue, 02 Dec 2008)
New Revision: 3162
Added:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDeploymentService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandlerService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractIdentityService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessDefinitionService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractTaskService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/PersistenceService.java
Removed:
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractDialectHandler.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/PersistenceService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/client/Deployment.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/DeploymentService.java
Modified:
projects/spec/trunk/modules/api/.classpath
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DialectHandlerService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ExecutionService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/IdentityService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessBuilderService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessDefinitionService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageBuilderService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalBuilderService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalService.java
projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/ThreadingService.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitMarshallerTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessDefinitionServiceTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessServiceTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/task/waitstate/WaitStateMarshallerTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/startevent/StartEventSignalTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/receive/ReceiveTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/transaction/TxRequiredMarshallerTest.java
projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/pattern/control/sequence/SequencePersistenceTest.java
projects/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/DialectHandlerImpl.java
projects/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/DialectHandlerImpl.java
projects/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/DialectHandlerImpl.java
projects/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/DialectHandlerImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/ProcessImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/PersistenceSessionInterceptor.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/TransactionInterceptor.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/DialectHandlerServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/HibernatePersistenceServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/InMemoryPersistenceServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessDefinitionServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ThreadingServiceImpl.java
projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/dialect/stp/sequence/SequenceTest.java
projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/NodePersistenceTest.java
projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessDefinitionPersistenceTest.java
projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessPersistenceTest.java
projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
Log:
Use interfaces for services
Modified: projects/spec/trunk/modules/api/.classpath
===================================================================
--- projects/spec/trunk/modules/api/.classpath 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/.classpath 2008-12-02 15:38:37 UTC (rev 3162)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractDialectHandler.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractDialectHandler.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractDialectHandler.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -1,48 +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.jboss.bpm.api.service;
-
-import org.jboss.bpm.api.client.ProcessEngine;
-
-//$Id$
-
-/**
- * The DialectHandler converts a supported dialect to the ProcessDefinition model.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public abstract class AbstractDialectHandler implements DialectHandler
-{
- private ProcessEngine engine;
-
- public ProcessEngine getProcessEngine()
- {
- return engine;
- }
-
- // Do not expose through the API
- protected void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-}
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -1,48 +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.jboss.bpm.api.service;
-
-// $Id$
-
-import org.jboss.bpm.api.client.ProcessEngine;
-
-/**
- * An abstract Service that gives access to the ProcessEngine
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class AbstractService implements Service
-{
- private ProcessEngine engine;
-
- public ProcessEngine getProcessEngine()
- {
- return engine;
- }
-
- // Do not expose through the API
- protected void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-}
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DialectHandlerService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DialectHandlerService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/DialectHandlerService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -24,35 +24,18 @@
//$Id$
import java.net.URI;
-import java.util.Map;
-
/**
* A registry that maps namespaceURI to a {@link DialectHandler}
*
* @author thomas.diesler(a)jboss.com
* @since 18-Jul-2008
*/
-public abstract class DialectHandlerService extends AbstractService
+public interface DialectHandlerService
{
- // Maps namespaceURI to a DialectHandler
- protected Map<URI, DialectHandler> dialectHandlers;
/**
* Get the handler for the dialect with the given namespace URI
*/
- public DialectHandler getDialectHandler(URI nsURI)
- {
- DialectHandler dialectHandler = dialectHandlers.get(nsURI);
- if (dialectHandler == null)
- throw new IllegalStateException("No dialect handler registered for: " + nsURI);
-
- if (dialectHandler instanceof AbstractDialectHandler)
- {
- AbstractDialectHandler absHandler = (AbstractDialectHandler)dialectHandler;
- absHandler.setProcessEngine(getProcessEngine());
- }
-
- return dialectHandler;
- }
-}
+ DialectHandler getDialectHandler(URI nsURI);
+}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ExecutionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ExecutionService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ExecutionService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -28,6 +28,7 @@
import javax.management.ObjectName;
import org.jboss.bpm.api.runtime.Token;
+import org.jboss.bpm.api.service.internal.AbstractService;
/**
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/IdentityService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/IdentityService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/IdentityService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -25,37 +25,33 @@
import java.util.List;
-
/**
* The IdentityService manages identities
*
* @author thomas.diesler(a)jboss.com
* @since 28-Nov-2008
*/
-public abstract class IdentityService extends AbstractService
+public interface IdentityService
{
- // Hide public constructor
- protected IdentityService()
- {
- }
/**
* Get a list of groups.
*/
- public abstract List<String> getGroups();
-
+ List<String> getGroups();
+
/**
* Get a list of groups a given actor belongs to.
*/
- public abstract List<String> getGroupsByActor(String actor);
-
+ List<String> getGroupsByActor(String actor);
+
/**
* Get a list of groups.
*/
- public abstract List<String> getActors();
-
+ List<String> getActors();
+
/**
* Get a list of actors that belong to a given group.
*/
- public abstract List<String> getActorsByGroup(String group);
-}
+ List<String> getActorsByGroup(String group);
+
+}
\ No newline at end of file
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/PersistenceService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/PersistenceService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/PersistenceService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -1,85 +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.jboss.bpm.api.service;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.hibernate.Session;
-import org.jboss.bpm.api.model.Node;
-import org.jboss.bpm.api.model.Process;
-import org.jboss.bpm.api.model.ProcessDefinition;
-
-/**
- * The persistence service.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 17-Sep-2008
- */
-public abstract class PersistenceService extends AbstractService
-{
- /**
- * Create a new persistence session
- */
- public abstract Session createSession();
-
- /**
- * Save the ProcessDefinition to persistent storage
- */
- public abstract ObjectName saveProcessDefinition(ProcessDefinition procDef);
-
- /**
- * Load the ProcessDefinition from persistent storage
- */
- public abstract ProcessDefinition loadProcessDefinition(ObjectName procDefID);
-
- /**
- * Delete the ProcessDefinition from persistent storage
- */
- public abstract void deleteProcessDefinition(ProcessDefinition procDef);
-
- /**
- * Save the Process to persistent storage
- */
- public abstract ObjectName saveProcess(Process proc);
-
- /**
- * Load the Process from persistent storage
- */
- public abstract Process loadProcess(ObjectName procID);
-
- /**
- * Delete the Process from persistent storage
- */
- public abstract void deleteProcess(Process proc);
-
- /**
- * Save the Node to persistent storage
- */
- public abstract ObjectName saveNode(Session session, Node node);
-
- /**
- * Load the Node from persistent storage
- */
- public abstract <T extends Node> T loadNode(Session session, Class<T> clazz, ObjectName nodeID);
-}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessBuilderService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessBuilderService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessBuilderService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -25,6 +25,7 @@
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.builder.ProcessBuilder;
+import org.jboss.bpm.api.service.internal.AbstractService;
/**
* The ProcessBuilder can be used to build a {@link Process} dynamically.
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessDefinitionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessDefinitionService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessDefinitionService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -23,22 +23,13 @@
//$Id$
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
import java.net.URL;
import java.util.Set;
import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
* The ProcessDefinitionService is the entry point to create, find and otherwise manage process definitions.
@@ -46,86 +37,36 @@
* @author thomas.diesler(a)jboss.com
* @since 25-Sep-2008
*/
-public abstract class ProcessDefinitionService extends AbstractService
+public interface ProcessDefinitionService
{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(ProcessDefinitionService.class);
-
- // Hide public constructor
- protected ProcessDefinitionService()
- {
- }
-
/**
* Register a ProcessDefinition.
*/
- public abstract ObjectName registerProcessDefinition(ProcessDefinition procDef);
+ ProcessDefinition registerProcessDefinition(ProcessDefinition procDef);
/**
* Unregister a ProcessDefinition.
*/
- public abstract boolean unregisterProcessDefinition(ObjectName procDefID);
+ boolean unregisterProcessDefinition(ObjectName procDefID);
/**
* Get a ProcessDefinition for a given id
*/
- public abstract ProcessDefinition getProcessDefinition(ObjectName procDefID);
+ ProcessDefinition getProcessDefinition(ObjectName procDefID);
/**
* Get the set of registered ProcessDefinition names
*/
- public abstract Set<ObjectName> getProcessDefinitions();
+ Set<ObjectName> getProcessDefinitions();
/**
* Create a ProcessDefinition from a XML string in one of the supported formats
*/
- public final ProcessDefinition parseProcessDefinition(String pXML)
- {
- URI nsURI = getNamespaceURI(new ByteArrayInputStream(pXML.getBytes()));
- DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
- DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
- if (dialectHandler == null)
- throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
-
- ProcessDefinition procDef = dialectHandler.parseProcessDefinition(pXML);
- return procDef;
- }
+ ProcessDefinition parseProcessDefinition(String pXML);
/**
* Create a ProcessDefinition from an URL to a XML descritor in one of the supported formats
*/
- public final ProcessDefinition parseProcessDefinition(URL pURL) throws IOException
- {
- URI nsURI = getNamespaceURI(pURL.openStream());
- DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
- DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
- if (dialectHandler == null)
- throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
-
- ProcessDefinition procDef = dialectHandler.parseProcessDefinition(pURL);
- return procDef;
- }
-
- private URI getNamespaceURI(InputStream procXML)
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- Document doc;
- try
- {
- DocumentBuilder db = dbf.newDocumentBuilder();
- doc = db.parse(procXML);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot parse process descriptor", ex);
- }
+ ProcessDefinition parseProcessDefinition(URL pURL) throws IOException;
- Element root = doc.getDocumentElement();
- String nsURI = root.getNamespaceURI();
- if (nsURI == null)
- throw new IllegalStateException("Cannot get namespace URI from root element");
-
- return URI.create(nsURI);
- }
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/ProcessService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -36,32 +36,28 @@
* @author thomas.diesler(a)jboss.com
* @since 25-Sep-2008
*/
-public abstract class ProcessService extends AbstractService
+public interface ProcessService
{
- // Hide public constructor
- protected ProcessService()
- {
- }
/**
* Register a Process.
*/
- public abstract ObjectName registerProcess(Process proc);
+ ObjectName registerProcess(Process proc);
/**
* Unregister a Process.
*/
- public abstract boolean unregisterProcess(ObjectName procID);
+ boolean unregisterProcess(ObjectName procID);
/**
* Get a Process for a given id
*/
- public abstract Process getProcess(ObjectName procID);
+ Process getProcess(ObjectName procID);
/**
* Get the set of registered Processes
*/
- public abstract Set<ObjectName> getProcesses();
+ Set<ObjectName> getProcesses();
/**
* Get the set of Processes for a given ProcessDefinition
@@ -70,5 +66,6 @@
* @param status The optional process status
* @return An empty set if the process cannot be found
*/
- public abstract Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status);
+ Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status);
+
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/TaskService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -21,7 +21,7 @@
*/
package org.jboss.bpm.api.service;
-// $Id$
+//$Id$
import java.util.List;
@@ -29,25 +29,21 @@
import org.jboss.bpm.api.task.Task;
-
/**
* The TaskService manages Tasks.
*
* @author thomas.diesler(a)jboss.com
* @since 28-Nov-2008
*/
-public abstract class TaskService extends AbstractService
+public interface TaskService
{
- // Hide public constructor
- protected TaskService()
- {
- }
- public abstract Task getTask(ObjectName taskID);
+ Task getTask(ObjectName taskID);
- public abstract List<Task> getTasksByActor(String actor);
+ List<Task> getTasksByActor(String actor);
- public abstract void reassignTask(ObjectName taskID, String actor);
-
- public abstract void closeTask(ObjectName taskID, String signalName);
-}
+ void reassignTask(ObjectName taskID, String actor);
+
+ void closeTask(ObjectName taskID, String signalName);
+
+}
\ No newline at end of file
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDeploymentService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDeploymentService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.api.service.internal;
+
+import org.jboss.bpm.api.service.DeploymentService;
+
+//$Id$
+
+
+/**
+ * The DeploymentService creates, deployes and undeployes ProcessDefinitions.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractDeploymentService extends AbstractService implements DeploymentService
+{
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDeploymentService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandler.java (from rev 3150, projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractDialectHandler.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandler.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandler.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -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.jboss.bpm.api.service.internal;
+
+//$Id$
+
+import org.jboss.bpm.api.client.ProcessEngine;
+import org.jboss.bpm.api.service.DialectHandler;
+
+
+/**
+ * The DialectHandler converts a supported dialect to the ProcessDefinition model.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class AbstractDialectHandler implements DialectHandler
+{
+ private ProcessEngine engine;
+
+ public ProcessEngine getProcessEngine()
+ {
+ return engine;
+ }
+
+ // Do not expose through the API
+ protected void setProcessEngine(ProcessEngine engine)
+ {
+ this.engine = engine;
+ }
+}
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandlerService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandlerService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandlerService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.api.service.internal;
+
+//$Id$
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jboss.bpm.api.service.DialectHandler;
+import org.jboss.bpm.api.service.DialectHandlerService;
+
+
+/**
+ * A registry that maps namespaceURI to a {@link DialectHandler}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jul-2008
+ */
+public abstract class AbstractDialectHandlerService extends AbstractService implements DialectHandlerService
+{
+ // Maps namespaceURI to a DialectHandler
+ protected Map<URI, DialectHandler> dialectHandlers;
+
+ public DialectHandler getDialectHandler(URI nsURI)
+ {
+ DialectHandler dialectHandler = dialectHandlers.get(nsURI);
+ if (dialectHandler == null)
+ throw new IllegalStateException("No dialect handler registered for: " + nsURI);
+
+ if (dialectHandler instanceof AbstractDialectHandler)
+ {
+ AbstractDialectHandler absHandler = (AbstractDialectHandler)dialectHandler;
+ absHandler.setProcessEngine(getProcessEngine());
+ }
+
+ return dialectHandler;
+ }
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractDialectHandlerService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractIdentityService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractIdentityService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractIdentityService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.api.service.internal;
+
+// $Id$
+
+import org.jboss.bpm.api.service.IdentityService;
+
+/**
+ * The IdentityService manages identities
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Nov-2008
+ */
+public abstract class AbstractIdentityService extends AbstractService implements IdentityService
+{
+ // Hide public constructor
+ protected AbstractIdentityService()
+ {
+ }
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractIdentityService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessDefinitionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessDefinitionService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessDefinitionService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,108 @@
+/*
+ * 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.jboss.bpm.api.service.internal;
+
+//$Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.bpm.api.model.ProcessDefinition;
+import org.jboss.bpm.api.service.DialectHandler;
+import org.jboss.bpm.api.service.DialectHandlerService;
+import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * The ProcessDefinitionService is the entry point to create, find and otherwise manage process definitions.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractProcessDefinitionService extends AbstractService implements ProcessDefinitionService
+{
+ // Provide logging
+ final static Logger log = LoggerFactory.getLogger(AbstractProcessDefinitionService.class);
+
+ // Hide public constructor
+ protected AbstractProcessDefinitionService()
+ {
+ }
+
+ @Override
+ public final ProcessDefinition parseProcessDefinition(String pXML)
+ {
+ URI nsURI = getNamespaceURI(new ByteArrayInputStream(pXML.getBytes()));
+ DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
+ DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+ if (dialectHandler == null)
+ throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+
+ ProcessDefinition procDef = dialectHandler.parseProcessDefinition(pXML);
+ return procDef;
+ }
+
+ @Override
+ public final ProcessDefinition parseProcessDefinition(URL pURL) throws IOException
+ {
+ URI nsURI = getNamespaceURI(pURL.openStream());
+ DialectHandlerService dhService = getProcessEngine().getService(DialectHandlerService.class);
+ DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
+ if (dialectHandler == null)
+ throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
+
+ ProcessDefinition procDef = dialectHandler.parseProcessDefinition(pURL);
+ return procDef;
+ }
+
+ private URI getNamespaceURI(InputStream procXML)
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ Document doc;
+ try
+ {
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ doc = db.parse(procXML);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot parse process descriptor", ex);
+ }
+
+ Element root = doc.getDocumentElement();
+ String nsURI = root.getNamespaceURI();
+ if (nsURI == null)
+ throw new IllegalStateException("Cannot get namespace URI from root element");
+
+ return URI.create(nsURI);
+ }
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessDefinitionService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.api.service.internal;
+
+//$Id$
+
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.api.model.Process;
+import org.jboss.bpm.api.model.Process.ProcessStatus;
+import org.jboss.bpm.api.service.ProcessService;
+
+/**
+ * The ProcessService is the entry point to create, find and otherwise manage processes.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractProcessService extends AbstractService implements ProcessService
+{
+ // Hide public constructor
+ protected AbstractProcessService()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bpm.api.service.internal.ProcessService#registerProcess(org.jboss.bpm.api.model.Process)
+ */
+ public abstract ObjectName registerProcess(Process proc);
+
+ /* (non-Javadoc)
+ * @see org.jboss.bpm.api.service.internal.ProcessService#unregisterProcess(javax.management.ObjectName)
+ */
+ public abstract boolean unregisterProcess(ObjectName procID);
+
+ /* (non-Javadoc)
+ * @see org.jboss.bpm.api.service.internal.ProcessService#getProcess(javax.management.ObjectName)
+ */
+ public abstract Process getProcess(ObjectName procID);
+
+ /* (non-Javadoc)
+ * @see org.jboss.bpm.api.service.internal.ProcessService#getProcesses()
+ */
+ public abstract Set<ObjectName> getProcesses();
+
+ /* (non-Javadoc)
+ * @see org.jboss.bpm.api.service.internal.ProcessService#getProcesses(javax.management.ObjectName, org.jboss.bpm.api.model.Process.ProcessStatus)
+ */
+ public abstract Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status);
+}
\ No newline at end of file
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractProcessService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractService.java (from rev 3150, projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/AbstractService.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,49 @@
+/*
+ * 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.jboss.bpm.api.service.internal;
+
+// $Id$
+
+import org.jboss.bpm.api.client.ProcessEngine;
+import org.jboss.bpm.api.service.Service;
+
+/**
+ * An abstract Service that gives access to the ProcessEngine
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class AbstractService implements Service
+{
+ private ProcessEngine engine;
+
+ public ProcessEngine getProcessEngine()
+ {
+ return engine;
+ }
+
+ // Do not expose through the API
+ protected void setProcessEngine(ProcessEngine engine)
+ {
+ this.engine = engine;
+ }
+}
Added: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractTaskService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractTaskService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractTaskService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.api.service.internal;
+
+import org.jboss.bpm.api.service.TaskService;
+
+// $Id$
+
+/**
+ * The TaskService manages Tasks.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Nov-2008
+ */
+public abstract class AbstractTaskService extends AbstractService implements TaskService
+{
+ // Hide public constructor
+ protected AbstractTaskService()
+ {
+ }
+}
Property changes on: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/internal/AbstractTaskService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/client/Deployment.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/client/Deployment.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/client/Deployment.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.incubator.client;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.bpm.api.client.ProcessEngine;
-import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.DialectHandler;
-import org.jboss.bpm.api.service.DialectHandlerService;
-import org.jboss.bpm.api.service.ProcessService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * A deployment, containing all information to create a process that will be deployed to the {@link ProcessService}
- *
- * @author Tom Baeyens
- * @author thomas.diesler(a)jboss.com
- * @since 25-Sep-2008
- */
-public class Deployment implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String procXML;
- private ProcessDefinition process;
-
- public Deployment(String procXML)
- {
- if (procXML == null)
- throw new IllegalArgumentException("Null process definition");
-
- this.procXML = procXML;
- }
-
- public Deployment(URL procURL) throws IOException
- {
- if (procURL == null)
- throw new IllegalArgumentException("Null process definition");
-
- StringBuilder strBuilder = new StringBuilder();
- BufferedReader br = new BufferedReader(new InputStreamReader(procURL.openStream()));
- String line = br.readLine();
- while (line != null)
- {
- strBuilder.append(line);
- line = br.readLine();
- }
- procXML = strBuilder.toString();
- }
-
- public Deployment(ProcessDefinition procDef)
- {
- this.process = procDef;
- }
-
- public ProcessDefinition getProcessDefinition(ProcessEngine engine)
- {
- if (process == null)
- {
- DialectHandlerService dhService = engine.getService(DialectHandlerService.class);
- if (dhService == null)
- throw new IllegalStateException("DialectHandlerService not registered");
-
- URI nsURI = getNamespaceURI();
- DialectHandler dialectHandler = dhService.getDialectHandler(nsURI);
- if (dialectHandler == null)
- throw new IllegalStateException("Cannot obtain DialectHandler for: " + nsURI);
-
- process = dialectHandler.parseProcessDefinition(procXML);
- }
- return process;
- }
-
- private URI getNamespaceURI()
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- Document doc;
- try
- {
- DocumentBuilder db = dbf.newDocumentBuilder();
- doc = db.parse(new ByteArrayInputStream(procXML.getBytes()));
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot parse process descriptor", ex);
- }
-
- Element root = doc.getDocumentElement();
- String nsURI = root.getNamespaceURI();
- if (nsURI == null)
- throw new IllegalStateException("Cannot get namespace URI from root element");
-
- return URI.create(nsURI);
- }
-}
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/DeploymentService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/DeploymentService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/DeploymentService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -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.jboss.bpm.incubator.service;
-
-//$Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.bpm.api.service.Service;
-import org.jboss.bpm.incubator.client.Deployment;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The marker interface for all Services
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Sep-2008
- */
-public abstract class DeploymentService implements Service
-{
- // Provide logging
- final static Logger log = LoggerFactory.getLogger(DeploymentService.class);
-
- /**
- * Deploy a new process to the process service.
- */
- ObjectName deploy(Deployment deployment)
- {
- return null;
- }
-}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageBuilderService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageBuilderService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageBuilderService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -25,7 +25,7 @@
import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
-import org.jboss.bpm.api.service.AbstractService;
+import org.jboss.bpm.api.service.internal.AbstractService;
import org.jboss.bpm.incubator.model.Message;
import org.jboss.bpm.incubator.model.builder.MessageBuilder;
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/MessageService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -37,8 +37,9 @@
import org.jboss.bpm.api.model.Node;
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.Task;
-import org.jboss.bpm.api.service.AbstractService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
+import org.jboss.bpm.api.service.internal.AbstractService;
import org.jboss.bpm.incubator.client.MessageListener;
import org.jboss.bpm.incubator.model.Message;
import org.jboss.bpm.incubator.model.Participant;
Copied: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/PersistenceService.java (from rev 3150, projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/api/service/PersistenceService.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/PersistenceService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/PersistenceService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -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.jboss.bpm.incubator.service;
+
+// $Id$
+
+import javax.management.ObjectName;
+
+import org.hibernate.Session;
+import org.jboss.bpm.api.model.Node;
+import org.jboss.bpm.api.model.Process;
+import org.jboss.bpm.api.model.ProcessDefinition;
+import org.jboss.bpm.api.service.internal.AbstractService;
+
+/**
+ * The persistence service.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Sep-2008
+ */
+public abstract class PersistenceService extends AbstractService
+{
+ /**
+ * Create a new persistence session
+ */
+ public abstract Session createSession();
+
+ /**
+ * Save the ProcessDefinition to persistent storage
+ */
+ public abstract ObjectName saveProcessDefinition(ProcessDefinition procDef);
+
+ /**
+ * Load the ProcessDefinition from persistent storage
+ */
+ public abstract ProcessDefinition loadProcessDefinition(ObjectName procDefID);
+
+ /**
+ * Delete the ProcessDefinition from persistent storage
+ */
+ public abstract void deleteProcessDefinition(ProcessDefinition procDef);
+
+ /**
+ * Save the Process to persistent storage
+ */
+ public abstract ObjectName saveProcess(Process proc);
+
+ /**
+ * Load the Process from persistent storage
+ */
+ public abstract Process loadProcess(ObjectName procID);
+
+ /**
+ * Delete the Process from persistent storage
+ */
+ public abstract void deleteProcess(Process proc);
+
+ /**
+ * Save the Node to persistent storage
+ */
+ public abstract ObjectName saveNode(Session session, Node node);
+
+ /**
+ * Load the Node from persistent storage
+ */
+ public abstract <T extends Node> T loadNode(Session session, Class<T> clazz, ObjectName nodeID);
+}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalBuilderService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalBuilderService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalBuilderService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -25,7 +25,7 @@
import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
-import org.jboss.bpm.api.service.AbstractService;
+import org.jboss.bpm.api.service.internal.AbstractService;
import org.jboss.bpm.incubator.model.Signal;
import org.jboss.bpm.incubator.model.builder.SignalBuilder;
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/SignalService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -29,7 +29,7 @@
import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
-import org.jboss.bpm.api.service.AbstractService;
+import org.jboss.bpm.api.service.internal.AbstractService;
import org.jboss.bpm.incubator.client.SignalListener;
import org.jboss.bpm.incubator.model.Signal;
import org.slf4j.Logger;
Modified: projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/ThreadingService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/ThreadingService.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/api/src/main/java/org/jboss/bpm/incubator/service/ThreadingService.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -30,7 +30,7 @@
import org.jboss.bpm.api.model.StartEvent;
import org.jboss.bpm.api.model.Process.ProcessStatus;
import org.jboss.bpm.api.runtime.Attachments;
-import org.jboss.bpm.api.service.AbstractService;
+import org.jboss.bpm.api.service.internal.AbstractService;
/**
* The ThreadingService executes processes
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitMarshallerTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitMarshallerTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/gateway/exclusive/ExclusiveGatewaySplitMarshallerTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -27,6 +27,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
/**
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessDefinitionServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessDefinitionServiceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessDefinitionServiceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -32,6 +32,8 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.service.ProcessDefinitionService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.api.test.ProcessCatalog;
@@ -79,9 +81,8 @@
ProcessEngine engine = procDef.getProcessEngine();
ProcessDefinitionService procDefService = engine.getService(ProcessDefinitionService.class);
- ObjectName procDefID = procDefService.registerProcessDefinition(procDef);
- assertSame(procDef, procDefService.getProcessDefinition(procDefID));
- assertEquals(procDefID, procDef.getKey());
+ procDef = procDefService.registerProcessDefinition(procDef);
+ assertNotNull("Registered ProcessDefinition not null", procDef);
boolean success = procDefService.unregisterProcessDefinition(procDef.getKey());
assertTrue("ProcessDefinition unregistered", success);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessServiceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessServiceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/service/process/ProcessServiceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -28,6 +28,7 @@
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.builder.ProcessBuilder;
+import org.jboss.bpm.api.runtime.Token;
import org.jboss.bpm.api.service.ProcessBuilderService;
import org.jboss.bpm.api.service.ProcessDefinitionService;
import org.jboss.bpm.api.service.ProcessService;
@@ -67,6 +68,29 @@
assertNull("ProcessDefinition unregistered", procDefService.getProcessDefinition(procDef.getKey()));
}
+ public void testStartProcess() throws Exception
+ {
+ ProcessDefinitionService procDefService = getProcessEngine().getService(ProcessDefinitionService.class);
+ ProcessService procService = getProcessEngine().getService(ProcessService.class);
+
+ ProcessDefinition procDef = getProcessDefinition();
+ Process proc = procDef.newInstance();
+
+ Token token = proc.startProcess();
+ assertNotNull("Token not null", token);
+
+ ObjectName procID = proc.getKey();
+ assertNotNull("Process registered", procService.getProcess(procID));
+
+ // Unregister the process
+ procService.unregisterProcess(procID);
+ assertNull("Process unregistered", procService.getProcess(procID));
+ assertNotNull("ProcessDefinition still registered", procDefService.getProcessDefinition(procDef.getKey()));
+
+ procDefService.unregisterProcessDefinition(procDef.getKey());
+ assertNull("ProcessDefinition unregistered", procDefService.getProcessDefinition(procDef.getKey()));
+ }
+
private ProcessDefinition getProcessDefinition()
{
ProcessBuilderService pbService = getProcessEngine().getService(ProcessBuilderService.class);
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/task/waitstate/WaitStateMarshallerTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/task/waitstate/WaitStateMarshallerTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/cts/task/waitstate/WaitStateMarshallerTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -25,6 +25,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
// $Id$
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/startevent/StartEventSignalTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/startevent/StartEventSignalTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/startevent/StartEventSignalTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -34,6 +34,8 @@
import org.jboss.bpm.api.service.ProcessBuilderService;
import org.jboss.bpm.api.service.ProcessDefinitionService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.incubator.client.ProcessExt;
import org.jboss.bpm.incubator.client.SignalListener;
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/receive/ReceiveTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/receive/ReceiveTaskTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/receive/ReceiveTaskTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -34,6 +34,8 @@
import org.jboss.bpm.api.service.ProcessBuilderService;
import org.jboss.bpm.api.service.ProcessDefinitionService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.incubator.client.ProcessExt;
import org.jboss.bpm.incubator.client.SignalListener;
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/task/user/UserTaskTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -36,6 +36,7 @@
import org.jboss.bpm.api.runtime.BasicAttachments;
import org.jboss.bpm.api.service.ProcessBuilderService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.incubator.client.MessageListener;
import org.jboss.bpm.incubator.client.ProcessExt;
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/transaction/TxRequiredMarshallerTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/transaction/TxRequiredMarshallerTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/incubator/transaction/TxRequiredMarshallerTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -27,6 +27,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
/**
* Test two tasks with Tx attribute REQUIRED
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/pattern/control/sequence/SequencePersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/pattern/control/sequence/SequencePersistenceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jboss/bpm/test/pattern/control/sequence/SequencePersistenceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -28,7 +28,7 @@
import javax.management.ObjectName;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.PersistenceService;
+import org.jboss.bpm.incubator.service.PersistenceService;
/**
* Test the basic execution sequence
Modified: projects/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/DialectHandlerImpl.java
===================================================================
--- projects/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/DialectHandlerImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/DialectHandlerImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -34,7 +34,7 @@
import org.jboss.bpm.api.InvalidProcessException;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.AbstractDialectHandler;
+import org.jboss.bpm.api.service.internal.AbstractDialectHandler;
/**
* The DialectHandler converts a supported dialect to the internal Process model.
Modified: projects/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/DialectHandlerImpl.java
===================================================================
--- projects/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/DialectHandlerImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/DialectHandlerImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -35,7 +35,7 @@
import org.jboss.bpm.api.InvalidProcessException;
import org.jboss.bpm.api.NotImplementedException;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.AbstractDialectHandler;
+import org.jboss.bpm.api.service.internal.AbstractDialectHandler;
import org.jboss.bpm.dialect.jpdl32.model.JPDL32ProcessDefinition;
Modified: projects/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/DialectHandlerImpl.java
===================================================================
--- projects/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/DialectHandlerImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/DialectHandlerImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -34,7 +34,7 @@
import org.jboss.bpm.api.InvalidProcessException;
import org.jboss.bpm.api.NotImplementedException;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.AbstractDialectHandler;
+import org.jboss.bpm.api.service.internal.AbstractDialectHandler;
/**
* The DialectHandler converts a supported dialect to the internal Process model.
Modified: projects/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/DialectHandlerImpl.java
===================================================================
--- projects/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/DialectHandlerImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/dialects/xpdl21/src/main/java/org/jboss/bpm/dialect/xpdl21/DialectHandlerImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -35,7 +35,7 @@
import org.jboss.bpm.api.InvalidProcessException;
import org.jboss.bpm.api.NotImplementedException;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.AbstractDialectHandler;
+import org.jboss.bpm.api.service.internal.AbstractDialectHandler;
import org.jboss.bpm.dialect.xpdl21.model.XPDLWorkflowProcess;
/**
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/ProcessImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/model/ProcessImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -53,6 +53,7 @@
import org.jboss.bpm.api.runtime.Token;
import org.jboss.bpm.api.runtime.Token.TokenStatus;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.incubator.client.ProcessExt;
import org.jboss.bpm.incubator.model.Assignment;
import org.jboss.bpm.incubator.model.Group;
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/PersistenceSessionInterceptor.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/PersistenceSessionInterceptor.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/PersistenceSessionInterceptor.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -26,7 +26,7 @@
import org.hibernate.Session;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.runtime.Token.TokenStatus;
-import org.jboss.bpm.api.service.PersistenceService;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/TransactionInterceptor.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/TransactionInterceptor.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/runtime/TransactionInterceptor.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -30,11 +30,11 @@
import org.jboss.bpm.api.Constants.TxType;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.model.Node;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.incubator.model.Group;
import org.jboss.bpm.incubator.model.NodeExt;
import org.jboss.bpm.incubator.model.Property;
import org.jboss.bpm.incubator.model.Group.GroupType;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/DialectHandlerServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/DialectHandlerServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/DialectHandlerServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -28,7 +28,7 @@
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.service.DialectHandler;
-import org.jboss.bpm.api.service.DialectHandlerService;
+import org.jboss.bpm.api.service.internal.AbstractDialectHandlerService;
/**
* A registry that maps namespaceURI to a {@link DialectHandler}
@@ -36,7 +36,7 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public class DialectHandlerServiceImpl extends DialectHandlerService implements MutableService
+public class DialectHandlerServiceImpl extends AbstractDialectHandlerService implements MutableService
{
@Override
public void setProcessEngine(ProcessEngine engine)
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/HibernatePersistenceServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/HibernatePersistenceServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/HibernatePersistenceServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -40,8 +40,8 @@
import org.jboss.bpm.api.model.Node;
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.api.service.Service;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.jboss.bpm.ri.model.AbstractElementImpl;
import org.jboss.bpm.ri.model.ProcessDefinitionImpl;
import org.jboss.bpm.ri.model.ProcessImpl;
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/InMemoryPersistenceServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/InMemoryPersistenceServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/InMemoryPersistenceServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -34,7 +34,7 @@
import org.jboss.bpm.api.model.Node;
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.PersistenceService;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessDefinitionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessDefinitionServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessDefinitionServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -32,9 +32,10 @@
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.model.ProcessDefinition;
-import org.jboss.bpm.api.service.PersistenceService;
-import org.jboss.bpm.api.service.ProcessDefinitionService;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.jboss.bpm.ri.model.ProcessDefinitionImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +46,7 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public class ProcessDefinitionServiceImpl extends ProcessDefinitionService implements MutableService
+public class ProcessDefinitionServiceImpl extends AbstractProcessDefinitionService implements MutableService
{
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
@@ -72,7 +73,7 @@
}
@Override
- public ObjectName registerProcessDefinition(ProcessDefinition procDef)
+ public ProcessDefinition registerProcessDefinition(ProcessDefinition procDef)
{
if (getProcessDefinition(procDef.getKey()) != null)
throw new IllegalStateException("Process definition already registered: " + procDef);
@@ -87,7 +88,7 @@
ProcessDefinitionImpl procDefImpl = (ProcessDefinitionImpl)procDef;
procDefImpl.register(procDef);
- return procDefID;
+ return procDef;
}
@Override
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ProcessServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -37,9 +37,10 @@
import org.jboss.bpm.api.model.Process;
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.Process.ProcessStatus;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.api.service.ProcessDefinitionService;
-import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.jboss.bpm.ri.model.ProcessImpl;
import org.jboss.bpm.ri.runtime.NodeInterceptor;
import org.slf4j.Logger;
@@ -51,7 +52,7 @@
* @author thomas.diesler(a)jboss.com
* @since 18-Jun-2008
*/
-public class ProcessServiceImpl extends ProcessService implements MutableService
+public class ProcessServiceImpl extends AbstractProcessService implements MutableService
{
// Provide logging
final static Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class);
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ThreadingServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ThreadingServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/ri/service/ThreadingServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -38,6 +38,7 @@
import org.jboss.bpm.api.runtime.Attachments;
import org.jboss.bpm.api.runtime.Token;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.incubator.client.ProcessExt;
import org.jboss.bpm.incubator.model.Assignment;
import org.jboss.bpm.incubator.model.Assignment.AssignTime;
Modified: projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/dialect/stp/sequence/SequenceTest.java
===================================================================
--- projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/dialect/stp/sequence/SequenceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/dialect/stp/sequence/SequenceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -27,6 +27,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
import org.jboss.bpm.api.test.APITestCase;
/**
Modified: projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/NodePersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/NodePersistenceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/NodePersistenceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -27,8 +27,8 @@
import org.hibernate.Session;
import org.jboss.bpm.api.model.Node;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.api.test.CTSTestCase;
+import org.jboss.bpm.incubator.service.PersistenceService;
import org.jboss.bpm.ri.service.HibernatePersistenceServiceImpl;
/**
Modified: projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessDefinitionPersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessDefinitionPersistenceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessDefinitionPersistenceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -31,9 +31,9 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.StartEvent;
import org.jboss.bpm.api.model.Task;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.api.test.ProcessCatalog;
+import org.jboss.bpm.incubator.service.PersistenceService;
/**
* Test the PersistenceService
Modified: projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessPersistenceTest.java
===================================================================
--- projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessPersistenceTest.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/ri/src/test/java/org/jboss/bpm/test/ri/service/persistence/ProcessPersistenceTest.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -32,10 +32,11 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.StartEvent;
import org.jboss.bpm.api.model.Task;
-import org.jboss.bpm.api.service.PersistenceService;
import org.jboss.bpm.api.service.ProcessDefinitionService;
+import org.jboss.bpm.api.service.internal.AbstractProcessDefinitionService;
import org.jboss.bpm.api.test.CTSTestCase;
import org.jboss.bpm.api.test.ProcessCatalog;
+import org.jboss.bpm.incubator.service.PersistenceService;
/**
* Test the PersistenceService
Modified: projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
+++ projects/spec/trunk/modules/samples/airticket/server/src/main/java/org/jboss/bpm/samples/airticket/server/AirticketServiceImpl.java 2008-12-02 15:38:37 UTC (rev 3162)
@@ -11,6 +11,7 @@
import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.builder.ObjectNameFactory;
import org.jboss.bpm.api.service.ProcessService;
+import org.jboss.bpm.api.service.internal.AbstractProcessService;
import org.jboss.bpm.incubator.client.MessageListener;
import org.jboss.bpm.incubator.client.ProcessExt;
import org.jboss.bpm.incubator.client.SignalListener;
15 years, 5 months
JBoss JBPM SVN: r3161 - in jbpm4/trunk/modules: task/src/main/java/org/jbpm/task/impl and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-02 05:16:43 -0500 (Tue, 02 Dec 2008)
New Revision: 3161
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
Log:
extracted scope behavior (variables and timers) in ScopeInstanceImpl so that Task can leverage it
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2008-12-02 08:46:03 UTC (rev 3160)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -22,11 +22,8 @@
package org.jbpm.pvm.internal.model;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.jbpm.model.CompositeElement;
import org.jbpm.model.Node;
@@ -34,16 +31,11 @@
/**
* @author Tom Baeyens
*/
-public abstract class CompositeElementImpl extends ObservableElementImpl implements CompositeElement {
+public abstract class CompositeElementImpl extends ScopeElementImpl implements CompositeElement {
private static final long serialVersionUID = 1L;
protected List<NodeImpl> nodes;
- protected boolean hasVariableDefinitions;
- protected List<VariableDefinitionImpl> variableDefinitions;
- protected boolean hasTimerDefinitions;
- protected Set<TimerDefinitionImpl> timerDefinitions;
-
transient protected Map<String, NodeImpl> nodesMap;
// nested nodes /////////////////////////////////////////////////////////////
@@ -158,41 +150,4 @@
return ((nodes!=null) && (!nodes.isEmpty()));
}
- // variable definitions /////////////////////////////////////////////////////
-
- public List<VariableDefinitionImpl> getVariableDefinitions() {
- if (!hasVariableDefinitions) {
- return Collections.EMPTY_LIST;
- }
- return (List) variableDefinitions;
- }
-
- public VariableDefinitionImpl createVariableDefinition() {
- VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
- if (variableDefinitions==null) {
- variableDefinitions = new ArrayList<VariableDefinitionImpl>();
- }
- variableDefinitions.add(variableDefinition);
- hasVariableDefinitions = true;
- return variableDefinition;
- }
-
- // timer definitions ////////////////////////////////////////////////////////
-
- public Set<TimerDefinitionImpl> getTimerDefinitions() {
- if (!hasTimerDefinitions) {
- return Collections.EMPTY_SET;
- }
- return timerDefinitions;
- }
-
- public TimerDefinitionImpl createTimerDefinition() {
- TimerDefinitionImpl timerDefinition = new TimerDefinitionImpl();
- if (timerDefinitions==null) {
- timerDefinitions = new HashSet<TimerDefinitionImpl>();
- }
- timerDefinitions.add(timerDefinition);
- hasTimerDefinitions = true;
- return timerDefinition;
- }
}
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 2008-12-02 08:46:03 UTC (rev 3160)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -80,7 +80,8 @@
/**
* @author Tom Baeyens
*/
-public class ExecutionImpl implements ClientProcessInstance,
+public class ExecutionImpl extends ScopeInstanceImpl
+ implements ClientProcessInstance,
ActivityExecution,
EventListenerExecution,
Serializable {
@@ -95,9 +96,6 @@
public static final AtomicOperation TAKE_TRANSITION = new TakeTransition();
public static final AtomicOperation PROPAGATE_TO_PARENT = new MoveToParentNode();
- protected long dbid;
- protected int dbversion;
-
/** an optional name for this execution. can be used to
* differentiate concurrent paths of execution like e.g.
* the 'shipping' and 'billing' paths. */
@@ -110,9 +108,6 @@
/** a unique id for this execution. */
protected String id;
- /** @see Execution */
- protected String state;
-
protected ProcessDefinitionImpl processDefinition;
// current position /////////////////////////////////////////////////////////
@@ -139,12 +134,8 @@
protected ExecutionImpl parent = null;
protected ExecutionImpl processInstance;
- boolean hasVariables;
- protected Map<String, Variable> variables;
+ protected ScopeInstanceImpl scopeInstanceImpl;
- boolean hasTimers;
- protected Set<TimerImpl> timers;
-
/** the super process link in case this is a sub process execution */
protected ExecutionImpl superProcessExecution;
@@ -210,8 +201,8 @@
if (state!=STATE_CREATED) {
throw new JbpmException(toString()+" is already begun: "+state);
}
- ExecutionImpl scopedExecution = initializeScopes();
this.state = STATE_ACTIVE;
+ ExecutionImpl scopedExecution = initializeScopes();
fire(Event.PROCESS_BEGIN, processDefinition);
if (node!=null) {
scopedExecution.performAtomicOperation(EXECUTE_NODE);
@@ -249,7 +240,7 @@
return scopedExecution;
}
- public ExecutionImpl createScope(CompositeElementImpl scope) {
+ public ExecutionImpl createScope(ScopeElementImpl scope) {
ExecutionImpl child = createExecution(scope.getName());
// copy the current state from the child execution to the parent execution
@@ -572,421 +563,6 @@
}
}
- // variables ////////////////////////////////////////////////////////////////
-
- protected void initializeVariables(CompositeElementImpl scope, ExecutionImpl outerExecution) {
- // loop over all variable definitions
- List<VariableDefinitionImpl> variableDefinitions = scope.getVariableDefinitions();
- if (!variableDefinitions.isEmpty()){
- if (log.isTraceEnabled()) {
- log.trace("initializing variables in scope "+scope);
- }
- variables = new HashMap<String, Variable>();
- for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
- String key = variableDefinition.getKey();
- Object value = variableDefinition.getSourceValue(outerExecution);
- Type type = variableDefinition.getType();
- createVariable(key, value, type);
- }
- }
- }
-
- protected void destroyVariables(CompositeElementImpl scope, ExecutionImpl outerExecution) {
- // loop over all variable definitions
- List<VariableDefinitionImpl> variableDefinitions = scope.getVariableDefinitions();
- if (variableDefinitions!=null) {
- if (log.isTraceEnabled()) {
- log.trace("destroying var scope "+scope);
- }
-
- for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
- String destination = variableDefinition.getDestination();
- if (destination!=null) {
- String key = variableDefinition.getKey();
- Object value = variableDefinition.getDestinationValue(this);
- outerExecution.setVariable(key, value);
- }
- }
- }
- }
-
-
- public void createVariable(String key, Object value) {
- createVariable(key, value, null, null);
- }
-
- public void createVariable(String key, Object value, String typeName) {
- createVariable(key, value, typeName, null);
- }
-
- public void createVariable(String key, Object value, Type type) {
- createVariable(key, value, null, type);
- }
-
- public void createVariable(String key, Object value, String typeName, Type type) {
- if (isFinished()) {
- throw new JbpmException("can't create variable '"+key+"' on "+this+": "+state);
- }
-
- log.debug("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
-
- if (type==null) {
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- VariableTypeResolver variableTypeResolver = environment.get(VariableTypeResolver.class);
- if (variableTypeResolver!=null) {
- if (typeName!=null) {
- type = variableTypeResolver.findTypeByName(typeName);
- }
- if (type==null) {
- type = variableTypeResolver.findTypeByMatch(key, value);
- }
- }
- }
- }
-
- Variable variable = null;
-
- if (type!=null) {
- Class<?> variableClass = type.getVariableClass();
- try {
- log.trace("creating new "+type+" variable "+key);
- variable = (Variable) variableClass.newInstance();
- } catch (Exception e) {
- throw new JbpmException("couldn't instantiate variable instance class '"+variableClass.getName()+"'");
- }
- Converter converter = type.getConverter();
- variable.setConverter(converter);
-
- } else {
- if (value==null) {
- log.trace("creating null variable for "+key);
- variable = new NullVariable();
- } else {
- log.trace("creating new unpersistable variable for "+key);
- variable = new UnpersistableVariable();
- }
- }
-
- variable.setKey(key);
- variable.setValue(value);
- variable.setProcessInstance(processInstance);
-
- if (variables==null) {
- variables = new HashMap<String, Variable>();
- }
- variables.put(variable.getKey(), variable);
- hasVariables = true;
-
- // TODO add create-variable-log
- }
-
- public void setVariable(String key, Object value) {
- if (isFinished()) {
- throw new JbpmException("can't update variable '"+key+"' on "+this+": "+state);
- }
- Variable variable = getVariableObject(key);
- // if there is already a variable instance and it doesn't support the current type...
- if ( (variable!=null)
- && (!variable.supports(value))
- ) {
- // delete the old variable instance
- log.debug("variable type change. deleting '"+key+"' from '"+this+"'");
- removeVariable(key);
- variable = null;
- }
-
- if (variable!=null) {
- log.debug("updating variable '"+key+"' in '"+this+"' to value '"+value+"'");
- variable.setValue(value);
-
- } else if (parent==null) {
- createVariable(key, value, null, null);
-
- } else {
- parent.setVariable(key,value);
- }
- }
-
- public void setVariables(Map<String, Object> variables) {
- if (variables!=null) {
- for (String key: variables.keySet()) {
- Object value = variables.get(key);
- setVariable(key, value);
- }
- }
- }
-
- public Object getVariable(String key) {
- Object value = null;
-
- Variable variable = getVariableObject(key);
- if (variable!=null) {
- return variable.getValue();
- }
-
- if (parent!=null) {
- return parent.getVariable(key);
- }
-
- return null;
- }
-
- public Variable getVariableObject(String key) {
- return (hasVariables ? (Variable) variables.get(key) : null);
- }
-
- public boolean hasVariable(String key) {
- return ( (hasVariables && variables.containsKey(key))
- || (parent!=null && parent.hasVariable(key))
- );
- }
-
- public Set<String> getVariableKeys() {
- Set<String> variableKeys = null;
- if (parent!=null) {
- variableKeys = parent.getVariableKeys();
- } else {
- variableKeys = new HashSet<String>();
- }
- if (hasVariables) {
- variableKeys.addAll(variables.keySet());
- }
- return variableKeys;
- }
-
- public Map<String, Object> getVariables() {
- Map<String, Object> values = null;
- if (parent!=null) {
- values = parent.getVariables();
- } else {
- values = new HashMap<String, Object>();
- }
- if (hasVariables) {
- for (Map.Entry<String, Variable> entry: variables.entrySet()) {
- String name = (String) entry.getKey();
- Variable variable = entry.getValue();
- Object value = variable.getValue();
- values.put(name, value);
- }
- }
- return values;
- }
-
- public boolean hasVariables() {
- return ( hasVariables
- || (parent!=null && parent.hasVariables())
- );
- }
-
- public boolean removeVariable(String key) {
- if (isFinished()) {
- throw new JbpmException("can't remove variable '"+key+"' on "+this+": "+state);
- }
-
- Variable variable = null;
- if (hasVariables) {
- variable = variables.remove(key);
- if (variables.isEmpty()) {
- hasVariables = false;
- }
- if (variable!=null) {
- return true;
- }
- }
- if (parent!=null) {
- return parent.removeVariable(key);
- }
- // the actual value is not returned to prevent that an object
- // has to be fetched from the db for it to be deleted
- return false;
- }
-
- public void removeVariables() {
- if (hasVariables) {
- variables.clear();
- }
- hasVariables = false;
- }
-
- // timers ///////////////////////////////////////////////////////////////////
-
- protected void initializeTimers(CompositeElementImpl scope) {
- // initialize the timers
- Set<TimerDefinitionImpl> timerDefinitions = scope.getTimerDefinitions();
- if (!timerDefinitions.isEmpty()) {
- timers = new HashSet<TimerImpl>();
- for (TimerDefinitionImpl timerDefinition: timerDefinitions) {
- createTimer(
- timerDefinition.getEventName(),
- timerDefinition.getSignalName(),
- timerDefinition.getDueDateDescription(),
- timerDefinition.getDueDate(),
- timerDefinition.getRepeat(),
- timerDefinition.isExclusive(),
- timerDefinition.getRetries()
- );
- }
- }
- }
-
- protected void destroyTimers(CompositeElementImpl scope) {
- log.debug("destroying timers of "+toString());
- if (hasTimers && timers!=null && !timers.isEmpty()) {
- // get the TimerSession from the environment
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- throw new JbpmException("non environment for initializing timers");
- }
- TimerSession timerSession = environment.get(TimerSession.class);
- if (timerSession==null) {
- throw new JbpmException("no TimerSession in environment for initializing timers");
- }
- for (Timer timer : timers) {
- timerSession.cancel(timer);
- }
- timers.clear();
- hasTimers = false;
- }
- }
-
- public void createTimer(String eventName, String signalName, String dueDateDescription) {
- createTimer(eventName, signalName, dueDateDescription, null, null, null, null);
- }
-
- public void createTimer(String eventName, String signalName, String dueDateDescription, String repeat) {
- createTimer(eventName, signalName, dueDateDescription, null, repeat, null, null);
- }
-
- public void createTimer(String eventName, String signalName, String dueDateDescription, Date dueDate, String repeat, Boolean isExclusive, Integer retries) {
- if ( (eventName==null)
- && (signalName==null)
- ) {
- throw new JbpmException("no event or signal specified");
- }
- if (log.isDebugEnabled()) {
- log.debug("creating timer on "+this.toString());
- }
-
- // instantiate the timer
- TimerImpl timerImpl = instantiateTimer();
- // create the bidirectional reference
- timerImpl.setExecution(this);
- timers.add(timerImpl);
- hasTimers = true;
- // setInverseReference(timerImpl);
-
- // initialise all the timer properties
- timerImpl.setEventName(eventName);
- timerImpl.setSignalName(signalName);
- if (dueDate!=null) {
- timerImpl.setDueDate(dueDate);
- } else {
- timerImpl.setDueDateDescription(dueDateDescription);
- }
-
- // the if is added to keep the original default
- if (isExclusive!=null) {
- timerImpl.setExclusive(isExclusive);
- }
-
- // the if is added to keep the original default
- if (retries!=null) {
- timerImpl.setRetries(retries);
- }
-
- // the if is added to keep the original default
- if (repeat!=null) {
- timerImpl.setRepeat(repeat);
- }
-
- // get the TimerSession from the environment
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- throw new JbpmException("non environment for initializing timers");
- }
- TimerSession timerSession = environment.get(TimerSession.class);
- if (timerSession==null) {
- throw new JbpmException("no TimerSession in environment for initializing timers");
- }
-
- // schedule the timer with the TimerSession
- timerSession.schedule(timerImpl);
- }
-
- public boolean hasTimers() {
- return hasTimers;
- }
-
- public Set<Timer> getTimers() {
- return (Set) timers;
- }
-
- protected TimerImpl instantiateTimer() {
- return new TimerImpl();
- }
-
-
- // state ////////////////////////////////////////////////////////////////////
-
- /** @see Execution#getState() */
- public String getState() {
- return state;
- }
-
- /** @see Execution#lock(String) */
- public void lock(String state) {
- if (state==null) {
- throw new JbpmException("given state is null");
- }
- checkLock();
- log.trace("locking "+this);
- this.state = state;
- }
-
- /** @see Execution#unlock() */
- public void unlock() {
- if (STATE_ACTIVE.equals(state)) {
- throw new JbpmException("state is already active");
- }
- log.trace("unlocking "+this);
- this.state = STATE_ACTIVE;
- }
-
- /** @see Execution#isActive() */
- public boolean isActive() {
- return STATE_ACTIVE.equals(state);
- }
-
- /** @see Execution#isLocked() */
- public boolean isLocked() {
- return ! isActive();
- }
-
- /** @see Execution#isSuspended() */
- public boolean isSuspended() {
- return STATE_SUSPENDED.equals(state);
- }
-
- /** @see Execution#isEnded() */
- public boolean isEnded() {
- return STATE_ENDED.equals(state);
- }
-
- /** @see Execution#isFinished() */
- public boolean isFinished() {
- return STATE_ENDED.equals(state)
- || STATE_CANCELLED.equals(state);
- }
-
- // state : internal methods /////////////////////////////////////////////////
-
- protected void checkLock() {
- if (!STATE_ACTIVE.equals(state)) {
- throw new JbpmException(toString()+" is not active: "+state);
- }
- }
-
// asynchronous continuations ////////////////////////////////////////////////
public void sendContinuationMessage(AtomicOperation operation) {
@@ -1308,7 +884,34 @@
subProcessInstance.start();
return subProcessInstance;
}
+
+ // state : internal methods /////////////////////////////////////////////////
+
+ /** @see Execution#lock(String) */
+ public void lock(String state) {
+ if (state==null) {
+ throw new JbpmException("given state is null");
+ }
+ checkLock();
+ log.trace("locking "+this);
+ this.state = state;
+ }
+ /** @see Execution#unlock() */
+ public void unlock() {
+ if (Execution.STATE_ACTIVE.equals(state)) {
+ throw new JbpmException("state is already active");
+ }
+ log.trace("unlocking "+this);
+ this.state = Execution.STATE_ACTIVE;
+ }
+
+ protected void checkLock() {
+ if (!Execution.STATE_ACTIVE.equals(state)) {
+ throw new JbpmException(toString()+" is not active: "+state);
+ }
+ }
+
// node name ////////////////////////////////////////////////////////////////
public String getNodeName() {
@@ -1335,7 +938,17 @@
public int nextLogIndex() {
return nextLogIndex++;
}
+
+ // overriding the ScopeInstanceImpl methods /////////////////////////////////
+
+ public ScopeInstanceImpl getParentVariableScope() {
+ return parent;
+ }
+ public ExecutionImpl getTimerExecution() {
+ return this;
+ }
+
// overridable by process languages /////////////////////////////////////////
/** by default this will use {@link NodeImpl#findOutgoingTransition(String)} to
@@ -1493,9 +1106,6 @@
public void setNode(NodeImpl node) {
this.node = node;
}
- public long getDbid() {
- return dbid;
- }
public void setKey(String key) {
this.key = key;
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScopeElementImpl extends ObservableElementImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean hasVariableDefinitions;
+ protected List<VariableDefinitionImpl> variableDefinitions;
+ protected boolean hasTimerDefinitions;
+ protected Set<TimerDefinitionImpl> timerDefinitions;
+
+ // variable definitions /////////////////////////////////////////////////////
+
+ public List<VariableDefinitionImpl> getVariableDefinitions() {
+ if (!hasVariableDefinitions) {
+ return Collections.EMPTY_LIST;
+ }
+ return (List) variableDefinitions;
+ }
+
+ public VariableDefinitionImpl createVariableDefinition() {
+ VariableDefinitionImpl variableDefinition = new VariableDefinitionImpl();
+ if (variableDefinitions==null) {
+ variableDefinitions = new ArrayList<VariableDefinitionImpl>();
+ }
+ variableDefinitions.add(variableDefinition);
+ hasVariableDefinitions = true;
+ return variableDefinition;
+ }
+
+ // timer definitions ////////////////////////////////////////////////////////
+
+ public Set<TimerDefinitionImpl> getTimerDefinitions() {
+ if (!hasTimerDefinitions) {
+ return Collections.EMPTY_SET;
+ }
+ return timerDefinitions;
+ }
+
+ public TimerDefinitionImpl createTimerDefinition() {
+ TimerDefinitionImpl timerDefinition = new TimerDefinitionImpl();
+ if (timerDefinitions==null) {
+ timerDefinitions = new HashSet<TimerDefinitionImpl>();
+ }
+ timerDefinitions.add(timerDefinition);
+ hasTimerDefinitions = true;
+ return timerDefinition;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeElementImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -0,0 +1,477 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
+import org.jbpm.job.Timer;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.type.Converter;
+import org.jbpm.pvm.internal.type.Type;
+import org.jbpm.pvm.internal.type.Variable;
+import org.jbpm.pvm.internal.type.VariableTypeResolver;
+import org.jbpm.pvm.internal.type.variable.NullVariable;
+import org.jbpm.pvm.internal.type.variable.UnpersistableVariable;
+import org.jbpm.session.TimerSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScopeInstanceImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private static Log log = Log.getLog(ScopeInstanceImpl.class.getName());
+
+ protected long dbid;
+ protected int dbversion;
+
+ protected boolean hasVariables;
+ protected Map<String, Variable> variables;
+ protected boolean hasTimers;
+ protected Set<TimerImpl> timers;
+
+ protected String state;
+
+ // variables ////////////////////////////////////////////////////////////////
+
+ protected void initializeVariables(ScopeElementImpl scope, ExecutionImpl outerExecution) {
+ // loop over all variable definitions
+ List<VariableDefinitionImpl> variableDefinitions = scope.getVariableDefinitions();
+ if (!variableDefinitions.isEmpty()){
+ if (log.isTraceEnabled()) {
+ log.trace("initializing variables in scope "+scope);
+ }
+ variables = new HashMap<String, Variable>();
+ for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
+ String key = variableDefinition.getKey();
+ Object value = variableDefinition.getSourceValue(outerExecution);
+ Type type = variableDefinition.getType();
+ createVariable(key, value, type);
+ }
+ }
+ }
+
+ protected void destroyVariables(ScopeElementImpl scope, ExecutionImpl outerExecution) {
+ // loop over all variable definitions
+ List<VariableDefinitionImpl> variableDefinitions = scope.getVariableDefinitions();
+ if (variableDefinitions!=null) {
+ if (log.isTraceEnabled()) {
+ log.trace("destroying var scope "+scope);
+ }
+
+ for (VariableDefinitionImpl variableDefinition: variableDefinitions) {
+ String destination = variableDefinition.getDestination();
+ if (destination!=null) {
+ String key = variableDefinition.getKey();
+ Object value = variableDefinition.getDestinationValue(this);
+ outerExecution.setVariable(key, value);
+ }
+ }
+ }
+ }
+
+
+ public void createVariable(String key, Object value) {
+ createVariable(key, value, null, null);
+ }
+
+ public void createVariable(String key, Object value, String typeName) {
+ createVariable(key, value, typeName, null);
+ }
+
+ public void createVariable(String key, Object value, Type type) {
+ createVariable(key, value, null, type);
+ }
+
+ public void createVariable(String key, Object value, String typeName, Type type) {
+ if (isFinished()) {
+ throw new JbpmException("can't create variable '"+key+"' on "+this+": "+state);
+ }
+
+ log.debug("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
+
+ if (type==null) {
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ VariableTypeResolver variableTypeResolver = environment.get(VariableTypeResolver.class);
+ if (variableTypeResolver!=null) {
+ if (typeName!=null) {
+ type = variableTypeResolver.findTypeByName(typeName);
+ }
+ if (type==null) {
+ type = variableTypeResolver.findTypeByMatch(key, value);
+ }
+ }
+ }
+ }
+
+ Variable variable = null;
+
+ if (type!=null) {
+ Class<?> variableClass = type.getVariableClass();
+ try {
+ log.trace("creating new "+type+" variable "+key);
+ variable = (Variable) variableClass.newInstance();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't instantiate variable instance class '"+variableClass.getName()+"'");
+ }
+ Converter converter = type.getConverter();
+ variable.setConverter(converter);
+
+ } else {
+ if (value==null) {
+ log.trace("creating null variable for "+key);
+ variable = new NullVariable();
+ } else {
+ log.trace("creating new unpersistable variable for "+key);
+ variable = new UnpersistableVariable();
+ }
+ }
+
+ variable.setKey(key);
+ variable.setValue(value);
+ variable.setProcessInstance(getProcessInstance());
+
+ if (variables==null) {
+ variables = new HashMap<String, Variable>();
+ }
+ variables.put(variable.getKey(), variable);
+ hasVariables = true;
+
+ // TODO add create-variable-log
+ }
+
+ public void setVariable(String key, Object value) {
+ if (isFinished()) {
+ throw new JbpmException("can't update variable '"+key+"' on "+this+": "+state);
+ }
+ Variable variable = getVariableObject(key);
+ // if there is already a variable instance and it doesn't support the current type...
+ if ( (variable!=null)
+ && (!variable.supports(value))
+ ) {
+ // delete the old variable instance
+ log.debug("variable type change. deleting '"+key+"' from '"+this+"'");
+ removeVariable(key);
+ variable = null;
+ }
+
+ if (variable!=null) {
+ log.debug("updating variable '"+key+"' in '"+this+"' to value '"+value+"'");
+ variable.setValue(value);
+
+ } else if (getParentVariableScope()==null) {
+ createVariable(key, value, null, null);
+
+ } else {
+ getParentVariableScope().setVariable(key,value);
+ }
+ }
+
+ public void setVariables(Map<String, Object> variables) {
+ if (variables!=null) {
+ for (String key: variables.keySet()) {
+ Object value = variables.get(key);
+ setVariable(key, value);
+ }
+ }
+ }
+
+ public Object getVariable(String key) {
+ Object value = null;
+
+ Variable variable = getVariableObject(key);
+ if (variable!=null) {
+ return variable.getValue();
+ }
+
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ if (parentScope!=null) {
+ return parentScope.getVariable(key);
+ }
+
+ return null;
+ }
+
+ public Variable getVariableObject(String key) {
+ return (hasVariables ? (Variable) variables.get(key) : null);
+ }
+
+ public boolean hasVariable(String key) {
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ return ( (hasVariables && variables.containsKey(key))
+ || (parentScope!=null && parentScope.hasVariable(key))
+ );
+ }
+
+ public Set<String> getVariableKeys() {
+ Set<String> variableKeys = null;
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ if (parentScope!=null) {
+ variableKeys = parentScope.getVariableKeys();
+ } else {
+ variableKeys = new HashSet<String>();
+ }
+ if (hasVariables) {
+ variableKeys.addAll(variables.keySet());
+ }
+ return variableKeys;
+ }
+
+ public Map<String, Object> getVariables() {
+ Map<String, Object> values = null;
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ if (parentScope!=null) {
+ values = parentScope.getVariables();
+ } else {
+ values = new HashMap<String, Object>();
+ }
+ if (hasVariables) {
+ for (Map.Entry<String, Variable> entry: variables.entrySet()) {
+ String name = (String) entry.getKey();
+ Variable variable = entry.getValue();
+ Object value = variable.getValue();
+ values.put(name, value);
+ }
+ }
+ return values;
+ }
+
+ public boolean hasVariables() {
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ return ( hasVariables
+ || (parentScope!=null && parentScope.hasVariables())
+ );
+ }
+
+ public boolean removeVariable(String key) {
+ if (isFinished()) {
+ throw new JbpmException("can't remove variable '"+key+"' on "+this+": "+state);
+ }
+
+ Variable variable = null;
+ if (hasVariables) {
+ variable = variables.remove(key);
+ if (variables.isEmpty()) {
+ hasVariables = false;
+ }
+ if (variable!=null) {
+ return true;
+ }
+ }
+ ScopeInstanceImpl parentScope = getParentVariableScope();
+ if (parentScope!=null) {
+ return parentScope.removeVariable(key);
+ }
+ // the actual value is not returned to prevent that an object
+ // has to be fetched from the db for it to be deleted
+ return false;
+ }
+
+ public void removeVariables() {
+ if (hasVariables) {
+ variables.clear();
+ }
+ hasVariables = false;
+ }
+
+ // timers ///////////////////////////////////////////////////////////////////
+
+ protected void initializeTimers(ScopeElementImpl scope) {
+ // initialize the timers
+ Set<TimerDefinitionImpl> timerDefinitions = scope.getTimerDefinitions();
+ if (!timerDefinitions.isEmpty()) {
+ timers = new HashSet<TimerImpl>();
+ for (TimerDefinitionImpl timerDefinition: timerDefinitions) {
+ createTimer(
+ timerDefinition.getEventName(),
+ timerDefinition.getSignalName(),
+ timerDefinition.getDueDateDescription(),
+ timerDefinition.getDueDate(),
+ timerDefinition.getRepeat(),
+ timerDefinition.isExclusive(),
+ timerDefinition.getRetries()
+ );
+ }
+ }
+ }
+
+ protected void destroyTimers(CompositeElementImpl scope) {
+ log.debug("destroying timers of "+toString());
+ if (hasTimers && timers!=null && !timers.isEmpty()) {
+ // get the TimerSession from the environment
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ throw new JbpmException("non environment for initializing timers");
+ }
+ TimerSession timerSession = environment.get(TimerSession.class);
+ if (timerSession==null) {
+ throw new JbpmException("no TimerSession in environment for initializing timers");
+ }
+ for (Timer timer : timers) {
+ timerSession.cancel(timer);
+ }
+ timers.clear();
+ hasTimers = false;
+ }
+ }
+
+ public void createTimer(String eventName, String signalName, String dueDateDescription) {
+ createTimer(eventName, signalName, dueDateDescription, null, null, null, null);
+ }
+
+ public void createTimer(String eventName, String signalName, String dueDateDescription, String repeat) {
+ createTimer(eventName, signalName, dueDateDescription, null, repeat, null, null);
+ }
+
+ public void createTimer(String eventName, String signalName, String dueDateDescription, Date dueDate, String repeat, Boolean isExclusive, Integer retries) {
+ if ( (eventName==null)
+ && (signalName==null)
+ ) {
+ throw new JbpmException("no event or signal specified");
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("creating timer on "+this.toString());
+ }
+
+ // instantiate the timer
+ TimerImpl timerImpl = instantiateTimer();
+ // create the bidirectional reference
+ timerImpl.setExecution(getTimerExecution());
+ timers.add(timerImpl);
+ hasTimers = true;
+ // setInverseReference(timerImpl);
+
+ // initialise all the timer properties
+ timerImpl.setEventName(eventName);
+ timerImpl.setSignalName(signalName);
+ if (dueDate!=null) {
+ timerImpl.setDueDate(dueDate);
+ } else {
+ timerImpl.setDueDateDescription(dueDateDescription);
+ }
+
+ // the if is added to keep the original default
+ if (isExclusive!=null) {
+ timerImpl.setExclusive(isExclusive);
+ }
+
+ // the if is added to keep the original default
+ if (retries!=null) {
+ timerImpl.setRetries(retries);
+ }
+
+ // the if is added to keep the original default
+ if (repeat!=null) {
+ timerImpl.setRepeat(repeat);
+ }
+
+ // get the TimerSession from the environment
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ throw new JbpmException("non environment for initializing timers");
+ }
+ TimerSession timerSession = environment.get(TimerSession.class);
+ if (timerSession==null) {
+ throw new JbpmException("no TimerSession in environment for initializing timers");
+ }
+
+ // schedule the timer with the TimerSession
+ timerSession.schedule(timerImpl);
+ }
+
+ public boolean hasTimers() {
+ return hasTimers;
+ }
+
+ public Set<Timer> getTimers() {
+ return (Set) timers;
+ }
+
+ protected TimerImpl instantiateTimer() {
+ return new TimerImpl();
+ }
+
+ // state ////////////////////////////////////////////////////////////////////
+
+ /** @see Execution#getState() */
+ public String getState() {
+ return state;
+ }
+
+ /** @see Execution#isActive() */
+ public boolean isActive() {
+ return Execution.STATE_ACTIVE.equals(state);
+ }
+
+ /** @see Execution#isLocked() */
+ public boolean isLocked() {
+ return ! isActive();
+ }
+
+ /** @see Execution#isSuspended() */
+ public boolean isSuspended() {
+ return Execution.STATE_SUSPENDED.equals(state);
+ }
+
+ /** @see Execution#isEnded() */
+ public boolean isEnded() {
+ return Execution.STATE_ENDED.equals(state);
+ }
+
+ /** @see Execution#isFinished() */
+ public boolean isFinished() {
+ return Execution.STATE_ENDED.equals(state)
+ || Execution.STATE_CANCELLED.equals(state);
+ }
+
+ // customizable methods /////////////////////////////////////////////////////
+
+ public ExecutionImpl getProcessInstance() {
+ return null;
+ }
+
+ public ExecutionImpl getTimerExecution() {
+ return null;
+ }
+
+ public ScopeInstanceImpl getParentVariableScope() {
+ return null;
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2008-12-02 08:46:03 UTC (rev 3160)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -72,13 +72,13 @@
return null;
}
- public Object getDestinationValue(ExecutionImpl execution) {
+ public Object getDestinationValue(ScopeInstanceImpl scopeInstanceImpl) {
if (destinationExpression!=null) {
// TODO add variable destination expression resolution
return null;
}
if (key!=null) {
- return execution.getVariable(key);
+ return scopeInstanceImpl.getVariable(key);
}
return null;
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-02 08:46:03 UTC (rev 3160)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-02 10:16:43 UTC (rev 3161)
@@ -36,6 +36,7 @@
import org.jbpm.pvm.internal.cal.Duration;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
import org.jbpm.pvm.internal.util.Clock;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -51,7 +52,7 @@
* someones task list) and that can trigger the continuation of execution
* of the token upon completion.
*/
-public class TaskImpl implements Serializable, Task {
+public class TaskImpl extends ScopeInstanceImpl implements Serializable, Task {
private static final long serialVersionUID = 1L;
// private static final Logger log = Logger.getLogger(TaskImpl.class.getName());
@@ -62,8 +63,6 @@
// PvmEnvironment.CONTEXTNAME_APPLICATION
};
- protected long dbid;
- protected int dbversion;
protected String id;
protected String name;
protected String description;
@@ -82,7 +81,7 @@
protected String state;
- protected Execution execution;
+ protected ExecutionImpl execution;
protected boolean isSignalling = true;
protected boolean isBlocking;
@@ -371,11 +370,11 @@
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
- public Execution getExecution() {
+ public ExecutionImpl getExecution() {
return execution;
}
public void setExecution(Execution execution) {
- this.execution = execution;
+ this.execution = (ExecutionImpl) execution;
}
public String getState() {
return state;
15 years, 5 months
JBoss JBPM SVN: r3160 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/wire/xml and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-02 03:46:03 -0500 (Tue, 02 Dec 2008)
New Revision: 3160
Added:
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml
Removed:
jbpm4/trunk/modules/task/src/main/resources/hibernate.task.hbm.xml
jbpm4/trunk/modules/task/src/main/resources/hibernate.task.queries.hbm.xml
jbpm4/trunk/modules/task/src/main/resources/pvm.hibernate.mappings.xml
jbpm4/trunk/modules/task/src/main/resources/pvm.wire.bindings.xml
jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/org.jbpm.task.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/org/
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java
jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
Log:
brought task component in sync with the new resource structure
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-12-02 08:46:03 UTC (rev 3160)
@@ -183,15 +183,17 @@
ActivityParser activityParser = new ActivityParser();
for (String activityResource: DEFAULT_ACTIVITIES_RESOURCES) {
- InputStream inputStream = ReflectUtil.getResourceAsStream(null, activityResource);
- if (inputStream!=null) {
- log.trace("parsing jpdl activities from resource: "+activityResource);
-
- activityParser.createParse()
- .setInputStream(inputStream)
- .pushObject(defaultBindings)
- .execute()
- .checkProblems("jpdl activities from resource "+activityResource);
+ Enumeration<URL> resourceUrls = ReflectUtil.getResources(null, activityResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading jpdl activities from resource: "+resourceUrl);
+ activityParser.createParse()
+ .setUrl(resourceUrl)
+ .pushObject(defaultBindings)
+ .execute()
+ .checkProblems("jpdl activities from "+resourceUrl.toString());
+ }
} else {
log.trace("skipping unavailable jpdl activities resource: "+activityResource);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,6 +1,5 @@
package org.jbpm.pvm.internal.wire.xml;
-import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -130,6 +129,7 @@
public static final String[] DEFAULT_WIRE_BINDING_RESOURCES = new String[]{
"jbpm.pvm.wire.bindings.xml",
"jbpm.jpdl.wire.bindings.xml",
+ "jbpm.task.wire.bindings.xml",
"jbpm.user.wire.bindings.xml"
};
@@ -299,14 +299,17 @@
BindingParser bindingParser = new BindingParser();
for (String wireResource: DEFAULT_WIRE_BINDING_RESOURCES) {
- InputStream inputStream = ReflectUtil.getResourceAsStream(null, wireResource);
- if (inputStream!=null) {
- log.trace("loading wire bindings from resource: "+wireResource);
- bindingParser.createParse()
- .setInputStream(inputStream)
- .pushObject(defaultBindings)
- .execute()
- .checkProblems("default wire bindings");
+ Enumeration<URL> resourceUrls = ReflectUtil.getResources(null, wireResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading wire bindings from resource: "+resourceUrl);
+ bindingParser.createParse()
+ .setUrl(resourceUrl)
+ .pushObject(defaultBindings)
+ .execute()
+ .checkProblems(resourceUrl.toString());
+ }
} else {
log.trace("skipping unavailable wire bindings resource "+wireResource);
}
Modified: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/impl/TaskImpl.java 2008-12-02 08:46:03 UTC (rev 3160)
@@ -311,7 +311,7 @@
public String getLifeCycleResource() {
// the default lifecycle can be overridden in subclasses
- return "org/jbpm/task/impl/default.lifecycle.xml";
+ return "jbpm.task.default.lifecycle.xml";
}
// modified getters and setters /////////////////////////////////////////////
Deleted: jbpm4/trunk/modules/task/src/main/resources/hibernate.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/hibernate.task.hbm.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/main/resources/hibernate.task.hbm.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,152 +0,0 @@
-<?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 auto-import="false" package="org.jbpm.task.impl" default-access="field">
-
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
-
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
- <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
- <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
-
- <many-to-one name="assignerDescriptor"
- column="ASSIGNER_DESCR_"
- cascade="all"
- class="org.jbpm.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
-
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
-
- <!-- ### TASK ########################################################### -->
- <class name="TaskImpl"
- discriminator-value="T">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
- <property name="assignee" column="ASSIGNEE_"/>
-
- <set name="roles" cascade="all-delete-orphan">
- <key column="TASK_" foreign-key="FK_ROLE_TASK" />
- <one-to-many class="RoleImpl" />
- </set>
-
- <property name="priority" column="PRIORITY_"/>
- <property name="create" column="CREATE_"/>
- <property name="dueDate" column="DUEDATE_"/>
- <property name="progress" column="PROGRESS_"/>
-
- <many-to-one name="variableMap"
- class="org.jbpm.pvm.impl.VariableMap"
- column="VARMAP_"
- foreign-key="FK_TASK_VARMAP"
- cascade="all" />
-
- <many-to-one name="swimlane"
- class="SwimlaneImpl"
- column="SWIMLANE_"
- foreign-key="FK_TASK_SWIML" />
-
- <many-to-one name="taskDefinition"
- column="TASK_DEF_"
- class="TaskDefinitionImpl"
- foreign-key="FK_TSK_DEF"
- index="IDX_TSK_DEF" />
-
- <list name="comments" cascade="all-delete-orphan">
- <key column="TASK_" />
- <list-index column="TASK_IDX_" />
- <one-to-many class="org.jbpm.pvm.impl.CommentImpl" />
- </list>
-
- <set name="subTasks" cascade="all-delete-orphan">
- <key column="SUPERTASK_" foreign-key="FK_TASK_SUPERTASK" />
- <one-to-many class="TaskImpl" />
- </set>
-
- </class>
-
- <!-- ### ROLE ########################################################### -->
- <class name="RoleImpl"
- discriminator-value="R">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="identityId" column="IDENTITYID_"/>
- <property name="roleType" type="org.jbpm.task.RoleType" column="ROLETYPE_" />
- <property name="description" column="DESCR_"/>
-
- <many-to-one name="task"
- class="TaskImpl"
- column="TASK_"
- foreign-key="FK_ROLE_TASK" />
-
- </class>
-
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
- <!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="assignee" column="ASSIGNEE_"/>
-
- <many-to-one name="swimlaneDefinition"
- class="SwimlaneDefinitionImpl"
- column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
-
- <set name="candidates" cascade="all-delete-orphan">
- <key column="SWIMLANE_" foreign-key="FK_ROLE_SWIMLANE" />
- <one-to-many class="RoleImpl" />
- </set>
-
- </class>
-
-</hibernate-mapping>
Deleted: jbpm4/trunk/modules/task/src/main/resources/hibernate.task.queries.hbm.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/hibernate.task.queries.hbm.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/main/resources/hibernate.task.queries.hbm.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,18 +0,0 @@
-<?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>
-
-
- <query name="findTasks">
- <![CDATA[
- select task
- from org.jbpm.task.impl.TaskImpl as task
- ]]>
- </query>
-
-
-</hibernate-mapping>
\ No newline at end of file
Copied: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml (from rev 3143, jbpm4/trunk/modules/task/src/test/resources/org/jbpm/task/impl/default.lifecycle.xml)
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml (rev 0)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -0,0 +1,13 @@
+<task-lifecycle initial="open">
+ <state name="open">
+ <transition name="complete" to="completed" />
+ <transition name="suspend" to="suspended" />
+ <transition name="cancel" to="cancelled" />
+ </state>
+ <state name="suspended">
+ <transition name="resume" to="open" />
+ <transition name="cancel" to="cancelled" />
+ </state>
+ <state name="cancelled" />
+ <state name="completed" />
+</task-lifecycle>
Copied: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml (from rev 3143, jbpm4/trunk/modules/task/src/main/resources/hibernate.task.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml (rev 0)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -0,0 +1,154 @@
+<?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 auto-import="false" package="org.jbpm.task.impl" default-access="field">
+
+ <!-- ### TASK DEFINITION ################################################ -->
+ <class name="TaskDefinitionImpl" discriminator-value="T">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="description" column="DESCR_"/>
+
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+ <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
+ <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
+
+ <many-to-one name="assignerDescriptor"
+ column="ASSIGNER_DESCR_"
+ cascade="all"
+ class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+ foreign-key="FK_TSK_ASIG_DESCR"
+ index="IDX_TSK_ASIG_DESCR" />
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </class>
+
+ <!-- ### TASK ########################################################### -->
+ <class name="TaskImpl"
+ discriminator-value="T">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="description" column="DESCR_"/>
+ <property name="assignee" column="ASSIGNEE_"/>
+
+ <set name="roles" cascade="all-delete-orphan">
+ <key column="TASK_" foreign-key="FK_ROLE_TASK" />
+ <one-to-many class="RoleImpl" />
+ </set>
+
+ <property name="priority" column="PRIORITY_"/>
+ <property name="create" column="CREATE_"/>
+ <property name="dueDate" column="DUEDATE_"/>
+ <property name="progress" column="PROGRESS_"/>
+
+ <!--
+ <many-to-one name="variableMap"
+ class="org.jbpm.pvm.impl.VariableMap"
+ column="VARMAP_"
+ foreign-key="FK_TASK_VARMAP"
+ cascade="all" />
+ -->
+
+ <many-to-one name="swimlane"
+ class="SwimlaneImpl"
+ column="SWIMLANE_"
+ foreign-key="FK_TASK_SWIML" />
+
+ <many-to-one name="taskDefinition"
+ column="TASK_DEF_"
+ class="TaskDefinitionImpl"
+ foreign-key="FK_TSK_DEF"
+ index="IDX_TSK_DEF" />
+
+ <list name="comments" cascade="all-delete-orphan">
+ <key column="TASK_" />
+ <list-index column="TASK_IDX_" />
+ <one-to-many class="org.jbpm.pvm.internal.model.CommentImpl" />
+ </list>
+
+ <set name="subTasks" cascade="all-delete-orphan">
+ <key column="SUPERTASK_" foreign-key="FK_TASK_SUPERTASK" />
+ <one-to-many class="TaskImpl" />
+ </set>
+
+ </class>
+
+ <!-- ### ROLE ########################################################### -->
+ <class name="RoleImpl"
+ discriminator-value="R">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="identityId" column="IDENTITYID_"/>
+ <property name="roleType" column="ROLETYPE_" />
+ <property name="description" column="DESCR_"/>
+
+ <many-to-one name="task"
+ class="TaskImpl"
+ column="TASK_"
+ foreign-key="FK_ROLE_TASK" />
+
+ </class>
+
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ </class>
+
+
+ <!-- ### SWIMLANE ####################################################### -->
+ <class name="SwimlaneImpl">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="assignee" column="ASSIGNEE_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ class="SwimlaneDefinitionImpl"
+ column="SWIMLANEDEF_"
+ foreign-key="FK_SWIMLANE_DEF" />
+
+ <set name="candidates" cascade="all-delete-orphan">
+ <key column="SWIMLANE_" foreign-key="FK_ROLE_SWIMLANE" />
+ <one-to-many class="RoleImpl" />
+ </set>
+
+ </class>
+
+</hibernate-mapping>
Property changes on: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml (from rev 3143, jbpm4/trunk/modules/task/src/main/resources/hibernate.task.queries.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml (rev 0)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -0,0 +1,18 @@
+<?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>
+
+
+ <query name="findTasks">
+ <![CDATA[
+ select task
+ from org.jbpm.task.impl.TaskImpl as task
+ ]]>
+ </query>
+
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml (from rev 3143, jbpm4/trunk/modules/task/src/main/resources/pvm.wire.bindings.xml)
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml (rev 0)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -0,0 +1,6 @@
+<wire-bindings>
+
+ <binding tag="task-db-session" class="org.jbpm.task.xml.TaskDbSessionBinding" category="descriptor" />
+ <binding tag="task-service" class="org.jbpm.task.xml.TaskServiceBinding" category="descriptor" />
+
+</wire-bindings>
Property changes on: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/task/src/main/resources/pvm.hibernate.mappings.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/pvm.hibernate.mappings.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/main/resources/pvm.hibernate.mappings.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,4 +0,0 @@
-<mappings>
- <mapping resource="hibernate.task.hbm.xml" />
- <mapping resource="hibernate.task.queries.hbm.xml" />
-</mappings>
Deleted: jbpm4/trunk/modules/task/src/main/resources/pvm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/pvm.wire.bindings.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/main/resources/pvm.wire.bindings.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,6 +0,0 @@
-<wire-bindings>
-
- <binding tag="task-db-session" class="org.jbpm.task.xml.TaskDbSessionBinding" category="descriptor" />
- <binding tag="task-service" class="org.jbpm.task.xml.TaskServiceBinding" category="descriptor" />
-
-</wire-bindings>
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskDbTest.java 2008-12-02 08:46:03 UTC (rev 3160)
@@ -21,30 +21,12 @@
*/
package org.jbpm.task;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jbpm.env.Environment;
-import org.jbpm.env.EnvironmentFactory;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.session.DbSession;
-import org.jbpm.task.impl.RoleImpl;
-import org.jbpm.task.impl.SwimlaneImpl;
-import org.jbpm.task.impl.TaskDefinitionImpl;
-import org.jbpm.task.impl.TaskImpl;
import org.jbpm.test.DbTestCase;
-import org.jbpm.test.EnvironmentDbTestCase;
/**
* @author Tom Baeyens
*/
-public class TaskDbTest extends EnvironmentDbTestCase {
+public class TaskDbTest extends DbTestCase {
public void testNothing() {
}
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/TaskServiceTest.java 2008-12-02 08:46:03 UTC (rev 3160)
@@ -21,14 +21,6 @@
*/
package org.jbpm.task;
-import java.util.Date;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.task.impl.TaskImpl;
import org.jbpm.test.DbTestCase;
/**
Deleted: jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
-
- <process-engine>
-
- <deployer-manager>
- <assign-file-type>
- <file extension=".jpdl.xml" type="jpdl" />
- </assign-file-type>
- <check-process-version />
- <check-process-id />
- <check-problems />
- <save />
- </deployer-manager>
-
- <process-service />
- <execution-service />
- <management-service />
-
- <command-service>
- <retry-interceptor />
- <environment-interceptor />
- <standard-transaction-interceptor />
- </command-service>
-
- <hibernate-configuration>
- <properties resource="hibernate.properties" />
- <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
- <mapping resource="jbpm.pvm.wire.hbm.xml" />
- <mapping resource="jbpm.pvm.definition.hbm.xml" />
- <mapping resource="jbpm.pvm.execution.hbm.xml" />
- <mapping resource="jbpm.pvm.variable.hbm.xml" />
- <mapping resource="jbpm.pvm.job.hbm.xml" />
- <cache-configuration resource="jbpm.pvm.cache.xml"
- usage="nonstrict-read-write" />
- </hibernate-configuration>
-
- <hibernate-session-factory />
-
- <job-executor auto-start="false" />
- <job-test-helper />
-
- <id-generator />
- <variable-types resource="jbpm.pvm.types.xml" />
-
- <business-calendar>
- <monday hours="9:00-12:00 and 12:30-17:00"/>
- <tuesday hours="9:00-12:00 and 12:30-17:00"/>
- <wednesday hours="9:00-12:00 and 12:30-17:00"/>
- <thursday hours="9:00-12:00 and 12:30-17:00"/>
- <friday hours="9:00-12:00 and 12:30-17:00"/>
- <holiday period="01/07/2008 - 31/08/2008"/>
- </business-calendar>
-
- </process-engine>
-
- <environment>
- <hibernate-session />
- <transaction />
- <pvm-db-session />
- <job-db-session />
- <message-session />
- <timer-session />
- </environment>
-
-</jbpm-configuration>
Modified: jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -32,6 +32,7 @@
<mapping resource="jbpm.pvm.execution.hbm.xml" />
<mapping resource="jbpm.pvm.variable.hbm.xml" />
<mapping resource="jbpm.pvm.job.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
<cache-configuration resource="jbpm.pvm.cache.xml"
usage="nonstrict-read-write" />
</hibernate-configuration>
Deleted: jbpm4/trunk/modules/task/src/test/resources/org.jbpm.task.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/org.jbpm.task.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
+++ jbpm4/trunk/modules/task/src/test/resources/org.jbpm.task.cfg.xml 2008-12-02 08:46:03 UTC (rev 3160)
@@ -1,37 +0,0 @@
-<environment>
-
- <application>
-
- <pvm-service />
- <task-service />
-
- <standard-command-service>
- <retry-interceptor />
- <environment-interceptor />
- <transaction-interceptor />
- </standard-command-service>
-
- <hibernate-configuration>
- <properties resource="hibernate.properties" />
- <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
- <mapping resource="jbpm.pvm.wire.hbm.xml" />
- <mapping resource="jbpm.pvm.definition.hbm.xml" />
- <mapping resource="jbpm.pvm.execution.hbm.xml" />
- <mapping resource="jbpm.pvm.variable.hbm.xml" />
- <mapping resource="jbpm.pvm.job.hbm.xml" />
- <cache-configuration resource="jbpm.pvm.cache.xml"
- usage="nonstrict-read-write" />
- </hibernate-configuration>
- <hibernate-session-factory />
- <variable-types resource="pvm.variable.types.xml" />
-
- </application>
-
- <block>
- <standard-transaction />
- <hibernate-session />
- <pvm-db-session />
- <task-db-session />
- </block>
-
-</environment>
15 years, 5 months
JBoss JBPM SVN: r3159 - in jbpm4/trunk/modules: api/src/main/resources and 17 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-01 11:28:48 -0500 (Mon, 01 Dec 2008)
New Revision: 3159
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
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/CheckProcessIdDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.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/wire/binding/AssignFileTypesBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
jbpm4/trunk/modules/devguide/src/main/diagrams/diagrams.mdzip
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
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/svc/DeploymentImpl.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/DeployerManagerBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
Log:
generalized deployment
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -29,18 +29,34 @@
import java.util.zip.ZipInputStream;
-/** a deployment unit, containing all information to create a process
- * definition that will be deployed in the persistent process repository
- * of the Process Virtual Machine.
+/** 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 {
-
+
Deployment setName(String name);
- Deployment setLanguage(String language);
- Deployment addObject(String name, Object object);
Deployment addResource(String resource);
Deployment addFile(File file);
Deployment addUrl(URL url);
@@ -55,8 +71,12 @@
Deployment addDirectory(File directory);
Deployment addDirectoryCanonical(File directory);
- ProcessDefinition deploy();
- List<ProcessDefinition> deployAll();
-
+ Deployment setFileType(String fileName, String fileType);
+
+ Deployment deploy();
+
+ /** the deployed process definitions. */
+ List<ProcessDefinition> getProcessDefinitions();
+ /** the problems encountered during deployment */
List<Problem> getProblems();
}
Modified: jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-01 16:28:48 UTC (rev 3159)
@@ -141,32 +141,13 @@
</element>
<element name="deployer-manager">
- <annotation><documentation>Has a list of deployers (org.jbpm.deploy.Deployer)
- for each process language for handling deployments.
+ <annotation><documentation>Has a list of deployers (org.jbpm.pvm.internal.deploy.Deployer)
+ for handling deployments.
</documentation></annotation>
<complexType>
- <choice maxOccurs="unbounded">
- <element name="language">
- <annotation><documentation>A process language that contains
- a list of deployers</documentation></annotation>
- <complexType>
- <choice maxOccurs="unbounded">
- <group ref="tns:deployers" />
- </choice>
- <attribute name="name" type="string" use="required" />
- <attribute name="extension" type="string" />
- </complexType>
- </element>
- </choice>
- <attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object programmatically.</documentation></annotation>
- </attribute>
- <attribute name="init" type="tns:initType" default="lazy">
- <annotation><documentation>Specifies when and how this object should be
- created and initialized. Default is lazy.</documentation></annotation>
- </attribute>
+ <choice maxOccurs="unbounded">
+ <group ref="tns:deployers" />
+ </choice>
</complexType>
</element>
Modified: jbpm4/trunk/modules/devguide/src/main/diagrams/diagrams.mdzip
===================================================================
(Binary files differ)
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,20 @@
+<chapter id="environments">
+ <title>Environments</title>
+
+ <para>This chapter describes the support for other environments then the ones
+ described in the userguide.
+ </para>
+
+ <section id="spring">
+ <title>Spring</title>
+ <para>TODO
+ </para>
+ </section>
+
+ <section id="osgi">
+ <title>OSGi</title>
+ <para>TODO
+ </para>
+ </section>
+
+</chapter>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -107,11 +107,14 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -35,24 +35,20 @@
static JpdlParser jpdlParser = new JpdlParser();
public void deploy(DeploymentImpl deployment) {
- for (String fileName: deployment.getFileNames()) {
- // for all files ending on .jpdl.xml
- if (fileName.endsWith(".jpdl.xml")) {
-
- // 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 objects
- // this is where the save process deployer will find it
- deployment.addObject(fileName, parse.getDocumentObject());
- }
+ 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 objects
+ // this is where the save process deployer will find it
+ deployment.addObject(fileName, parse.getDocumentObject());
}
}
}
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -5,12 +5,14 @@
<process-engine>
<deployer-manager>
- <language name="jpdl">
- <parse-jpdl />
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,57 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AssignFileTypeDeployer implements Deployer {
+
+ /* maps extensions to file types */
+ Map<String, String> fileTypes = new HashMap<String, String>();
+
+ 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";
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,39 +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.JbpmException;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CheckProblems implements Deployer {
-
- public void deploy(DeploymentImpl deployment) {
- if (deployment.hasProblems()) {
- throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
- }
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,42 @@
+/*
+ * 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.JbpmException;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProblemsDeployer implements Deployer {
+
+ public void deploy(DeploymentImpl deployment) {
+ if (deployment.hasProblems()) {
+ throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
+ }
+ }
+
+ public String toString() {
+ return "check-problems";
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,70 @@
+/*
+ * 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.ProcessDefinition;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProcessIdDeployer implements Deployer {
+
+ private static final Log log = Log.getLog(CheckProcessIdDeployer.class.getName());
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ createId((ProcessDefinitionImpl)object, deployment);
+ }
+ }
+ }
+
+ private void createId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ if (processDefinition.getId()==null) {
+ String key = processDefinition.getKey();
+ if (key==null) {
+ key = processDefinition.getName();
+ }
+
+ if ("".equals(key)) {
+ deployment.addProblem("empty string is not a valid key");
+ }
+
+ // replace any non-word character with an underscore
+ key = key.replaceAll("\\W", "_");
+
+ String id = key+":"+processDefinition.getVersion();
+
+ log.trace("created id '"+id+"' for "+processDefinition);
+ processDefinition.setId(id);
+ }
+ }
+
+ public String toString() {
+ return "check-process-id";
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,101 @@
+/*
+ * 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.ProcessDefinition;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.env.Environment;
+import org.jbpm.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 CheckProcessVersionDeployer implements Deployer {
+
+ private static final Log log = Log.getLog(CheckProcessVersionDeployer.class.getName());
+
+ protected boolean assign = true;
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ checkProcessDefinition((ProcessDefinitionImpl)object, deployment);
+ }
+ }
+ }
+
+ public void checkProcessDefinition(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ String name = processDefinition.getName();
+ if (name == null) {
+ deployment.addProblem("process must have a name to deploy it");
+ }
+
+ int version = processDefinition.getVersion();
+ if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
+ && ! assign
+ ) {
+ deployment.addProblem("no version specified in process definition "+name);
+ }
+
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ deployment.addProblem("environment is required by deployer check-version");
+ return;
+ }
+
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ if (pvmDbSession==null) {
+ deployment.addProblem(PvmDbSession.class.getName()+" is required in the environment by "+getClass().getName());
+ return;
+ }
+
+ if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
+ && assign
+ ) {
+ ClientProcessDefinition latestDeployedVersion = pvmDbSession.findLatestProcessDefinitionByName(name);
+ if (latestDeployedVersion!=null) {
+ version = latestDeployedVersion.getVersion() + 1;
+ } else {
+ version = 1;
+ }
+ log.debug("assigning version "+version+" to process definition "+name);
+ processDefinition.setVersion(version);
+
+ } else {
+ if (pvmDbSession.findProcessDefinitionByName(name, version) != null) {
+ deployment.addProblem("process '" + name + "' version " + version + " already exists");
+ }
+ }
+ }
+
+ public void setAssign(boolean assign) {
+ this.assign = assign;
+ }
+
+ public String toString() {
+ return "check-process-version";
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.env.Environment;
-import org.jbpm.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 CheckVersion implements Deployer {
-
- private static final Log log = Log.getLog(CheckVersion.class.getName());
-
- protected boolean assign = true;
-
- public void deploy(DeploymentImpl deployment) {
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- checkProcessDefinition((ProcessDefinitionImpl)object, deployment);
- }
- }
- }
-
- public void checkProcessDefinition(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- String name = processDefinition.getName();
- if (name == null) {
- deployment.addProblem("process must have a name to deploy it");
- }
-
- int version = processDefinition.getVersion();
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && ! assign
- ) {
- deployment.addProblem("no version specified in process definition "+name);
- }
-
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- deployment.addProblem("environment is required by deployer check-version");
- return;
- }
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- if (pvmDbSession==null) {
- deployment.addProblem(PvmDbSession.class.getName()+" is required in the environment by "+getClass().getName());
- return;
- }
-
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && assign
- ) {
- ClientProcessDefinition latestDeployedVersion = pvmDbSession.findLatestProcessDefinitionByName(name);
- if (latestDeployedVersion!=null) {
- version = latestDeployedVersion.getVersion() + 1;
- } else {
- version = 1;
- }
- log.debug("assigning version "+version+" to process definition "+name);
- processDefinition.setVersion(version);
-
- } else {
- if (pvmDbSession.findProcessDefinitionByName(name, version) != null) {
- deployment.addProblem("process '" + name + "' version " + version + " already exists");
- }
- }
- }
-
- public void setAssign(boolean assign) {
- this.assign = assign;
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.deploy;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateId implements Deployer {
-
- private static final Log log = Log.getLog(CreateId.class.getName());
-
- public void deploy(DeploymentImpl deployment) {
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- createId((ProcessDefinitionImpl)object, deployment);
- }
- }
- }
-
- private void createId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- if (processDefinition.getId()==null) {
- String key = processDefinition.getKey();
- if (key==null) {
- key = processDefinition.getName();
- }
-
- if ("".equals(key)) {
- deployment.addProblem("empty string is not a valid key");
- }
-
- // replace any non-word character with an underscore
- key = key.replaceAll("\\W", "_");
-
- String id = key+":"+processDefinition.getVersion();
-
- log.trace("created id '"+id+"' for "+processDefinition);
- processDefinition.setId(id);
- }
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,69 +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.ProcessDefinition;
-import org.jbpm.JbpmException;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateProcess implements Deployer {
-
- private static final Log log = Log.getLog(CreateProcess.class.getName());
-
- protected Class<?> processDefinitionClass;
-
- public void deploy(DeploymentImpl deployment) {
- ProcessDefinition processDefinition = deployment.getProcessDefinition();
-
- if (processDefinition==null) {
- if (processDefinitionClass==null) {
- deployment.addProblem("create-process deployer improperly configured: no class specified");
- return;
- }
-
- // instantiate
- try {
- log.trace("creating new "+processDefinitionClass.getName());
- processDefinition = (ProcessDefinition) processDefinitionClass.newInstance();
- } catch (Exception e) {
- deployment.addProblem("couldn't instantiate process definition with class "+processDefinitionClass+": "+e.toString());
- }
-
- // make the process definition available in the deployment
- deployment.setProcessDefinition(processDefinition);
-
- } else {
- log.trace("using process definition provided in deployment");
- }
- }
-
- public void setProcessDefinitionClass(Class< ? > processDefinitionClass) {
- this.processDefinitionClass = processDefinitionClass;
- }
-
-}
Modified: 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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -30,6 +30,6 @@
*/
public interface Deployer {
- void deploy(DeploymentImpl deploymentImpl);
+ void deploy(DeploymentImpl deployment);
}
Modified: 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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -21,11 +21,8 @@
*/
package org.jbpm.pvm.internal.deploy;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import org.jbpm.JbpmException;
import org.jbpm.log.Log;
@@ -51,81 +48,21 @@
private static final Log log = Log.getLog(DeployerManager.class.getName());
- /** maps extensions to language-ids */
- protected Map<String, String> extensions = new HashMap<String, String>();
-
- /** maps language-ids to a sequence of process deployers */
- protected Map<String, List<Deployer>> deployers = new HashMap<String, List<Deployer>>();
+ /** configurable list of deployers */
+ protected List<Deployer> deployers = new ArrayList<Deployer>();
- public void deploy(DeploymentImpl deploymentImpl) {
- if (deploymentImpl==null) {
+ public void deploy(DeploymentImpl deployment) {
+ if (deployment==null) {
throw new JbpmException("deployment is null");
}
-
- // find the language based on the extension
- String language = deploymentImpl.getLanguage();
- if (language==null) {
- String deploymentName = deploymentImpl.getName();
- log.trace("no language specified in deployment, looking for extension in "+deploymentName);
- if (deploymentName==null) {
- throw new JbpmException("no name nor language specified in deployment");
- }
- Iterator<Entry<String, String>> iter = extensions.entrySet().iterator();
- while ( (iter.hasNext())
- && (language==null)
- ) {
- Map.Entry<String, String> extensionEntry = iter.next();
- if (deploymentName.endsWith(extensionEntry.getKey())) {
- language = extensionEntry.getValue();
- }
- }
-
- if (language==null) {
- throw new JbpmException("couldn't find process language matching extension of "+deploymentName+ " for deploying "+deploymentImpl);
- }
- }
-
- // find the process parser based on the specified language
- log.trace("looking up process deployer sequence for language "+language);
- List<Deployer> deployerSequence = deployers.get(language);
- if (deployerSequence==null) {
- throw new JbpmException("couldn't find deployer sequence for language "+language+ " for deploying "+deploymentImpl);
- }
- log.debug("deploying deployment "+deploymentImpl+" with "+language+"-parser");
-
- for (Deployer deployer: deployerSequence) {
- log.trace("deploying "+deploymentImpl+" to "+deployer);
- deployer.deploy(deploymentImpl);
+ for (Deployer deployer: deployers) {
+ log.debug("applying deployer "+deployer+" to "+deployment);
+ deployer.deploy(deployment);
}
}
-
- public static String getExtension(String fileName) {
- if ( (fileName==null)
- || (fileName.length()==0)
- ) {
- throw new JbpmException("can't extract extension of deployment: no file name");
- }
-
- int lastDotIndex = fileName.lastIndexOf('.');
- if (lastDotIndex==-1) {
- lastDotIndex = 0;
- }
- return fileName.substring(lastDotIndex);
- }
-
- public void addLanguage(String language, String extension, List<Deployer> deployerSequence) {
- if (extension!=null) {
- extensions.put(extension, language);
- }
- deployers.put(language, deployerSequence);
- }
-
- public void setExtensions(Map<String, String> extensions) {
- this.extensions = extensions;
- }
-
- public void setDeployers(Map<String, List<Deployer>> deployers) {
+
+ public void setDeployers(List<Deployer> deployers) {
this.deployers = deployers;
}
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,70 @@
+/*
+ * 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.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SaveDeployer implements Deployer {
+
+ 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;
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ deployedProcess = true;
+ log.debug("saving process definition "+object);
+ pvmDbSession.save(object);
+ }
+ }
+
+ if (!deployedProcess) {
+ log.info("no process definition in "+deployment);
+ }
+ }
+
+ public String toString() {
+ return "save";
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -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.deploy;
-
-import org.jbpm.JbpmException;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.session.PvmDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SaveProcess implements Deployer {
-
- private static Log log = Log.getLog(SaveProcess.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;
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- deployedProcess = true;
- log.debug("saving process definition "+object);
- pvmDbSession.save(object);
- }
- }
-
- if (!deployedProcess) {
- log.info("no process definition in "+deployment);
- }
- }
-
-}
Modified: 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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -54,10 +54,11 @@
import org.w3c.dom.Document;
-/** a deployment unit, containing all information to create a process
- * definition that will be deployed in the persistent store of the
- * Process Virtual Machine.
- *
+/** 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 {
@@ -71,12 +72,28 @@
protected ProcessServiceImpl processServiceImpl;
protected String name;
- protected String language;
+ /** maps file names to stream source */
protected Map<String, StreamSource> files;
- protected Map<String, Document> documents;
+ /** maps file names to dom so that duplicate xml parsing can be avoided. */
+ protected Map<String, Document> fileDocuments;
+ /** maps file names to file types */
+ protected Map<String, String> fileTypes;
+
+ /** generic pool of objects.
+ * 1) users can supply objects directly to a deployment like
+ * e.g. ProcessDefinition's created by a factory
+ * 2) deployers can create objects as a result from processing the files
+ * in those cases the object names are typically identical to the file
+ * names
+ * 3) the save deployer will store all objects in the db.
+ */
protected Map<String, Object> objects;
+
+ /* maps object names to object types */
+ protected Map<String, Object> objectTypes;
+ // TODO REMOVE
protected ProcessDefinition processDefinition;
public DeploymentImpl(ProcessServiceImpl processServiceImpl) {
@@ -96,15 +113,6 @@
}
- public String getLanguage() {
- return language;
- }
-
- public Deployment setLanguage(String language) {
- this.language = language;
- return this;
- }
-
public Deployment addResource(String resource) {
addStreamSource(resource, new ResourceStreamSource(resource));
return this;
@@ -265,10 +273,10 @@
}
public Document getDocument(String name) {
- if ( (documents!=null)
- && (documents.containsKey(name))
+ if ( (fileDocuments!=null)
+ && (fileDocuments.containsKey(name))
) {
- return documents.get(name);
+ return fileDocuments.get(name);
}
if ( (files!=null)
&& (files.containsKey(name))
@@ -288,9 +296,6 @@
}
public void setProcessDefinition(ProcessDefinition processDefinition) {
- if (language==null) {
- language = "api";
- }
this.processDefinition = processDefinition;
}
@@ -310,16 +315,25 @@
return this;
}
- public ProcessDefinition deploy() {
- List<ProcessDefinition> deployedProcessDefinitions = processServiceImpl.deploy(this);
- if (deployedProcessDefinitions.size()>0) {
- return deployedProcessDefinitions.get(0);
- }
- return null;
+ public Deployment deploy() {
+ processServiceImpl.deploy(this);
+ return this;
}
- public List<ProcessDefinition> deployAll() {
- return processServiceImpl.deploy(this);
+ public List<ProcessDefinition> getProcessDefinitions() {
+ List<ProcessDefinition> processDefinitions = null;
+ if (objects!=null) {
+ processDefinitions = new ArrayList<ProcessDefinition>();
+ for (Object object: objects.values()) {
+ if (object instanceof ProcessDefinition) {
+ processDefinitions.add((ProcessDefinition) object);
+ }
+ }
+ } else {
+ processDefinitions = Collections.EMPTY_LIST;
+ }
+
+ return processDefinitions;
}
// error logging ////////////////////////////////////////////////////////////
@@ -341,10 +355,10 @@
}
public void addDocument(String name, Document document) {
- if (documents==null) {
- documents = new HashMap<String, Document>();
+ if (fileDocuments==null) {
+ fileDocuments = new HashMap<String, Document>();
}
- documents.put(name, document);
+ fileDocuments.put(name, document);
}
/** throws an exception with appropriate message in case the parse contains
@@ -362,4 +376,33 @@
return this;
}
+ public Deployment addObject(String name, Object object, String objectType) {
+ addObject(name, objectType);
+ if (objectTypes==null) {
+ objectTypes = new HashMap<String, Object>();
+ }
+ objectTypes.put(name, objectType);
+ return this;
+ }
+
+ public Deployment setFileType(String fileName, String fileType) {
+ if (fileTypes==null) {
+ fileTypes = new HashMap<String, String>();
+ }
+ fileTypes.put(name, 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;
+ }
}
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.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==null) {
+ 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;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: 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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.deploy.CheckProblems;
+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;
@@ -38,8 +38,8 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- CheckProblems checkProblems = new CheckProblems();
- return new ProvidedObjectDescriptor(checkProblems);
+ CheckProblemsDeployer checkProblemsDeployer = new CheckProblemsDeployer();
+ return new ProvidedObjectDescriptor(checkProblemsDeployer);
}
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -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.deploy.CheckProcessIdDeployer;
+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 CheckProcessIdBinding extends WireDescriptorBinding {
+
+ public CheckProcessIdBinding() {
+ super("check-process-id");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CheckProcessIdDeployer checkProcessIdDeployer = new CheckProcessIdDeployer();
+ return new ProvidedObjectDescriptor(checkProcessIdDeployer);
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.deploy.CheckProcessVersionDeployer;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
+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 CheckProcessVersionDeployer version verification deployer}.
+ *
+ * See schema docs for more details.
+ *
+ * @author Tom Baeyens
+ */
+public class CheckProcessVersionBinding extends WireDescriptorBinding {
+
+ public CheckProcessVersionBinding() {
+ super("check-process-version");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CheckProcessVersionDeployer checkProcessVersionDeployer = new CheckProcessVersionDeployer();
+
+ Boolean assign = XmlUtil.attributeBoolean(element, "assign", false, parse, null);
+ if (assign!=null) {
+ checkProcessVersionDeployer.setAssign(assign);
+ }
+
+ return new ProvidedObjectDescriptor(checkProcessVersionDeployer);
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CheckVersion;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
-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 CheckVersion version verification deployer}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class CheckVersionBinding extends WireDescriptorBinding {
-
- public CheckVersionBinding() {
- super("check-version");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CheckVersion checkVersion = new CheckVersion();
-
- Boolean assign = XmlUtil.attributeBoolean(element, "assign", false, parse, null);
- if (assign!=null) {
- checkVersion.setAssign(assign);
- }
-
- return new ProvidedObjectDescriptor(checkVersion);
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -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.CreateId;
-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 CreateIdBinding extends WireDescriptorBinding {
-
- public CreateIdBinding() {
- super("create-id");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CreateId createId = new CreateId();
- return new ProvidedObjectDescriptor(createId);
- }
-
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -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.CreateProcess;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-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 CreateProcess}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class CreateProcessBinding extends WireDescriptorBinding {
-
- public CreateProcessBinding() {
- super("create-process");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CreateProcess createProcess = new CreateProcess();
-
- if (element.hasAttribute("class")) {
- String className = element.getAttribute("class");
- Class<?> processDefinitionClass = ReflectUtil.loadClass(parse.getClassLoader(), className);
- createProcess.setProcessDefinitionClass(processDefinitionClass);
- } else {
- parse.addProblem("class is a required attribute in "+XmlUtil.toString(element));
- }
-
- return new ProvidedObjectDescriptor(createProcess);
- }
-
-}
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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -21,15 +21,10 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import java.net.URL;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.List;
-import org.jbpm.log.Log;
import org.jbpm.pvm.internal.deploy.DeployerManager;
-import org.jbpm.pvm.internal.stream.UrlStreamSource;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.DeployerManagerDescriptor;
@@ -47,54 +42,33 @@
*/
public class DeployerManagerBinding extends WireDescriptorBinding {
- private static final Log log = Log.getLog(DeployerManagerBinding.class.getName());
+ private static final String DEPLOYER_MANAGER_TAG = "deployer-manager";
public DeployerManagerBinding() {
- super("deployer-manager");
+ super(DEPLOYER_MANAGER_TAG);
}
public Object parse(Element element, Parse parse, Parser parser) {
DeployerManagerDescriptor descriptor = new DeployerManagerDescriptor();
- List<Element> languageElements = XmlUtil.elements(element, "language");
- if (languageElements!=null) {
- for (Element languageElement: languageElements) {
- String language = null;
- if (languageElement.hasAttribute("name")) {
- language = languageElement.getAttribute("name");
- } else {
- parse.addProblem("name is a required attribute in element language: "+XmlUtil.toString(languageElement));
- }
-
- String extension = null;
- if (element.hasAttribute("extension")) {
- language = element.getAttribute("extension");
- }
-
- List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
+ List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
+ descriptor.setDeployerDescriptors(deployerDescriptors);
- List<Element> deployerElements = XmlUtil.elements(languageElement);
- if (deployerElements!=null) {
- 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 "+language);
- }
-
- descriptor.addLanguage(language, extension, deployerDescriptors);
+ List<Element> deployerElements = XmlUtil.elements(element);
+ if (deployerElements!=null) {
+ for (Element deployerElement: deployerElements) {
+ Descriptor deployerDescriptor = (Descriptor) parser
+ .parseElement(deployerElement,
+ parse,
+ WireParser.CATEGORY_DESCRIPTOR);
+ deployerDescriptors.add(deployerDescriptor);
}
- } else {
- parse.addProblem("at least one language is required in a deployer-manager: "+XmlUtil.toString(element));
}
+ if (deployerDescriptors.isEmpty()) {
+ parse.addProblem("no deployers defined for "+DEPLOYER_MANAGER_TAG);
+ }
+
return descriptor;
}
-
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java (from rev 3143, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.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);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -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.SaveProcess;
-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 SaveProcess} deployer.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class SaveProcessBinding extends WireDescriptorBinding {
-
- public SaveProcessBinding() {
- super("save-process");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- SaveProcess saveProcess = new SaveProcess();
- return new ProvidedObjectDescriptor(saveProcess);
- }
-}
Modified: 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 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -22,9 +22,7 @@
package org.jbpm.pvm.internal.wire.descriptor;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jbpm.pvm.internal.deploy.Deployer;
import org.jbpm.pvm.internal.deploy.DeployerManager;
@@ -40,11 +38,8 @@
private static final long serialVersionUID = 1L;
- /** maps extensions to language-ids */
- protected Map<String, String> extensions = new HashMap<String, String>();
-
- /** maps language-ids to a sequence of process deployers */
- protected Map<String, List<Descriptor>> deployerDescriptors = new HashMap<String, List<Descriptor>>();
+ /** 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();
@@ -53,31 +48,20 @@
public void initialize(Object object, WireContext wireContext) {
DeployerManager deployerManager = (DeployerManager) object;
- Map<String, List<Deployer>> deployers = new HashMap<String, List<Deployer>>();
- for (Map.Entry<String, List<Descriptor>> languageEntry: deployerDescriptors.entrySet()) {
- String language = languageEntry.getKey();
- List<Descriptor> descriptors = languageEntry.getValue();
-
- List<Deployer> deployerSequence = new ArrayList<Deployer>();
- for (Descriptor descriptor: descriptors) {
- deployerSequence.add((Deployer) wireContext.create(descriptor, true));
- }
-
- deployers.put(language, deployerSequence);
+ List<Deployer> deployers = new ArrayList<Deployer>();
+ for (Descriptor deployerDescriptor: deployerDescriptors) {
+ Deployer deployer = (Deployer) wireContext.create(deployerDescriptor, true);
+ deployers.add(deployer);
}
- deployerManager.setExtensions(extensions);
deployerManager.setDeployers(deployers);
}
public Class< ? > getType(WireDefinition wireDefinition) {
return DeployerManager.class;
}
-
- public void addLanguage(String language, String extension, List<Descriptor> deployerDescriptorSequence) {
- if (extension!=null) {
- extensions.put(extension, language);
- }
- deployerDescriptors.put(language, deployerDescriptorSequence);
+
+ public void setDeployerDescriptors(List<Descriptor> deployerDescriptors) {
+ this.deployerDescriptors = deployerDescriptors;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -58,11 +58,11 @@
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CreateProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckVersionBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveProcessBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.CreateIdBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessVersionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessIdBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- ############################ -->
<!-- ### Interceptor bindings ### -->
Modified: jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -4,12 +4,14 @@
<process-engine>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -16,12 +16,14 @@
<transaction-interceptor />
</command-service>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<hibernate-configuration>
Modified: jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -4,12 +4,14 @@
<process-engine>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-12-01 16:28:48 UTC (rev 3159)
@@ -85,18 +85,22 @@
}
public ProcessDefinition deployJpdlXmlString(String jpdlXmlString) {
- ProcessDefinition deployedProcessDefinition =
+ List<ProcessDefinition> deployedProcessDefinitions =
processService.createDeployment()
- .setLanguage("jpdl")
.addString("xmlstring.jpdl.xml", jpdlXmlString)
- .deploy();
+ .deploy()
+ .getProcessDefinitions();
if (processDefinitions==null) {
processDefinitions = new ArrayList<ProcessDefinition>();
}
- processDefinitions.add(deployedProcessDefinition);
+ processDefinitions.addAll(deployedProcessDefinitions);
- return deployedProcessDefinition;
+ if (deployedProcessDefinitions.size()>=1) {
+ return deployedProcessDefinitions.get(0);
+ }
+
+ return null;
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -5,13 +5,14 @@
<process-engine>
<deployer-manager>
- <language name="jpdl">
- <parse-jpdl />
- <check-version />
- <create-id />
- <check-problems />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -15,35 +15,9 @@
<para>TODO</para>
</section>
- <section id="jboss-4.2.2">
- <title>JBoss 4.2.2</title>
+ <section id="jboss-xxx">
+ <title>JBoss xxx</title>
<para>TODO</para>
</section>
- <section id="jboss-4.2.3">
- <title>JBoss 4.2.3</title>
- <para>TODO</para>
- </section>
-
- <section id="jboss-5.0.0">
- <title>JBoss 5.0.0</title>
- <para>TODO</para>
- </section>
-
- <section id="spring">
- <title>Spring</title>
- <para>Usage of jBPM with Spring is only supported when jBPM is configured with
- the jBPM configuration file and when hibernate or JTA is used for transaction
- demarcation. For configuring jBPM in a Spring configuration file and for
- binding jBPM to Spring demarcated transactions, see the non-supported
- developers guide.
- </para>
- </section>
-
- <section id="osgi">
- <title>OSGi</title>
- <para>TODO
- </para>
- </section>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml 2008-12-01 16:28:48 UTC (rev 3159)
@@ -1,7 +1,7 @@
<chapter id="services">
<title>Services</title>
- <para>Interacting with jBPM occurs through <link linkend="services">services</link>.
+ <para>Interacting with jBPM occurs through services.
The service interfaces can be obtained from the <literal>ProcessEngine</literal>
which is build from a <literal>Configuration</literal>.
</para>
15 years, 5 months
JBoss JBPM SVN: r3158 - in jbpm3/trunk: modules/core and 19 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-11-30 23:47:28 -0500 (Sun, 30 Nov 2008)
New Revision: 3158
Modified:
jbpm3/trunk/modules/core/pom.xml
jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmContext.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/TokenVariableMap.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/SerializabilityTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/DeleteProcessInstanceDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/GraphSessionDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm522/JBPM522Test.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobExecutorDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessArchiveDeploymentDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java
jbpm3/trunk/pom.xml
Log:
[JBPM-1816] merged back revisions 2833 and 2788, sans the schema creation in advance
Modified: jbpm3/trunk/modules/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/core/pom.xml 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/pom.xml 2008-12-01 04:47:28 UTC (rev 3158)
@@ -342,21 +342,16 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <!-- [JBPM-1764] JobExecutorDbTest does not work on Sybase -->
- <exclude>org/jbpm/job/executor/JobExecutorDbTest</exclude>
- <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
- <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
-
- <!-- [JBPM-1824] Investigate core test failures against Sybase -->
- <exclude>org/jbpm/db/DeleteProcessInstanceDbTest.java</exclude>
+ <!-- [JBPM-1764] Deadlocks make job execution tests fail on Sybase -->
+ <exclude>org/jbpm/job/executor/JobExecutorDbTest.java</exclude>
<exclude>org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java</exclude>
<exclude>org/jbpm/jbpm1072/JBPM1072Test.java</exclude>
<exclude>org/jbpm/jbpm1755/JBPM1755Test.java</exclude>
<exclude>org/jbpm/jbpm983/JBPM983Test.java</exclude>
- <exclude>org/jbpm/job/executor/JobExecutorDbTest.java</exclude>
<exclude>org/jbpm/optimisticlocking/LockingTest.java</exclude>
- <exclude>org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java</exclude>
<exclude>org/jbpm/seam/JobExecutorCustomizationTest.java</exclude>
+ <!-- [JBPM-1810] Fix clean, drop, create schema with JbpmSchema -->
+ <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
</excludes>
</configuration>
</plugin>
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -602,13 +602,12 @@
synchronized (instances)
{
- Iterator iter = instances.keySet().iterator();
+ Iterator iter = instances.values().iterator();
while (iter.hasNext())
{
- String resource = (String)iter.next();
- if (this == instances.get(resource))
+ if (this == iter.next())
{
- instances.remove(resource);
+ iter.remove();
break;
}
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmContext.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmContext.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmContext.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -524,81 +524,81 @@
/**
* gets the hibernate session factory from the default configured persistence service.
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * @return the hibernate session factory, or <code>null</code> if a nonstandard
+ * persistence service is configured
*/
public SessionFactory getSessionFactory()
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return null;
- return persistenceService.getSessionFactory();
+ PersistenceService persistenceService = getPersistenceService();
+ return persistenceService instanceof DbPersistenceService
+ ? ((DbPersistenceService) persistenceService).getSessionFactory()
+ : null;
}
/**
* sets the hibernate session factory into the default configured persistence service, overwriting the configured session factory (if there is one configured).
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * if a nonstandard persistence service is configured, then this call has no effect.
*/
public void setSessionFactory(SessionFactory sessionFactory)
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return;
- persistenceService.setSessionFactory(sessionFactory);
+ PersistenceService persistenceService = getPersistenceService();
+ if (persistenceService instanceof DbPersistenceService) {
+ DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService;
+ dbPersistenceService.setSessionFactory(sessionFactory);
+ }
}
/**
* gets the hibernate session from the default configured persistence service.
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * @return the hibernate session, or <code>null</code> if a nonstandard
+ * persistence service is configured.
*/
public Session getSession()
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return null;
- return persistenceService.getSession();
+ PersistenceService persistenceService = getPersistenceService();
+ return persistenceService instanceof DbPersistenceService
+ ? ((DbPersistenceService) persistenceService).getSession()
+ : null;
}
/**
* sets the hibernate session into the default configured persistence service, preventing the creation of a session from the configured session factory (if there is
* one configured).
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * if a nonstandard persistence service is configured, then this call has no effect.
*/
public void setSession(Session session)
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return;
- persistenceService.setSession(session);
+ PersistenceService persistenceService = getPersistenceService();
+ if (persistenceService instanceof DbPersistenceService) {
+ DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService;
+ dbPersistenceService.setSession(session);
+ }
}
/**
* gets the jdbc connection from the default configured persistence service.
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * @return the jdbc connectoin, or <code>null</code> if a nonstandard
+ * persistence service is configured.
*/
public Connection getConnection()
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return null;
- return persistenceService.getConnection();
+ PersistenceService persistenceService = getPersistenceService();
+ return persistenceService instanceof DbPersistenceService
+ ? ((DbPersistenceService) persistenceService).getConnection()
+ : null;
}
/**
* allows users to provide a jdbc connection to be used when the hibernate session is created.
- *
- * @throws ClassCastException if another persistence service is configured then the default.
+ * if a nonstandard persistence service is configured, then this call has no effect.
*/
public void setConnection(Connection connection)
{
- DbPersistenceService persistenceService = (DbPersistenceService)getPersistenceService();
- if (persistenceService == null)
- return;
- persistenceService.setConnection(connection);
+ PersistenceService persistenceService = getPersistenceService();
+ if (persistenceService instanceof DbPersistenceService) {
+ DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService;
+ dbPersistenceService.setConnection(connection);
+ }
}
// jbpm database access sessions
@@ -704,9 +704,7 @@
PersistenceService getPersistenceService()
{
- if (services == null)
- return null;
- return services.getPersistenceService();
+ return services != null ? services.getPersistenceService() : null;
}
public JbpmConfiguration getJbpmConfiguration()
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/ant/AntHelper.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -37,12 +37,16 @@
/**
* common strategy for jbpm ant tasks to obtain a hibernate SessionFactory.
*/
-public abstract class AntHelper
+public class AntHelper
{
final static Map configurations = new HashMap();
final static Map jbpmConfigurations = new HashMap();
+ private AntHelper() {
+ // prevent instantiation
+ }
+
public static Configuration getConfiguration(String hibernateCfgResource, String hibernatePropertiesResource)
{
Object key = getKey(hibernateCfgResource, hibernatePropertiesResource);
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/TokenVariableMap.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/TokenVariableMap.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/TokenVariableMap.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -54,7 +54,7 @@
}
public String toString() {
- return "TokenVariableMap"+( (token!=null)&&(token.getName()!=null) ? "["+token.getName()+"]" : Integer.toHexString(System.identityHashCode(this)));
+ return "TokenVariableMap"+( (token!=null) ? "["+token.getFullName()+"]" : "@" + Integer.toHexString(System.identityHashCode(this)));
}
// protected ////////////////////////////////////////////////////////////////
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -21,6 +21,8 @@
*/
package org.jbpm.context.exe.variableinstance;
+import org.hibernate.Session;
+import org.jbpm.JbpmContext;
import org.jbpm.bytes.ByteArray;
import org.jbpm.context.exe.VariableInstance;
import org.jbpm.context.log.variableinstance.ByteArrayUpdateLog;
@@ -42,6 +44,15 @@
protected void setObject(Object value) {
if (token!=null) token.addLog(new ByteArrayUpdateLog(this, this.value, (ByteArray) value));
+ // delete old value, otherwise it will be unreachable
+ if (this.value != null) {
+ JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+ if (jbpmContext != null) {
+ Session session = jbpmContext.getSession();
+ if (session != null) session.delete(this.value);
+ }
+ }
+ // set new value
this.value = (ByteArray) value;
}
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -83,8 +83,7 @@
JbpmSchema jbpmSchema = new JbpmSchema(configuration);
Map jbpmTablesRecordCount = jbpmSchema.getJbpmTablesRecordCount();
- Iterator iter = jbpmTablesRecordCount.entrySet().iterator();
- while (iter.hasNext())
+ for (Iterator iter = jbpmTablesRecordCount.entrySet().iterator(); iter.hasNext();)
{
Map.Entry entry = (Map.Entry)iter.next();
String tableName = (String)entry.getKey();
@@ -94,7 +93,7 @@
{
hasLeftOvers = true;
// [JBPM-1812] Fix tests that don't cleanup the database
- // System.err.println("FIXME: " + getClass().getName() + "." + getName() + " left " + count + " records in " + tableName);
+ System.err.println("FIXME: " + getClass().getName() + "." + getName() + " left " + count + " records in " + tableName);
}
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/JbpmSchema.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -29,7 +29,6 @@
import java.io.InputStream;
import java.io.PrintStream;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -44,9 +43,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.Settings;
import org.hibernate.connection.ConnectionProvider;
-import org.hibernate.connection.ConnectionProviderFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.Mapping;
import org.hibernate.mapping.ForeignKey;
@@ -64,8 +62,7 @@
private static final long serialVersionUID = 1L;
Configuration configuration = null;
- Properties properties = null;
- Dialect dialect = null;
+ Settings settings;
Mapping mapping = null;
String[] createSql = null;
String[] dropSql = null;
@@ -78,26 +75,15 @@
public JbpmSchema(Configuration configuration)
{
this.configuration = configuration;
- this.properties = configuration.getProperties();
- this.dialect = Dialect.getDialect(properties);
- try
- {
- // get the mapping field via reflection :-(
- Field mappingField = Configuration.class.getDeclaredField("mapping");
- mappingField.setAccessible(true);
- this.mapping = (Mapping)mappingField.get(configuration);
- }
- catch (Exception e)
- {
- throw new JbpmException("couldn't get the hibernate mapping", e);
- }
+ this.settings = configuration.buildSettings();
+ this.mapping = configuration.buildMapping();
}
public String[] getCreateSql()
{
if (createSql == null)
{
- createSql = configuration.generateSchemaCreationScript(dialect);
+ createSql = configuration.generateSchemaCreationScript(settings.getDialect());
}
return createSql;
}
@@ -106,7 +92,7 @@
{
if (dropSql == null)
{
- dropSql = configuration.generateDropSchemaScript(dialect);
+ dropSql = configuration.generateDropSchemaScript(settings.getDialect());
}
return dropSql;
}
@@ -116,10 +102,11 @@
if (cleanSql == null)
{
new SchemaExport(configuration);
-
- String catalog = properties.getProperty(Environment.DEFAULT_CATALOG);
- String schema = properties.getProperty(Environment.DEFAULT_SCHEMA);
+ Dialect dialect = settings.getDialect();
+ String catalog = settings.getDefaultCatalogName();
+ String schema = settings.getDefaultSchemaName();
+
// loop over all foreign key constraints
List dropForeignKeysSql = new ArrayList();
List createForeignKeysSql = new ArrayList();
@@ -351,8 +338,7 @@
public void execute(String[] sqls)
{
String sql = null;
- String showSqlText = properties.getProperty("hibernate.show_sql");
- boolean showSql = ("true".equalsIgnoreCase(showSqlText));
+ boolean showSql = settings.isShowSqlEnabled();
try
{
@@ -410,7 +396,7 @@
void createConnection() throws SQLException
{
- connectionProvider = ConnectionProviderFactory.newConnectionProvider(properties);
+ connectionProvider = settings.getConnectionProvider();
connection = connectionProvider.getConnection();
if (!connection.getAutoCommit())
{
@@ -421,7 +407,7 @@
public Properties getProperties()
{
- return properties;
+ return configuration.getProperties();
}
// sql delimiter ////////////////////////////////////////////////////////////
@@ -432,7 +418,7 @@
{
if (sqlDelimiter == null)
{
- sqlDelimiter = properties.getProperty("jbpm.sql.delimiter", ";");
+ sqlDelimiter = getProperties().getProperty("jbpm.sql.delimiter", ";");
}
return sqlDelimiter;
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -33,17 +32,12 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
-import org.hibernate.tool.hbm2ddl.SchemaExport;
-import org.jbpm.JbpmException;
import org.jbpm.util.ClassLoaderUtil;
-public abstract class HibernateHelper {
+public class HibernateHelper {
- /** maps SessionFactory's to Configurations. */
- /** by default, configuration lookup will be enabled */
- static Map configurations = new HashMap();
- public static void clearConfigurationsCache() {
- configurations = new HashMap();
+ private HibernateHelper() {
+ // prevent instantiation
}
public static SessionFactory createSessionFactory() {
@@ -64,11 +58,7 @@
}
public static SessionFactory createSessionFactory(Configuration configuration, boolean isConfigLookupEnabled) {
- SessionFactory sessionFactory = configuration.buildSessionFactory();
- if (isConfigLookupEnabled) {
- configurations.put(sessionFactory, configuration);
- }
- return sessionFactory;
+ return configuration.buildSessionFactory();
}
public static Configuration createConfiguration(String cfgXmlResource, String propertiesResource) {
@@ -102,23 +92,6 @@
return configuration;
}
- public static Configuration getConfiguration(SessionFactory sessionFactory) {
- return (Configuration) configurations.get(sessionFactory);
- }
-
- public static SchemaExport createSchemaExport(SessionFactory sessionFactory) {
- return new SchemaExport(getConfiguration(sessionFactory));
- }
-
- public static boolean createSchemaExportScript(SessionFactory sessionFactory) {
- boolean script = false;
- String showSql = getConfiguration(sessionFactory).getProperty("hibernate.show_sql");
- if ("true".equalsIgnoreCase(showSql)) {
- script = true;
- }
- return script;
- }
-
public static void clearHibernateCache(SessionFactory sessionFactory) {
sessionFactory.evictQueries();
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceServiceFactory.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -156,6 +156,11 @@
}
}
+ public void finalize() throws Throwable
+ {
+ close();
+ }
+
public String getDataSourceJndiName()
{
return dataSourceJndiName;
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/SerializabilityTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/SerializabilityTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/SerializabilityTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -37,12 +37,7 @@
String testRootDir = FileDefinitionFileSystemConfigTest.class.getProtectionDomain().getCodeSource().getLocation().getFile().toString();
static Set excusedClasses = new HashSet(Arrays.asList(new String[] {
- "org.jbpm.ant.DeployProcessTask",
- "org.jbpm.ant.JbpmSchemaTask",
- "org.jbpm.ant.Launcher",
- "org.jbpm.ant.ShutDownHsqldb",
- "org.jbpm.ant.StartHsqldbTask",
- "org.jbpm.ant.StartJBossTask",
+ "org.jbpm.ant",
"org.jbpm.context.exe.JbpmType",
"org.jbpm.db.hibernate.ConverterEnumType",
"org.jbpm.db.hibernate.Converters",
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -21,7 +21,6 @@
*/
package org.jbpm.context.exe;
-import org.hibernate.cfg.Configuration;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.context.def.ContextDefinition;
@@ -31,49 +30,35 @@
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
import org.jbpm.svc.Services;
-public class CustomVariableLongIdDbTest extends AbstractDbTestCase
-{
+public class CustomVariableLongIdDbTest extends AbstractDbTestCase {
- static JbpmConfiguration customLongJbpmConfiguration = createJbpmConfiguration();
-
- private static JbpmConfiguration createJbpmConfiguration()
- {
- // make custom jbpm configuration aware of hibernate.properties
- String configurationResource = CustomVariableLongIdDbTest.class.getClassLoader().getResource("hibernate.properties") != null ? "org/jbpm/db/jbpm.db.test.cfg.xml"
- : "org/jbpm/jbpm.test.cfg.xml";
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource(configurationResource);
-
- DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try
- {
- /*
- * getConfiguration() relies on JbpmConfiguration.Configs, which accesses either the current context or the default jbpm configuration resource, but has no access
- * to a custom jbpm configuration. The context is created only to enforce the use of the custom jbpm configuration.
- */
- Configuration configuration = dbPersistenceServiceFactory.getConfiguration();
- configuration.addClass(CustomLongClass.class);
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ jbpmConfiguration = JbpmConfiguration.parseResource(getJbpmTestConfig());
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) jbpmContext.getServices()
+ .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ persistenceServiceFactory.getConfiguration().addClass(CustomLongClass.class);
+ }
+ finally {
+ jbpmContext.close();
+ }
}
- finally
- {
- jbpmContext.close();
- }
return jbpmConfiguration;
}
- protected JbpmConfiguration getJbpmConfiguration()
- {
- return customLongJbpmConfiguration;
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
}
- public void testCustomVariableClassWithLongId()
- {
+ public void testCustomVariableClassWithLongId() {
// create and save the process definition
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.addDefinition(new ContextDefinition());
graphSession.saveProcessDefinition(processDefinition);
- try
- {
+ try {
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
// set the jbpmSession in the context because its used to determine the
@@ -88,12 +73,11 @@
contextInstance = processInstance.getContextInstance();
// get the custom hibernatable object from the variableInstances
- customLongObject = (CustomLongClass)contextInstance.getVariable("custom hibernate object");
+ customLongObject = (CustomLongClass) contextInstance.getVariable("custom hibernate object");
assertNotNull(customLongObject);
assertEquals("customname", customLongObject.getName());
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -21,7 +21,6 @@
*/
package org.jbpm.context.exe;
-import org.hibernate.cfg.Configuration;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.context.def.ContextDefinition;
@@ -31,52 +30,39 @@
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
import org.jbpm.svc.Services;
-public class CustomVariableStringIdDbTest extends AbstractDbTestCase
-{
+public class CustomVariableStringIdDbTest extends AbstractDbTestCase {
- static JbpmConfiguration customStringJbpmConfiguration = createJbpmConfiguration();
-
- private static JbpmConfiguration createJbpmConfiguration()
- {
- // make custom jbpm configuration aware of hibernate.properties
- String configurationResource = CustomVariableStringIdDbTest.class.getClassLoader().getResource("hibernate.properties") != null ? "org/jbpm/db/jbpm.db.test.cfg.xml"
- : "org/jbpm/jbpm.test.cfg.xml";
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource(configurationResource);
-
- DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try
- {
- /*
- * getConfiguration() relies on JbpmConfiguration.Configs, which accesses either the current context or the default jbpm configuration resource, but has no access
- * to a custom jbpm configuration. The context is created only to enforce the use of the custom jbpm configuration.
- */
- Configuration configuration = dbPersistenceServiceFactory.getConfiguration();
- configuration.addClass(CustomStringClass.class);
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ jbpmConfiguration = JbpmConfiguration.parseResource(getJbpmTestConfig());
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) jbpmContext.getServices()
+ .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ persistenceServiceFactory.getConfiguration().addClass(CustomStringClass.class);
+ }
+ finally {
+ jbpmContext.close();
+ }
}
- finally
- {
- jbpmContext.close();
- }
return jbpmConfiguration;
}
- protected JbpmConfiguration getJbpmConfiguration()
- {
- return customStringJbpmConfiguration;
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
}
- public void testCustomVariableClassWithStringId()
- {
+ public void testCustomVariableClassWithStringId() {
// create and save the process definition
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.addDefinition(new ContextDefinition());
graphSession.saveProcessDefinition(processDefinition);
- try
- {
+ try {
// create the process instance
ProcessInstance processInstance = new ProcessInstance(processDefinition);
- // set the jbpmSession in the context because its used to determine the jbpm-type for the custom object.
+ // set the jbpmSession in the context because its used to determine the
+ // jbpm-type for the custom object.
ContextInstance contextInstance = processInstance.getContextInstance();
// create the custom object
@@ -87,12 +73,11 @@
contextInstance = processInstance.getContextInstance();
// get the custom hibernatable object from the variableInstances
- customStringObject = (CustomStringClass)contextInstance.getVariable("custom hibernate object");
+ customStringObject = (CustomStringClass) contextInstance.getVariable("custom hibernate object");
assertNotNull(customStringObject);
assertEquals("customname", customStringObject.getName());
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/DeleteProcessInstanceDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/DeleteProcessInstanceDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/DeleteProcessInstanceDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -6,139 +6,123 @@
import org.jbpm.graph.exe.Token;
public class DeleteProcessInstanceDbTest extends AbstractDbTestCase {
-
+
public void testDeleteProcessInstance() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='make fondue'>" +
- " <start-state>" +
- " <transition to='buy cheese' />" +
- " </start-state>" +
- " <state name='buy cheese' />" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='make fondue'>"
+ + " <start-state>"
+ + " <transition to='buy cheese' />"
+ + " </start-state>"
+ + " <state name='buy cheese' />"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(processDefinition);
- try
- {
+ try {
newTransaction();
-
+
ProcessInstance processInstance = jbpmContext.newProcessInstance("make fondue");
processInstance.signal();
-
+
processInstance = saveAndReload(processInstance);
-
+
jbpmContext.getGraphSession().deleteProcessInstance(processInstance);
-
+
newTransaction();
-
- assertEquals(0, session.createQuery("from org.jbpm.graph.exe.ProcessInstance").list().size());
+
+ assertDeleted(processInstance);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
public void testDeleteProcessInstanceWithTask() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='make fondue'>" +
- " <start-state>" +
- " <transition to='buy cheese' />" +
- " </start-state>" +
- " <task-node name='buy cheese'>" +
- " <task />" +
- " </task-node>" +
- "</process-definition>"
- );
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='make fondue'>"
+ + " <start-state>"
+ + " <transition to='buy cheese' />"
+ + " </start-state>"
+ + " <task-node name='buy cheese'>"
+ + " <task />"
+ + " </task-node>"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(processDefinition);
- try
- {
+ try {
newTransaction();
-
+
ProcessInstance processInstance = jbpmContext.newProcessInstance("make fondue");
processInstance.signal();
-
+
processInstance = saveAndReload(processInstance);
-
+
jbpmContext.getGraphSession().deleteProcessInstance(processInstance);
-
+
newTransaction();
-
- assertEquals(0, session.createQuery("from org.jbpm.graph.exe.ProcessInstance").list().size());
+
+ assertDeleted(processInstance);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
public void testDeleteProcessInstanceWithSubProcessInstance() {
- ProcessDefinition buyCheese = ProcessDefinition.parseXmlString(
- "<process-definition name='buy cheese'>" +
- " <start-state>" +
- " <transition to='find shop' />" +
- " </start-state>" +
- " <state name='find shop' />" +
- "</process-definition>"
- );
+ ProcessDefinition buyCheese = ProcessDefinition.parseXmlString("<process-definition name='buy cheese'>"
+ + " <start-state>"
+ + " <transition to='find shop' />"
+ + " </start-state>"
+ + " <state name='find shop' />"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(buyCheese);
-
- ProcessDefinition makeFondue = ProcessDefinition.parseXmlString(
- "<process-definition name='make fondue'>" +
- " <start-state>" +
- " <transition to='buy cheese' />" +
- " </start-state>" +
- " <process-state name='buy cheese'>" +
- " <sub-process name='buy cheese' />" +
- " </process-state>" +
- "</process-definition>"
- );
+
+ ProcessDefinition makeFondue = ProcessDefinition.parseXmlString("<process-definition name='make fondue'>"
+ + " <start-state>"
+ + " <transition to='buy cheese' />"
+ + " </start-state>"
+ + " <process-state name='buy cheese'>"
+ + " <sub-process name='buy cheese' />"
+ + " </process-state>"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(makeFondue);
- try
- {
+ try {
newTransaction();
-
+
ProcessInstance processInstance = jbpmContext.newProcessInstance("make fondue");
processInstance.signal();
-
+
processInstance = saveAndReload(processInstance);
-
+
jbpmContext.getGraphSession().deleteProcessInstance(processInstance);
-
+
newTransaction();
-
- assertEquals(0, session.createQuery("from org.jbpm.graph.exe.ProcessInstance").list().size());
+
+ assertDeleted(processInstance.getRootToken().getProcessInstance());
+ assertDeleted(processInstance);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(buyCheese.getId());
jbpmContext.getGraphSession().deleteProcessDefinition(makeFondue.getId());
}
}
public void testDeleteProcessInstanceWithConcurrentPathsOfExecution() {
- ProcessDefinition makeFondue = ProcessDefinition.parseXmlString(
- "<process-definition name='make fondue'>" +
- " <start-state>" +
- " <transition to='fork' />" +
- " </start-state>" +
- " <fork name='fork'>" +
- " <transition name='cheese' to='buy cheese' />" +
- " <transition name='bread' to='bake bread' />" +
- " </fork>" +
- " <state name='buy cheese' />" +
- " <state name='bake bread' />" +
- "</process-definition>"
- );
+ ProcessDefinition makeFondue = ProcessDefinition.parseXmlString("<process-definition name='make fondue'>"
+ + " <start-state>"
+ + " <transition to='fork' />"
+ + " </start-state>"
+ + " <fork name='fork'>"
+ + " <transition name='cheese' to='buy cheese' />"
+ + " <transition name='bread' to='bake bread' />"
+ + " </fork>"
+ + " <state name='buy cheese' />"
+ + " <state name='bake bread' />"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(makeFondue);
- try
- {
+ try {
newTransaction();
-
+
ProcessInstance processInstance = jbpmContext.newProcessInstance("make fondue");
ContextInstance contextInstance = processInstance.getContextInstance();
contextInstance.setVariable("a", "asterix");
contextInstance.setVariable("b", "obelix");
-
+
processInstance.signal();
Token cheese = processInstance.getRootToken().getChild("cheese");
contextInstance.setVariable("a", "mik", cheese);
@@ -150,21 +134,21 @@
contextInstance.setVariable("b", "janneke", bread);
processInstance = saveAndReload(processInstance);
-
+
jbpmContext.getGraphSession().deleteProcessInstance(processInstance);
-
+
newTransaction();
-
- assertEquals(0, session.createQuery("from org.jbpm.graph.exe.ProcessInstance").list().size());
- assertEquals(0, session.createQuery("from org.jbpm.graph.exe.Token").list().size());
- assertEquals(0, session.createQuery("from org.jbpm.context.exe.TokenVariableMap").list().size());
- assertEquals(0, session.createQuery("from org.jbpm.context.exe.VariableInstance").list().size());
- assertEquals(0, session.createQuery("from org.jbpm.logging.log.ProcessLog").list().size());
- assertEquals(0, session.createQuery("from org.jbpm.module.exe.ModuleInstance").list().size());
+
+ assertDeleted(processInstance);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(makeFondue.getId());
}
}
+
+ private void assertDeleted(ProcessInstance processInstance) {
+ long processInstanceId = processInstance.getId();
+ assertNull("process instance not deleted: " + processInstanceId,
+ graphSession.getProcessInstance(processInstanceId));
+ }
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/GraphSessionDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/GraphSessionDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/db/GraphSessionDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -29,17 +29,14 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
-public class GraphSessionDbTest extends AbstractDbTestCase
-{
+public class GraphSessionDbTest extends AbstractDbTestCase {
- public void testProcessDefinitionSaveAndLoad()
- {
+ public void testProcessDefinitionSaveAndLoad() {
// create a process definition
ProcessDefinition processDefinition = new ProcessDefinition("auction");
// save it in the database
graphSession.saveProcessDefinition(processDefinition);
- try
- {
+ try {
// get the assigned id
long processDefinitionId = processDefinition.getId();
// start a new transaction
@@ -49,16 +46,15 @@
// check the result
assertEquals("auction", processDefinition.getName());
}
- finally
- {
- // cleanup
+ finally {
+ // cleanup
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
- public void testFindProcessDefinitionByNameAndVersion()
- {
- // put 3 process definitions in the database with the same name, but different versions
+ public void testFindProcessDefinitionByNameAndVersion() {
+ // put 3 process definitions in the database with the same name, but
+ // different versions
ProcessDefinition processDefinitionOne = new ProcessDefinition("auction");
processDefinitionOne.setVersion(1);
graphSession.saveProcessDefinition(processDefinitionOne);
@@ -81,11 +77,11 @@
assertEquals(secondVersionProcessDefinitionId, processDefinitionTwo.getId());
assertEquals("auction", processDefinitionTwo.getName());
assertEquals(2, processDefinitionTwo.getVersion());
-
+
// start a new transaction
newTransaction();
- // cleanup
+ // cleanup
graphSession.deleteProcessDefinition(processDefinitionOne.getId());
newTransaction();
graphSession.deleteProcessDefinition(processDefinitionTwo.getId());
@@ -93,9 +89,9 @@
graphSession.deleteProcessDefinition(processDefinitionThree.getId());
}
- public void testFindLatestProcessDefinition() throws Exception
- {
- // put 3 process definitions in the database with the same name, but different versions
+ public void testFindLatestProcessDefinition() throws Exception {
+ // put 3 process definitions in the database with the same name, but
+ // different versions
ProcessDefinition processDefinition = new ProcessDefinition("auction");
processDefinition.setVersion(1);
graphSession.saveProcessDefinition(processDefinition);
@@ -119,7 +115,7 @@
newTransaction();
- // cleanup
+ // cleanup
processDefinition = graphSession.findProcessDefinition("auction", 1);
graphSession.deleteProcessDefinition(processDefinition.getId());
@@ -130,9 +126,11 @@
graphSession.deleteProcessDefinition(processDefinition.getId());
}
- public void testFindAllProcessDefinitions() throws Exception
- {
- // put 3 process definitions in the database with the same name, but different versions
+ public void testFindAllProcessDefinitions() throws Exception {
+ ensureCleanProcessDefinitionTable();
+
+ // put 3 process definitions in the database with the same name, but
+ // different versions
ProcessDefinition processDefinition = new ProcessDefinition("auction");
processDefinition.setVersion(1);
graphSession.saveProcessDefinition(processDefinition);
@@ -155,41 +153,43 @@
newTransaction();
- List allProcessDefinitions = graphSession.findAllProcessDefinitions();
- assertEquals(5, allProcessDefinitions.size());
- assertEquals(3, ((ProcessDefinition)allProcessDefinitions.get(0)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitions.get(0)).getName());
- assertEquals(2, ((ProcessDefinition)allProcessDefinitions.get(1)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitions.get(1)).getName());
- assertEquals(1, ((ProcessDefinition)allProcessDefinitions.get(2)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitions.get(2)).getName());
- assertEquals(2, ((ProcessDefinition)allProcessDefinitions.get(3)).getVersion());
- assertEquals("bake cake", ((ProcessDefinition)allProcessDefinitions.get(3)).getName());
- assertEquals(1, ((ProcessDefinition)allProcessDefinitions.get(4)).getVersion());
- assertEquals("bake cake", ((ProcessDefinition)allProcessDefinitions.get(4)).getName());
+ try {
+ List allProcessDefinitions = graphSession.findAllProcessDefinitions();
+ assertEquals(5, allProcessDefinitions.size());
+ assertEquals(3, ((ProcessDefinition) allProcessDefinitions.get(0)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitions.get(0)).getName());
+ assertEquals(2, ((ProcessDefinition) allProcessDefinitions.get(1)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitions.get(1)).getName());
+ assertEquals(1, ((ProcessDefinition) allProcessDefinitions.get(2)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitions.get(2)).getName());
+ assertEquals(2, ((ProcessDefinition) allProcessDefinitions.get(3)).getVersion());
+ assertEquals("bake cake", ((ProcessDefinition) allProcessDefinitions.get(3)).getName());
+ assertEquals(1, ((ProcessDefinition) allProcessDefinitions.get(4)).getVersion());
+ assertEquals("bake cake", ((ProcessDefinition) allProcessDefinitions.get(4)).getName());
- newTransaction();
+ newTransaction();
+ }
+ finally {
+ processDefinition = graphSession.findProcessDefinition("auction", 1);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- // cleanup
- processDefinition = graphSession.findProcessDefinition("auction", 1);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("auction", 2);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("auction", 2);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("auction", 3);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("auction", 3);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("bake cake", 1);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("bake cake", 1);
- graphSession.deleteProcessDefinition(processDefinition.getId());
-
- processDefinition = graphSession.findProcessDefinition("bake cake", 2);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("bake cake", 2);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testFindAllProcessDefinitionVersions() throws Exception
- {
- // put 3 process definitions in the database with the same name, but different versions
+ public void testFindAllProcessDefinitionVersions() throws Exception {
+ // put 3 process definitions in the database with the same name, but
+ // different versions
ProcessDefinition processDefinition = new ProcessDefinition("auction");
processDefinition.setVersion(1);
graphSession.saveProcessDefinition(processDefinition);
@@ -212,184 +212,213 @@
newTransaction();
- List allProcessDefinitionVersions = graphSession.findAllProcessDefinitionVersions("auction");
- assertEquals(3, allProcessDefinitionVersions.size());
- assertEquals(3, ((ProcessDefinition)allProcessDefinitionVersions.get(0)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitionVersions.get(0)).getName());
- assertEquals(2, ((ProcessDefinition)allProcessDefinitionVersions.get(1)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitionVersions.get(1)).getName());
- assertEquals(1, ((ProcessDefinition)allProcessDefinitionVersions.get(2)).getVersion());
- assertEquals("auction", ((ProcessDefinition)allProcessDefinitionVersions.get(2)).getName());
+ try {
+ List allProcessDefinitionVersions = graphSession.findAllProcessDefinitionVersions("auction");
+ assertEquals(3, allProcessDefinitionVersions.size());
+ assertEquals(3, ((ProcessDefinition) allProcessDefinitionVersions.get(0)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitionVersions.get(0)).getName());
+ assertEquals(2, ((ProcessDefinition) allProcessDefinitionVersions.get(1)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitionVersions.get(1)).getName());
+ assertEquals(1, ((ProcessDefinition) allProcessDefinitionVersions.get(2)).getVersion());
+ assertEquals("auction", ((ProcessDefinition) allProcessDefinitionVersions.get(2)).getName());
- allProcessDefinitionVersions = graphSession.findAllProcessDefinitionVersions("bake cake");
- assertEquals(2, allProcessDefinitionVersions.size());
- assertEquals(2, ((ProcessDefinition)allProcessDefinitionVersions.get(0)).getVersion());
- assertEquals("bake cake", ((ProcessDefinition)allProcessDefinitionVersions.get(0)).getName());
- assertEquals(1, ((ProcessDefinition)allProcessDefinitionVersions.get(1)).getVersion());
- assertEquals("bake cake", ((ProcessDefinition)allProcessDefinitionVersions.get(1)).getName());
+ allProcessDefinitionVersions = graphSession.findAllProcessDefinitionVersions("bake cake");
+ assertEquals(2, allProcessDefinitionVersions.size());
+ assertEquals(2, ((ProcessDefinition) allProcessDefinitionVersions.get(0)).getVersion());
+ assertEquals("bake cake", ((ProcessDefinition) allProcessDefinitionVersions.get(0)).getName());
+ assertEquals(1, ((ProcessDefinition) allProcessDefinitionVersions.get(1)).getVersion());
+ assertEquals("bake cake", ((ProcessDefinition) allProcessDefinitionVersions.get(1)).getName());
- newTransaction();
+ newTransaction();
+ }
+ finally {
+ processDefinition = graphSession.findProcessDefinition("auction", 1);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- // cleanup
- processDefinition = graphSession.findProcessDefinition("auction", 1);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("auction", 2);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("auction", 2);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("auction", 3);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("auction", 3);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("bake cake", 1);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("bake cake", 1);
- graphSession.deleteProcessDefinition(processDefinition.getId());
-
- processDefinition = graphSession.findProcessDefinition("bake cake", 2);
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ processDefinition = graphSession.findProcessDefinition("bake cake", 2);
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testSaveAndLoadProcessInstance()
- {
+ public void testSaveAndLoadProcessInstance() {
ProcessInstance processInstance = new ProcessInstance();
processInstance = saveAndReload(processInstance);
- assertNotNull(processInstance);
-
- // cleanup
- session.delete(processInstance);
+ try {
+ assertNotNull(processInstance);
+ }
+ finally {
+ graphSession.deleteProcessInstance(processInstance);
+ }
}
- public void testUpdateProcessInstance()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + " <start-state name='s' />" + " <node name='n' />"
+ public void testUpdateProcessInstance() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='s' />"
+ + " <node name='n' />"
+ "</process-definition>");
processDefinition = saveAndReload(processDefinition);
+
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance = saveAndReload(processInstance);
+ long pid = processInstance.getId();
- processInstance = saveAndReload(processInstance);
- long pid = processInstance.getId();
+ assertEquals("s", processInstance.getRootToken().getNode().getName());
+ processInstance.getRootToken().setNode(processInstance.getProcessDefinition().getNode("n"));
- assertEquals("s", processInstance.getRootToken().getNode().getName());
- processInstance.getRootToken().setNode(processInstance.getProcessDefinition().getNode("n"));
+ processInstance = saveAndReload(processInstance);
+ assertEquals("n", processInstance.getRootToken().getNode().getName());
+ assertEquals(pid, processInstance.getId());
- processInstance = saveAndReload(processInstance);
- assertEquals("n", processInstance.getRootToken().getNode().getName());
- assertEquals(pid, processInstance.getId());
-
- newTransaction();
-
- // cleanup
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ newTransaction();
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testFindProcessInstancesByProcessDefinition()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + " <start-state name='s' />" + " <node name='n' />"
+ public void testFindProcessInstancesByProcessDefinition() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='s' />"
+ + " <node name='n' />"
+ "</process-definition>");
graphSession.saveProcessDefinition(processDefinition);
- jbpmContext.save(new ProcessInstance(processDefinition));
- jbpmContext.save(new ProcessInstance(processDefinition));
- jbpmContext.save(new ProcessInstance(processDefinition));
+ try {
+ jbpmContext.save(new ProcessInstance(processDefinition));
+ jbpmContext.save(new ProcessInstance(processDefinition));
+ jbpmContext.save(new ProcessInstance(processDefinition));
- newTransaction();
+ newTransaction();
- List processInstances = graphSession.findProcessInstances(processDefinition.getId());
- assertEquals(3, processInstances.size());
+ List processInstances = graphSession.findProcessInstances(processDefinition.getId());
+ assertEquals(3, processInstances.size());
- // process instances should be ordered from recent to old
- long previousStart = System.currentTimeMillis();
- Iterator iter = processInstances.iterator();
- while (iter.hasNext())
- {
- ProcessInstance processInstance = (ProcessInstance)iter.next();
- long processStart = processInstance.getStart().getTime();
- assertTrue(previousStart >= processStart);
- previousStart = processStart;
+ // process instances should be ordered from recent to old
+ long previousStart = System.currentTimeMillis();
+ Iterator iter = processInstances.iterator();
+ while (iter.hasNext()) {
+ ProcessInstance processInstance = (ProcessInstance) iter.next();
+ long processStart = processInstance.getStart().getTime();
+ assertTrue(previousStart >= processStart);
+ previousStart = processStart;
+ }
+
+ newTransaction();
}
-
- newTransaction();
-
- // cleanup
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testDeleteProcessInstance()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + " <start-state name='s' />" + " <node name='n' />"
+ public void testDeleteProcessInstance() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='s' />"
+ + " <node name='n' />"
+ "</process-definition>");
graphSession.saveProcessDefinition(processDefinition);
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- jbpmContext.save(processInstance);
- newTransaction();
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ jbpmContext.save(processInstance);
- graphSession.deleteProcessInstance(processInstance.getId());
+ newTransaction();
- newTransaction();
+ graphSession.deleteProcessInstance(processInstance.getId());
- assertEquals(0, graphSession.findProcessInstances(processDefinition.getId()).size());
-
- newTransaction();
+ newTransaction();
- // cleanup
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ assertEquals(0, graphSession.findProcessInstances(processDefinition.getId()).size());
+
+ newTransaction();
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testDeleteProcessInstanceWithVariables()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + " <start-state name='start'>" + " <transition to='fork' />"
- + " </start-state>" + " <fork name='fork'>" + " <transition name='a' to='a' />" + " <transition name='b' to='b' />" + " </fork>"
- + " <state name='a' />" + " <state name='b' />" + "</process-definition>");
+ public void testDeleteProcessInstanceWithVariables() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state name='start'>"
+ + " <transition to='fork' />"
+ + " </start-state>"
+ + " <fork name='fork'>"
+ + " <transition name='a' to='a' />"
+ + " <transition name='b' to='b' />"
+ + " </fork>"
+ + " <state name='a' />"
+ + " <state name='b' />"
+ + "</process-definition>");
graphSession.saveProcessDefinition(processDefinition);
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- Token tokenA = processInstance.findToken("/a");
- Token tokenB = processInstance.findToken("/b");
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+ Token tokenA = processInstance.findToken("/a");
+ Token tokenB = processInstance.findToken("/b");
- ContextInstance contextInstance = processInstance.getContextInstance();
- contextInstance.setVariable("r", "rrrrrr");
- contextInstance.createVariable("a", "aaaaaa", tokenA);
- contextInstance.createVariable("b", "bbbbbb", tokenB);
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("r", "rrrrrr");
+ contextInstance.createVariable("a", "aaaaaa", tokenA);
+ contextInstance.createVariable("b", "bbbbbb", tokenB);
- processInstance = saveAndReload(processInstance);
+ processInstance = saveAndReload(processInstance);
- graphSession.deleteProcessInstance(processInstance);
+ graphSession.deleteProcessInstance(processInstance);
- newTransaction();
+ newTransaction();
- List processInstances = graphSession.findProcessInstances(processDefinition.getId());
- assertEquals(0, processInstances.size());
-
- newTransaction();
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ List processInstances = graphSession.findProcessInstances(processDefinition.getId());
+ assertEquals(0, processInstances.size());
+
+ newTransaction();
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
- public void testDeleteProcessDefinition()
- {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + " <start-state name='s' />" + " <node name='n' />"
+ public void testDeleteProcessDefinition() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='deleteme'>"
+ + " <start-state name='s' />"
+ + " <node name='n' />"
+ "</process-definition>");
graphSession.saveProcessDefinition(processDefinition);
- jbpmContext.save(new ProcessInstance(processDefinition));
- jbpmContext.save(new ProcessInstance(processDefinition));
- jbpmContext.save(new ProcessInstance(processDefinition));
- jbpmContext.save(new ProcessInstance(processDefinition));
- newTransaction();
+ try {
+ jbpmContext.save(new ProcessInstance(processDefinition));
+ jbpmContext.save(new ProcessInstance(processDefinition));
+ jbpmContext.save(new ProcessInstance(processDefinition));
+ jbpmContext.save(new ProcessInstance(processDefinition));
- graphSession.deleteProcessDefinition(processDefinition.getId());
+ newTransaction();
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
newTransaction();
- assertEquals(0, graphSession.findAllProcessDefinitions().size());
+ assertEquals(0, graphSession.findAllProcessDefinitionVersions(processDefinition.getName()).size());
assertEquals(0, graphSession.findProcessInstances(processDefinition.getId()).size());
}
- public void testLatestProcessDefinitions()
- {
+ public void testLatestProcessDefinitions() {
+ ensureCleanProcessDefinitionTable();
+
ProcessDefinition websale = new ProcessDefinition("websale");
jbpmContext.deployProcessDefinition(websale);
jbpmContext.deployProcessDefinition(websale);
@@ -413,14 +442,23 @@
graphSession.deleteProcessDefinition(changeNappy.getId());
}
- private int getVersionOfProcess(String name, List latestProcessDefinitions)
- {
+ private void ensureCleanProcessDefinitionTable() {
+ List processDefinitions = session.createCriteria(ProcessDefinition.class).list();
+ if (!processDefinitions.isEmpty()) {
+ System.err.println("FIXME: "+ getClass().getName() + "." + getName() +
+ " found " + processDefinitions.size() + " process definitions left over");
+ for (Iterator i = processDefinitions.iterator(); i.hasNext();) {
+ ProcessDefinition processDefinition = (ProcessDefinition) i.next();
+ graphSession.deleteProcessDefinition(processDefinition);
+ }
+ }
+ }
+
+ private int getVersionOfProcess(String name, List latestProcessDefinitions) {
Iterator iter = latestProcessDefinitions.iterator();
- while (iter.hasNext())
- {
- ProcessDefinition processDefinition = (ProcessDefinition)iter.next();
- if (name.equals(processDefinition.getName()))
- {
+ while (iter.hasNext()) {
+ ProcessDefinition processDefinition = (ProcessDefinition) iter.next();
+ if (name.equals(processDefinition.getName())) {
return processDefinition.getVersion();
}
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/exe/SubProcessPlusConcurrencyDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -59,7 +59,7 @@
" <transition name='a' to='join' />" +
" <transition name='b' to='join' />" +
" </fork>" +
- " <join name='join'>" +
+ " <join name='join' lock='UPGRADE'>" +
" <transition to='s' />" +
" </join>" +
" <state name='s'>" +
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/graph/node/ProcessStateDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -21,8 +21,7 @@
*/
package org.jbpm.graph.node;
-import java.util.List;
-
+import org.hibernate.criterion.Order;
import org.jbpm.JbpmException;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.db.AbstractDbTestCase;
@@ -40,7 +39,7 @@
"<process-definition>" +
" <process-state name='subprocess' />" +
"</process-definition>");
-
+
processDefinition = saveAndReload(processDefinition);
try
{
@@ -49,8 +48,7 @@
}
finally
{
- newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition);
}
}
@@ -79,76 +77,72 @@
ProcessInstance superProcessInstance = processDefinition.createProcessInstance();
superProcessInstance.signal();
superProcessInstance.signal();
-
+
superProcessInstance = saveAndReload(superProcessInstance);
-
+
Token superToken = superProcessInstance.getRootToken();
assertEquals("subprocessnode", superToken.getNode().getName());
-
+
ProcessInstance subProcessInstance = superToken.getSubProcessInstance();
assertNotNull(subProcessInstance);
assertEquals("recursive process", subProcessInstance.getProcessDefinition().getName());
Token subToken = subProcessInstance.getRootToken();
-
+
assertEquals("first wait", subToken.getNode().getName());
-
+
subProcessInstance.signal("done");
-
+
subProcessInstance = saveAndReload(subProcessInstance);
superProcessInstance = graphSession.loadProcessInstance(superProcessInstance.getId());
-
- assertTrue(subProcessInstance.hasEnded());
+
+ assertTrue(subProcessInstance.hasEnded());
assertTrue(superProcessInstance.hasEnded());
-
}
finally
{
- newTransaction();
- try {
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
- } catch (RuntimeException e) {
- e.printStackTrace();
- } finally {
- newTransaction();
- }
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
- public void testMultipleRecursiveProcessDefinitions() {
+ public void testMultipleRecursiveProcessDefinitions()
+ {
for (int i=0; i<30; i++) {
testRecursiveProcessDefinition();
newTransaction();
}
}
-
public void testProcessStateSubProcessDefinition()
{
// create the subprocess
ProcessDefinition subProcessDefinition = new ProcessDefinition("sub");
// store the subprocess in the database
graphSession.saveProcessDefinition(subProcessDefinition);
-
- // create the super process
- ProcessDefinition superProcessDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='super'>" +
- " <process-state name='subprocess' />" +
- "</process-definition>");
- // resolve the reference to the subprocess
- ProcessState processState = (ProcessState) superProcessDefinition.getNode("subprocess");
- processState.setSubProcessDefinition(subProcessDefinition);
-
- // save and reload the superprocess
- superProcessDefinition = saveAndReload(superProcessDefinition);
- try
+ try
{
- processState = (ProcessState) superProcessDefinition.getNode("subprocess");
- assertNotNull("sub", processState.getSubProcessDefinition().getName());
+ // create the super process
+ ProcessDefinition superProcessDefinition = ProcessDefinition.parseXmlString(
+ "<process-definition name='super'>" +
+ " <process-state name='subprocess' />" +
+ "</process-definition>");
+ // resolve the reference to the subprocess
+ ProcessState processState = (ProcessState) superProcessDefinition.getNode("subprocess");
+ processState.setSubProcessDefinition(subProcessDefinition);
+
+ // save and reload the superprocess
+ superProcessDefinition = saveAndReload(superProcessDefinition);
+ try
+ {
+ processState = (ProcessState) superProcessDefinition.getNode("subprocess");
+ assertNotNull("sub", processState.getSubProcessDefinition().getName());
+ }
+ finally
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(superProcessDefinition);
+ }
}
finally
- {
- newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(superProcessDefinition.getId());
+ {
jbpmContext.getGraphSession().deleteProcessDefinition(subProcessDefinition.getId());
}
}
@@ -171,44 +165,48 @@
}
finally
{
- newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition);
}
}
public void testSubProcessBindingWithLatestVersion()
{
- jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
- jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
- jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
-
+ final int versionCount = 3;
+ for (int i = 0; i < versionCount; i++)
+ {
+ jbpmContext.deployProcessDefinition(new ProcessDefinition("the multiversion subprocess"));
+ }
+
newTransaction();
-
- ProcessDefinition processDefinitionTwo = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <process-state name='the sub process state'>" +
- " <sub-process name='the multiversion subprocess'/>" +
- " </process-state>" +
- "</process-definition>"
- );
- processDefinitionTwo = saveAndReload(processDefinitionTwo);
try
{
- ProcessState processState = (ProcessState) processDefinitionTwo.getNode("the sub process state");
- assertEquals("the multiversion subprocess", processState.getSubProcessDefinition().getName() );
- assertEquals(3, processState.getSubProcessDefinition().getVersion() );
+ ProcessDefinition processDefinitionTwo = ProcessDefinition.parseXmlString(
+ "<process-definition>" +
+ " <process-state name='the sub process state'>" +
+ " <sub-process name='the multiversion subprocess'/>" +
+ " </process-state>" +
+ "</process-definition>"
+ );
+ processDefinitionTwo = saveAndReload(processDefinitionTwo);
+ try
+ {
+ ProcessState processState = (ProcessState) processDefinitionTwo.getNode("the sub process state");
+ assertEquals("the multiversion subprocess", processState.getSubProcessDefinition().getName() );
+ assertEquals(3, processState.getSubProcessDefinition().getVersion() );
+ }
+ finally
+ {
+ graphSession.deleteProcessDefinition(processDefinitionTwo);
+ }
}
finally
{
- newTransaction();
- ProcessDefinition processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 1);
- graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 2);
- graphSession.deleteProcessDefinition(processDefinition.getId());
- processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", 3);
- graphSession.deleteProcessDefinition(processDefinition.getId());
- graphSession.deleteProcessDefinition(processDefinitionTwo.getId());
- }
+ for (int i = 1; i <= versionCount; i++)
+ {
+ ProcessDefinition processDefinition = graphSession.findProcessDefinition("the multiversion subprocess", i);
+ graphSession.deleteProcessDefinition(processDefinition);
+ }
+ }
}
public void testAverageSubProcess()
@@ -291,7 +289,6 @@
}
finally
{
- newTransaction();
jbpmContext.getGraphSession().deleteProcessDefinition(superProcessDefinition.getId());
jbpmContext.getGraphSession().deleteProcessDefinition(subProcessDefinition.getId());
}
@@ -320,9 +317,8 @@
}
finally
{
- newTransaction();
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionOne.getId());
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionTwo.getId());
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinitionTwo);
}
}
@@ -352,46 +348,37 @@
"</process-definition>");
jbpmContext.deployProcessDefinition(superProcessDefinition);
- ProcessInstance superProcessInstance = null;
- ProcessInstance subProcessInstance = null;
-
try
{
newTransaction();
- superProcessInstance = jbpmContext.newProcessInstanceForUpdate("superprocess");
+ ProcessInstance superProcessInstance = jbpmContext.newProcessInstanceForUpdate("superprocess");
superProcessInstance.signal();
newTransaction();
long subProcessInstanceId = superProcessInstance.getRootToken().getSubProcessInstance().getId();
- subProcessInstance = jbpmContext.loadProcessInstance(subProcessInstanceId);
+ ProcessInstance subProcessInstance = jbpmContext.loadProcessInstance(subProcessInstanceId);
subProcessInstance.signal();
jbpmContext.save(subProcessInstance);
newTransaction();
- List processStateLogs = session.createQuery(
- "select l " +
- "from org.jbpm.graph.log.ProcessStateLog l "
- ).list();
-
- assertEquals(1, processStateLogs.size());
- ProcessStateLog processStateLog = (ProcessStateLog) processStateLogs.get(0);
-
+ ProcessStateLog processStateLog = (ProcessStateLog) session.createCriteria(ProcessStateLog.class)
+ .addOrder(Order.desc("enter"))
+ .setMaxResults(1)
+ .uniqueResult();
+
assertEquals(subProcessInstanceId, processStateLog.getSubProcessInstance().getId());
assertEquals(superProcessInstance.getId(), processStateLog.getToken().getProcessInstance().getId());
}
finally
{
- newTransaction();
- graphSession.deleteProcessInstance(superProcessInstance.getId());
- newTransaction();
graphSession.deleteProcessDefinition(subProcessDefinition.getId());
graphSession.deleteProcessDefinition(superProcessDefinition.getId());
}
}
-
+
public void testDynamicProcessBinding()
{
ProcessDefinition processDefinitionOne = ProcessDefinition.parseXmlString(
@@ -417,7 +404,6 @@
" <end-state name='end' />" +
"</process-definition>");
jbpmContext.deployProcessDefinition(processDefinitionTwo);
-
ProcessDefinition processDefinitionThree = ProcessDefinition.parseXmlString(
"<process-definition name='superprocess'>" +
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1452/JBPM1452Test.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -60,6 +60,7 @@
protected void tearDown() throws Exception {
graphSession.deleteProcessDefinition(processDefinitionId);
super.tearDown();
+ jbpmConfiguration.close();
}
public void testNoJobExecutor() {
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm522/JBPM522Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm522/JBPM522Test.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm522/JBPM522Test.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -45,38 +45,47 @@
public void testDeployProcess()
{
runTarget("deploy.process");
- List processDefinitions = graphSession.findAllProcessDefinitions();
+ List processDefinitions = graphSession.findAllProcessDefinitionVersions("timerProcess");
assertEquals(1, processDefinitions.size());
ProcessDefinition processDefinition = (ProcessDefinition)processDefinitions.get(0);
assertEquals("timerProcess", processDefinition.getName());
- session.delete(processDefinition);
+ graphSession.deleteProcessDefinition(processDefinition);
}
public void testDeployBadProcess()
{
runTarget("deploy.bad.process");
- List processDefinitions = graphSession.findAllProcessDefinitions();
+ List processDefinitions = graphSession.findAllProcessDefinitionVersions("sequential process");
assertEquals(0, processDefinitions.size());
}
public void testDeployProcesses()
{
runTarget("deploy.processes");
- List processDefinitions = graphSession.findAllProcessDefinitions();
- assertEquals(2, processDefinitions.size());
+ List processDefinitions = graphSession.findAllProcessDefinitionVersions("classLoadingProcess");
+ assertEquals(1, processDefinitions.size());
ProcessDefinition processDefinition = (ProcessDefinition)processDefinitions.get(0);
assertEquals("classLoadingProcess", processDefinition.getName());
- session.delete(processDefinition);
- processDefinition = (ProcessDefinition)processDefinitions.get(1);
+ graphSession.deleteProcessDefinition(processDefinition);
+
+ processDefinitions = graphSession.findAllProcessDefinitionVersions("timerProcess");
+ assertEquals(1, processDefinitions.size());
+ processDefinition = (ProcessDefinition)processDefinitions.get(0);
assertEquals("timerProcess", processDefinition.getName());
- session.delete(processDefinition);
+ graphSession.deleteProcessDefinition(processDefinition);
}
public void testDeployProcessesIncludingBad()
{
runTarget("deploy.processes.including.bad");
- List processDefinitions = graphSession.findAllProcessDefinitions();
+ List processDefinitions = graphSession.findAllProcessDefinitionVersions("timerProcess");
assertEquals(0, processDefinitions.size());
+
+ processDefinitions = graphSession.findAllProcessDefinitionVersions("sequential process");
+ assertEquals(0, processDefinitions.size());
+
+ processDefinitions = graphSession.findAllProcessDefinitionVersions("classLoadingProces");
+ assertEquals(0, processDefinitions.size());
}
private static void runTarget(String target)
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -25,11 +25,6 @@
private long subProcessDefinitionId;
private long processDefinitionId;
- @Override
- protected String getJbpmTestConfig() {
- return "org/jbpm/jbpm.test.cfg.xml";
- }
-
protected void setUp() throws Exception {
super.setUp();
@@ -49,6 +44,7 @@
protected void tearDown() throws Exception {
stopJobExecutor();
+ getJbpmConfiguration().getJobExecutor().setNbrOfThreads(1);
graphSession.deleteProcessDefinition(processDefinitionId);
graphSession.deleteProcessDefinition(subProcessDefinitionId);
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobExecutorDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobExecutorDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/job/executor/JobExecutorDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -22,11 +22,6 @@
static List<Long> allocatedProcessIds = Collections.synchronizedList(new ArrayList<Long>());
@Override
- protected String getJbpmTestConfig() {
- return "org/jbpm/jbpm.test.cfg.xml";
- }
-
- @Override
protected void setUp() throws Exception {
super.setUp();
deployProcess();
@@ -35,6 +30,7 @@
@Override
protected void tearDown() throws Exception {
+ getJbpmConfiguration().getJobExecutor().setNbrOfThreads(1);
deleteProcess();
super.tearDown();
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessArchiveDeploymentDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessArchiveDeploymentDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessArchiveDeploymentDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -23,10 +23,6 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
@@ -37,10 +33,6 @@
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.instantiation.ProcessClassLoader;
-import org.jbpm.taskmgmt.def.Task;
-import org.jbpm.taskmgmt.def.TaskMgmtDefinition;
import org.jbpm.util.ClassLoaderUtil;
import org.jbpm.util.IoUtil;
@@ -70,7 +62,7 @@
{
newTransaction();
- List allProcessDefinitions = graphSession.findAllProcessDefinitions();
+ List allProcessDefinitions = graphSession.findAllProcessDefinitionVersions(processDefinition.getName());
assertEquals(1, allProcessDefinitions.size());
processDefinition = (ProcessDefinition)allProcessDefinitions.get(0);
@@ -100,7 +92,7 @@
{
newTransaction();
- List allProcessDefinitions = graphSession.findAllProcessDefinitions();
+ List allProcessDefinitions = graphSession.findAllProcessDefinitionVersions(processDefinition.getName());
assertEquals(1, allProcessDefinitions.size());
processDefinition = (ProcessDefinition)allProcessDefinitions.get(0);
byte[] processBytes = processDefinition.getFileDefinition().getBytes("classes/org/jbpm/jpdl/par/ProcessArchiveDeploymentDbTest.class");
@@ -135,12 +127,15 @@
ProcessDefinition processDefinitionTwo = ProcessDefinition.parseParZipInputStream(zipInputStream);
jbpmContext.deployProcessDefinition(processDefinitionTwo);
+ String processDefinitionName = processDefinitionTwo.getName();
+ assertEquals(processDefinitionName, processDefinitionOne.getName());
+
newTransaction();
try
{
- assertEquals(2, graphSession.findAllProcessDefinitions().size());
- assertEquals(2, graphSession.findLatestProcessDefinition("the deployable process").getVersion());
+ assertEquals(2, graphSession.findAllProcessDefinitionVersions(processDefinitionName).size());
+ assertEquals(2, graphSession.findLatestProcessDefinition(processDefinitionName).getVersion());
}
finally
{
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/logging/exe/LoggingConfigDbTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -7,18 +7,27 @@
import org.jbpm.graph.exe.ProcessInstance;
public class LoggingConfigDbTest extends AbstractDbTestCase {
-
+
@Override
protected JbpmConfiguration getJbpmConfiguration() {
- return JbpmConfiguration.parseResource("org/jbpm/logging/exe/nologging.jbpm.cfg.xml");
+ if (jbpmConfiguration == null) {
+ jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/logging/exe/nologging.jbpm.cfg.xml");
+ }
+ return jbpmConfiguration;
}
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
public void testLoggingconfiguration() {
jbpmContext.deployProcessDefinition(new ProcessDefinition("logging"));
ProcessInstance processInstance = jbpmContext.newProcessInstance("logging");
processInstance.getContextInstance().setVariable("a", "1");
newTransaction();
-
+
Query query = session.createQuery("from org.jbpm.logging.log.ProcessLog");
assertEquals(0, query.list().size());
}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java 2008-12-01 04:47:28 UTC (rev 3158)
@@ -16,6 +16,12 @@
return "org/jbpm/seam/custom.job.executor.jbpm.cfg.xml";
}
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
public void testCustomJobExecutor() {
JobExecutor jobExecutor = getJbpmConfiguration().getJobExecutor();
assertEquals(CustomJobExecutor.class, jobExecutor.getClass());
Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml 2008-11-28 17:06:35 UTC (rev 3157)
+++ jbpm3/trunk/pom.xml 2008-12-01 04:47:28 UTC (rev 3158)
@@ -29,11 +29,13 @@
<!-- Modules -->
<modules>
<module>modules/core</module>
+ <module>modules/db</module>
<module>modules/identity</module>
<module>modules/enterprise</module>
<module>modules/examples</module>
<module>modules/simulation</module>
<module>modules/integration</module>
+ <module>modules/userguide</module>
</modules>
<!-- Properties -->
15 years, 5 months