JBoss JBPM SVN: r5146 - projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-29 06:20:29 -0400 (Mon, 29 Jun 2009)
New Revision: 5146
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/EngineEditor.java
Log:
Move deployment deetail panel to deployment list
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java 2009-06-29 10:19:44 UTC (rev 5145)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java 2009-06-29 10:20:29 UTC (rev 5146)
@@ -68,6 +68,8 @@
private List<DeploymentRef> deployments = null;
+ private DeploymentDetailView detailView;
+
public DeploymentListView()
{
super();
@@ -245,12 +247,11 @@
layout.add(deploymentList, new BorderLayoutData(BorderLayout.Region.CENTER));
// details
- /*ProcessDetailView detailsView = new ProcessDetailView();
- controller.addView(ProcessDetailView.ID, detailsView);
- controller.addAction(UpdateProcessDetailAction.ID, new UpdateProcessDetailAction());
- layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH, 10,200));
- */
-
+ // detail panel
+ detailView = new DeploymentDetailView();
+ controller.addView(DeploymentDetailView.ID, detailView);
+ layout.add(detailView, new BorderLayoutData(BorderLayout.Region.SOUTH,10,200));
+
this.add(layout);
initialized = true;
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/EngineEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/EngineEditor.java 2009-06-29 10:19:44 UTC (rev 5145)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/EngineEditor.java 2009-06-29 10:20:29 UTC (rev 5146)
@@ -51,8 +51,6 @@
private TabLayoutPanel tabPanel;
- private DeploymentDetailView detailView;
-
private Map<String,Integer> view2index = new HashMap<String,Integer>();
public EngineEditor(ApplicationContext appContext)
@@ -86,17 +84,20 @@
lazyPanel.initialize();
appContext.refreshView(); // TODO: hack around rendering problems
}
+
+ // load jobs
+ if(1==i)
+ {
+ controller.handleEvent(
+ new Event(UpdateJobsAction.ID, null)
+ );
+ }
}
}
);
this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
- // detail panel
- detailView = new DeploymentDetailView();
- controller.addView(DeploymentDetailView.ID, detailView);
- this.add(detailView, new BorderLayoutData(BorderLayout.Region.SOUTH,10,200));
-
// create and register views
registerView(DeploymentListView.ID, new DeploymentListView());
registerView(JobListView.ID, new JobListView(appContext));
16 years, 10 months
JBoss JBPM SVN: r5145 - projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-29 06:19:44 -0400 (Mon, 29 Jun 2009)
New Revision: 5145
Modified:
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/ProcessEnginePlugin.java
Log:
Add executeJob() signature
Modified: projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/ProcessEnginePlugin.java
===================================================================
--- projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/ProcessEnginePlugin.java 2009-06-29 10:12:05 UTC (rev 5144)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/ProcessEnginePlugin.java 2009-06-29 10:19:44 UTC (rev 5145)
@@ -40,4 +40,6 @@
void suspendDeployment(String id, boolean isSuspended);
List<JobRef> getJobs();
+
+ void executeJob(String jobId);
}
16 years, 10 months
JBoss JBPM SVN: r5144 - jbpm4/trunk/modules/userguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-29 06:12:05 -0400 (Mon, 29 Jun 2009)
New Revision: 5144
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch07-Variables.xml
Log:
variables documented in the userguide
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch07-Variables.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch07-Variables.xml 2009-06-29 09:45:55 UTC (rev 5143)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch07-Variables.xml 2009-06-29 10:12:05 UTC (rev 5144)
@@ -1,7 +1,83 @@
<chapter id="variables">
<title>Variables</title>
- <para>TODO
+ <para>Process variables can be accessed from outside the process with methods from the <literal>ExecutionService</literal>:
</para>
+
+ <itemizedlist>
+ <listitem><literal>ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables);</literal></listitem>
+ <listitem><literal>ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String processInstanceKey);</literal></listitem>
+ <listitem><literal>ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, ?> variables);</literal></listitem>
+ <listitem><literal>ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, ?> variables, String processInstanceKey);</literal></listitem>
+ <listitem><literal>void setVariable(String executionId, String name, Object value);</literal></listitem>
+ <listitem><literal>void setVariables(String executionId, Map<String, ?> variables);</literal></listitem>
+ <listitem><literal>Object getVariable(String executionId, String variableName);</literal></listitem>
+ <listitem><literal>Set<String> getVariableNames(String executionId);</literal></listitem>
+ <listitem><literal>Map<String, Object> getVariables(String executionId, Set<String> variableNames);</literal></listitem>
+ </itemizedlist>
+
+ <para>And from inside the process with methods from Execution interfaces passed to user code like
+ <literal>ActivityExecution</literal> and <literal>EventListenerExecution</literal>:
+ </para>
+ <itemizedlist>
+ <listitem><literal>Object getVariable(String key);</literal></listitem>
+ <listitem><literal>void setVariables(Map<String, ?> variables);</literal></listitem>
+ <listitem><literal>boolean hasVariable(String key);</literal></listitem>
+ <listitem><literal>boolean removeVariable(String key);</literal></listitem>
+ <listitem><literal>void removeVariables();</literal></listitem>
+ <listitem><literal>boolean hasVariables();</literal></listitem>
+ <listitem><literal>Set<String> getVariableKeys();</literal></listitem>
+ <listitem><literal>Map<String, Object> getVariables();</literal></listitem>
+ <listitem><literal>void createVariable(String key, Object value);</literal></listitem>
+ <listitem><literal>void createVariable(String key, Object value, String typeName);</literal></listitem>
+ </itemizedlist>
+
+ <para>jBPM doesn't have a mechanism for detecting changes automatically to variable values. So if you
+ get e.g. a serializable collection from the process variables and add an element, then you need to
+ set the changed variable value explicitely for the changes to be saved to the DB.
+ </para>
+
+ <section>
+ <title>Variable scoping</title>
+ <para>By default variables are created in the top level process instance scope. This means they are
+ visible and accessible in all the paths of execution of the whole process instance. Process variables are
+ created dynamically. Meaning that a variable is created the first time it is set
+ through one of these methods.
+ </para>
+ <para>Each execution is a variable scope. Variables declared in a nested execution level will 'see'
+ their own variables and variables declared in parent executions according to the normal scoping rules.
+ With the <literal>createVariable</literal> methods in the execution interfaces <literal>ActivityExecution</literal>
+ and <literal>EventListenerExecution</literal>, execution-local variables can be created.
+ </para>
+ <para>In one of the future releases, we might add variable declaration in the jPDL process language.
+ </para>
+ </section>
+
+ <section>
+ <title>Variable types</title>
+ <para>jBPM supports following Java types as process variables:</para>
+ <itemizedlist>
+ <listitem>java.lang.String</listitem>
+ <listitem>java.lang.Long</listitem>
+ <listitem>java.lang.Double</listitem>
+ <listitem>java.util.Date</listitem>
+ <listitem>java.lang.Boolean</listitem>
+ <listitem>java.lang.Character</listitem>
+ <listitem>java.lang.Byte</listitem>
+ <listitem>java.lang.Short</listitem>
+ <listitem>java.lang.Integer</listitem>
+ <listitem>java.lang.Float</listitem>
+ <listitem>byte[] (byte array)</listitem>
+ <listitem>char[] (char array)</listitem>
+ <listitem>hibernate entity with a long id</listitem>
+ <listitem>hibernate entity with a string id</listitem>
+ <listitem>serializable</listitem>
+ </itemizedlist>
+ <para>For persistence of these variable, the type of the variable is
+ checked in the order of this list. The first match will determine how
+ the variable is stored.
+ </para>
+ </section>
+
</chapter>
16 years, 10 months
JBoss JBPM SVN: r5143 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/async/activity and 5 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-29 05:45:55 -0400 (Mon, 29 Jun 2009)
New Revision: 5143
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/jpdl/DecisionHandler.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/fork/Application.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
Log:
JBPM-2323 some user code classes in the examples were not yet serializable
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/jpdl/DecisionHandler.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/jpdl/DecisionHandler.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/jpdl/DecisionHandler.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -21,13 +21,15 @@
*/
package org.jbpm.api.jpdl;
+import java.io.Serializable;
+
import org.jbpm.api.model.OpenExecution;
/**
* @author Tom Baeyens
*/
-public interface DecisionHandler {
+public interface DecisionHandler extends Serializable {
/** the name of the selected outgoing transition */
String decide(OpenExecution execution);
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -21,12 +21,16 @@
*/
package org.jbpm.examples.async.activity;
+import java.io.Serializable;
+
/**
* @author Tom Baeyens
*/
-public class Application {
+public class Application implements Serializable {
+ private static final long serialVersionUID = 1L;
+
public void generatePdf() {
// assume long automatic calculations here
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/fork/Application.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/fork/Application.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/fork/Application.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -21,12 +21,16 @@
*/
package org.jbpm.examples.async.fork;
+import java.io.Serializable;
+
/**
* @author Tom Baeyens
*/
-public class Application {
+public class Application implements Serializable {
+ private static final long serialVersionUID = 1L;
+
public void shipGoods() {
// assume automatic calculations here
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -21,11 +21,13 @@
*/
package org.jbpm.examples.java;
+import java.io.Serializable;
+
/**
* @author Tom Baeyens
*/
-public class JohnDoe {
+public class JohnDoe implements Serializable {
String state;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -21,7 +21,8 @@
*/
package org.jbpm.pvm.internal.task;
-import org.jbpm.api.model.OpenExecution;
+import java.io.Serializable;
+
import org.jbpm.api.task.OpenTask;
import org.jbpm.pvm.internal.client.ClientExecution;
@@ -31,8 +32,10 @@
*
* @author Tom Baeyens
*/
-public class TaskHandler {
+public class TaskHandler implements Serializable {
+ private static final long serialVersionUID = 1L;
+
/** called after the task is created according
* to the task definition. This method allows to
* create subtasks.
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/JobQueryTest.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -1,5 +1,6 @@
package org.jbpm.test.mgmt;
+import java.io.Serializable;
import java.util.List;
import org.jbpm.api.job.Job;
@@ -57,7 +58,8 @@
}
- public static class Dog {
+ public static class Dog implements Serializable {
+ private static final long serialVersionUID = 1L;
public void bark() {
throw new RuntimeException("wooof");
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-28 19:03:05 UTC (rev 5142)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-29 09:45:55 UTC (rev 5143)
@@ -34,6 +34,7 @@
public class TaskHandlerTest extends JbpmTestCase {
public static class ReviewHandler extends TaskHandler {
+ private static final long serialVersionUID = 1L;
public boolean executionCreateTask(OpenTask task) {
task.getExecution().setVariable("isExecutionCreateTaskCalled", "true");
return super.executionCreateTask(task);
16 years, 10 months
JBoss JBPM SVN: r5142 - jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-06-28 15:03:05 -0400 (Sun, 28 Jun 2009)
New Revision: 5142
Added:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/AbstractTransactionalSpringJbpmTestCase.java
Log:
AbstractTransactionalSpringJbpmTestCase
Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/AbstractTransactionalSpringJbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/AbstractTransactionalSpringJbpmTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/AbstractTransactionalSpringJbpmTestCase.java 2009-06-28 19:03:05 UTC (rev 5142)
@@ -0,0 +1,108 @@
+/**
+ *
+ */
+package org.jbpm.test;
+
+import java.io.IOException;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.HistoryService;
+import org.jbpm.api.IdentityService;
+import org.jbpm.api.ManagementService;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.api.TaskService;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
+
+/**
+ * Convenient superclass for tests of processes that should occur in a
+ * transaction, but normally will roll the transaction back on the completion of
+ * each test.
+ *
+ * It contains some convenience methods:
+ * - Deploying XML
+ * - Deploying from classpath
+ *
+ * Exposes all relevant services as protected fields.
+ *
+ *
+ * @author Andries Inze
+ * @see AbstractTransactionalDataSourceSpringContextTests
+ *
+ */
+public abstract class AbstractTransactionalSpringJbpmTestCase extends AbstractTransactionalDataSourceSpringContextTests {
+
+ private Configuration configuration;
+ protected ProcessEngine processEngine;
+
+ protected RepositoryService repositoryService;
+ protected ExecutionService executionService;
+ protected ManagementService managementService;
+ protected TaskService taskService;
+ protected HistoryService historyService;
+ protected IdentityService identityService;
+
+ /**
+ * Creates a new instance. Will require a transactionManager.
+ */
+ public AbstractTransactionalSpringJbpmTestCase() {
+ super();
+
+ // AUTOWIRE_BY_NAME is default behavior for Spring version 2.5.x
+ // AUTOWIRE_BY_TYPE is default behavior for Spring version 2.0.8, but
+ // fails because of Hibernate specific instances.
+ setAutowireMode(AUTOWIRE_BY_NAME);
+ }
+
+ /**
+ * {@inheritDoc)
+ */
+ protected void injectDependencies() throws Exception {
+ super.injectDependencies();
+
+ configuration = (Configuration) applicationContext.getBean(getJbpmConfigurationName());
+ processEngine = configuration.buildProcessEngine();
+
+ repositoryService = processEngine.get(RepositoryService.class);
+ executionService = processEngine.getExecutionService();
+ historyService = processEngine.getHistoryService();
+ managementService = processEngine.getManagementService();
+ taskService = processEngine.getTaskService();
+ identityService = processEngine.getIdentityService();
+ }
+
+ /**
+ * Default configuration name. Overwrite this if the jbpm configuration is
+ * named different.
+ *
+ * @return the jbpmConfigurationName
+ */
+ protected String getJbpmConfigurationName() {
+ return "jbpmConfiguration";
+ }
+
+ /**
+ * deploys the process.
+ */
+ public String deployJpdlXmlString(String jpdlXmlString) {
+ String deploymentId = repositoryService.createDeployment().addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString).deploy();
+ return deploymentId;
+ }
+
+ /**
+ * deploys the process.
+ */
+ public String deployJpdlFromClasspath(String jpdlXmlString) {
+ String deploymentId;
+ try {
+ deploymentId = repositoryService.createDeployment().addResourceFromInputStream("xmlstring.jpdl.xml",
+ new ClassPathResource(jpdlXmlString).getInputStream()).deploy();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return deploymentId;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/AbstractTransactionalSpringJbpmTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 10 months
JBoss JBPM SVN: r5141 - in jbpm4/trunk: modules/test-base and 1 other directory.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-06-28 15:02:16 -0400 (Sun, 28 Jun 2009)
New Revision: 5141
Modified:
jbpm4/trunk/modules/test-base/pom.xml
jbpm4/trunk/pom.xml
Log:
added spring-mock dependency (scope=provided)
Modified: jbpm4/trunk/modules/test-base/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-base/pom.xml 2009-06-27 14:30:55 UTC (rev 5140)
+++ jbpm4/trunk/modules/test-base/pom.xml 2009-06-28 19:02:16 UTC (rev 5141)
@@ -53,6 +53,16 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-mock</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-06-27 14:30:55 UTC (rev 5140)
+++ jbpm4/trunk/pom.xml 2009-06-28 19:02:16 UTC (rev 5141)
@@ -321,6 +321,11 @@
<version>${spring.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-mock</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp-wiser</artifactId>
<version>${wiser.version}</version>
16 years, 10 months
JBoss JBPM SVN: r5140 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources: org/jbpm/context/exe and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-27 10:30:55 -0400 (Sat, 27 Jun 2009)
New Revision: 5140
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.mapping.db2.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/VariableInstance.db2.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/graph/node/ProcessState.db2.hbm.xml
Log:
JBPM-2116: Index names too long for DB2 8.2 (OPEN)
Shorten index names only in DB2
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.mapping.db2.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.mapping.db2.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.mapping.db2.xml 2009-06-27 14:30:55 UTC (rev 5140)
@@ -0,0 +1,139 @@
+ <!-- ###################### -->
+ <!-- # jbpm mapping files # -->
+ <!-- ###################### -->
+
+ <!-- hql queries -->
+ <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
+
+ <!-- hql queries used in simulation for querying historical data.
+ uncomment if you want to use the GetSimulationInputCommand
+ or you want to use the queries directly.
+ beware: the queries need the stddev function to be enabled in your dialect.
+ for more information, visit:
+ http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!--
+ <mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
+ -->
+
+ <!-- graph.action mapping files -->
+ <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/>
+
+ <!-- graph.def mapping files -->
+ <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+ <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+ <!-- ########################################### -->
+ <!-- # mapping file with external dependencies # -->
+ <!-- ########################################### -->
+ <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
+ uncomment this if bsh is not in your classpath.
+ the script element will not be available in process definition files.
+ note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+ <!-- graph.node mapping files -->
+ <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/ProcessState.db2.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+ <!-- context.def mapping files -->
+ <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+ <!-- bytes mapping files -->
+ <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+ <!-- module.def mapping files -->
+ <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+ <!-- file.def mapping files -->
+ <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+ <!-- taskmgmt.def mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+ <!-- scheduler.def mapping files -->
+ <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+ <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+ <!-- graph.exe mapping files -->
+ <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+ <!-- module.exe mapping files -->
+ <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+
+ <!-- context.exe mapping files -->
+ <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/VariableInstance.db2.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+ <!-- job mapping files -->
+ <mapping resource="org/jbpm/job/Job.hbm.xml"/>
+ <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
+ <mapping resource="org/jbpm/job/CleanUpProcessJob.hbm.xml"/>
+
+ <!-- taskmgmt.exe mapping files -->
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+ <!-- logging mapping files -->
+ <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+ <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+ <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/VariableInstance.db2.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/VariableInstance.db2.hbm.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/VariableInstance.db2.hbm.xml 2009-06-27 14:30:55 UTC (rev 5140)
@@ -0,0 +1,45 @@
+<?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" default-access="field">
+ <class name="org.jbpm.context.exe.VariableInstance"
+ table="JBPM_VARIABLEINSTANCE"
+ abstract="true"
+ discriminator-value="V">
+ <id name="id" column="ID_"><generator class="native" /></id>
+ <discriminator type="char" column="CLASS_"/>
+ <!-- V : org.jbpm.context.exe.VariableInstance -->
+ <!-- B : org.jbpm.context.exe.variableinstance.ByteArrayInstance -->
+ <!-- D : org.jbpm.context.exe.variableinstance.DateInstance -->
+ <!-- O : org.jbpm.context.exe.variableinstance.DoubleInstance -->
+ <!-- H : org.jbpm.context.exe.variableinstance.HibernateLongInstance -->
+ <!-- I : org.jbpm.context.exe.variableinstance.HibernateStringInstance -->
+ <!-- L : org.jbpm.context.exe.variableinstance.LongInstance -->
+ <!-- S : org.jbpm.context.exe.variableinstance.StringInstance -->
+ <!-- N : org.jbpm.context.exe.variableinstance.NullInstance -->
+ <!-- J : org.jbpm.context.exe.variableinstance.JcrNodeInstance -->
+ <version name="version" column="VERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="converter"
+ column="CONVERTER_"
+ type="org.jbpm.db.hibernate.ConverterEnumType" />
+
+ <many-to-one name="token"
+ column="TOKEN_"
+ foreign-key="FK_VARINST_TK"
+ index="IDX_VARINST_TK" />
+ <many-to-one name="tokenVariableMap"
+ column="TOKENVARIABLEMAP_"
+ foreign-key="FK_VARINST_TKVARMP"
+ index="IDX_VARINST_TKVARM" />
+ <many-to-one name="processInstance"
+ column="PROCESSINSTANCE_"
+ foreign-key="FK_VARINST_PRCINST"
+ index="IDX_VARINST_PRCINS" />
+
+ </class>
+</hibernate-mapping>
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/graph/node/ProcessState.db2.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/graph/node/ProcessState.db2.hbm.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/graph/node/ProcessState.db2.hbm.xml 2009-06-27 14:30:55 UTC (rev 5140)
@@ -0,0 +1,24 @@
+<?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" default-access="field" >
+
+ <subclass name="org.jbpm.graph.node.ProcessState"
+ extends="org.jbpm.graph.def.Node"
+ discriminator-value="C">
+
+ <property name="subProcessName" column="SUBPROCNAME_" />
+ <many-to-one name="subProcessDefinition"
+ column="SUBPROCESSDEFINITION_"
+ foreign-key="FK_PROCST_SBPRCDEF"
+ index="IDX_PSTATE_SBPRCDE"/>
+ <set name="variableAccesses" cascade="all">
+ <key column="PROCESSSTATE_" foreign-key="FK_VARACC_PROCST"/>
+ <one-to-many class="org.jbpm.context.def.VariableAccess" />
+ </set>
+
+ </subclass>
+
+</hibernate-mapping>
16 years, 10 months
JBoss JBPM SVN: r5139 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/xml and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-27 09:52:38 -0400 (Sat, 27 Jun 2009)
New Revision: 5139
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.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/task/AssignableDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2323 instantiate user code objects referenced by class during parsing time
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -26,10 +26,6 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.activity.ExternalActivityBehaviour;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
/**
@@ -39,23 +35,21 @@
private static final long serialVersionUID = 1L;
- protected Descriptor descriptor;
+ protected ActivityBehaviour customBehaviour;
public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
- ExternalActivityBehaviour activityBehaviour = (ExternalActivityBehaviour) WireContext.create(descriptor);
- activityBehaviour.signal(execution, signalName, parameters);
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)customBehaviour;
+ externalActivityBehaviour.signal(execution, signalName, parameters);
}
public void execute(ActivityExecution execution) throws Exception {
- ActivityBehaviour activityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
- activityBehaviour.execute(execution);
+ customBehaviour.execute(execution);
}
-
- public Descriptor getDescriptor() {
- return descriptor;
+ public ActivityBehaviour getCustomBehaviour() {
+ return customBehaviour;
}
- public void setDescriptor(Descriptor descriptor) {
- this.descriptor = descriptor;
+ public void setCustomBehaviour(ActivityBehaviour customBehaviour) {
+ this.customBehaviour = customBehaviour;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -21,6 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
@@ -43,7 +45,8 @@
CustomActivity customActivity = new CustomActivity();
ObjectDescriptor descriptor = (ObjectDescriptor)
objectBinding.parse(element, parse, wireParser);
- customActivity.setDescriptor(descriptor);
+ ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
+ customActivity.setCustomBehaviour(customActivityBehaviour);
return customActivity;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -23,9 +23,11 @@
import java.util.List;
+import org.jbpm.api.jpdl.DecisionHandler;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -68,7 +70,8 @@
DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
objectBinding.parse(handlerElement, parse, wireParser);
- decisionHandlerActivity.setDecisionHandlerDescriptor(decisionHandlerDescriptor);
+ DecisionHandler decisionHandler = (DecisionHandler) WireContext.create(decisionHandlerDescriptor);
+ decisionHandlerActivity.setDecisionHandler(decisionHandler);
return decisionHandlerActivity;
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -39,7 +39,7 @@
private static final long serialVersionUID = 1L;
protected String decisionHandlerName;
- protected Descriptor decisionHandlerDescriptor;
+ protected DecisionHandler decisionHandler;
public void execute(ActivityExecution execution) {
execute((ExecutionImpl) execution);
@@ -47,24 +47,28 @@
public void execute(ExecutionImpl execution) {
Activity activity = execution.getActivity();
+
String transitionName = null;
- Object object = null;
- if (decisionHandlerDescriptor!=null) {
- object = WireContext.create(decisionHandlerDescriptor);
+ DecisionHandler usedDecisionHandler = null;
+ if (decisionHandler!=null) {
+ usedDecisionHandler = decisionHandler;
+
} else if (decisionHandlerName!=null) {
Environment environment = Environment.getCurrent();
- object = environment.get(decisionHandlerName);
+ Object object = environment.get(decisionHandlerName);
+ if (object==null) {
+ throw new JbpmException("decision handler for "+activity+" is null");
+ }
+ if (! (object instanceof DecisionHandler)) {
+ throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
+ }
+ usedDecisionHandler = (DecisionHandler) object;
+ } else {
+ throw new JbpmException("no decision handler specified");
}
- if (object==null) {
- throw new JbpmException("decision handler for "+activity+" is null");
- }
- if (! (object instanceof DecisionHandler)) {
- throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
- }
- DecisionHandler decisionHandler = (DecisionHandler) object;
- transitionName = decisionHandler.decide(execution);
+ transitionName = usedDecisionHandler.decide(execution);
Transition transition = activity.getOutgoingTransition(transitionName);
if (transition==null) {
@@ -79,7 +83,7 @@
public void setDecisionHandlerName(String decisionHandlerName) {
this.decisionHandlerName = decisionHandlerName;
}
- public void setDecisionHandlerDescriptor(Descriptor decisionHandlerDescriptor) {
- this.decisionHandlerDescriptor = decisionHandlerDescriptor;
+ public void setDecisionHandler(DecisionHandler decisionHandler) {
+ this.decisionHandler = decisionHandler;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -48,7 +48,7 @@
protected String targetExpression;
protected String targetLanguage;
- protected Descriptor targetDescriptor;
+ protected Object target;
protected String methodName;
protected String variableName;
@@ -56,16 +56,16 @@
public void perform(OpenExecution execution) throws Exception {
- Object target = null;
+ Object invocationTarget = null;
WireContext wireContext = new WireContext();
- if (targetDescriptor!=null) {
- target = wireContext.create(targetDescriptor, false);
+ if (target!=null) {
+ invocationTarget = target;
} else if (targetExpression!=null) {
ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
- target = scriptManager.evaluateExpression(targetExpression, targetLanguage);
+ invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
} else {
throw new JbpmException("no target specified");
@@ -79,13 +79,13 @@
args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
}
- Class<?> clazz = target.getClass();
+ Class<?> clazz = invocationTarget.getClass();
Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
if (method==null) {
throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
}
- Object returnValue = ReflectUtil.invoke(method, target, args);
+ Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
if (variableName!=null) {
execution.setVariable(variableName, returnValue);
@@ -98,8 +98,8 @@
}
}
- public void setTargetDescriptor(Descriptor descriptor) {
- this.targetDescriptor = descriptor;
+ public void setTarget(Object target) {
+ this.target = target;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -25,6 +25,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
@@ -63,7 +64,8 @@
if (element.hasAttribute("class")) {
ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
- javaActivity.setTargetDescriptor(objectDescriptor);
+ Object target = WireContext.create(objectDescriptor);
+ javaActivity.setTarget(target);
} else if (element.hasAttribute("expr")) {
String expression = element.getAttribute("expr");
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -31,11 +31,10 @@
import java.util.Set;
import java.util.StringTokenizer;
-import org.w3c.dom.Element;
-
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.model.Event;
+import org.jbpm.api.task.AssignmentHandler;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlBinding;
import org.jbpm.jpdl.internal.activity.MailListener;
@@ -62,11 +61,11 @@
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskHandler;
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.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -76,6 +75,7 @@
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.jbpm.pvm.internal.xml.ProblemImpl;
+import org.w3c.dom.Element;
/**
* @author Tom Baeyens
@@ -428,7 +428,8 @@
Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
if (assignmentHandlerElement!=null) {
ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
- assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
+ AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
+ assignableDefinition.setAssignmentHandler(assignmentHandler);
}
String assigneeExpression = XmlUtil.attribute(element, "assignee");
@@ -480,7 +481,8 @@
Element taskHandlerElement = XmlUtil.element(element, "task-handler");
if (taskHandlerElement!=null) {
ObjectDescriptor objectDescriptor = parseObjectDescriptor(taskHandlerElement, parse);
- taskDefinition.setTaskHandlerDescriptor(objectDescriptor);
+ TaskHandler taskHandler = (TaskHandler) WireContext.create(objectDescriptor);
+ taskDefinition.setTaskHandler(taskHandler);
}
JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
@@ -613,14 +615,12 @@
eventListener.setMailProducer(mailProducer);
}
- public static MailProducer parseMailProducer(Element element, Parse parse,
- String defaultTemplateName) {
+ public static MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
// check whether the element is a generic object descriptor
if (ObjectBinding.isObjectDescriptor(element)) {
// TODO test custom mail producer
ObjectDescriptor objectDescriptor = parseObjectDescriptor(element, parse);
- WireDefinition wireDefinition = parse.findObject(WireDefinition.class);
- return (MailProducer) objectDescriptor.construct(new WireContext(wireDefinition));
+ return (MailProducer) WireContext.create(objectDescriptor);
}
// parse the default producer
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -784,13 +784,12 @@
}
}
- Descriptor assignmentHandlerDescriptor = assignableDefinition.getAssignmentHandlerDescriptor();
- if (assignmentHandlerDescriptor!=null) {
- AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(assignmentHandlerDescriptor);
+ AssignmentHandler assignmentHandler = assignableDefinition.getAssignmentHandler();
+ if (assignmentHandler!=null) {
try {
assignmentHandler.assign(assignable, this);
} catch (Exception e) {
- throw new JbpmException("assignment handler threw exception: "+e, e);
+ throw new JbpmException("assignment handler threw exception: " + e, e);
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.task;
+import org.jbpm.api.task.AssignmentHandler;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
import org.jbpm.pvm.internal.util.EqualsUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
/**
* @author Tom Baeyens
@@ -41,7 +41,7 @@
protected String candidateUsersExpressionLanguage;
protected String candidateGroupsExpression;
protected String candidateGroupsExpressionLanguage;
- protected Descriptor assignmentHandlerDescriptor;
+ protected AssignmentHandler assignmentHandler;
// equals ///////////////////////////////////////////////////////////////////
// hack to support comparing hibernate proxies against the real objects
@@ -70,11 +70,11 @@
public void setAssigneeExpression(String assigneeExpression) {
this.assigneeExpression = assigneeExpression;
}
- public Descriptor getAssignmentHandlerDescriptor() {
- return assignmentHandlerDescriptor;
+ public AssignmentHandler getAssignmentHandler() {
+ return assignmentHandler;
}
- public void setAssignmentHandlerDescriptor(Descriptor assignmentHandlerDescriptor) {
- this.assignmentHandlerDescriptor = assignmentHandlerDescriptor;
+ public void setAssignmentHandler(AssignmentHandler assignmentHandler) {
+ this.assignmentHandler = assignmentHandler;
}
public String getAssigneeExpressionLanguage() {
return assigneeExpressionLanguage;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -26,7 +26,6 @@
import java.util.List;
import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.pvm.internal.wire.Descriptor;
/**
* defines a task and how the actor(s) must be calculated at runtime.
@@ -40,7 +39,7 @@
protected List<TaskDefinitionImpl> subTaskDefinitions = new ArrayList<TaskDefinitionImpl>();
protected int priority = Priority.NORMAL;
protected SwimlaneDefinitionImpl swimlaneDefinition;
- protected Descriptor taskHandlerDescriptor;
+ protected TaskHandler taskHandler;
public int getPriority() {
return priority;
@@ -72,10 +71,10 @@
public void setFormResourceName(String form) {
this.formResourceName = form;
}
- public Descriptor getTaskHandlerDescriptor() {
- return taskHandlerDescriptor;
+ public TaskHandler getTaskHandler() {
+ return taskHandler;
}
- public void setTaskHandlerDescriptor(Descriptor taskHandlerDescriptor) {
- this.taskHandlerDescriptor = taskHandlerDescriptor;
+ public void setTaskHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-06-27 13:52:38 UTC (rev 5139)
@@ -347,11 +347,11 @@
}
public TaskHandler getTaskHandler() {
- if ((getTaskDefinition() == null) || (taskDefinition.getTaskHandlerDescriptor() == null)) {
+ if ((getTaskDefinition() == null) || (taskDefinition.getTaskHandler() == null)) {
return DEFAULT_TASK_HANDLER;
}
- TaskHandler taskHandler = (TaskHandler) WireContext.create(taskDefinition.getTaskHandlerDescriptor());
+ TaskHandler taskHandler = taskDefinition.getTaskHandler();
return taskHandler;
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-27 13:10:22 UTC (rev 5138)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-27 13:52:38 UTC (rev 5139)
@@ -3028,10 +3028,22 @@
<section id="usercode">
<title>User code</title>
<para>Various elements in the jPDL process language refer to a an
- object on which an interface method will be invoked. See for example
- <xref linkend="taskassignmenthandler" />. This section describes the
- attributes and sub elements of those type of user code objects.
+ object on which an interface method will be invoked.
+ </para>
+ <itemizedlist>
+ <listitem><literal>event-listener</literal></listitem>
+ <listitem><literal>custom</literal></listitem>
+ <listitem><literal>java</literal></listitem>
+ <listitem><literal>assignment-handler</literal> in task</listitem>
+ <listitem><literal>handler</literal> in decision</listitem>
+ </itemizedlist>
+ <para>For all objects that are referenced by a class name, will be
+ instantiated during parsing time. Which implies that the objects have to be
+ threadsafe. This is typically OK since those objects are typically immutable.
</para>
+ <para>Objects that are referenced by an expression are calculated
+ dynamically.
+ </para>
<table><title>attributes:</title>
<tgroup cols="5" rowsep="1" colsep="1">
<thead>
@@ -3056,7 +3068,7 @@
<entry>expression</entry>
<entry></entry>
<entry>one of {class|expr} is required</entry>
- <entry>The fully qualified classname.</entry>
+ <entry>Expression for which the resulting value will be taken as the target object.</entry>
</row>
</tbody>
</tgroup>
16 years, 10 months
JBoss JBPM SVN: r5138 - jbpm3/branches/jbpm-3.2-soa/modules/core.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-27 09:10:22 -0400 (Sat, 27 Jun 2009)
New Revision: 5138
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
Log:
exclude JbpmSchemaDbTest from Oracle suite
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-27 12:56:00 UTC (rev 5137)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-27 13:10:22 UTC (rev 5138)
@@ -335,6 +335,11 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/jbpm/db/JbpmSchemaDbTest.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
</plugins>
</build>
16 years, 10 months
JBoss JBPM SVN: r5137 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: main/java/org/jbpm/graph/node and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-27 08:56:00 -0400 (Sat, 27 Jun 2009)
New Revision: 5137
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/ContextInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Join.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/jta/JtaDbPersistenceService.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
Log:
JBPM-2115: jBPM testsuite hangs when executed with DB2 (CODING IN PROGRESS)
Prevent JobExecutorThread from waiting 5 sec after LockAcquisitionException
Start job executor after starting processes in SimplePerformanceTest to avoid concurrency and allow measurements with HSQL
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/ContextInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/ContextInstance.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/ContextInstance.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -31,391 +31,341 @@
import org.jbpm.module.exe.ModuleInstance;
/**
- * maintains all the key-variable pairs for a process instance. You can obtain a
- * ContextInstance from a processInstance from a process instance like this :
+ * maintains all the key-variable pairs for a process instance. You can obtain a ContextInstance
+ * from a processInstance from a process instance like this :
+ *
* <pre>
* ProcessInstance processInstance = ...;
* ContextInstance contextInstance = processInstance.getContextInstance();
* </pre>
- * More information on context and process variableInstances can be found in
- * <a href="../../../../../userguide/en/html/reference.html#context">the userguide, section context</a>
+ *
+ * More information on context and process variableInstances can be found in <a
+ * href="../../../../../userguide/en/html/reference.html#context">the userguide, section context</a>
*/
-public class ContextInstance extends ModuleInstance
-{
+public class ContextInstance extends ModuleInstance {
private static final long serialVersionUID = 1L;
- // maps Token's to TokenVariableMap's
+ // maps Tokens to TokenVariableMaps
protected Map tokenVariableMaps = null;
- // maps variablenames (String) to values (Object)
+ // maps variable names (String) to values (Object)
protected transient Map transientVariables = null;
protected transient List updatedVariableContainers = null;
- public ContextInstance()
- {
+ public ContextInstance() {
}
// normal variableInstances (persistent) ////////////////////////////////////
- /*
- * creates a variable on the root-token (= process-instance scope) and calculates the actual VariableInstance-type from the value.
+ /**
+ * creates a variable on the root-token (= process-instance scope) and calculates the actual
+ * VariableInstance-type from the value.
*/
- public void createVariable(String name, Object value)
- {
+ public void createVariable(String name, Object value) {
setVariableLocally(name, value, getRootToken());
}
- /*
- * sets the variable on the root token, creates the variable if necessary and calculates the actual VariableInstance-type from the value.
+ /**
+ * sets the variable on the root token, creates the variable if necessary and calculates the
+ * actual VariableInstance-type from the value.
*/
- public void setVariableLocally(String name, Object value)
- {
+ public void setVariableLocally(String name, Object value) {
setVariableLocally(name, value, getRootToken());
}
- /*
- * creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.
+ /**
+ * creates a variable in the scope of the given token and calculates the actual
+ * VariableInstance-type from the value.
*/
- public void createVariable(String name, Object value, Token token)
- {
+ public void createVariable(String name, Object value, Token token) {
setVariableLocally(name, value, token);
}
- /*
- * creates a variable in the scope of the given token and calculates the actual VariableInstance-type from the value.
+ /**
+ * creates a variable in the scope of the given token and calculates the actual
+ * VariableInstance-type from the value.
*/
- public void setVariableLocally(String name, Object value, Token token)
- {
+ public void setVariableLocally(String name, Object value, Token token) {
TokenVariableMap tokenVariableMap = createTokenVariableMap(token);
tokenVariableMap.setVariableLocally(name, value);
}
- /*
+ /**
* gets all the variableInstances on the root-token (= process-instance scope).
*/
- public Map getVariables()
- {
+ public Map getVariables() {
return getVariables(getRootToken());
}
- /*
+ /**
* retrieves all the variableInstances in scope of the given token.
*/
- public Map getVariables(Token token)
- {
- Map variables = null;
-
+ public Map getVariables(Token token) {
TokenVariableMap tokenVariableMap = getTokenVariableMap(token);
- if (tokenVariableMap != null)
- {
- variables = tokenVariableMap.getVariables();
- }
-
- return variables;
+ return tokenVariableMap != null ? tokenVariableMap.getVariables() : null;
}
- /*
+ /**
* adds all the variableInstances on the root-token (= process-instance scope).
*/
- public void addVariables(Map variables)
- {
+ public void addVariables(Map variables) {
setVariables(variables, getRootToken());
}
- /*
- * The method setVariables is the same as the {@link #addVariables(Map, Token)}, but it was added for more consistency.
+ /**
+ * The method setVariables is the same as the {@link #addVariables(Map, Token)}, but it was added
+ * for more consistency.
*/
- public void setVariables(Map variables)
- {
+ public void setVariables(Map variables) {
setVariables(variables, getRootToken());
}
- /*
- * adds all the variableInstances to the scope of the given token. This method delegates to {@link #setVariables(Map, Token)}. The method setVariables was added for
- * more consistency.
+ /**
+ * adds all the variableInstances to the scope of the given token. This method delegates to
+ * {@link #setVariables(Map, Token)}. The method setVariables was added for more consistency.
*/
- public void addVariables(Map variables, Token token)
- {
+ public void addVariables(Map variables, Token token) {
setVariables(variables, token);
}
- /*
- * adds all the variableInstances to the scope of the given token. The method setVariables is the same as the {@link #addVariables(Map, Token)}, but it was added for
- * more consistency.
+ /**
+ * adds all the variableInstances to the scope of the given token. The method setVariables is the
+ * same as the {@link #addVariables(Map, Token)}, but it was added for more consistency.
*/
- public void setVariables(Map variables, Token token)
- {
+ public void setVariables(Map variables, Token token) {
// [JBPM-1778] Empty map variables on process creation is set as null
TokenVariableMap tokenVariableMap = getOrCreateTokenVariableMap(token);
Iterator iter = variables.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
- String name = (String)entry.getKey();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String name = (String) entry.getKey();
Object value = entry.getValue();
tokenVariableMap.setVariable(name, value);
}
}
- /*
+ /**
* gets the variable with the given name on the root-token (= process-instance scope).
*/
- public Object getVariable(String name)
- {
+ public Object getVariable(String name) {
return getVariable(name, getRootToken());
}
- /*
- * retrieves a variable in the scope of the token. If the given token does not have a variable for the given name, the variable is searched for up the token
- * hierarchy.
+ /**
+ * retrieves a variable in the scope of the token. If the given token does not have a variable for
+ * the given name, the variable is searched for up the token hierarchy.
*/
- public Object getVariable(String name, Token token)
- {
+ public Object getVariable(String name, Token token) {
Object variable = null;
TokenVariableMap tokenVariableMap = getTokenVariableMap(token);
- if (tokenVariableMap != null)
- {
+ if (tokenVariableMap != null) {
variable = tokenVariableMap.getVariable(name);
}
return variable;
}
- /*
- * retrieves a variable which is local to the token. Method {@link #getVariableLocally(String, Token)} is the same as this method and it was added for naming
- * consistency.
+ /**
+ * retrieves a variable which is local to the token. Method
+ * {@link #getVariableLocally(String, Token)} is the same as this method and it was added for
+ * naming consistency.
*/
- public Object getLocalVariable(String name, Token token)
- {
+ public Object getLocalVariable(String name, Token token) {
return getVariableLocally(name, token);
}
- /*
- * retrieves a variable which is local to the token. this method was added for naming consistency. it is the same as {@link #getLocalVariable(String, Token)}.
+ /**
+ * retrieves a variable which is local to the token. this method was added for naming consistency.
+ * it is the same as {@link #getLocalVariable(String, Token)}.
*/
- public Object getVariableLocally(String name, Token token)
- {
+ public Object getVariableLocally(String name, Token token) {
Object variable = null;
- if (tokenVariableMaps != null && tokenVariableMaps.containsKey(token))
- {
- TokenVariableMap tokenVariableMap = (TokenVariableMap)tokenVariableMaps.get(token);
- if (tokenVariableMap != null)
- {
+ if (tokenVariableMaps != null && tokenVariableMaps.containsKey(token)) {
+ TokenVariableMap tokenVariableMap = (TokenVariableMap) tokenVariableMaps.get(token);
+ if (tokenVariableMap != null) {
variable = tokenVariableMap.getVariableLocally(name);
}
}
return variable;
}
- /*
+ /**
* sets a variable on the process instance scope.
*/
- public void setVariable(String name, Object value)
- {
+ public void setVariable(String name, Object value) {
setVariable(name, value, getRootToken());
}
- /*
- * sets a variable. If a variable exists in the scope given by the token, that variable is updated. Otherwise, the variable is created on the root token (=process
- * instance scope).
+ /**
+ * sets a variable. If a variable exists in the scope given by the token, that variable is
+ * updated. Otherwise, the variable is created on the root token (=process instance scope).
*/
- public void setVariable(String name, Object value, Token token)
- {
+ public void setVariable(String name, Object value, Token token) {
TokenVariableMap tokenVariableMap = getOrCreateTokenVariableMap(token);
tokenVariableMap.setVariable(name, value);
}
- /*
- * checks if a variable is present with the given name on the root-token (= process-instance scope).
+ /**
+ * checks if a variable is present with the given name on the root-token (= process-instance
+ * scope).
*/
- public boolean hasVariable(String name)
- {
+ public boolean hasVariable(String name) {
return hasVariable(name, getRootToken());
}
- /*
+ /**
* checks if a variable is present with the given name in the scope of the token.
*/
- public boolean hasVariable(String name, Token token)
- {
+ public boolean hasVariable(String name, Token token) {
boolean hasVariable = false;
TokenVariableMap tokenVariableMap = getTokenVariableMap(token);
- if (tokenVariableMap != null)
- {
+ if (tokenVariableMap != null) {
hasVariable = tokenVariableMap.hasVariable(name);
}
return hasVariable;
}
- /*
+ /**
* deletes the given variable on the root-token (=process-instance scope).
*/
- public void deleteVariable(String name)
- {
+ public void deleteVariable(String name) {
deleteVariable(name, getRootToken());
}
- /*
- * deletes a variable from the given token. For safety reasons, this method does not propagate the deletion to parent tokens in case the given token does not contain
- * the variable.
+ /**
+ * deletes a variable from the given token. For safety reasons, this method does not propagate the
+ * deletion to parent tokens in case the given token does not contain the variable.
*/
- public void deleteVariable(String name, Token token)
- {
+ public void deleteVariable(String name, Token token) {
TokenVariableMap tokenVariableMap = getTokenVariableMap(token);
- if (tokenVariableMap != null)
- {
+ if (tokenVariableMap != null) {
tokenVariableMap.deleteVariable(name);
}
}
// transient variableInstances //////////////////////////////////////////////
- /*
+ /**
* retrieves the transient variable for the given name.
*/
- public Object getTransientVariable(String name)
- {
+ public Object getTransientVariable(String name) {
Object transientVariable = null;
- if (transientVariables != null)
- {
+ if (transientVariables != null) {
transientVariable = transientVariables.get(name);
}
return transientVariable;
}
- /*
+ /**
* sets the transient variable for the given name to the given value.
*/
- public void setTransientVariable(String name, Object value)
- {
- if (transientVariables == null)
- {
+ public void setTransientVariable(String name, Object value) {
+ if (transientVariables == null) {
transientVariables = new HashMap();
}
transientVariables.put(name, value);
}
- /*
+ /**
* tells if a transient variable with the given name is present.
*/
- public boolean hasTransientVariable(String name)
- {
- if (transientVariables == null)
- {
+ public boolean hasTransientVariable(String name) {
+ if (transientVariables == null) {
return false;
}
return transientVariables.containsKey(name);
}
- /*
- * retrieves all the transient variableInstances map. note that no deep copy is performed, changing the map leads to changes in the transient variableInstances of
- * this context instance.
+ /**
+ * retrieves all the transient variableInstances map. note that no deep copy is performed,
+ * changing the map leads to changes in the transient variableInstances of this context instance.
*/
- public Map getTransientVariables()
- {
+ public Map getTransientVariables() {
return transientVariables;
}
- /*
+ /**
* replaces the transient variableInstances with the given map.
*/
- public void setTransientVariables(Map transientVariables)
- {
+ public void setTransientVariables(Map transientVariables) {
this.transientVariables = transientVariables;
}
- /*
+ /**
* removes the transient variable.
*/
- public void deleteTransientVariable(String name)
- {
- if (transientVariables == null)
- return;
+ public void deleteTransientVariable(String name) {
+ if (transientVariables == null) return;
transientVariables.remove(name);
}
- Token getRootToken()
- {
+ Token getRootToken() {
return processInstance.getRootToken();
}
- /*
- * searches for the first token-variable-map for the given token and creates it on the root token if it doesn't exist.
+ /**
+ * searches for the first token-variable-map for the given token and creates it on the root token
+ * if it doesn't exist.
*/
- public TokenVariableMap getOrCreateTokenVariableMap(Token token)
- {
- if (token == null)
- {
+ public TokenVariableMap getOrCreateTokenVariableMap(Token token) {
+ if (token == null) {
throw new JbpmException("can't get variables for token 'null'");
}
// if the given token has a variable map
TokenVariableMap tokenVariableMap = null;
- if ((tokenVariableMaps != null) && (tokenVariableMaps.containsKey(token)))
- {
- tokenVariableMap = (TokenVariableMap)tokenVariableMaps.get(token);
+ if ((tokenVariableMaps != null) && (tokenVariableMaps.containsKey(token))) {
+ tokenVariableMap = (TokenVariableMap) tokenVariableMaps.get(token);
}
- else if (!token.isRoot())
- {
+ else if (!token.isRoot()) {
tokenVariableMap = getOrCreateTokenVariableMap(token.getParent());
}
- else
- {
+ else {
tokenVariableMap = createTokenVariableMap(token);
}
return tokenVariableMap;
}
- TokenVariableMap createTokenVariableMap(Token token)
- {
- if (tokenVariableMaps == null)
- {
+ TokenVariableMap createTokenVariableMap(Token token) {
+ if (tokenVariableMaps == null) {
tokenVariableMaps = new HashMap();
}
- TokenVariableMap tokenVariableMap = (TokenVariableMap)tokenVariableMaps.get(token);
- if (tokenVariableMap == null)
- {
+ TokenVariableMap tokenVariableMap = (TokenVariableMap) tokenVariableMaps.get(token);
+ if (tokenVariableMap == null) {
tokenVariableMap = new TokenVariableMap(token, this);
tokenVariableMaps.put(token, tokenVariableMap);
}
return tokenVariableMap;
}
- /*
- * looks for the first token-variable-map that is found up the token-parent hirarchy.
+ /**
+ * looks for the first token-variable-map that is found up the token-parent hierarchy.
*/
- public TokenVariableMap getTokenVariableMap(Token token)
- {
+ public TokenVariableMap getTokenVariableMap(Token token) {
TokenVariableMap tokenVariableMap = null;
- if (tokenVariableMaps != null)
- {
- if (tokenVariableMaps.containsKey(token))
- {
- tokenVariableMap = (TokenVariableMap)tokenVariableMaps.get(token);
+ if (tokenVariableMaps != null) {
+ if (tokenVariableMaps.containsKey(token)) {
+ tokenVariableMap = (TokenVariableMap) tokenVariableMaps.get(token);
}
- else if (!token.isRoot())
- {
+ else if (!token.isRoot()) {
tokenVariableMap = getTokenVariableMap(token.getParent());
}
}
return tokenVariableMap;
}
- public VariableInstance getVariableInstance(String name, Token token)
- {
+ public VariableInstance getVariableInstance(String name, Token token) {
VariableInstance variableInstance = null;
TokenVariableMap tokenVariableMap = getTokenVariableMap(token);
- if (tokenVariableMap != null)
- {
+ if (tokenVariableMap != null) {
tokenVariableMap.getVariableInstances();
}
return variableInstance;
}
- public Map getTokenVariableMaps()
- {
+ public Map getTokenVariableMaps() {
return tokenVariableMaps;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Join.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -95,28 +95,24 @@
public void execute(ExecutionContext executionContext) {
Token token = executionContext.getToken();
-
boolean isAbleToReactivateParent = token.isAbleToReactivateParent();
if (!token.hasEnded()) {
token.end(false);
}
- // if this token is not able to reactivate the parent,
+ // if this token is not able to reactivate the parent,
// we don't need to check anything
if (isAbleToReactivateParent) {
-
- // the token arrived in the join and can only reactivate
+ // the token arrived in the join and can only reactivate
// the parent once
token.setAbleToReactivateParent(false);
Token parentToken = token.getParent();
-
if (parentToken != null) {
-
JbpmContext jbpmContext = executionContext.getJbpmContext();
- Session session = (jbpmContext != null ? jbpmContext.getSession() : null);
- if (session != null) {
+ Session session;
+ if (jbpmContext != null && (session = jbpmContext.getSession()) != null) {
// obtain update lock by default (LockMode.UPGRADE)
LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode)
: LockMode.UPGRADE;
@@ -125,7 +121,7 @@
session.lock(parentToken, lockMode);
}
- boolean reactivateParent = true;
+ boolean reactivateParent;
// if this is a discriminator
if (isDiscriminator) {
@@ -133,57 +129,50 @@
// this must be the first token arriving, otherwise isAbleToReactivateParent()
// should have been false above.
reactivateParent = true;
-
- // if a fixed set of tokenNames is specified at design time...
}
+ // if a fixed set of tokenNames is specified at design time...
else if (tokenNames != null) {
// check reactivation on the basis of those tokenNames
reactivateParent = mustParentBeReactivated(parentToken, tokenNames.iterator());
-
- // if a script is specified
}
+ // if a script is specified
else if (script != null) {
-
// check if the script returns a collection or a boolean
Object result = null;
try {
result = script.eval(token);
}
catch (Exception e) {
- this.raiseException(e, executionContext);
+ raiseException(e, executionContext);
}
- // if the result is a collection
+ // if the result is a collection
if (result instanceof Collection) {
- // it must be a collection of tokenNames
+ // it must be a collection of tokenNames
Collection runtimeTokenNames = (Collection) result;
reactivateParent = mustParentBeReactivated(parentToken, runtimeTokenNames.iterator());
-
- // if it's a boolean...
}
+ // if it's a boolean...
else if (result instanceof Boolean) {
// the boolean specifies if the parent needs to be reactivated
reactivateParent = ((Boolean) result).booleanValue();
}
-
- // if a nOutOfM is specified
+ // otherwise
+ else {
+ // non-null result means the parent needs to be reactivated
+ reactivateParent = result != null;
+ }
}
+ // if a nOutOfM is specified
else if (nOutOfM != -1) {
-
int n = 0;
- // wheck how many tokens already arrived in the join
- Iterator iter = parentToken.getChildren().values().iterator();
- while (iter.hasNext()) {
+ // check how many tokens already arrived in the join
+ for (Iterator iter = parentToken.getChildren().values().iterator(); iter.hasNext();) {
Token concurrentToken = (Token) iter.next();
- if (this.equals(concurrentToken.getNode())) {
- n++;
- }
+ if (equals(concurrentToken.getNode())) n++;
}
- if (n < nOutOfM) {
- reactivateParent = false;
- }
-
- // if no configuration is specified..
+ reactivateParent = n >= nOutOfM;
}
+ // if no configuration is specified..
else {
// the default behaviour is to check all concurrent tokens and reactivate
// the parent if the last token arrives in the join
@@ -194,13 +183,11 @@
// if the parent token needs to be reactivated from this join node
if (reactivateParent) {
-
// write to all child tokens that the parent is already reactivated
- Iterator iter = parentToken.getChildren().values().iterator();
- while (iter.hasNext()) {
- ((Token) iter.next()).setAbleToReactivateParent(false);
+ for (Iterator iter = parentToken.getChildren().values().iterator(); iter.hasNext();) {
+ Token concurrentToken = (Token) iter.next();
+ concurrentToken.setAbleToReactivateParent(false);
}
-
// write to all child tokens that the parent is already reactivated
ExecutionContext parentContext = new ExecutionContext(parentToken);
leave(parentContext);
@@ -209,21 +196,16 @@
}
}
- public boolean mustParentBeReactivated(Token parentToken, Iterator childTokenNameIterator) {
- boolean reactivateParent = true;
- while ((childTokenNameIterator.hasNext()) && (reactivateParent)) {
- String concurrentTokenName = (String) childTokenNameIterator.next();
-
+ public boolean mustParentBeReactivated(Token parentToken, Iterator concurrentTokenNames) {
+ while (concurrentTokenNames.hasNext()) {
+ String concurrentTokenName = (String) concurrentTokenNames.next();
Token concurrentToken = parentToken.getChild(concurrentTokenName);
-
if (concurrentToken.isAbleToReactivateParent()) {
- log.debug("join will not yet reactivate parent: found concurrent token '"
- + concurrentToken
- + "'");
- reactivateParent = false;
+ log.debug("join will not reactivate parent yet, found concurrent " + concurrentToken);
+ return false;
}
}
- return reactivateParent;
+ return true;
}
public String getParentLockMode() {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -16,7 +16,6 @@
import org.jbpm.db.JobSession;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.job.Job;
-import org.jbpm.persistence.JbpmPersistenceException;
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
@@ -151,16 +150,12 @@
acquiredJobs = jobsToLock;
log.debug("acquired lock on jobs: " + acquiredJobs);
}
- catch (JbpmPersistenceException e) {
- // if this is a stale state exception, keep it quiet
- if (DbPersistenceService.isStaleStateException(e)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
- .error("failed to acquire lock on jobs " + jobsToLock);
- acquiredJobs = Collections.EMPTY_LIST;
- }
- else {
- throw e;
- }
+ catch (RuntimeException e) {
+ if (!DbPersistenceService.isLockingException(e)) throw e;
+ // if this is a locking exception, keep it quiet
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
+ "failed to acquire lock on jobs " + jobsToLock);
+ acquiredJobs = Collections.EMPTY_LIST;
}
}
}
@@ -207,15 +202,11 @@
try {
jbpmContext.close();
}
- catch (JbpmPersistenceException e) {
- // if this is a stale state exception, keep it quiet
- if (DbPersistenceService.isStaleStateException(e)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("failed to complete job " +
- job);
- }
- else {
- throw e;
- }
+ catch (RuntimeException e) {
+ if (!DbPersistenceService.isLockingException(e)) throw e;
+ // if this is a locking exception, keep it quiet
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
+ "failed to complete job " + job);
}
}
}
@@ -241,16 +232,12 @@
try {
jbpmContext.close();
}
- catch (JbpmPersistenceException e) {
- // if this is a stale state exception, keep it quiet
- if (DbPersistenceService.isStaleStateException(e)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog()
- .error("failed to determine next due date for job executor thread " + threadName);
- nextDueDate = null;
- }
- else {
- throw e;
- }
+ catch (RuntimeException e) {
+ if (!DbPersistenceService.isLockingException(e)) throw e;
+ // if this is a locking exception, keep it quiet
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
+ "failed to determine next due date for job executor thread " + threadName);
+ nextDueDate = null;
}
}
return nextDueDate;
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -11,7 +11,6 @@
import org.jbpm.JbpmContext;
import org.jbpm.db.JobSession;
import org.jbpm.job.Job;
-import org.jbpm.persistence.JbpmPersistenceException;
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
@@ -47,16 +46,16 @@
currentLockMonitorInterval = lockMonitorInterval;
}
catch (RuntimeException e) {
- log.error("exception in lock monitor thread. waiting "
- + currentLockMonitorInterval
- + " milliseconds", e);
+ log.error("exception in lock monitor thread. waiting " +
+ currentLockMonitorInterval +
+ " milliseconds", e);
try {
sleep(currentLockMonitorInterval);
}
catch (InterruptedException ie) {
log.debug("delay after exception got interrupted", ie);
}
- // after an exception, double the current lock monitor interval to prevent
+ // after an exception, double the current lock monitor interval to prevent
// continuous exception generation when e.g. the db is unreachable
currentLockMonitorInterval <<= 1;
if (currentLockMonitorInterval > maxLockMonitorInterval || currentLockMonitorInterval < 0) {
@@ -92,15 +91,11 @@
try {
jbpmContext.close();
}
- catch (JbpmPersistenceException e) {
- // if this is a stale state exception, keep it quiet
- if (DbPersistenceService.isStaleStateException(e)) {
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
- "optimistic locking failed, could not unlock overdue jobs: " + overdueJobs);
- }
- else {
- throw e;
- }
+ catch (RuntimeException e) {
+ if (!DbPersistenceService.isLockingException(e)) throw e;
+ // if this is a locking exception, keep it quiet
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
+ "could not unlock overdue jobs: " + overdueJobs);
}
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -22,6 +22,7 @@
package org.jbpm.persistence.db;
import java.sql.Connection;
+import java.sql.SQLException;
import javax.sql.DataSource;
@@ -32,6 +33,8 @@
import org.hibernate.SessionFactory;
import org.hibernate.StaleStateException;
import org.hibernate.Transaction;
+import org.hibernate.exception.LockAcquisitionException;
+
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.db.ContextSession;
@@ -78,8 +81,8 @@
}
public SessionFactory getSessionFactory() {
- return session != null ? session.getSessionFactory() : persistenceServiceFactory
- .getSessionFactory();
+ return session != null ? session.getSessionFactory()
+ : persistenceServiceFactory.getSessionFactory();
}
public Session getSession() {
@@ -155,14 +158,14 @@
if (connection == null) {
if (persistenceServiceFactory.getDataSource() != null) {
try {
- log.debug("fetching jdbc connection from datasource");
+ log.debug("establishing connneciton to data source");
connection = persistenceServiceFactory.getDataSource().getConnection();
mustConnectionBeClosed = true;
}
- catch (Exception e) {
+ catch (SQLException e) {
// NOTE that Errors are not caught because that might halt the JVM
// and mask the original Error.
- throw new JbpmException("could not obtain connection from datasource", e);
+ throw new JbpmPersistenceException("connection to data source failed", e);
}
}
else {
@@ -172,9 +175,9 @@
}
if (session != null) {
connection = session.connection();
- log.debug("fetched "
- + connection
- + " from hibernate session, client is responsible for closing it!");
+ log.debug("fetched " +
+ connection +
+ " from hibernate session, client is responsible for closing it!");
mustConnectionBeClosed = false;
}
}
@@ -226,15 +229,8 @@
mustSessionBeFlushed = false; // commit does a flush anyway
transaction.commit();
}
- catch (Exception e) {
- if (isStaleStateException(e)) {
- log.info("problem committing transaction: optimistic locking failed");
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
- "optimistic locking failed while committing " + transaction, e);
- }
- else {
- log.error("transaction commit failed", e);
- }
+ catch (HibernateException e) {
+ // avoid log and throw antipattern
return e;
}
return null;
@@ -247,8 +243,8 @@
mustSessionBeFlushed = false;
transaction.rollback();
}
- catch (Exception e) {
- log.error("transaction rollback failed", e);
+ catch (HibernateException e) {
+ // avoid log and throw antipattern
return e;
}
return null;
@@ -260,15 +256,8 @@
log.debug("flushing " + session);
session.flush();
}
- catch (Exception e) {
- if (isStaleStateException(e)) {
- log.info("problem flushing session: optimistic locking failed");
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
- "optimistic locking failed while flushing " + session, e);
- }
- else {
- log.error("hibernate flush failed", e);
- }
+ catch (HibernateException e) {
+ // avoid log and throw antipatternf
return e;
}
}
@@ -277,17 +266,18 @@
private Exception closeSession() {
if (mustSessionBeClosed) {
- try {
- if (session.isOpen()) {
+ if (session.isOpen()) {
+ try {
log.debug("closing hibernate session");
session.close();
}
- else {
- log.warn("hibernate session was already closed");
+ catch (HibernateException e) {
+ // avoid log and throw antipattern
+ return e;
}
}
- catch (Exception e) {
- return e;
+ else {
+ log.warn("hibernate session was already closed");
}
}
return null;
@@ -295,18 +285,18 @@
private Exception closeConnection() {
if (mustConnectionBeClosed) {
- try {
- if (connection != null) {
+ if (connection != null) {
+ try {
log.debug("closing jdbc connection");
connection.close();
}
- else {
- log.warn("jdbc connection was already closed");
+ catch (SQLException e) {
+ // avoid log and throw antipattern
+ return e;
}
}
- catch (Exception e) {
- log.error("hibernate session close failed", e);
- return e;
+ else {
+ log.warn("jdbc connection was already closed");
}
}
return null;
@@ -316,7 +306,7 @@
try {
getSession().save(object);
}
- catch (Exception e) {
+ catch (HibernateException e) {
// NOTE that Errors are not caught because that might halt the JVM
// and mask the original Error.
throw new JbpmPersistenceException("couldn't assign id to " + object, e);
@@ -514,9 +504,9 @@
return false;
}
- public static boolean isStaleStateException(Exception exception) {
+ public static boolean isLockingException(Exception exception) {
for (Throwable t = exception; t != null; t = t.getCause()) {
- if (t instanceof StaleStateException) return true;
+ if (t instanceof StaleStateException || t instanceof LockAcquisitionException) return true;
}
return false;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/jta/JtaDbPersistenceService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/jta/JtaDbPersistenceService.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/jta/JtaDbPersistenceService.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -21,6 +21,10 @@
*/
package org.jbpm.persistence.jta;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.UserTransaction;
@@ -29,9 +33,9 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.util.JTAHelper;
+
import org.jbpm.JbpmException;
import org.jbpm.persistence.db.DbPersistenceService;
-import org.jbpm.persistence.db.StaleObjectLogConfigurer;
public class JtaDbPersistenceService extends DbPersistenceService {
@@ -59,8 +63,8 @@
}
protected boolean isTransactionRollbackOnly() {
- return super.isTransactionRollbackOnly()
- || JTAHelper.isMarkedForRollback(getTransactionStatus());
+ return super.isTransactionRollbackOnly() ||
+ JTAHelper.isMarkedForRollback(getTransactionStatus());
}
public void beginTransaction() {
@@ -70,7 +74,10 @@
transaction = jtaFactory.getUserTransaction();
transaction.begin();
}
- catch (Exception e) {
+ catch (NotSupportedException e) {
+ throw new JbpmException("transaction is already in course", e);
+ }
+ catch (SystemException e) {
throw new JbpmException("transaction begin failed", e);
}
}
@@ -91,21 +98,19 @@
transaction.commit();
return null;
}
- catch (Exception e) {
- if (isStaleStateException(e)) {
- log.debug("optimistic locking failed, could not commit " + transaction);
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
- "optimistic locking failed, could not commit " + transaction, e);
- }
- else {
- // Switched to debug because either handle OR log
- // an exception is best practice, not both!
- // Example: Clustered JobExecutor may have
- // Exceptions which should be kept quiet
- log.debug("transaction commit failed", e);
- }
+ // avoid log and throw antipattern
+ catch (RollbackException e) {
return e;
}
+ catch (HeuristicMixedException e) {
+ return e;
+ }
+ catch (HeuristicRollbackException e) {
+ return e;
+ }
+ catch (SystemException e) {
+ return e;
+ }
}
protected Exception rollback() {
@@ -114,12 +119,8 @@
transaction.rollback();
return null;
}
- catch (Exception e) {
- // Switched to debug because either handle OR log
- // an exception is best practice, not both!
- // Example: Clustered JobExecutor may have
- // Exceptions which should be kept quiet
- log.debug("transaction rollback failed", e);
+ catch (SystemException e) {
+ // avoid log and throw antipattern
return e;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -33,11 +33,9 @@
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
-import org.jbpm.JbpmException;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.logging.LoggingService;
import org.jbpm.msg.MessageService;
-import org.jbpm.persistence.JbpmPersistenceException;
import org.jbpm.persistence.PersistenceService;
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
@@ -236,45 +234,36 @@
}
public void close() {
- if (services != null) {
- Exception firstException = null;
- for (Iterator iter = serviceNames.iterator(); iter.hasNext();) {
- String serviceName = (String) iter.next();
- Service service = (Service) services.get(serviceName);
- if (service != null) {
- try {
- log.debug("closing service '" + serviceName + "': " + service);
- service.close();
+ if (services == null) return;
+
+ RuntimeException firstException = null;
+ for (Iterator iter = serviceNames.iterator(); iter.hasNext();) {
+ String serviceName = (String) iter.next();
+ Service service = (Service) services.get(serviceName);
+ if (service == null) continue;
+
+ try {
+ log.debug("closing '" + serviceName + "' service");
+ service.close();
+ }
+ catch (RuntimeException e) {
+ if (firstException == null) {
+ firstException = e;
+ }
+ else {
+ // if this is a locking exception, keep it quiet
+ if (DbPersistenceService.isLockingException(e)) {
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
+ "problem closing '" + serviceName + "' service", e);
}
- catch (JbpmPersistenceException e) {
- // if this is a stale state exception, keep it quiet
- if (DbPersistenceService.isStaleStateException(e)) {
- log.info("optimistic locking failed, could not close service: " + serviceName);
- StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error(
- "optimistic locking failed, could not close service: " + serviceName, e);
- }
- else {
- log.error("problem closing service '" + serviceName + "'", e);
- }
- if (firstException == null) {
- firstException = e;
- }
+ else {
+ log.error("problem closing '" + serviceName + "' service", e);
}
- catch (Exception e) {
- // NOTE that Error's are not caught because that might halt the JVM
- // and mask the original Error.
- log.error("problem closing service '" + serviceName + "'", e);
- if (firstException == null) {
- firstException = e;
- }
- }
}
}
- if (firstException != null) {
- throw firstException instanceof JbpmException ? (JbpmException) firstException
- : new JbpmException("problem closing services", firstException);
- }
}
+
+ if (firstException != null) throw firstException;
}
public static void assignId(Object object) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-06-27 12:19:46 UTC (rev 5136)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-06-27 12:56:00 UTC (rev 5137)
@@ -22,11 +22,8 @@
package org.jbpm.perf;
import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.util.Semaphore;
/**
* This test creates a number of process instances. Every instance has a call to an ActionHandler.
@@ -41,86 +38,52 @@
private static final int WARMUP_INSTANCES = 100;
private static final int MEASUREMENT_INSTANCES = 1000;
+ private static final long TIMEOUT = 5 * 60 * 1000;
- private static final Semaphore signalLight = new Semaphore(0);
-
private ProcessDefinition processDefinition;
protected void setUp() throws Exception {
super.setUp();
processDefinition = ProcessDefinition.parseXmlString("<process-definition name='perf'>"
- + " <event type='process-start'>"
- + " <action class='"
- + AsyncSignalAction.class.getName()
- + "' async='true'/>"
- + " </event>"
+ " <start-state name='start'>"
+ " <transition to='end'/>"
+ " </start-state>"
- + " <end-state name='end'/>"
+ + " <end-state async='true' name='end'/>"
+ "</process-definition>");
jbpmContext.deployProcessDefinition(processDefinition);
-
- newTransaction();
- startJobExecutor();
}
protected void tearDown() throws Exception {
- stopJobExecutor();
-
- newTransaction();
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
-
super.tearDown();
}
public void testAsyncCall() {
- // Won't Fix [JBPM-2043] Performance test coverage
- if (getHibernateDialect().indexOf("HSQL") != -1) return;
-
launchProcessInstances(WARMUP_INSTANCES);
long startTime = System.currentTimeMillis();
launchProcessInstances(MEASUREMENT_INSTANCES);
long duration = (System.currentTimeMillis() - startTime) / 1000;
- System.out.println("=== Test finished processing "
- + MEASUREMENT_INSTANCES
- + " instances in "
- + duration
- + " seconds ===");
- System.out.println("=== This is "
- + (MEASUREMENT_INSTANCES / duration)
- + " instances per second ===");
+ System.out.println("=== Test finished processing " +
+ MEASUREMENT_INSTANCES +
+ " instances in " +
+ duration +
+ " seconds ===");
+ System.out.println("=== This is " +
+ (MEASUREMENT_INSTANCES / duration) +
+ " instances per second ===");
}
private void launchProcessInstances(int count) {
for (int i = 0; i < count; i++) {
- ProcessInstance pi = new ProcessInstance(processDefinition);
- jbpmContext.save(pi);
newTransaction();
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+ jbpmContext.save(processInstance);
}
- commitAndCloseSession();
- try {
- signalLight.acquire(count);
- }
- catch (InterruptedException e) {
- fail(getName() + " got interrupted while waiting for process instances to end");
- }
- finally {
- beginSessionTransaction();
- }
+ processJobs(TIMEOUT);
}
-
- public static class AsyncSignalAction implements ActionHandler {
-
- private static final long serialVersionUID = -8617329370138396271L;
-
- public void execute(final ExecutionContext executionContext) throws Exception {
- executionContext.leaveNode();
- signalLight.release();
- }
- }
}
16 years, 10 months