[jbpm-commits] JBoss JBPM SVN: r3295 - in jbpm4/trunk: modules/jpdl/src/main/java/org/jbpm/jpdl/xml and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Dec 9 11:07:45 EST 2008


Author: tom.baeyens at jboss.com
Date: 2008-12-09 11:07:44 -0500 (Tue, 09 Dec 2008)
New Revision: 3295

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/WriteBinding.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Scripting.xml
Modified:
   jbpm4/trunk/build.xml
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ExclusiveBinding.java
   jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
   jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
   jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
Log:
exclusive

Modified: jbpm4/trunk/build.xml
===================================================================
--- jbpm4/trunk/build.xml	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/build.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -17,6 +17,7 @@
 	<property name="windows.browser" value="C:/Program Files/Mozilla Firefox/firefox.exe" />
 	<property name="macos.browser" value="/usr/bin/open" />
 	<property name="linux.browser" value="mozilla" />
+	<property name="distro.installation.dir" value="c:/software" />
 
   <target name="clean">
     <exec executable="cmd">
@@ -57,6 +58,11 @@
     </antcall>
   </target>
 
+  <target name="distro.install">
+  	<delete dir="${distro.installation.dir}/jbpm-4.0.0*" />
+  	<unzip dest="${distro.installation.dir}" src="modules/distro/package/jbpm-4.0.0*.zip"/>
+  </target>
+
   <target name="schemadocs">
     <exec executable="cmd" dir="modules/api">
       <arg line="/C mvn -Pschemadocs package" />

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ExclusiveBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ExclusiveBinding.java	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ExclusiveBinding.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -45,7 +45,7 @@
   static ObjectBinding objectBinding = new ObjectBinding();
 
   public ExclusiveBinding() {
-    super("decision");
+    super("exclusive");
   }
 
   public Object parse(Element element, Parse parse, Parser parser) {
@@ -73,7 +73,7 @@
     }
     
     boolean hasConditions = false;
-    List<Element> transitionElements = XmlUtil.elements(element, "transition");
+    List<Element> transitionElements = XmlUtil.elements(element, "flow");
     NodeImpl node = parse.findObject(NodeImpl.class);
     List<TransitionImpl> transitions = (List) node.getOutgoingTransitions();
     

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-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -18,7 +18,10 @@
     <discriminator column="CLASS_" />
     <subclass name="org.jbpm.jpdl.activity.StartActivity" discriminator-value="start" />
     <subclass name="org.jbpm.jpdl.activity.ExclusiveConditionActivity" discriminator-value="excl-cond" />
-    <subclass name="org.jbpm.jpdl.activity.ExclusiveExpressionActivity" discriminator-value="excl-expr" />
+    <subclass name="org.jbpm.jpdl.activity.ExclusiveExpressionActivity" discriminator-value="excl-expr">
+      <property name="expr" column="EXPR_" />
+      <property name="lang" column="LANG_" />
+    </subclass>
     <subclass name="org.jbpm.jpdl.activity.ExclusiveHandlerActivity" discriminator-value="excl-handler" />
     <subclass name="org.jbpm.jpdl.activity.StateActivity" discriminator-value="state" />
     <subclass name="org.jbpm.jpdl.activity.EndActivity" discriminator-value="end" />

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -205,7 +205,7 @@
       for (String key: variables.keySet()) {
         Object value = variables.get(key);
         setVariable(key, value);
-      }
+       }
     }
   }
   

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/EnvironmentBindings.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -22,13 +22,11 @@
 package org.jbpm.pvm.internal.script;
 
 import java.util.Collection;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.script.Bindings;
 
-import org.jbpm.Execution;
 import org.jbpm.env.Context;
 import org.jbpm.env.Environment;
 
@@ -40,6 +38,7 @@
   
   protected String[] readContextNames;
   protected String writeContextName;
+  protected Map<String, WriteBinding> writeBindings;
   protected Environment environment;
 
   public EnvironmentBindings(String[] readContextNames, String writeContextName) {

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/WriteBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/WriteBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/WriteBinding.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -0,0 +1,35 @@
+/*
+ * 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.script;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class WriteBinding {
+
+  protected String scriptVariable;
+  protected String contextName;
+  protected String contextVariableName;
+  
+  
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/WriteBinding.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -21,7 +21,6 @@
  */
 package org.jbpm.pvm.internal.wire.binding;
 
-import java.util.Arrays;
 import java.util.List;
 
 import javax.script.ScriptEngineFactory;

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java	2008-12-09 16:07:44 UTC (rev 3295)
@@ -0,0 +1,60 @@
+/*
+ * 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.test.activities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTest extends DbTestCase {
+
+  public void testWaitStatesSequence() {
+    deployJpdlXmlString(
+      "<process name='Poolcar'>" +
+      "  <start>" +
+      "    <flow to='How far?' />" +
+      "  </start>" +
+      "  <exclusive name='How far?' expr='#{distance}'>" +
+      "    <flow name='far'    to='Big car' />" +
+      "    <flow name='nearby' to='Small car' />" +
+      "  </exclusive>" +
+      "  <state name='Big car' />" +
+      "  <state name='Small car' />" +
+      "</process>"
+    );
+
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("distance", "far");
+    Execution execution = executionService.startExecutionByKey("Poolcar", variables);
+    assertEquals("Big car", execution.getNodeName());
+
+    variables.put("distance", "nearby");
+    execution = executionService.startExecutionByKey("Poolcar", variables);
+    assertEquals("Small car", execution.getNodeName());
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -39,6 +39,13 @@
     
     <hibernate-session-factory />
     
+    <script-manager default-expression-language="juel"
+                    default-script-language="juel"
+                    read-contexts="execution, environment, process-engine"
+                    write-context="">
+        <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+    </script-manager>
+    
     <job-executor auto-start="false" />
     <job-test-helper />
 

Modified: jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
===================================================================
--- jbpm4/trunk/modules/userguide/.settings/attachedFile.properties	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/userguide/.settings/attachedFile.properties	2008-12-09 16:07:44 UTC (rev 3295)
@@ -1,2 +1,2 @@
 ## index of importer -> set(imports)
-#Mon Dec 08 10:14:36 CET 2008
+#Tue Dec 09 13:47:09 CET 2008

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -6,6 +6,7 @@
   <!ENTITY ch03-Services           SYSTEM "modules/ch03-Services.xml">
   <!ENTITY ch04-Jpdl               SYSTEM "modules/ch04-Jpdl.xml">
   <!ENTITY ch05-Gpd                SYSTEM "modules/ch05-Gpd.xml">
+  <!ENTITY ch06-Scripting          SYSTEM "modules/ch06-Scripting.xml">
 ]>
 
 <book lang="en">
@@ -21,5 +22,6 @@
   &ch03-Services;
   &ch04-Jpdl;
   &ch05-Gpd;
+  &ch06-Scripting;
 
 </book>
\ No newline at end of file

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	2008-12-09 15:42:37 UTC (rev 3294)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -138,7 +138,7 @@
               <entry>any text</entry>
               <entry></entry>
               <entry>optional</entry>
-              <entry>name of the start activity.  Since a start activity 
+              <entry>name of the activity.  Since a start activity 
               cannot have incoming flows, the name is optional. 
               </entry>
             </row>
@@ -170,6 +170,7 @@
       <para>A wait state.  Process execution will wait until an external trigger is 
       provided through the API.
       </para>
+      <para>Example: TODO</para>
     </section>
 
     <section id="exclusive">
@@ -178,6 +179,66 @@
       activity has multiple outgoing flows and when an execution arrives in an exclusive 
       activity, an automatic evaluation will decide which outgoing flow is taken.
       </para>
+      <para>An exclusive activity should be configured in one of the three following ways:  
+      </para>
+      <section id="exclusiveexpression">
+        <title>Exclusive expression</title>
+        <para>An exclusive expression evaluates to a String representing the name of 
+        an outgoing flow.
+        </para>
+        <table><title><literal>exclusive</literal> attributes:</title>
+          <tgroup cols="5" rowsep="1" colsep="1">
+            <thead>
+              <row>
+                <entry>Attribute</entry>
+                <entry>Type</entry>
+                <entry>Default</entry>
+                <entry>Required?</entry>
+                <entry>Description</entry>
+              </row>
+            </thead>
+            <tbody>
+              <row>
+                <entry><literal>expr</literal></entry>
+                <entry>script</entry>
+                <entry></entry>
+                <entry><emphasis role="bold">required</emphasis></entry>
+                <entry>script that will be evaluated in the specified 
+                expression language.
+                </entry>
+              </row>
+              <row>
+                <entry><literal>lang</literal></entry>
+                <entry>expression language</entry>
+                <entry>the <literal>default-expression-language</literal> taken from the <link linkend="scripting"><literal>script-manager</literal> configuration</link></entry>
+                <entry>optional</entry>
+                <entry>the language in which <literal>expr</literal> is 
+                to be evaluated.
+                </entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+        <para>Example:
+        </para>
+        <programlisting>&lt;process name=&quot;Poolcar&quot;&gt;
+  &lt;start&gt;
+    &lt;flow to=&quot;How far?&quot; /&gt;
+  &lt;/start&gt;
+  &lt;exclusive name=&quot;How far?&quot; <emphasis role="bold">expr=&quot;#{distance}&quot;</emphasis>&gt;
+    &lt;flow name=&quot;far&quot;    to=&quot;Big car&quot; /&gt;
+    &lt;flow name=&quot;nearby&quot; to=&quot;Small car&quot; /&gt;
+  &lt;/exclusive&gt;
+  &lt;state name=&quot;Big car&quot; /&gt;
+  &lt;state name=&quot;Small car&quot; /&gt;
+&lt;/process&gt;</programlisting>
+      </section>
+      <para>When you start an new process instance like this
+      </para>
+      <programlisting>Map&lt;String, Object&gt; variables = new HashMap&lt;String, Object&gt;();
+variables.put("distance", "far");
+Execution execution = executionService.startExecutionByKey(&quot;Poolcar&quot;, variables);</programlisting>
+      <para>then the new execution will go to node <literal>Big car</literal>.</para>
     </section>
 
     <section id="end">
@@ -185,6 +246,53 @@
       <para>Ends the execution.
       </para>
     </section>
+
+    <section id="commonactivitycontents">
+      <title>Common activity contents</title>
+      <para>Unless specified otherwise above, all activities also include this 
+      content model:
+      </para>
+      <table><title>Common activity attributes:</title>
+        <tgroup cols="5" rowsep="1" colsep="1">
+          <thead>
+            <row>
+              <entry>Attribute</entry>
+              <entry>Type</entry>
+              <entry>Default</entry>
+              <entry>Required?</entry>
+              <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry><literal>name</literal></entry>
+              <entry>any text</entry>
+              <entry></entry>
+              <entry><emphasis role="bold">required</emphasis></entry>
+              <entry>name of the activity</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <table><title>Common activity elements:</title>
+        <tgroup cols="3" rowsep="1" colsep="1">
+          <thead>
+            <row>
+              <entry>Element</entry>
+              <entry>Multiplicity</entry>
+              <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry><literal>flow</literal></entry>
+              <entry>0..*</entry>
+              <entry>the outgoing flows</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+    </section>
   </section>
 
 </chapter>

Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Scripting.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Scripting.xml	                        (rev 0)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Scripting.xml	2008-12-09 16:07:44 UTC (rev 3295)
@@ -0,0 +1,18 @@
+<chapter id="scripting">
+  <title>Scripting</title>
+  
+  <para>Scripting in jBPM is based on JSR 223: Scripting for the JavaTM Platform.
+  Scripting engines can be configured like this:
+  </para>
+  <programlisting>&lt;script-manager default-expression-language=&quot;juel&quot;
+                    default-script-language=&quot;juel&quot;
+                    read-contexts=&quot;execution, environment, process-engine&quot;
+                    write-context=&quot;&quot;&gt;
+  &lt;script-language name=&quot;juel&quot; factory=&quot;com.sun.script.juel.JuelScriptEngineFactory&quot; /&gt;
+&lt;/script-manager&gt;</programlisting>
+  <para>A jPDL process definition can contain scripts and expressions.  All 
+  of the configured scripting engines can be used in each situation.  But 
+  scripts and expressions each have their own default.  
+  </para>
+
+</chapter>


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Scripting.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list