[jbpm-commits] JBoss JBPM SVN: r3410 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples and 12 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 17 10:53:57 EST 2008
Author: tom.baeyens at jboss.com
Date: 2008-12-17 10:53:56 -0500 (Wed, 17 Dec 2008)
New Revision: 3410
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JavaInstantiateTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JohnDoe.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java
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/binding/EnvBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvRefBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvDescriptor.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentRefBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvironmentTypeRefDescriptor.java
Modified:
jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBinding.java
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/WireBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/JobExecutorTest.java
Log:
adding java instantiate
Modified: jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-17 15:53:56 UTC (rev 3410)
@@ -163,7 +163,7 @@
</complexType>
</element>
- <element name="environment-ref">
+ <element name="env-ref">
<annotation><documentation>Obtains the current environment. The environment
is only available in objects declared inside the environment context. So it
can't be used inside the session-factory context.
@@ -1105,7 +1105,7 @@
<element ref="tns:class" />
<element ref="tns:context-ref" />
<element ref="tns:double" />
- <element ref="tns:environment-ref" />
+ <element ref="tns:env-ref" />
<element ref="tns:process-engine-ref" />
<element ref="tns:false" />
<element ref="tns:float" />
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-17 15:53:56 UTC (rev 3410)
@@ -202,8 +202,10 @@
</element>
<element name="java">
- <annotation><documentation>Instantiates java class with reflection, inject
- values from the environment in the fields and execute a method.
+ <annotation><documentation>Invokes a method on a java object.
+ Either the java class is instantiated with reflection, or the
+ java object is fetched from the environment. Then values from the
+ environment are injected into the fields and a method is executed.
</documentation></annotation>
<complexType>
<complexContent>
@@ -217,22 +219,6 @@
</complexType>
</element>
- <element name="java-ref">
- <annotation><documentation>Invokes a method on a java object in the
- environment.
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:javaRefType">
- <sequence>
- <element ref="tns:flow" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- <attributeGroup ref="tns:nodeAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
<!--
<element name="process-state">
<annotation><documentation>Waits while a sub process instance is
@@ -327,59 +313,53 @@
</choice>
</group>
- <complexType name="scriptType">
- <sequence>
- <element name="expr" type="string">
- <annotation><documentation>The content of this expression element
- is the script text that will be evaluated. This is mutually
- exclusive with the expression attribute.</documentation></annotation>
- </element>
- </sequence>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated. This
- is mutually exclusive with the expression element.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- </complexType>
-
<complexType name="javaType">
<sequence>
<element name="field" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>Field injections from the environment
invocation.</documentation></annotation>
</element>
+ <element name="arg" minOccurs="0" maxOccurs="unbounded">
+ <annotation><documentation>Method arguments.</documentation></annotation>
+ </element>
</sequence>
+ <attribute name="object" type="string">
+ <annotation><documentation>Name of the object in the environment
+ </documentation></annotation>
+ </attribute>
<attribute name="method" type="string" use="required">
<annotation><documentation>The name of the method to invoke.
</documentation></annotation>
</attribute>
<attribute name="class" type="string">
- <annotation><documentation>The class to use.
+ <annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
+ <attribute name="var" type="string">
+ <annotation><documentation>The variable name to store the return value
+ </documentation></annotation>
+ </attribute>
</complexType>
- <complexType name="javaRefType">
+ <complexType name="scriptType">
<sequence>
- <element name="arg" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Arguments passed into the method
- invocation.</documentation></annotation>
+ <element name="script" type="string">
+ <annotation><documentation>The content of this expression element
+ is the script text that will be evaluated. This is mutually
+ exclusive with the expression attribute.</documentation></annotation>
</element>
</sequence>
- <attribute name="method" type="string" use="required">
- <annotation><documentation>The name of the method to invoke.
+ <attribute name="expr" type="string">
+ <annotation><documentation>The script text that will be evaluated. This
+ is mutually exclusive with the expression element.
</documentation></annotation>
</attribute>
- <attribute name="object" type="string">
- <annotation><documentation>The name of the object in the environment to use.
- </documentation></annotation>
+ <attribute name="lang" type="string">
+ <annotation><documentation>Identification of the scripting language
+ to use.</documentation></annotation>
</attribute>
</complexType>
-
+
<attributeGroup name="nodeAttributes">
<attribute name="name" type="string">
<annotation><documentation>The id of this activity. The name should be unique
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JavaInstantiateTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JavaInstantiateTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JavaInstantiateTest.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -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.instantiate;
+
+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/instantiate/process.jpdl.xml");
+
+ Execution execution = executionService.startExecutionByKey("JavaInstantiate");
+ String executionId = execution.getId();
+
+ String answer = (String) executionService.getVariable(executionId, "answer");
+
+ assertEquals("I'm fine, thank you.", answer);
+ }
+
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JavaInstantiateTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JohnDoe.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JohnDoe.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JohnDoe.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -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.instantiate;
+
+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;
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/instantiate/JohnDoe.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/process.jpdl.xml 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JavaInstantiate" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="invoke java method" />
+ </start>
+
+ <java name="invoke java method"
+ class="org.jbpm.examples.java.instantiate.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>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/instantiate/process.jpdl.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBinding.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -31,6 +31,7 @@
import org.jbpm.pvm.internal.wire.descriptor.ExpressionConditionDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -42,6 +43,7 @@
public class ExclusiveBinding extends JpdlActivityBinding {
static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
public ExclusiveBinding() {
super("exclusive");
@@ -66,7 +68,7 @@
if (handlerElement!=null) {
ExclusiveHandlerActivity exclusiveHandlerActivity = new ExclusiveHandlerActivity();
ObjectDescriptor exclusiveHandlerDescriptor = (ObjectDescriptor)
- objectBinding.parse(handlerElement, parse, parser);
+ objectBinding.parse(handlerElement, parse, wireParser);
exclusiveHandlerActivity.setExclusiveHandlerDescriptor(exclusiveHandlerDescriptor);
return exclusiveHandlerActivity;
}
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.activity;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Descriptor descriptor;
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ WireContext wireContext = new WireContext();
+ Object target = wireContext.create(descriptor, false);
+
+ try {
+ List<ArgDescriptor> argDescriptors = invokeOperation.getArgDescriptors();
+ Object[] args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ Class<?> clazz = target.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);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public void setDescriptor(Descriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jpdl.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+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;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaBinding extends JpdlActivityBinding {
+
+ public static final String TAG = "java";
+
+ private static final WireParser wireParser = WireParser.getInstance();
+
+ public JavaBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JavaActivity javaActivity = new JavaActivity();
+
+ String methodName = XmlUtil.attribute(element, "method", true, parse, null);
+ javaActivity.setMethodName(methodName);
+
+ String variableName = XmlUtil.attribute(element, "var");
+ javaActivity.setVariableName(variableName);
+
+ List<Element> argElements = XmlUtil.elements(element, "arg");
+ if (!argElements.isEmpty()) {
+ List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
+ InvokeOperation invokeOperation = new InvokeOperation();
+ invokeOperation.setArgDescriptors(argDescriptors);
+ javaActivity.setInvokeOperation(invokeOperation);
+ }
+
+ String className = XmlUtil.attribute(element, "class");
+ if (className!=null) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+
+ objectDescriptor.setClassName(className);
+
+ // read the operations elements
+ List<Operation> operations = null;
+ List<Element> elements = XmlUtil.elements(element);
+
+ Set<String> operationTagNames = wireParser.getBindings().getTagNames(WireParser.CATEGORY_OPERATION);
+ for (Element childElement: elements) {
+ if (operationTagNames.contains(childElement.getTagName())) {
+ Operation operation = (Operation) wireParser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
+ if (operations==null) {
+ operations = new ArrayList<Operation>();
+ }
+ operations.add(operation);
+ }
+ }
+ objectDescriptor.setOperations(operations);
+
+ // autowiring
+ Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
+ if (isAutoWireEnabled!=null) {
+ objectDescriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
+ }
+
+ 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;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2008-12-17 15:53:56 UTC (rev 3410)
@@ -8,4 +8,5 @@
<activity binding="org.jbpm.jpdl.activity.JoinBinding" />
<activity binding="org.jbpm.jpdl.activity.HqlBinding" />
<activity binding="org.jbpm.jpdl.activity.SqlBinding" />
+ <activity binding="org.jbpm.jpdl.activity.JavaBinding" />
</activities>
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2008-12-17 15:53:56 UTC (rev 3410)
@@ -51,6 +51,22 @@
<subclass name="org.jbpm.jpdl.activity.SqlActivity" discriminator-value="sql" />
</subclass>
+ <subclass name="org.jbpm.jpdl.activity.JavaActivity" discriminator-value="java">
+ <property name="methodName" column="TEXT_" />
+ <property name="variableName" column="TEXT2_" />
+ <many-to-one name="descriptor"
+ column="JAVADESCR_"
+ cascade="all"
+ class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+ foreign-key="FK_ACT_JAVADESCR"
+ index="IDX_ACT_JAVADESCR" />
+ <many-to-one name="invokeOperation"
+ column="INVOPER_"
+ cascade="all"
+ class="org.jbpm.pvm.internal.wire.operation.InvokeOperation"
+ foreign-key="FK_ACT_INVKOPER"
+ index="IDX_ACT_INVKOPER" />
+ </subclass>
</class>
</hibernate-mapping>
\ No newline at end of file
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.descriptor.EnvDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EnvBinding extends WireDescriptorBinding {
+
+ public EnvBinding() {
+ super("env");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EnvDescriptor envDescriptor = new EnvDescriptor();
+
+ String typeName = XmlUtil.attribute(element, "type");
+ envDescriptor.setTypeName(typeName);
+
+ String objectName = XmlUtil.attribute(element, "object");
+ envDescriptor.setObjectName(objectName);
+
+ return envDescriptor;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvRefBinding.java (from rev 3404, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentRefBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvRefBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvRefBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.wire.descriptor.EnvironmentDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/** parses a descriptor for obtaining a reference to the {@link Environment}.
+ *
+ * See schema docs for more details.
+ *
+ * @author Tom Baeyens
+ * @author Guillaume Porcher (documentation)
+ */
+public class EnvRefBinding extends WireDescriptorBinding {
+
+ public EnvRefBinding() {
+ super("env-ref");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new EnvironmentDescriptor();
+ }
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvRefBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentRefBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentRefBinding.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/EnvironmentRefBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.wire.descriptor.EnvironmentDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/** parses a descriptor for obtaining a reference to the {@link Environment}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- * @author Guillaume Porcher (documentation)
- */
-public class EnvironmentRefBinding extends WireDescriptorBinding {
-
- public EnvironmentRefBinding() {
- super("environment-ref");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- return new EnvironmentDescriptor();
- }
-
-}
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -22,7 +22,9 @@
package org.jbpm.pvm.internal.wire.binding;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.Set;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
@@ -30,6 +32,7 @@
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.operation.Operation;
import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -42,12 +45,13 @@
* @author Guillaume Porcher (documentation)
*/
public class ObjectBinding extends WireDescriptorBinding {
+
+ public static final String TAG = "object";
public ObjectBinding() {
- super("object");
+ super(TAG);
}
-
public static boolean isObjectDescriptor(Element element) {
if (XmlUtil.attribute(element, "class")!=null) {
return true;
@@ -122,21 +126,22 @@
// read the operations elements
List<Operation> operations = null;
List<Element> elements = XmlUtil.elements(element);
+
+ Set<String> operationTagNames = null;
+ Bindings bindings = parser.getBindings();
+ if (bindings!=null) {
+ operationTagNames = bindings.getTagNames(WireParser.CATEGORY_OPERATION);
+ } else {
+ operationTagNames = Collections.EMPTY_SET;
+ }
+
for (Element childElement: elements) {
- if(!childElement.getTagName().equals("constructor")
- && !childElement.getTagName().equals("factory")
- && !childElement.getTagName().equals("arg")){
+ if (operationTagNames.contains(childElement.getTagName())) {
Operation operation = (Operation) parser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
- if (operation!=null) {
- if (operations==null) {
- operations = new ArrayList<Operation>();
- }
- operations.add(operation);
- }else{
- parse.addProblem("element 'object' can only have 'factory', 'arg', 'constructor' elements or an operation element ("+
- parser.getBindings().getTagNames(WireParser.CATEGORY_OPERATION) +")." +
- " Invalid element '"+childElement.getTagName()+"' in: "+XmlUtil.toString(element));
+ if (operations==null) {
+ operations = new ArrayList<Operation>();
}
+ operations.add(operation);
}
}
descriptor.setOperations(operations);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TimerSessionBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -26,7 +26,7 @@
import org.jbpm.pvm.internal.jobexecutor.JobExecutorTimerSession;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.EnvironmentTypeRefDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.EnvDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.TransactionRefDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
@@ -60,7 +60,7 @@
// inject fields
objectDescriptor.addInjection("transaction", new TransactionRefDescriptor());
- objectDescriptor.addInjection("jobExecutor", new EnvironmentTypeRefDescriptor(JobExecutor.class));
+ objectDescriptor.addInjection("jobExecutor", new EnvDescriptor(JobExecutor.class));
objectDescriptor.addInjection("jobDbSession", new ContextTypeRefDescriptor(JobDbSession.class));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/WireBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/WireBinding.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/WireBinding.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -32,7 +32,8 @@
static final String WIRE_NAMESPACE = "http://jbpm.org/4/cfg";
public WireBinding(String tagName, String category) {
- super(tagName, WIRE_NAMESPACE, category);
+ // the wire bindings currently don't use the namespace as
+ super(tagName, null, category);
}
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvDescriptor.java (from rev 3404, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvironmentTypeRefDescriptor.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvDescriptor.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvDescriptor.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.descriptor;
+
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EnvDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = Log.getLog(EnvDescriptor.class.getName());
+
+ protected String objectName;
+ protected String typeName;
+ protected Class<?> type;
+
+ public EnvDescriptor() {
+ }
+
+ public EnvDescriptor(Class<?> type) {
+ this.type = type;
+ }
+
+ public Object construct(WireContext wireContext) {
+ Environment environment = Environment.getCurrent();
+
+ if (environment==null) {
+ throw new WireException("no environment to get object "+(objectName!=null ? objectName : typeName));
+ }
+
+ if (objectName!=null) {
+ log.trace("looking up "+objectName+" by name in environment");
+ return environment.get(objectName);
+ }
+
+ log.trace("looking up an object of type "+typeName+" in environment");
+ if (type==null) {
+ try {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ type = classLoader.loadClass(typeName);
+ } catch (Exception e) {
+ throw new WireException("couldn't load class "+typeName, e);
+ }
+ }
+ return environment.get(type);
+ }
+
+ public void setObjectName(String objectName) {
+ this.objectName = objectName;
+ }
+ public void setTypeName(String typeName) {
+ this.typeName = typeName;
+ }
+ public void setType(Class< ? > type) {
+ this.type = type;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvDescriptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvironmentTypeRefDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvironmentTypeRefDescriptor.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/EnvironmentTypeRefDescriptor.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.descriptor;
-
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireException;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EnvironmentTypeRefDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = Log.getLog(ContextTypeRefDescriptor.class.getName());
-
- Class<?> type;
-
- public EnvironmentTypeRefDescriptor(Class< ? > type) {
- this.type = type;
- }
-
- public Object construct(WireContext wireContext) {
- log.trace("looking up "+type+" by type in environment");
- if (type!=null) {
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- throw new WireException("no environment to search an object of type "+type.getName());
- }
- return environment.get(type);
- }
- return null;
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -366,7 +366,7 @@
/** convenience method to add a type based field injection */
public void addTypedInjection(String fieldName, Class<?> type) {
- addInjection(fieldName, new EnvironmentTypeRefDescriptor(type));
+ addInjection(fieldName, new EnvDescriptor(type));
}
/** add an injection based on a descriptor */
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-17 15:53:56 UTC (rev 3410)
@@ -27,7 +27,8 @@
<binding class="org.jbpm.pvm.internal.wire.binding.PropertiesBinding" />
<!-- environment refs -->
<binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentFactoryRefBinding" />
- <binding class="org.jbpm.pvm.internal.wire.binding.EnvironmentRefBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.EnvRefBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.EnvBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.ContextRefBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TransactionRefBinding" />
<!-- various specials -->
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.hbm.xml 2008-12-17 15:53:56 UTC (rev 3410)
@@ -136,6 +136,12 @@
</any>
<property name="exposeType" column="BOOLVAL_" />
</subclass>
+
+ <subclass name="EnvDescriptor" discriminator-value="env">
+ <property name="objectName" column="TEXT_" />
+ <property name="typeName" column="CLASSNAME_" />
+ </subclass>
+
</class>
<!-- ### OPERATIONS ##################################################### -->
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/EnvWireTest.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -16,7 +16,7 @@
"<environment-scopes>" +
" <process-engine />" +
" <environment>" +
- " <environment-ref name='e' />" +
+ " <env-ref name='e' />" +
" </environment>" +
"</environment-scopes>"
);
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/JobExecutorTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/JobExecutorTest.java 2008-12-17 14:55:23 UTC (rev 3409)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/JobExecutorTest.java 2008-12-17 15:53:56 UTC (rev 3410)
@@ -160,14 +160,17 @@
assertTrue("message " + i + " is not failed once: " + failOnceMessageIds, failOnceMessageIds.contains(i));
}
assertEquals(nbrOfTestMessages, failOnceMessageIds.size());
+
+ log.debug("==== all messages processed, now checking if all messages have arrived exactly once ====");
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
List<Comment> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
-
+
for (Comment comment : comments) {
+ log.debug("retrieved message: "+comment.getMessage());
Integer messageId = new Integer(comment.getMessage());
assertTrue("message " + messageId + " committed twice", failOnceMessageIds.remove(messageId));
}
More information about the jbpm-commits
mailing list