Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 10:07:40 -0400 (Thu, 10 Jul 2008)
New Revision: 1571
Added:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/jaxb.index
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
Modified:
api/trunk/modules/api/pom.xml
api/trunk/modules/api/scripts/antrun-schemagen.xml
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
Log:
Add ProcessMarshaller/Unmarshaller
Modified: api/trunk/modules/api/pom.xml
===================================================================
--- api/trunk/modules/api/pom.xml 2008-07-10 12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/pom.xml 2008-07-10 14:07:40 UTC (rev 1571)
@@ -69,11 +69,12 @@
<destdir>target/schema</destdir>
<schemas>
<schema>
- <namespace>org.jboss.bpm.api</namespace>
+ <namespace>http://org.jboss.bpm.api</namespace>
<file>jbpm-api.xsd</file>
</schema>
</schemas>
<includes>
+ <include>package-info.java</include>
<include>Activity.java</include>
<include>ComplexGateway.java</include>
<include>EndEvent.java</include>
Modified: api/trunk/modules/api/scripts/antrun-schemagen.xml
===================================================================
--- api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 14:07:40 UTC (rev 1571)
@@ -23,7 +23,8 @@
<mkdir dir="target/schema"/>
<schemagen srcdir="src/main/java/org/jboss/bpm/model"
destdir="target/schema">
- <schema namespace="org.jboss.bpm.api"
file="jbpm-api.xsd"/>
+ <schema namespace="http://org.jboss.bpm.api"
file="jbpm-api.xsd"/>
+ <include name="package-info.java"/>
<include name="Activity.java"/>
<include name="ComplexGateway.java"/>
<include name="EndEvent.java"/>
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -23,14 +23,19 @@
// $Id$
+import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.EngineShutdownException;
import org.jboss.bpm.model.Process;
+import org.jboss.bpm.util.ProcessMarshaller;
/**
* The process manager is the entry point to create, find and otherwise manage
processes.
@@ -40,6 +45,9 @@
*/
public abstract class ProcessManager
{
+ // provide logging
+ private static final Log log = LogFactory.getLog(ProcessManager.class);
+
// Injected through the MC
protected ProcessEngine engine;
// The set of process definitions
@@ -50,7 +58,7 @@
{
}
- /* Get the associated process engine */
+ /* Get the associated process engine */
public ProcessEngine getProcessEngine()
{
if (engine == null)
@@ -59,7 +67,7 @@
return engine;
}
- /* Locate the process definition manager */
+ /* Locate the process definition manager */
public static ProcessManager locateProcessManager()
{
ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
@@ -74,17 +82,13 @@
// TODO: test this
if (engine.isPrepareForShutdown())
throw new EngineShutdownException("Cannot create new Process while engine is
shutting down");
-
- Process pd = createProcessOverride(procDescriptor);
- return pd;
+
+ Process proc = createProcessOverride(procDescriptor);
+ marshallProcess(proc);
+ return proc;
}
/*
- * Override to implement process definition creation
- */
- protected abstract Process createProcessOverride(String procDescriptor);
-
- /*
* Create a process defintion from an URL to a XML descritor in one of the supported
formats
*/
public final Process createProcess(URL procURL) throws IOException
@@ -92,11 +96,32 @@
// TODO: test this
if (engine.isPrepareForShutdown())
throw new EngineShutdownException("Cannot create new Process while engine is
shutting down");
-
- Process pd = createProcessOverride(procURL);
- return pd;
+
+ Process proc = createProcessOverride(procURL);
+ marshallProcess(proc);
+ return proc;
}
+ /**
+ * Override to implement process definition creation
+ */
+ protected abstract Process createProcessOverride(String procDescriptor);
+
+ private void marshallProcess(Process proc)
+ {
+ try
+ {
+ File file = new File("target/" + proc.getName() +
".xml").getCanonicalFile();
+ ProcessMarshaller marshaller = new ProcessMarshaller();
+ marshaller.marshallProcess(proc, new FileWriter(file));
+ log.info("Generated: " + file);
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot marshall: " + proc);
+ }
+ }
+
/*
* Override to implement process definition creation
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -33,9 +33,24 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="Activity")
+@XmlType(name="Activity")
public abstract class Activity extends NamedFlowObject
{
+ /**
+ * Construct an anonymous Activity
+ */
+ public Activity()
+ {
+ }
+
+ /**
+ * Construct a Activity with a given name
+ */
+ public Activity(String name)
+ {
+ super(name);
+ }
+
/**
* Call to initialize fully
* Note, this MUST NOT leak into the public API.
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -36,7 +36,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="ComplexGateway")
+@XmlType(name="ComplexGateway")
public class ComplexGateway extends Gateway
{
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -40,7 +40,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="EndEvent")
+@XmlType(name="EndEvent")
public class EndEvent extends Event
{
@XmlTransient
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-10 12:13:06
UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-10 14:07:40
UTC (rev 1571)
@@ -34,7 +34,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="Event")
+@XmlType(name="Event")
public abstract class Event extends FlowObject
{
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -32,7 +32,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="ExclusiveGateway")
+@XmlType(name="ExclusiveGateway")
public class ExclusiveGateway extends Gateway
{
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -35,7 +35,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="FlowObject")
+@XmlType(name="FlowObject")
public abstract class FlowObject
{
@XmlTransient
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -34,7 +34,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="Gateway")
+@XmlType(name="Gateway")
public abstract class Gateway extends FlowObject
{
@Override
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -34,7 +34,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="InclusiveGateway")
+@XmlType(name="InclusiveGateway")
public class InclusiveGateway extends Gateway
{
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -36,7 +36,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="ItermediateEvent")
+@XmlType(name="ItermediateEvent")
public class ItermediateEvent extends Event
{
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -21,36 +21,49 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
//$Id$
-
/**
- * A Flow Object with a name
+ * A Flow Object with a name
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="NamedFlowObject")
+@XmlType(name = "NamedFlowObject")
public abstract class NamedFlowObject extends FlowObject
{
- @XmlElement
+ @XmlAttribute(required = true)
private String name;
+
+ /**
+ * Construct an anonymous NamedFlowObject
+ */
+ public NamedFlowObject()
+ {
+ }
+
+ /**
+ * Construct a NamedFlowObject with a given name
+ */
+ public NamedFlowObject(String name)
+ {
+ this.name = name;
+ }
- /**
- * Get the name
+ /**
+ * Get the name
*/
public String getName()
{
return name;
}
-
- /**
- * Set the name
- * Note, this MUST NOT leak into the public API.
+
+ /**
+ * Set the name Note, this MUST NOT leak into the public API.
*/
// TODO
@XmlTransient
@@ -58,7 +71,7 @@
{
if (this.name != null)
throw new IllegalStateException("Cannot rename: " + name);
-
+
this.name = name;
}
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java
===================================================================
---
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -32,7 +32,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="ParallelGateway")
+@XmlType(name="ParallelGateway")
public class ParallelGateway extends Gateway
{
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -21,9 +21,9 @@
*/
package org.jboss.bpm.model;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -40,7 +40,6 @@
import org.jboss.bpm.client.ProcessManager;
import org.jboss.bpm.runtime.Attachments;
-
// $Id$
/**
@@ -49,17 +48,31 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="Process")
-(a)XmlRootElement(namespace="org.jboss.bpm.api", name="process")
+@XmlType(name = "Process")
+@XmlRootElement(name = "process")
public class Process extends Activity
{
- @XmlElement
- protected Set<FlowObject> flowObjects = new HashSet<FlowObject>();
-
- /**
- * Call to initialize fully
- * Note, this MUST NOT leak into the public API.
+ @XmlElement(name = "flowObject")
+ protected List<FlowObject> flowObjects = new ArrayList<FlowObject>();
+
+ /**
+ * Construct an anonymous process
*/
+ public Process()
+ {
+ }
+
+ /**
+ * Construct a process with a given name
+ */
+ public Process(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Call to initialize fully Note, this MUST NOT leak into the public API.
+ */
protected void init(String name)
{
if (name == null)
@@ -69,10 +82,9 @@
setName(name);
}
}
-
- /**
- * Add a flow object
- * Note, this MUST NOT leak into the public API.
+
+ /**
+ * Add a flow object Note, this MUST NOT leak into the public API.
*/
protected void addFlowObject(FlowObject flowObject)
{
@@ -88,9 +100,9 @@
flowObjects.add(flowObject);
}
-
- /**
- * Get the start event
+
+ /**
+ * Get the start event
*/
@XmlTransient
public StartEvent getStartEvent()
@@ -115,21 +127,21 @@
}
return start;
}
-
+
/** Get the set of end events */
@XmlTransient
- public Set<EndEvent> getEndEvents()
+ public List<EndEvent> getEndEvents()
{
- Set<EndEvent> ends = getEndEventsInternal();
+ List<EndEvent> ends = getEndEventsInternal();
if (ends.size() == 0)
throw new InvalidProcessException("Process does not have end events");
return ends;
}
- private Set<EndEvent> getEndEventsInternal()
+ private List<EndEvent> getEndEventsInternal()
{
- Set<EndEvent> ends = new HashSet<EndEvent>();
+ List<EndEvent> ends = new ArrayList<EndEvent>();
for (FlowObject aux : flowObjects)
{
if (aux instanceof EndEvent)
@@ -139,28 +151,29 @@
}
return ends;
}
-
+
/** Get the set of flow objects */
- public Set<FlowObject> getFlowObjects()
+ public List<FlowObject> getFlowObjects()
{
- return Collections.unmodifiableSet(flowObjects);
+ return Collections.unmodifiableList(flowObjects);
}
-
+
/** Start the process */
public Future<Result> startProcess()
{
return startProcess(null);
}
-
+
/** Start the process, with a given execution context */
public Future<Result> startProcess(Attachments att)
{
execute(new InitialToken(this, att));
return new ResultFuture();
}
-
- /**
+
+ /**
* Find a flow object by name
+ *
* @return null if not found
*/
public NamedFlowObject findFlowObject(String name)
@@ -176,9 +189,9 @@
}
return nfo;
}
-
- /**
- * Get signal for enter
+
+ /**
+ * Get signal for enter
*/
@Override
public Signal getEnterSignal()
@@ -186,8 +199,8 @@
return new Signal(this, Signal.Type.ENTER_PROCESS);
}
- /**
- * Get signal for exit
+ /**
+ * Get signal for exit
*/
@Override
public Signal getExitSignal()
@@ -229,7 +242,7 @@
{
if (result == null)
{
- Set<EndEvent> ends = getEndEventsInternal();
+ List<EndEvent> ends = getEndEventsInternal();
for (EndEvent aux : ends)
{
result = aux.getResult();
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -37,7 +37,7 @@
public class Signal
{
// @XmlTransient does not work with jaxb-2.1.7
- @XmlType(namespace="org.jboss.bpm.api", name="SignalType")
+ @XmlType(name="SignalType")
public enum Type
{
ENTER_START_EVENT, EXIT_START_EVENT,
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -21,10 +21,9 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlType;
-
//$Id$
+import javax.xml.bind.annotation.XmlType;
/**
* A Start Event indicates where a particular Process will start.
@@ -35,7 +34,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="StartEvent")
+@XmlType(name="StartEvent")
public class StartEvent extends Event
{
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-10
12:13:06 UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -32,7 +32,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="SubProcess")
+@XmlType(name="SubProcess")
public class SubProcess extends Process
{
@XmlTransient
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 12:13:06
UTC (rev 1570)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 14:07:40
UTC (rev 1571)
@@ -34,9 +34,24 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-(a)XmlType(namespace="org.jboss.bpm.api", name="Task")
+@XmlType(name="Task")
public class Task extends Activity
{
+ /**
+ * Construct an anonymous Task
+ */
+ public Task()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ */
+ public Task(String name)
+ {
+ super(name);
+ }
+
/** Get signal for enter */
public Signal getEnterSignal()
{
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/jaxb.index
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/jaxb.index
(rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/jaxb.index 2008-07-10 14:07:40
UTC (rev 1571)
@@ -0,0 +1,16 @@
+Activity
+ComplexGateway
+EndEvent
+Event
+ExclusiveGateway
+FlowObject
+Gateway
+InclusiveGateway
+ItermediateEvent
+NamedFlowObject
+ParallelGateway
+Process
+Signal
+StartEvent
+SubProcess
+Task
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
(rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+@XmlSchema(namespace="http://org.jboss.bpm.api")
+package org.jboss.bpm.model;
+
+import javax.xml.bind.annotation.XmlSchema;
+
Property changes on:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
(rev 0)
+++
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -0,0 +1,68 @@
+/*
+ * 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.jboss.bpm.model;
+
+// $Id$
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.jboss.bpm.util.ProcessMarshaller;
+import org.jboss.bpm.util.ProcessUnmarshaller;
+
+/**
+ * Test JAXB marshalling of the process
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessMarshallerTest extends TestCase
+{
+ public void testProcess() throws Exception
+ {
+ Process inProc = new Process("myproc");
+ inProc.addFlowObject(new StartEvent());
+ inProc.addFlowObject(new Task("mytask"));
+ inProc.addFlowObject(new EndEvent());
+
+ StringWriter strwr = new StringWriter();
+ ProcessMarshaller marshaller = new ProcessMarshaller();
+ marshaller.marshallProcess(inProc, strwr);
+ String xml = strwr.toString();
+
+ //System.out.println(xml);
+
+ ProcessUnmarshaller unmarshaller = new ProcessUnmarshaller();
+ Process outProc = unmarshaller.unmarshallProcess(new StringReader(xml));
+
+ assertEquals(inProc.getName(), outProc.getName());
+ assertNotNull(outProc.getStartEvent());
+ assertEquals(outProc, outProc.getStartEvent().getProcess());
+ assertNotNull(outProc.findFlowObject("mytask"));
+ assertEquals(outProc, outProc.findFlowObject("mytask").getProcess());
+ assertEquals(1, outProc.getEndEvents().size());
+ assertNotNull(outProc.getEndEvents().get(0));
+ assertEquals(outProc, outProc.getEndEvents().get(0).getProcess());
+ }
+}
Property changes on:
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
===================================================================
---
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-10
12:13:06 UTC (rev 1570)
+++
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-10
14:07:40 UTC (rev 1571)
@@ -23,16 +23,10 @@
// $Id$
-import java.util.Set;
+import java.util.List;
import org.jboss.bpm.InvalidProcessException;
import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.model.EndEvent;
-import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.NamedFlowObject;
-import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.StartEvent;
-import org.jboss.bpm.model.Task;
import org.jboss.bpm.test.DefaultEngineTestCase;
public class ProcessTest extends DefaultEngineTestCase
@@ -58,14 +52,14 @@
StartEvent start = proc.getStartEvent();
assertNotNull("Start expected", start);
- Set<FlowObject> fos = proc.getFlowObjects();
+ List<FlowObject> fos = proc.getFlowObjects();
assertEquals(3, fos.size());
NamedFlowObject nfo = proc.findFlowObject("stateA");
assertNotNull("FlowObject expected", nfo);
assertTrue("Task expected", nfo instanceof Task);
- Set<EndEvent> ends = proc.getEndEvents();
+ List<EndEvent> ends = proc.getEndEvents();
assertEquals(1, ends.size());
}