[jbpm-commits] JBoss JBPM SVN: r4977 - in jbpm4/trunk/modules: examples/src/test/resources/org/jbpm/examples/java and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 2 13:37:31 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-02 13:37:31 -0400 (Tue, 02 Jun 2009)
New Revision: 4977
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
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/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2283 JBPM-2215 making the value types concrete and documenting the migration limitations
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-06-02 17:37:31 UTC (rev 4977)
@@ -439,6 +439,141 @@
<group name="wireObjectGroup">
<choice>
+ <!-- SPECIAL OBJECTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="null">
+ <annotation><documentation>the null value
+ </documentation></annotation>
+ </element>
+ <element name="ref">
+ <annotation><documentation>A reference to an object in the current environment</documentation></annotation>
+ <complexType>
+ <attribute name="object" type="string" use="required">
+ <annotation><documentation>The name of the referred object</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="env-ref">
+ <annotation><documentation>The current environment.
+ </documentation></annotation>
+ </element>
+ <element name="jndi">
+ <annotation><documentation>A lookup from JNDI through the InitialContext
+ </documentation></annotation>
+ <complexType>
+ <attribute name="jndi-name" type="string" use="required" />
+ </complexType>
+ </element>
+
+ <!-- COLLECTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="list">
+ <annotation><documentation>A java.util.List</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="class" type="string" default="java.util.ArrayList">
+ <annotation><documentation>Implementation class for this list.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedList(List)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="map">
+ <annotation><documentation>A java.util.Map</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="entry">
+ <complexType>
+ <choice minOccurs="0">
+ <element name="key" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ <element name="value" minOccurs="0">
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ </complexType>
+ </element>
+ </choice>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string" default="java.util.HashMap">
+ <annotation><documentation>Implementation class for this map.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedList(List)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="set">
+ <annotation><documentation>A java.util.Set
+ </documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:wireObjectGroup" />
+ </choice>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="class" type="string" default="java.util.HashList">
+ <annotation><documentation>Implementation class for this set.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="synchronized" type="tns:booleanValueType" default="false">
+ <annotation><documentation>Indicates if this collection should be synchronized
+ with Collections.synchronizedSet(Set)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="properties">
+ <annotation><documentation>A java.util.Properties</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="property">
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attribute name="value" type="string" use="required" />
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="file" type="string">
+ <annotation><documentation>A file on the file system</documentation></annotation>
+ </attribute>
+ <attribute name="resource" type="string">
+ <annotation><documentation>A file as a resource in the classpath</documentation></annotation>
+ </attribute>
+ <attribute name="url" type="string">
+ <annotation><documentation>the contents is fetched by loading a url</documentation></annotation>
+ </attribute>
+ <attribute name="is-xml" type="tns:booleanValueType">
+ <annotation><documentation>optionally indicates if the content of referenced file in attributes
+ 'file', 'resource' or 'url' is XML. The default is the
+ plain properties format with a space or the equals character (=) separating key and value on
+ each line.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <!-- OBJECT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <element name="object" type="tns:wireObjectType" />
+
+ <!-- BASIC TYPES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
<element name="string">
<complexType>
<attribute name="name">
@@ -449,34 +584,240 @@
</attribute>
</complexType>
</element>
- <element name="object" type="tns:wireObjectType" />
+
+ <element name="byte">
+ <annotation><documentation>A java.lang.Byte</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="byte" use="required" />
+ </complexType>
+ </element>
+ <element name="char">
+ <annotation><documentation>A java.lang.Character</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" use="required">
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="1" />
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="double">
+ <annotation><documentation>A java.lang.Double</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="double" use="required" />
+ </complexType>
+ </element>
+ <element name="false">
+ <annotation><documentation>java.lang.Boolean.FALSE
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="float">
+ <annotation><documentation>A java.lang.Float
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="float" use="required" />
+ </complexType>
+ </element>
+ <element name="int">
+ <annotation><documentation>A java.lang.Integer
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="int" use="required"/>
+ </complexType>
+ </element>
+ <element name="long">
+ <annotation><documentation>A java.lang.Long</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="long" use="required"/>
+ </complexType>
+ </element>
+ <element name="short">
+ <annotation><documentation>a java.lang.Short
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ <attribute name="value" type="short" use="required"/>
+ </complexType>
+ </element>
+ <element name="true">
+ <annotation><documentation>java.lang.Boolean.TRUE
+ </documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation><documentation>The name of the object. It's optional and serves
+ as an id to refer to this object from other object declarations. This name can
+ also be used lookup the object programmatically.</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
</choice>
</group>
<complexType name="wireObjectType">
- <sequence>
- <element name="field" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Field injections from the environment
- invocation.</documentation></annotation>
- <complexType >
+ <annotation><documentation>Any java object that will be created by reflection. .
+ <p>There are three main ways to create an object: by constructor or by a factory
+ object or a static factory method.</p>
+ <p><b>Using the constructor</b>: Then the <code>class</code> attribute must provide the
+ fully qualified class name. In case another constructor then the default is
+ targetted, a <code>constructor</code> child element can be provided.
+ The <code>factory</code> attribute should not be provided for using a constructor.
+ </p>
+ <p><b>Using a factory</b>: Then the <code>factory</code> attribute or one
+ <code>factory</code> element must be provided along with the attribute
+ <code>method</code>.
+ </p>
+ <p><b>Using a static factory method</b>: Then the <code>class</code> and
+ <code>method</code> attributes should be specified. There should be no
+ reference to a <code>factory</code> attribute of element.
+ </p>
+ <p><b>Construction and initialization</b>: all objects (constructor and factory)
+ are build in two phases: construction and initialisation phase. During construction
+ all is done until a pointer is obtained to the object. In initialisation, operations
+ are applied to the object until it is ready to be used. The separation between
+ construction and initialisation is made to allow for bidirectional references. In
+ that case, at least one of both ends can not be fully initialised before it is injected
+ into the other end.
+ </p>
+ <p><b>Operations</b>: after construction, various operations can be applied to objects
+ like e.g. direct field injection, injection through setters, method invocation,
+ enlist with the standard transaction, subscribe the object as a listener to an observable
+ </p>
+ <p><b>Arguments</b>: There are two different places for arguments. The <code>arg</code>
+ elements for the factory method invocation should be placed as child elements under the
+ <code>object</code> element. The <code>arg</code> elements for the constructor should be
+ placed as child elements under the <code>constructor</code> element.
+ </p>
+ </documentation></annotation>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="factory">
+ <annotation><documentation>Contains one element that describes the factory object.</documentation></annotation>
+ <complexType>
<group ref="tns:wireObjectGroup" />
- <attribute name="name" type="string">
- <annotation><documentation>Name of the field in which the value should be injected.
- </documentation></annotation>
+ </complexType>
+ </element>
+ <element name="constructor">
+ <annotation><documentation>Specifies the arguments to use for a non-default constructor.</documentation></annotation>
+ <complexType>
+ <choice maxOccurs="unbounded">
+ <element name="arg" type="tns:argType" />
+ </choice>
+ </complexType>
+ </element>
+ <element name="arg" type="tns:argType">
+ <annotation><documentation>The factory method arguments.</documentation></annotation>
+ </element>
+ <element name="field">
+ <annotation><documentation>Injects a value into a member field of this object.
+ Exactly one child element must specify the value.
+ </documentation></annotation>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name">
+ <annotation><documentation>The member field name</documentation></annotation>
</attribute>
</complexType>
</element>
- </sequence>
- <attribute name="object" type="string">
- <annotation><documentation>Name of the object in the environment
+ <element name="property">
+ <annotation><documentation>Injects a value through a setter method.
+ Exactly one child element must specify the value.
+ </documentation></annotation>
+ <complexType>
+ <group ref="tns:wireObjectGroup" />
+ <attribute name="name">
+ <annotation><documentation>The name of the property (without the 'set' prefix)</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element name="invoke">
+ <annotation><documentation>Invokes a method</documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="arg" type="tns:argType" />
+ </choice>
+ <attribute name="method" type="string" use="required">
+ <annotation><documentation>the method name</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </choice>
+ <attribute name="class" type="string">
+ <annotation><documentation>The fully qualified class name</documentation></annotation>
+ </attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
- <attribute name="class" type="string">
+ <attribute name="lang" type="string">
<annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
- <attribute name="name" type="string">
- <annotation><documentation>The name of this object.
+ <attribute name="factory" type="string">
+ <annotation><documentation>The name of the factory object</documentation></annotation>
+ </attribute>
+ <attribute name="method" type="string">
+ <annotation><documentation>The factory method name</documentation></annotation>
+ </attribute>
+ <attribute name="auto-wire" type="string">
+ <annotation><documentation>Indicates if the member fields and setter properties
+ should be automatically wired based on matching the property names and types with the
+ object names and types</documentation></annotation>
+ </attribute>
+ </complexType>
+
+ <complexType name="argType">
+ <annotation><documentation>The method arguments.
+ Each 'arg' element should have exactly one child element
+ that represents the value of the argument.
+ </documentation></annotation>
+ <attribute name="type" type="string">
+ <annotation><documentation>The java class name representing
+ the type of the method. This is optional and can be used to
+ indicate the appropriate method in case of method overloading.
</documentation></annotation>
</attribute>
</complexType>
@@ -503,6 +844,16 @@
<annotation><documentation>The class to instantiate.
</documentation></annotation>
</attribute>
+ <attribute name="expr" type="string">
+ <annotation><documentation>Expression that resolves to the target object
+ on which the method should be invoked.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="lang" type="string">
+ <annotation><documentation>The language in which attribute 'expr' is to be
+ resolved.
+ </documentation></annotation>
+ </attribute>
<attribute name="var" type="string">
<annotation><documentation>The variable name to store the return value
</documentation></annotation>
@@ -733,7 +1084,7 @@
<annotation><documentation>Reference to the email template</documentation></annotation>
</attribute>
</complexType>
-
+
<complexType name="taskType" >
<!--
<sequence>
@@ -781,42 +1132,16 @@
</attribute>
-->
</complexType>
-
- <!--
- <element name="timer">
- <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
- Timers can give a signal to an activity instance. The signal will correspond to a transition
- or to an event being fired.
- </documentation></annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <group ref="tns:eventListenerGroup">
- <annotation><documentation>An inline list of event listeners
- on a timer is a short cut for defining the event separately.
- </documentation></annotation>
- </group>
- </choice>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="signal" type="string" use="required">
- <annotation><documentation>Refers to the signal that will be used.
- If inline event listeners are declared, the signal name can not be
- the same as an event that is declared in this scope.
- </documentation></annotation>
- </attribute>
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
- <simpleType name="priorityType">
+ <simpleType name="booleanValueType">
<restriction base="string">
- <enumeration value="highest"/>
- <enumeration value="high"/>
- <enumeration value="normal"/>
- <enumeration value="low"/>
- <enumeration value="lowest"/>
+ <enumeration value="true" />
+ <enumeration value="on" />
+ <enumeration value="enabled" />
+ <enumeration value="false" />
+ <enumeration value="off" />
+ <enumeration value="disabled" />
</restriction>
</simpleType>
- -->
-
</schema>
Modified: 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 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -24,8 +24,8 @@
var="hand"
g="96,16,127,52">
- <arg><resolve expr="#{joesmoe.handshakes.force}"/></arg>
- <arg><resolve expr="#{joesmoe.handshakes.duration}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.force}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.duration}"/></arg>
<transition to="wait" />
</java>
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-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -68,7 +68,7 @@
} else if (element.hasAttribute("expr")) {
String expression = element.getAttribute("expr");
javaActivity.setTargetExpression(expression);
- javaActivity.setTargetLanguage(XmlUtil.attribute(element, "language"));
+ javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
} else {
// parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
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 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -70,6 +70,7 @@
Parser wireParser = (Parser) parser;
String className = XmlUtil.attribute(element, "class");
+ String expr = XmlUtil.attribute(element, "expr");
String factoryObjectName = XmlUtil.attribute(element, "factory");
Element factoryElement = XmlUtil.element(element, "factory");
@@ -104,8 +105,13 @@
Descriptor factoryDescriptor = (Descriptor) parser.parseElement(factoryDescriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
descriptor.setFactoryDescriptor(factoryDescriptor);
+ } else if (expr!=null) {
+ descriptor.setExpr(expr);
+ String lang = XmlUtil.attribute(element, "lang");
+ descriptor.setLang(lang);
+
} else {
- parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element));
+ parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element));
}
// method
@@ -115,12 +121,16 @@
List<Element> argElements = XmlUtil.elements(element, "arg");
List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
descriptor.setArgDescriptors(argDescriptors);
- } else if (className == null) {
+ } else if ( (factoryObjectName!=null)
+ || (factoryElement!=null)
+ ) {
parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' must have a attribute 'method': "+XmlUtil.toString(element));
}
- if( (className == null) && (XmlUtil.element(element, "constructor") != null)){
- parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: "+XmlUtil.toString(element));
+ if( (className == null)
+ && (XmlUtil.element(element, "constructor") != null)
+ ) {
+ parse.addProblem("element 'object' with a 'constructor' element must have 'class' attribute: "+XmlUtil.toString(element));
}
// read the operations elements
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ResolveBinding.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ResolveDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ResolveBinding extends WireDescriptorBinding {
-
- public ResolveBinding() {
- super("resolve");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ResolveDescriptor resolveDescriptor = new ResolveDescriptor();
-
- String expr = XmlUtil.attribute(element, "expr");
- resolveDescriptor.setExpr(expr);
-
- String lang = XmlUtil.attribute(element, "lang");
- resolveDescriptor.setLang(lang);
-
- return resolveDescriptor;
- }
-}
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 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -11,6 +11,8 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.env.Environment;
import org.jbpm.internal.log.Log;
+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;
@@ -84,7 +86,7 @@
private static final long serialVersionUID = 1L;
private static Log log = Log.getLog(ObjectDescriptor.class.getName());
- String className = null;
+ protected String className = null;
/** specifies the object reference on which the method will be invoked.
* Either className, objectName or a descriptor has to be specified.
@@ -94,19 +96,23 @@
* */
String factoryObjectName = null;
+ protected String expr;
+
+ protected String lang;
+
/** specifies the object on which to invoke the method.
* Either className, objectName or a descriptor has to be specified. */
- Descriptor factoryDescriptor = null;
+ protected Descriptor factoryDescriptor = null;
- String methodName = null;
+ protected String methodName = null;
/** map to db as a component */
- List<ArgDescriptor> argDescriptors = null;
+ protected List<ArgDescriptor> argDescriptors = null;
/** list of operations to perform during initialization. */
- List<Operation> operations = null;
+ protected List<Operation> operations = null;
/** True if autowiring is enabled. */
- boolean isAutoWireEnabled = false;
+ protected boolean isAutoWireEnabled = false;
public ObjectDescriptor() {
}
@@ -169,6 +175,9 @@
if (object==null) {
throw new WireException("created factory object is null, can't invoke method '"+methodName+"' on it");
}
+ } else if (expr!=null) {
+ ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ object = scriptManager.evaluateExpression(expr, lang);
}
if (methodName!=null) {
@@ -387,127 +396,61 @@
addOperation(operation);
}
- /**
- * Gets the class name of the object to create.
- * This name is defined only when creating objects from a constructor or when invoking static methods.
- * @return the name of the class of the object to create.
- */
+
+ // getters and setters //////////////////////////////////////////////////////
+
public String getClassName() {
return className;
}
-
- /**
- * Sets class name of the object to create.
- * This name is defined only when creating objects from a constructor or when invoking static methods.
- * If this name is set, the factoryObjectName and factoryDescriptor should not be set.
- * @see #setFactoryDescriptor(Descriptor)
- * @see #setFactoryObjectName(String)
- * @param className name of the class to use.
- */
public void setClassName(String className) {
this.className = className;
}
-
- /**
- * Gets the list of descriptors to use to create method arguments.
- * @return list of descriptors to use to create method arguments.
- */
public List<ArgDescriptor> getArgDescriptors() {
return argDescriptors;
}
-
- /**
- * Sets the list of descriptors to use to create method arguments.
- * @param argDescriptors list of descriptors to use to create method arguments.
- */
public void setArgDescriptors(List<ArgDescriptor> argDescriptors) {
this.argDescriptors = argDescriptors;
}
-
- /**
- * Gets the list of operations to perform during initialization.
- * @return list of operations to perform during initialization.
- */
public List<Operation> getOperations() {
return operations;
}
-
- /**
- * Sets the list of operations to perform during initialization.
- * @param operations list of operations to perform during initialization.
- */
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
-
- /**
- * Gets the Descriptor from which the object should be created.
- * @return the Descriptor from which the object should be created.
- */
public Descriptor getFactoryDescriptor() {
return factoryDescriptor;
}
-
- /**
- * Sets the Descriptor from which the object should be created.
- * If this Descriptor is set, the className and factoryObjectName should not be set.
- * @see #setClassName(String)
- * @see #setFactoryObjectName(String)
- * @param factoryDescriptor the Descriptor from which the object should be created.
- */
public void setFactoryDescriptor(Descriptor factoryDescriptor) {
this.factoryDescriptor = factoryDescriptor;
}
-
-
- /**
- * Gets the name of the object to get from the WireContext.
- * @return name of the object to get from the WireContext.
- */
public String getFactoryObjectName() {
return factoryObjectName;
}
-
- /**
- * Sets name of the object to get from the WireContext.
- * If this name is set, the className and factoryDescriptor should not be set.
- * @see #setClassName(String)
- * @see #setFactoryDescriptor(Descriptor)
- * @param factoryObjectName name of the object to get from the WireContext.
- */
public void setFactoryObjectName(String factoryObjectName) {
this.factoryObjectName = factoryObjectName;
}
-
- /**
- * Gets the name of the method to invoke.
- * @return name of the method to invoke.
- */
public String getMethodName() {
return methodName;
}
-
- /**
- * Sets the name of the method to invoke.
- * @param methodName name of the method to invoke.
- */
public void setMethodName(String methodName) {
this.methodName = methodName;
}
-
- /**
- * Checks if auto-wiring is enabled
- * @return <code>true</code> if auto-wiring is enabled.
- */
public boolean isAutoWireEnabled() {
return isAutoWireEnabled;
}
-
- /**
- * Enables/Disables auto wiring mode.
- * @param isAutoWireEnabled <code>true</code> to enable auto-wiring.
- */
public void setAutoWireEnabled(boolean isAutoWireEnabled) {
this.isAutoWireEnabled = isAutoWireEnabled;
}
+ public String getExpr() {
+ return expr;
+ }
+ public void setExpr(String expr) {
+ this.expr = expr;
+ }
+ public String getLang() {
+ return lang;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ResolveDescriptor.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1,56 +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.pvm.internal.env.EnvironmentDefaults;
-import org.jbpm.pvm.internal.script.ScriptManager;
-import org.jbpm.pvm.internal.wire.WireContext;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ResolveDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- protected String expr;
- protected String lang;
-
- public Object construct(WireContext wireContext) {
- ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
- return scriptManager.evaluateExpression(expr, lang);
- }
-
- public String getExpr() {
- return expr;
- }
- public void setExpr(String expr) {
- this.expr = expr;
- }
- public String getLang() {
- return lang;
- }
- public void setLang(String lang) {
- this.lang = lang;
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -32,7 +32,6 @@
<binding class="org.jbpm.pvm.internal.wire.binding.ContextRefBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.TransactionRefBinding" />
<!-- various specials -->
- <binding class="org.jbpm.pvm.internal.wire.binding.ResolveBinding"/>
<binding class="org.jbpm.pvm.internal.wire.binding.TransactionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobExecutorBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobTestHelperBinding" />
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2009-06-02 17:37:31 UTC (rev 4977)
@@ -92,7 +92,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
+ assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
}
public void testInvalidObjectType() {
@@ -178,7 +178,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
+ assertTextPresent("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}", problems.get(0).getMsg());
}
public static class StaticFactoryMethodWithoutParametersClass {
@@ -1021,7 +1021,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: ", problems.get(0).getMsg());
+ assertTextPresent("element 'object' with a 'constructor' element must have 'class' attribute", problems.get(0).getMsg());
}
public void testConstructorAndFactoryElement(){
@@ -1036,7 +1036,7 @@
"</objects>"
);
assertNotNull(problems);
- assertTextPresent("element 'object' with a element 'factory' or a attribute 'factory' can't have a 'constructor' element: ", problems.get(0).getMsg());
+ assertTextPresent("element 'object' with a 'constructor' element must have 'class' attribute", problems.get(0).getMsg());
}
public void testFactoryAttributeUnknownObject(){
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-06-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -49,4 +49,29 @@
</para>
</section>
+ <section>
+ <title>Migration from jBPM 3</title>
+ <para>Migration from jBPM 3 to jBPM 4 is not supported.
+ </para>
+ <para>jBPM 3 and jBPM 4 can be deployed on the same JVM and
+ on the same database. Packages are stricktly separated and database
+ table prefix is changed from <literal>JBPM_</literal> to <literal>JBPM4_</literal>
+ </para>
+ <itemizedlist>
+ <listitem><emphasis role="bold">jPDL process files</emphasis>: A process file
+ conversion tool is in the works. It will be shipped with the distribution
+ in one of the following releases.
+ </listitem>
+ <listitem><emphasis role="bold">API</emphasis>: The jBPM API has completely
+ changed. Where jBPM 3 exposed the internal object model and didn't have
+ a session facade API, the supported API of jBPM 4 are the services, which are
+ in fact session facades that can be used in any environment that we support.
+ </listitem>
+ <listitem><emphasis role="bold">Database</emphasis>: The jBPM database also
+ has drastically changed between version 3 and 4. There is no migration tool
+ to convert jBPM 3 runtime database contents to jBPM 4.
+ </listitem>
+ </itemizedlist>
+ </section>
+
</chapter>
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-02 11:41:04 UTC (rev 4976)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-06-02 17:37:31 UTC (rev 4977)
@@ -1764,8 +1764,8 @@
var="hand"
>
- <arg><resolve expr="#{joesmoe.handshakes.force}"/></arg>
- <arg><resolve expr="#{joesmoe.handshakes.duration}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.force}"/></arg>
+ <arg><object expr="#{joesmoe.handshakes.duration}"/></arg>
<transition to="wait" />
</java>
More information about the jbpm-commits
mailing list