Author: tom.baeyens(a)jboss.com
Date: 2009-05-20 05:10:17 -0400 (Wed, 20 May 2009)
New Revision: 4854
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.concurrency.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.multipleentries.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.simple.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.timer.png
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/
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/AsyncActivityTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/process.jpdl.xml
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
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
Log:
JBPM-2256 starting on async example
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-05-20 08:57:25 UTC (rev
4853)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-05-20 09:10:17 UTC (rev
4854)
@@ -602,6 +602,16 @@
<annotation><documentation>Graphical information used by process
designer tool.
</documentation></annotation>
</attribute>
+ <attribute name="async">
+ <annotation><documentation>Graphical information used by process
designer tool.
+ </documentation></annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="true" />
+ <enumeration value="exclusive" />
+ </restriction>
+ </simpleType>
+ </attribute>
</attributeGroup>
<attributeGroup name="assignmentAttributes">
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.concurrency.png
===================================================================
(Binary files differ)
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.concurrency.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.multipleentries.png
===================================================================
(Binary files differ)
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.multipleentries.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.simple.png
===================================================================
(Binary files differ)
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.simple.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.timer.png
===================================================================
(Binary files differ)
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/process.group.timer.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
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
(rev 0)
+++
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java 2009-05-20
09:10:17 UTC (rev 4854)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.examples.async.activity;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Application {
+
+}
Property changes on:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/Application.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java
===================================================================
---
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java
(rev 0)
+++
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java 2009-05-20
09:10:17 UTC (rev 4854)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.examples.async.activity;
+
+import org.jbpm.api.Execution;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncActivityTest extends JbpmTestCase {
+
+ long deploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentDbid = repositoryService.createDeployment()
+
.addResourceFromClasspath("org/jbpm/examples/async/activity/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ super.tearDown();
+ }
+
+ public void testJavaInstantiate() {
+ Execution execution =
executionService.startProcessInstanceByKey("AsyncActivity");
+ String executionId = execution.getId();
+ }
+}
Property changes on:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/async/activity/AsyncActivityTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/process.jpdl.xml
===================================================================
---
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/process.jpdl.xml
(rev 0)
+++
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/process.jpdl.xml 2009-05-20
09:10:17 UTC (rev 4854)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="AsyncActivity"
xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start>
+ <transition to="generate pdf" />
+ </start>
+
+ <java name="generate pdf"
+ class="org.jbpm.examples.async.activity.Application"
+ method="generatePdf"
+ async="true">
+ <transition to="calculate primes" />
+ </java>
+
+ <java name="calculate primes"
+ class="org.jbpm.examples.async.activity.Application"
+ method="calculatePrimes"
+ async="true">
+ <transition to="run test suite" />
+ </java>
+
+ <java name="run test suite"
+ class="org.jbpm.examples.async.activity.Application"
+ method="runTestSuite"
+ async="true">
+ <transition to="end" />
+ </java>
+
+ <end name="end" />
+
+</process>
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/async/activity/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-05-20
08:57:25 UTC (rev 4853)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-05-20
09:10:17 UTC (rev 4854)
@@ -24,7 +24,11 @@
import java.lang.reflect.Method;
import java.util.List;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.env.Environment;
import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentDefaults;
+import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
@@ -41,15 +45,30 @@
private static final long serialVersionUID = 1L;
+ protected String expression;
+ protected String language;
protected Descriptor descriptor;
protected String methodName;
protected String variableName;
protected InvokeOperation invokeOperation;
public void perform(OpenExecution execution) throws Exception {
+
+ Object target = null;
+
WireContext wireContext = new WireContext();
- Object target = wireContext.create(descriptor, false);
+ if (descriptor!=null) {
+ target = wireContext.create(descriptor, false);
+
+ } else if (expression!=null) {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ target = scriptManager.evaluateExpression(expression, execution, language);
+
+ } else {
+ throw new JbpmException("no target specified");
+ }
+
try {
List<ArgDescriptor> argDescriptors = null;
Object[] args = null;
@@ -89,4 +108,10 @@
public void setInvokeOperation(InvokeOperation invokeOperation) {
this.invokeOperation = invokeOperation;
}
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
}
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-05-20
08:57:25 UTC (rev 4853)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-05-20
09:10:17 UTC (rev 4854)
@@ -64,6 +64,14 @@
if (element.hasAttribute("class")) {
ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element,
parse);
javaActivity.setDescriptor(objectDescriptor);
+
+ } else if (element.hasAttribute("expr")) {
+ String expression = element.getAttribute("expr");
+ javaActivity.setExpression(expression);
+ javaActivity.setLanguage(XmlUtil.attribute(element, "language"));
+
+ } else {
+ // parse.addProblem("no target specified in "+TAG+": must specify
attribute 'class' or 'expr'", element);
}
return javaActivity;