[jbpm-commits] JBoss JBPM SVN: r3411 - in jbpm4/trunk/modules: examples/src/test/resources/org/jbpm/examples/java and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 17 15:33:42 EST 2008
Author: tom.baeyens at jboss.com
Date: 2008-12-17 15:33:41 -0500 (Wed, 17 Dec 2008)
New Revision: 3411
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
Log:
moved java.instantiate to java
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JavaInstantiateTest.java 2008-12-17 20:33:41 UTC (rev 3411)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.java;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaInstantiateTest extends DbTestCase {
+
+ public void testJavaInstantiate() {
+ deployJpdlResource("org/jbpm/examples/java/process.jpdl.xml");
+
+ Execution execution = executionService.startExecutionByKey("Java");
+ String executionId = execution.getId();
+
+ String answer = (String) executionService.getVariable(executionId, "answer");
+
+ assertEquals("I'm fine, thank you.", answer);
+ }
+
+}
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2008-12-17 20:33:41 UTC (rev 3411)
@@ -0,0 +1,43 @@
+/*
+ * 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.java;
+
+import org.hibernate.Session;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JohnDoe {
+
+ String state;
+ Session session;
+
+ public String hello(String msg) {
+ if ( (msg.indexOf("how are you?")!=-1)
+ && (session.isOpen())
+ ) {
+ return "I'm "+state+", thank you.";
+ }
+ return null;
+ }
+}
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2008-12-17 20:33:41 UTC (rev 3411)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Java" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="invoke java method" />
+ </start>
+
+ <java name="invoke java method"
+ class="org.jbpm.examples.java.JohnDoe"
+ method="hello"
+ var="answer">
+
+ <field name="state"><string value="fine"/></field>
+ <field name="session"><env type="org.hibernate.Session"/></field>
+
+ <arg><string value="Hi, how are you?"/></arg>
+
+ <flow to="wait" />
+ </java>
+
+ <state name="wait" />
+
+</process>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java 2008-12-17 20:33:41 UTC (rev 3411)
@@ -26,11 +26,8 @@
import java.util.Set;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
import org.jbpm.pvm.internal.wire.operation.Operation;
import org.jbpm.pvm.internal.wire.xml.WireParser;
@@ -99,25 +96,7 @@
javaActivity.setDescriptor(objectDescriptor);
}
-
- String objectName = XmlUtil.attribute(element, "object");
- if (objectName!=null) {
- Descriptor objectDescriptor = new ReferenceDescriptor(objectName);
- javaActivity.setDescriptor(objectDescriptor);
- }
-
- if ( (objectName!=null)
- && (className!=null)
- ) {
- parse.addProblem("in <"+TAG+"...>, attributes object and class are mutually exclusive");
- }
-
- if ( (objectName!=null)
- && (!XmlUtil.elements(element, "field").isEmpty())
- ) {
- parse.addProblem("in <"+TAG+"...>, attribute object is mutually exclusive with field elements");
- }
-
+
return javaActivity;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2008-12-17 15:53:56 UTC (rev 3410)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2008-12-17 20:33:41 UTC (rev 3411)
@@ -411,7 +411,8 @@
}
// then check if we can create the object from a descriptor
- if (wireDefinition.hasDescriptor(objectName)) {
+ boolean hasDescriptor = (wireDefinition!=null ? wireDefinition.hasDescriptor(objectName) : false);
+ if (hasDescriptor) {
if (isUnderConstruction(objectName) || isUnderInitialization(objectName)) {
throw new WireException("circular dependency for "+objectName);
More information about the jbpm-commits
mailing list