[jbpm-commits] JBoss JBPM SVN: r2045 - in jbpm3/trunk/modules/jpdl/core/src: main/java/org/jbpm/jpdl/xml and 11 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Aug 29 03:54:21 EDT 2008
Author: alex.guizar at jboss.com
Date: 2008-08-29 03:54:19 -0400 (Fri, 29 Aug 2008)
New Revision: 2045
Added:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/pageflow/
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/pageflow/Page.java
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/seam/
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/seam/pageflow-2.0.xsd
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/sitemap.xsd
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithNamespace.xml
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithSchemaLocation.xml
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithoutNamespace.xml
Removed:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/files/
Modified:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/Problem.java
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/ProcessDefinitionXmlTest.java
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/XmlSchemaTest.java
jbpm3/trunk/modules/jpdl/core/src/test/resources/log4j.xml
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/encodedprocess.xml
Log:
[JBPM-1707] jpdl parser reads pageflow schema from local resource instead of remote url
added pageflow parsing tests to XmlSchemaTest
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -41,6 +42,7 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.node.ProcessFactory;
import org.jbpm.graph.node.StartState;
+import org.jbpm.jpdl.JpdlException;
import org.jbpm.jpdl.par.ProcessArchive;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.module.def.ModuleDefinition;
@@ -155,19 +157,12 @@
* @throws org.jbpm.jpdl.JpdlException if parsing reported an error.
*/
public static ProcessDefinition parseXmlResource(String xmlResource) {
- InputStream resourceStream = ClassLoaderUtil.getStream(xmlResource);
- try {
- return parseXmlInputStream(resourceStream);
+ URL resourceURL = ClassLoaderUtil.getClassLoader().getResource(xmlResource);
+ if (resourceURL != null) {
+ throw new JpdlException("resource not found: " + xmlResource);
}
- finally {
- if (resourceStream != null) {
- try {
- resourceStream.close();
- }
- catch (IOException e) {
- }
- }
- }
+ JpdlXmlReader jpdlReader = new JpdlXmlReader(new InputSource(resourceURL.toString()));
+ return jpdlReader.readProcessDefinition();
}
/**
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -21,9 +21,13 @@
*/
package org.jbpm.jpdl.xml;
-import java.io.IOException;
-import java.io.InputStream;
import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -32,13 +36,14 @@
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
-import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
+import org.jbpm.util.ClassLoaderUtil;
+
/**
* Validate an XML document using JAXP techniques and an XML Schema. This helper
* class wraps the processing of a schema to aid in schema validation throughout
@@ -50,8 +55,10 @@
public class JpdlParser implements Serializable {
private static final long serialVersionUID = 1L;
- static final EntityResolver JPDL_ENTITY_RESOLVER = new JpdlEntityResolver();
+
static SAXParserFactory saxParserFactory = createSaxParserFactory();
+ private static Set schemaResources = getDefaultSchemaResources();
+ private static Object schemaSource;
public static Document parse(InputSource inputSource, ProblemListener problemListener) throws Exception {
Document document = null;
@@ -64,7 +71,6 @@
XMLReader xmlReader = createXmlReader();
SAXReader saxReader = new SAXReader(xmlReader);
saxReader.setErrorHandler(new JpdlErrorHandler(problemListener));
- saxReader.setEntityResolver(JPDL_ENTITY_RESOLVER);
return saxReader;
}
@@ -75,83 +81,84 @@
try {
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
} catch (SAXException e){
- log.warn("couldn't set xml parser property 'http://java.sun.com/xml/jaxp/properties/schemaLanguage' to 'http://www.w3.org/2001/XMLSchema'", e);
+ log.warn("couldn't set schema language property", e);
}
-
+
try {
- saxParser.setProperty(
- "http://apache.org/xml/properties/schema/external-schemaLocation",
- "http://jbpm.org/3/jpdl http://jbpm.org/jpdl-3.0.xsd " +
- "urn:jbpm.org:jpdl-3.0 http://jbpm.org/jpdl-3.0.xsd " +
- "urn:jbpm.org:jpdl-3.1 http://jbpm.org/jpdl-3.1.xsd " +
- "urn:jbpm.org:jpdl-3.2 http://jbpm.org/jpdl-3.2.xsd");
+ saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", getSchemaSource());
} catch (SAXException e){
- log.warn("couldn't set xml parser property 'http://apache.org/xml/properties/schema/external-schemaLocation'", e);
+ log.warn("couldn't set schema source property", e);
}
try {
xmlReader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
} catch (SAXException e){
- log.warn("couldn't set xml parser feature 'http://apache.org/xml/features/validation/dynamic'", e);
+ log.warn("couldn't set dynamic validation feature", e);
}
return xmlReader;
}
+ private static Object getSchemaSource() {
+ if (schemaSource == null) {
+ ClassLoader classLoader = ClassLoaderUtil.getClassLoader();
+ List schemaLocations = new ArrayList(schemaResources.size());
+ for (Iterator i = schemaResources.iterator(); i.hasNext();) {
+ String schemaResource = (String) i.next();
+ URL schemaURL = classLoader.getResource(schemaResource);
+ if (schemaURL != null) {
+ String schemaLocation = schemaURL.toString();
+ log.debug("schema resource found: " + schemaResource);
+ schemaLocations.add(schemaLocation);
+ }
+ }
+ schemaSource = schemaLocations.toArray(new String[schemaLocations.size()]);
+ }
+ return schemaSource;
+ }
+
static class JpdlErrorHandler implements ErrorHandler, Serializable {
+
+ private ProblemListener problemListener = null;
+
private static final long serialVersionUID = 1L;
- ProblemListener problemListener = null;
+
JpdlErrorHandler(ProblemListener problemListener) {
this.problemListener = problemListener;
}
+
public void warning(SAXParseException pe) {
- addProblem(Problem.LEVEL_WARNING, "line " + pe.getLineNumber() + ": " + pe.getMessage(), pe);
+ addProblem(Problem.LEVEL_WARNING, pe);
}
+
public void error(SAXParseException pe) {
- addProblem(Problem.LEVEL_ERROR, "line " + pe.getLineNumber() + ": " + pe.getMessage(), pe);
+ addProblem(Problem.LEVEL_ERROR, pe);
}
+
public void fatalError(SAXParseException pe) {
- addProblem(Problem.LEVEL_FATAL, "line " + pe.getLineNumber() + ": " + pe.getMessage(), pe);
+ addProblem(Problem.LEVEL_FATAL, pe);
}
- void addProblem(int level, String description, Throwable exception) {
- problemListener.addProblem(new Problem(level, description, exception));
+
+ private void addProblem(int level, SAXParseException pe) {
+ Problem problem = new Problem(level, pe.getMessage(), pe);
+ problem.setResource(pe.getSystemId());
+ int line = pe.getLineNumber();
+ if (line != -1) problem.setLine(new Integer(line));
+ problemListener.addProblem(problem);
}
}
- static class JpdlEntityResolver implements EntityResolver, Serializable {
- private static final long serialVersionUID = 1L;
+ public static void addSchemaResource(String resource) {
+ schemaResources.add(resource);
+ schemaSource = null;
+ }
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
- InputSource inputSource = null;
- log.debug("resolving schema reference publicId(" + publicId + ") systemId(" + systemId + ")");
-
- InputStream stream = null;
- if ("http://jbpm.org/jpdl-3.2.xsd".equals(systemId)) {
- log.debug("providing input source to local 'jpdl-3.2.xsd' resource");
- stream = getClass().getResourceAsStream("jpdl-3.2.xsd");
-
- } else if ("http://jbpm.org/jpdl-3.1.xsd".equals(systemId)) {
- log.debug("providing input source to local 'jpdl-3.1.xsd' resource");
- stream = getClass().getResourceAsStream("jpdl-3.1.xsd");
-
- } else if ("http://jbpm.org/jpdl-3.0.xsd".equals(systemId)) {
- log.debug("providing input source to local 'jpdl-3.0.xsd' resource");
- stream = getClass().getResourceAsStream("jpdl-3.0.xsd");
-
- } else {
- log.debug("original systemId as input source");
- inputSource = new InputSource(systemId);
- }
-
- if (inputSource == null)
- {
- if (stream == null)
- throw new IllegalStateException("Cannot find schema resource for publicId(" + publicId + ") systemId(" + systemId + ")");
-
- inputSource = new InputSource(stream);
- }
-
- return inputSource;
- }
+ private static Set getDefaultSchemaResources() {
+ Set schemaResources = new HashSet();
+ schemaResources.add("org/jbpm/jpdl/xml/jpdl-3.0.xsd");
+ schemaResources.add("org/jbpm/jpdl/xml/jpdl-3.1.xsd");
+ schemaResources.add("org/jbpm/jpdl/xml/jpdl-3.2.xsd");
+ schemaResources.add("org/jboss/seam/pageflow-2.0.xsd");
+ return schemaResources;
}
private static SAXParserFactory createSaxParserFactory() {
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -101,14 +101,6 @@
document = null;
}
- /**
- * @deprecated Originally, this class extended java.io.Reader. This method
- * is reminiscent of those days.
- */
- public int read(char[] cbuf, int off, int len) throws IOException {
- return 0;
- }
-
public ProcessDefinition getProcessDefinition() {
return processDefinition;
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/Problem.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/Problem.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/jpdl/xml/Problem.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -63,10 +63,10 @@
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("["+getTypeDescription(level)+"]");
- if (resource!=null) buffer.append(" "+resource);
- if (line!=null) buffer.append("("+line+")");
- if (folder!=null) buffer.append(" "+folder);
- if (description!=null) buffer.append(" "+description);
+ if (description!=null) buffer.append(" "+description);
+ if (resource!=null) buffer.append(" at "+resource);
+ if (line!=null) buffer.append(" line "+line);
+ if (folder!=null) buffer.append(" in "+folder);
return buffer.toString();
}
Added: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/pageflow/Page.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/pageflow/Page.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jboss/seam/pageflow/Page.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,168 @@
+package org.jboss.seam.pageflow;
+
+import org.dom4j.Element;
+/*
+import org.jboss.seam.bpm.BusinessProcess;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.Interpolator;
+*/
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.jbpm.jpdl.xml.Parsable;
+
+/**
+ * A page node in a jPDL pageflow
+ *
+ * @author Tom Baeyens
+ * @author Gavin King
+ */
+public class Page extends Node implements Parsable {
+
+ // This classname is configured in the jbpm configuration
+ // file : org/jbpm/graph/node/node.types.xml inside
+ // the jbpm-{version}.jar
+
+ // In case it would be necessary, that file, can be customized
+ // by updating the reference to it in the central jbpm configuration
+ // file 'jbpm.cfg.xml'
+
+ private static final long serialVersionUID = 1L;
+
+ private String viewId;
+ private boolean isConversationEnd = false;
+ private boolean isConversationEndBeforeRedirect = false;
+ private boolean isTaskEnd = false;
+ private String transition;
+ private String processToCreate;
+ private boolean redirect;
+ private String description;
+ private Integer timeout;
+ private boolean backEnabled;
+ private boolean switchEnabled;
+ private String noConversationViewId;
+
+ /**
+ * parses the dom4j element that corresponds to this page.
+ */
+ public void read(Element pageElement, JpdlXmlReader jpdlXmlReader) {
+ super.read(pageElement, jpdlXmlReader);
+ viewId = pageElement.attributeValue("view-id");
+ if (viewId == null) {
+ throw new IllegalStateException("must specify view-id for <page/> node: "
+ + pageElement.attributeValue("name"));
+ }
+ noConversationViewId = pageElement.attributeValue("no-conversation-view-id");
+ backEnabled = "enabled".equals(pageElement.attributeValue("back"));
+ switchEnabled = !"disabled".equals(pageElement.attributeValue("switch"));
+ Element endConversationElement = pageElement.element("end-conversation");
+ if (endConversationElement != null) {
+ isConversationEnd = true;
+ isConversationEndBeforeRedirect = "true".equals(endConversationElement.attributeValue("before-redirect"));
+ processToCreate = endConversationElement.attributeValue("create-process");
+ }
+ Element endTaskElement = pageElement.element("end-task");
+ if (endTaskElement != null) {
+ isTaskEnd = true;
+ transition = endTaskElement.attributeValue("transition");
+ }
+ redirect = "true".equals(pageElement.attributeValue("redirect"));
+ if (pageElement.element("redirect") != null) {
+ redirect = true;
+ }
+ Element descriptionElement = pageElement.element("description");
+ if (descriptionElement != null) {
+ description = descriptionElement.getTextTrim();
+ }
+ String timeoutString = pageElement.attributeValue("timeout");
+ if (timeoutString != null) {
+ timeout = Integer.valueOf(timeoutString);
+ }
+ }
+
+ /**
+ * is executed when execution arrives in this page at runtime.
+ */
+ public void execute(ExecutionContext executionContext) {
+ /*
+ if (isConversationEnd && processToCreate != null) {
+ BusinessProcess.instance().createProcess(processToCreate);
+ }
+
+ if (isTaskEnd) {
+ BusinessProcess.instance().endTask(transition);
+ }
+
+ if (isConversationEnd || isTaskEnd) {
+ if (isConversationEndBeforeRedirect) {
+ Conversation.instance().endBeforeRedirect();
+ }
+ else {
+ Conversation.instance().end();
+ }
+ }
+ */
+ if (getAction() != null) {
+ try {
+ getAction().execute(executionContext);
+ }
+ catch (Exception e) {
+ raiseException(e, executionContext);
+ }
+ }
+ }
+
+ public boolean isConversationEnd() {
+ return isConversationEnd;
+ }
+
+ public String getTransition() {
+ return transition;
+ }
+
+ public String getViewId() {
+ // return Interpolator.instance().interpolate(viewId);
+ return null;
+ }
+
+ public boolean isRedirect() {
+ return redirect;
+ }
+
+ public boolean hasDescription() {
+ return description != null;
+ }
+
+ public String getDescription() {
+ // return Interpolator.instance().interpolate(description);
+ return null;
+ }
+
+ public Integer getTimeout() {
+ return timeout;
+ }
+
+ public boolean isBackEnabled() {
+ return backEnabled;
+ }
+
+ public boolean isSwitchEnabled() {
+ return switchEnabled;
+ }
+
+ public String getNoConversationViewId() {
+ return noConversationViewId;
+ }
+
+ protected boolean isTaskEnd() {
+ return isTaskEnd;
+ }
+
+ protected String getProcessToCreate() {
+ return processToCreate;
+ }
+
+ public boolean isConversationEndBeforeRedirect() {
+ return isConversationEndBeforeRedirect;
+ }
+}
Modified: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/ProcessDefinitionXmlTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/ProcessDefinitionXmlTest.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/ProcessDefinitionXmlTest.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -21,8 +21,12 @@
*/
package org.jbpm.jpdl.xml;
+import java.util.List;
+
import org.dom4j.*;
import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.EndState;
+import org.jbpm.graph.node.StartState;
public class ProcessDefinitionXmlTest extends AbstractXmlTestCase {
@@ -36,7 +40,12 @@
public void testParseProcessDefinitionNonUTFEncoding() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(
"org/jbpm/jpdl/xml/encodedprocess.xml");
- assertEquals("espa\u00f1ol", processDefinition.getName());
+ assertEquals("jbpm en espa\u00f1ol", processDefinition.getName());
+ List nodes = processDefinition.getNodes();
+ StartState startState = (StartState) nodes.get(0);
+ assertEquals("introducci\u00f3n", startState.getName());
+ EndState endState = (EndState) nodes.get(2);
+ assertEquals("conclusi\u00f3n", endState.getName());
}
public void testParseProcessDefinitionName() {
Modified: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/XmlSchemaTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/XmlSchemaTest.java 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/jpdl/xml/XmlSchemaTest.java 2008-08-29 07:54:19 UTC (rev 2045)
@@ -21,7 +21,7 @@
*/
package org.jbpm.jpdl.xml;
-import java.io.InputStream;
+import java.util.List;
import junit.framework.TestCase;
@@ -35,12 +35,8 @@
* with the test method name.
*/
public ProcessDefinition parseXmlForThisMethod() {
- String name = "files/"+getName()+".xml";
- InputStream inputStream = getClass().getResourceAsStream(name);
- if (inputStream==null) {
- throw new RuntimeException("couldn't find resource "+name);
- }
- return ProcessDefinition.parseXmlInputStream(inputStream);
+ String resource = "org/jbpm/jpdl/xml/files/"+getName()+".xml";
+ return ProcessDefinition.parseXmlResource(resource);
}
public void testInvalidXml() {
@@ -77,6 +73,7 @@
}
public void testMultipleNamespaces() {
+ JpdlParser.addSchemaResource("org/jbpm/jpdl/xml/files/sitemap.xsd");
try {
parseXmlForThisMethod();
fail("expected exception");
@@ -120,4 +117,22 @@
public void testExceptionHandler() {parseXmlForThisMethod();}
public void testEndState() {parseXmlForThisMethod();}
public void testScript() {parseXmlForThisMethod();}
+
+ public void testPageflowWithoutNamespace() { parseXmlForThisMethod(); }
+
+ public void testPageflowWithNamespace() {
+ try {
+ parseXmlForThisMethod();
+ fail("expected exception");
+ }
+ catch (JpdlException e) {
+ List problems = e.getProblems();
+ assertEquals(1, problems.size());
+ Problem problem = (Problem) problems.get(0);
+ assertEquals(Problem.LEVEL_ERROR, problem.getLevel());
+ assertEquals(3, problem.getLine().intValue());
+ }
+ }
+
+ public void testPageflowWithSchemaLocation() { parseXmlForThisMethod(); }
}
Modified: jbpm3/trunk/modules/jpdl/core/src/test/resources/log4j.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/log4j.xml 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/log4j.xml 2008-08-29 07:54:19 UTC (rev 2045)
@@ -67,7 +67,7 @@
<!-- ======================= -->
<root>
- <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/seam/pageflow-2.0.xsd
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/seam/pageflow-2.0.xsd (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jboss/seam/pageflow-2.0.xsd 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xs:schema xmlns="http://jboss.com/products/seam/pageflow"
+ targetNamespace="http://jboss.com/products/seam/pageflow"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <!-- PAGEFLOW-DEFINITION -->
+ <!-- ################### -->
+ <xs:element name="pageflow-definition">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="start-node-elements" />
+ <xs:group ref="node-elements" />
+ <xs:group ref="end-node-elements" />
+ <xs:group ref="action-elements" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="start-page" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- NODES -->
+ <!-- ##### -->
+ <xs:element name="start-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="transition" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="end-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="process-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="sub-process" />
+ <xs:element ref="transition" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="binding" type="bindingType" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="sub-process">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="version" type="xs:integer" />
+
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="start-page">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="page-elements" />
+ </xs:choice>
+ <xs:attributeGroup ref="page-attributes" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="decision">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="handler" type="delegation" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ <xs:element name="transition">
+ <xs:complexType>
+ <xs:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:element name="condition">
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:any processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="expression"
+ type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+ <xs:group ref="action-elements" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="to" type="xs:string"
+ use="required" />
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="expression" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="page">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="end-conversation" />
+ </xs:choice>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="end-task" />
+ </xs:choice>
+ <xs:group ref="page-elements" />
+ </xs:sequence>
+ <xs:attributeGroup ref="page-attributes" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redirect" />
+ <xs:element name="description" type="xs:string" />
+
+ <xs:element name="end-conversation">
+ <xs:complexType>
+ <xs:attribute name="before-redirect" type="booleanType" />
+ <xs:attribute name="create-process" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="end-task">
+ <xs:complexType>
+ <xs:attribute name="transition" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- TRANSITION -->
+ <!-- ########## -->
+ <xs:element name="transition">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="action-elements" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="to" type="xs:string" use="required" />
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- ACTIONS -->
+ <!-- ####### -->
+ <xs:element name="action">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string" />
+ <xs:attribute name="config-type" default="field" type="xs:string" />
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="ref-name" type="xs:string" />
+ <xs:attribute name="accept-propagated-events"
+ type="booleanType" default="true" />
+ <xs:attribute name="expression" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="script">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="accept-propagated-events"
+ type="booleanType" default="true" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- EVENT -->
+ <!-- ##### -->
+ <xs:element name="event">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="action-elements" />
+ </xs:choice>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:string" />
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="node-enter" />
+ <xs:enumeration value="node-leave" />
+ <xs:enumeration value="process-start" />
+ <xs:enumeration value="process-end" />
+ <xs:enumeration value="task-create" />
+ <xs:enumeration value="task-assign" />
+ <xs:enumeration value="task-start" />
+ <xs:enumeration value="task-end" />
+ <xs:enumeration value="before-signal" />
+ <xs:enumeration value="after-signal" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- EXCEPTION-HANDLER -->
+ <!-- ################# -->
+ <xs:element name="exception-handler">
+ <xs:complexType>
+ <xs:choice minOccurs="1" maxOccurs="unbounded">
+ <xs:element ref="action" />
+ <xs:element ref="script" />
+ </xs:choice>
+ <xs:attribute name="exception-class" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- TYPES AND GROUPS -->
+ <!-- ################ -->
+ <xs:complexType name="delegation" mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string" />
+ <xs:attribute name="config-type" default="field" type="xs:string" />
+ </xs:complexType>
+
+ <xs:simpleType name="configType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="field" />
+ <xs:enumeration value="bean" />
+ <xs:enumeration value="constructor" />
+ <xs:enumeration value="configuration-property" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="booleanType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="yes" />
+ <xs:enumeration value="no" />
+ <xs:enumeration value="true" />
+ <xs:enumeration value="false" />
+ <xs:enumeration value="on" />
+ <xs:enumeration value="off" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="enabledType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="enabled" />
+ <xs:enumeration value="disabled" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="start-node-elements">
+ <xs:choice>
+ <xs:element ref="start-state" />
+ <xs:element ref="start-page" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="node-elements">
+ <xs:choice>
+ <xs:element ref="page" />
+ <xs:element ref="decision" />
+ <xs:element ref="process-state" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="end-node-elements">
+ <xs:choice>
+ <xs:element ref="end-state" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="action-elements">
+ <xs:choice>
+ <xs:element ref="action" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="page-elements">
+ <xs:sequence>
+ <xs:element ref="description" maxOccurs="1" minOccurs="0"/>
+ <xs:element ref="redirect" maxOccurs="1" minOccurs="0"/>
+ <xs:element ref="event" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="exception-handler" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="transition" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:group ref="action-elements" minOccurs="0" maxOccurs="1" />
+ </xs:sequence>
+ </xs:group>
+
+ <xs:attributeGroup name="page-attributes">
+ <xs:attribute name="redirect" type="xs:boolean" />
+ <xs:attribute name="switch" type="enabledType" />
+ <xs:attribute name="no-conversation-view-id" type="xs:string" />
+ <xs:attribute name="timeout" type="xs:int" />
+ <xs:attribute name="back" type="enabledType" />
+ <xs:attribute name="view-id" type="xs:string" use="required" />
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:attributeGroup>
+
+ <xs:simpleType name="bindingType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="late" />
+ <xs:enumeration value="early" />
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
Modified: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/encodedprocess.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/encodedprocess.xml 2008-08-28 20:23:08 UTC (rev 2044)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/encodedprocess.xml 2008-08-29 07:54:19 UTC (rev 2045)
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<process-definition name='español'>
- <start-state>
- <transition to='árbol' />
+<process-definition name='jbpm en español'>
+ <start-state name="introducción">
+ <transition to='desarrollo' />
</start-state>
- <node name='árbol'>
- <transition to='león' />
+ <node name='desarrollo'>
+ <transition to='conclusión' />
</node>
- <node name='león'>
- <transition to='uña' />
- </node>
- <end-state name='uña' />
+ <end-state name='conclusión' />
</process-definition>
\ No newline at end of file
Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/sitemap.xsd
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/sitemap.xsd (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/sitemap.xsd 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.google.com/schemas/sitemap/0.84" xmlns="http://www.google.com/schemas/sitemap/0.84">
+<xsd:annotation>
+ <xsd:documentation>
+ XML Schema for Sitemap files.
+ Last Modifed 2005-05-24
+ </xsd:documentation>
+</xsd:annotation>
+
+<xsd:element name="urlset">
+ <xsd:annotation>
+ <xsd:documentation>
+ Container for a set of up to 50,000 document elements.
+ This is the root element of the XML file.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="url" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="url">
+ <xsd:annotation>
+ <xsd:documentation>
+ Container for the data needed to describe a document to crawl.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element ref="loc"/>
+ <xsd:element ref="lastmod" minOccurs="0"/>
+ <xsd:element ref="changefreq" minOccurs="0"/>
+ <xsd:element ref="priority" minOccurs="0"/>
+ </xsd:all>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="loc">
+ <xsd:annotation>
+ <xsd:documentation>
+ REQUIRED: The location URI of a document.
+ The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:anyURI">
+ <xsd:minLength value="12"/>
+ <xsd:maxLength value="2048"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:element>
+
+<xsd:element name="lastmod">
+ <xsd:annotation>
+ <xsd:documentation>
+ OPTIONAL: The date the document was last modified. The date must conform
+ to ISO 8601 (http://www.w3.org/TR/NOTE-datetime). Example: 2005-05-10
+ Lastmod may also contain a timestamp. Example: 2005-05-10T17:33:30+08:00
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:minLength value="10"/>
+ <xsd:maxLength value="25"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:element>
+
+<xsd:element name="changefreq">
+ <xsd:annotation>
+ <xsd:documentation>
+ OPTIONAL: Indicates how frequently the content at a particular URL is
+ likely to change. The value "always" should be used to describe
+ documents that change each time they are accessed. The value "never"
+ should be used to describe archived URLs. Please note that web
+ crawlers may not necessarily crawl pages marked "always" more often.
+ Consider this element as a friendly suggestion and not a command.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="always"/>
+ <xsd:enumeration value="hourly"/>
+ <xsd:enumeration value="daily"/>
+ <xsd:enumeration value="weekly"/>
+ <xsd:enumeration value="monthly"/>
+ <xsd:enumeration value="yearly"/>
+ <xsd:enumeration value="never"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:element>
+
+<xsd:element name="priority">
+ <xsd:annotation>
+ <xsd:documentation>
+ OPTIONAL: The priority of a particular URL relative to other pages
+ on the same site. The value for this element is a number between
+ 0.0 and 1.0 where 0.0 identifies the lowest priority page(s).
+ The default priority of a page is 0.5. Priority is used to select
+ between pages on your site. Setting a priority of 1.0 for all URLs
+ will not help you, as the relative priority of pages on your site
+ is what will be considered.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:decimal">
+ <xsd:minInclusive value="0.0"/>
+ <xsd:maxInclusive value="1.0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:element>
+
+</xsd:schema>
\ No newline at end of file
Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithNamespace.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithNamespace.xml (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithNamespace.xml 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,35 @@
+<pageflow-definition name="numberGuess" xmlns="http://jboss.com/products/seam/pageflow">
+
+ <i-do-not-belong-here>
+ <the-parser-will-complain />
+ </i-do-not-belong-here>
+
+ <start-page name="displayGuess" view-id="/numberGuess.jsp">
+ <redirect />
+ <transition name="guess" to="evaluateGuess">
+ <action expression="#{numberGuess.guess}" />
+ </transition>
+ </start-page>
+
+ <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
+ <transition name="true" to="win" />
+ <transition name="false" to="evaluateRemainingGuesses" />
+ </decision>
+
+ <decision name="evaluateRemainingGuesses"
+ expression="#{numberGuess.lastGuess}">
+ <transition name="true" to="lose" />
+ <transition name="false" to="displayGuess" />
+ </decision>
+
+ <page name="win" view-id="/win.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+ <page name="lose" view-id="/lose.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+</pageflow-definition>
\ No newline at end of file
Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithSchemaLocation.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithSchemaLocation.xml (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithSchemaLocation.xml 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pageflow-definition name="numberGuess"
+ xsi:schemaLocation="http://jboss.com/products/seam/pageflow
+ http://jboss.com/products/seam/pageflow-2.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.com/products/seam/pageflow">
+
+ <start-page name="displayGuess" view-id="/numberGuess.jsp">
+ <redirect />
+ <transition name="guess" to="evaluateGuess">
+ <action expression="#{numberGuess.guess}" />
+ </transition>
+ </start-page>
+
+ <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
+ <transition name="true" to="win" />
+ <transition name="false" to="evaluateRemainingGuesses" />
+ </decision>
+
+ <decision name="evaluateRemainingGuesses"
+ expression="#{numberGuess.lastGuess}">
+ <transition name="true" to="lose" />
+ <transition name="false" to="displayGuess" />
+ </decision>
+
+ <page name="win" view-id="/win.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+ <page name="lose" view-id="/lose.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+</pageflow-definition>
\ No newline at end of file
Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithoutNamespace.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithoutNamespace.xml (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/jpdl/xml/files/testPageflowWithoutNamespace.xml 2008-08-29 07:54:19 UTC (rev 2045)
@@ -0,0 +1,35 @@
+<pageflow-definition name="numberGuess">
+
+ <i-do-not-belong-here>
+ <the-parser-will-not-complain />
+ </i-do-not-belong-here>
+
+ <start-page name="displayGuess" view-id="/numberGuess.jsp">
+ <redirect />
+ <transition name="guess" to="evaluateGuess">
+ <action expression="#{numberGuess.guess}" />
+ </transition>
+ </start-page>
+
+ <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
+ <transition name="true" to="win" />
+ <transition name="false" to="evaluateRemainingGuesses" />
+ </decision>
+
+ <decision name="evaluateRemainingGuesses"
+ expression="#{numberGuess.lastGuess}">
+ <transition name="true" to="lose" />
+ <transition name="false" to="displayGuess" />
+ </decision>
+
+ <page name="win" view-id="/win.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+ <page name="lose" view-id="/lose.jsp">
+ <end-conversation />
+ <redirect />
+ </page>
+
+</pageflow-definition>
\ No newline at end of file
More information about the jbpm-commits
mailing list