[jbpm-commits] JBoss JBPM SVN: r3274 - in jbpm4/trunk/modules: api/src/main/resources and 12 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 8 11:53:26 EST 2008
Author: tom.baeyens at jboss.com
Date: 2008-12-08 11:53:26 -0500 (Mon, 08 Dec 2008)
New Revision: 3274
Added:
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
jbpm4/trunk/modules/jpdl/src/test/resources/org/
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/extended.jpdl.xml
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/invalid.jpdl.xml
jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/valid.jpdl.xml
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
Log:
starting jpdl schema docs and validation
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2008-12-08 16:53:26 UTC (rev 3274)
@@ -32,8 +32,7 @@
*/
public interface TaskService {
- /** Creates a task with the given identifier.
- * The returned task will be transient.
+ /** Creates a not-yet-persisted task with the given identifier.
* Use {@link #saveTask(Task)} to persist the task. */
Task newTask(String taskId);
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-08 16:53:26 UTC (rev 3274)
@@ -4,8 +4,9 @@
targetNamespace="http://jbpm.org/4/jpdl"
xmlns:tns="http://jbpm.org/4/jpdl"
elementFormDefault="qualified"
- attributeFormDefault="qualified">
+ attributeFormDefault="unqualified">
+
<annotation>
<documentation>Schema for jPDL 4 process descriptions;
element process is the top level element.
@@ -40,36 +41,42 @@
is the top level element in a jPDL process file.</documentation></annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
- <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded"/>
+ <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
<!--
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- -->
+ </element>
+ <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+ -->
</sequence>
<attribute name="name" use="required" type="string">
- <annotation><documentation>The process name. Multiple processes can
- be deployed with the same name, as long as they have a different
- version.</documentation></annotation>
+ <annotation>
+ <documentation>
+ The process name. Multiple processes can be deployed with the same name, as long as they have a different
+ version.
+ </documentation>
+ </annotation>
</attribute>
<attribute name="key" type="string">
- <annotation><documentation>The key can be used to provide a short
- acronym that will replace the name as the basis for the generated
- process definition id
- </documentation></annotation>
+ <annotation>
+ <documentation>
+ The key can be used to provide a short acronym that will replace the name as the basis for the generated
+ process definition id
+ </documentation>
+ </annotation>
</attribute>
<attribute name="version" type="int">
- <annotation><documentation>Indicates the sequence number of this
- version for all processes with the same name. By specifying a version
- automatic deployment can figure out if this process is already deployed
- or not.
- </documentation></annotation>
+ <annotation>
+ <documentation>
+ Indicates the sequence number of this version for all processes with the same name. By specifying a version
+ automatic deployment can figure out if this process is already deployed or not.
+ </documentation>
+ </annotation>
</attribute>
- <attribute name="g" type="string">
- <annotation><documentation>Graphical information used by designer tool.
+ <anyAttribute processContents="skip">
+ <annotation><documentation>for extensibility
</documentation></annotation>
- </attribute>
+ </anyAttribute>
</complexType>
</element>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-12-08 16:53:26 UTC (rev 3274)
@@ -21,7 +21,6 @@
*/
package org.jbpm.jpdl.xml;
-import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
Added: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2008-12-08 16:53:26 UTC (rev 3274)
@@ -0,0 +1,54 @@
+/*
+ * 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.xml;
+
+import java.util.List;
+
+import org.jbpm.Problem;
+import org.jbpm.jpdl.xml.JpdlParser;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlXmlTest extends JbpmTestCase {
+
+ public void testValidXml() {
+ List<Problem> problems = new JpdlParser()
+ .createParse()
+ .setResource("org/jbpm/test/xml/valid.jpdl.xml")
+ .execute()
+ .getProblems();
+
+ assertEquals(problems.toString(), 0, problems.size());
+ }
+
+ public void testInvalidXml() {
+ List<Problem> problems = new JpdlParser()
+ .createParse()
+ .setResource("org/jbpm/test/xml/invalid.jpdl.xml")
+ .execute()
+ .getProblems();
+
+ assertEquals(problems.toString(), 1, problems.size());
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/extended.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/extended.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/extended.jpdl.xml 2008-12-08 16:53:26 UTC (rev 3274)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Purchase order" xmlns="http://jbpm.org/4/jpdl"
+ xmlns:ext="http://jbpm.org/customextensions">
+
+ <start>
+ <flow to="a"/>
+ </start>
+
+ <customactivity name="a" customattrib="xxx">
+ <customconfigelement a="yyy" />
+ <flow to="end"/>
+ </customactivity>
+
+ <end name="end" />
+
+</process>
Property changes on: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/extended.jpdl.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/invalid.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/invalid.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/invalid.jpdl.xml 2008-12-08 16:53:26 UTC (rev 3274)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Purchase order" xmlns="http://jbpm.org/4/jpdl">
+
+ <start />
+
+ <buzzz>
+
+ </buzzz>
+
+</process>
Property changes on: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/invalid.jpdl.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/valid.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/valid.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/valid.jpdl.xml 2008-12-08 16:53:26 UTC (rev 3274)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Purchase order" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="a" />
+ </start>
+
+ <state name="a">
+ <flow name="Supplier ok" to="b" />
+ </state>
+
+ <state name="b">
+ <flow name="nok" to="Error" />
+ <flow name="ok" to="Completed" />
+ </state >
+
+ <end name="Completed" />
+
+ <end name="Error" />
+
+</process>
Property changes on: jbpm4/trunk/modules/jpdl/src/test/resources/org/jbpm/test/xml/valid.jpdl.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2008-12-08 16:53:26 UTC (rev 3274)
@@ -21,13 +21,17 @@
*/
package org.jbpm.pvm.internal.xml;
+import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
-import org.jbpm.JbpmException;
import org.jbpm.log.Log;
import org.jbpm.pvm.internal.stream.StreamSource;
import org.jbpm.pvm.internal.util.UrlEntity;
@@ -243,6 +247,15 @@
private static Log log = Log.getLog(Parser.class.getName());
protected DocumentBuilderFactory documentBuilderFactory = null;
+
+ /* TODO add schema's
+Source schemaSource = new StreamSource(inputStream);
+SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+Schema schema = schemaFactory.newSchema(schemaSource);
+// Instead of explicitly validating, assign the Schema to the factory
+factory.setSchema(schema);
+ */
+
protected Map<String, Entity> entities = null;
protected Bindings bindings = null;
protected ClassLoader classLoader = null;
@@ -286,7 +299,8 @@
* of the documentBuilderFactory. Can be overridden by subclasses to change
* the DocumentBuilderFactory implementation or to apply specific configurations. */
protected DocumentBuilderFactory newDocumentBuilderFactory() {
- return DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ return factory;
}
// entities /////////////////////////////////////////////////////////////////
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2008-12-08 16:53:26 UTC (rev 3274)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.jbpm.Problem;
@@ -47,6 +48,9 @@
/** all problems encountered */
public List<Problem> getProblems() {
+ if (problems==null) {
+ return Collections.EMPTY_LIST;
+ }
return (List) problems;
}
Modified: jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
===================================================================
--- jbpm4/trunk/modules/userguide/.settings/attachedFile.properties 2008-12-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/userguide/.settings/attachedFile.properties 2008-12-08 16:53:26 UTC (rev 3274)
@@ -1,2 +1,2 @@
## index of importer -> set(imports)
-#Thu Dec 04 15:25:44 CET 2008
+#Mon Dec 08 10:14:36 CET 2008
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-08 16:04:25 UTC (rev 3273)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml 2008-12-08 16:53:26 UTC (rev 3274)
@@ -2,36 +2,188 @@
<title>jPDL</title>
<para>This chapter will explain the jPDL file format for describing
- process definitions.
+ process definitions. The schemadocs can also serve as a quick reference for this
+ information.
</para>
+ <para>An example jPDL process file looks like this:
+ </para>
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Purchase order" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="Verify supplier" />
+ </start>
+
+ <state name="Verify supplier">
+ <flow name="Supplier ok" to="Check supplier data" />
+ <flow name="Supplier not ok" to="Error" />
+ </state>
+
+ <exclusive name="Check supplier data">
+ <flow name="nok" to="Error" />
+ <flow name="ok" to="Completed" />
+ </exclusive>
+
+ <end name="Completed" />
+
+ <end name="Error" />
+
+</process></programlisting>
<section id="process">
<title><literal>process</literal></title>
- <para></para>
+ <para>The top level element representing one process definition.
+ </para>
+ <table><title><literal>process</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>name</literal></entry>
+ <entry>any text</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>name or label of the process used to display to the process
+ name in user interactions.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>key</literal></entry>
+ <entry>alpha numeric characters and underscores</entry>
+ <entry>if omitted, the key will be generated based on the name by replacing
+ all non-alpha-numeric characters with underscores</entry>
+ <entry>optional</entry>
+ <entry>identification to distinct different process definitions.
+ Multiple versions of a process with the same key can be deployed.
+ The key:name combination must remain exactly the same for all
+ deployed versions.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>version</literal></entry>
+ <entry>integer</entry>
+ <entry>one higher then highest version number starting with 1 if no other process
+ is deployed with the same name/key.
+ </entry>
+ <entry>optional</entry>
+ <entry>version number of this process</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title><literal>process</literal> 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>description</literal></entry>
+ <entry>0..1</entry>
+ <entry>description text</entry>
+ </row>
+ <row>
+ <entry><link linkend="activities">activities</link></entry>
+ <entry>1..*</entry>
+ <entry>a list of any activity type can be placed here. At least
+ one <literal>start</literal> activity must be present.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</section>
<section id="activities">
<title>Activities</title>
- <para>Diff between node and activity?</para>
-
+ <para>(BPMN note: when we mention activities here, we are not only refering to BPMN
+ activities, but also to BPMN events and BPMN gateways.)
+ </para>
+
<section id="start">
<title><literal>start</literal></title>
- <para>TODO</para>
+ <para>Indicates where an execution for this process starts. Typically there is
+ exactly one start activity in a process. A process has to have at least one start
+ activity. A start activity must have exactly one outgoing flow and that flow
+ is taken when a process execution starts.
+ </para>
+ <table><title><literal>start</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>name</literal></entry>
+ <entry>any text</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>name of the start activity. Since a start activity
+ cannot have incoming flows, the name is optional.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>start</literal> 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>1</entry>
+ <entry>the outgoing flow</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</section>
<section id="state">
<title><literal>state</literal></title>
- <para>TODO</para>
+ <para>A wait state. Process execution will wait until an external trigger is
+ provided through the API.
+ </para>
</section>
<section id="exclusive">
<title><literal>exclusive</literal></title>
- <para>TODO</para>
+ <para>Takes one path of many alternatives. Also known as a decision. An exclusive
+ 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>
</section>
<section id="end">
<title><literal>end</literal></title>
- <para>TODO</para>
+ <para>Ends the execution.
+ </para>
</section>
</section>
More information about the jbpm-commits
mailing list