[jbpm-commits] JBoss JBPM SVN: r4700 - in jbpm4/branches/jimma/modules: migration and 17 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun May 3 22:27:15 EDT 2009


Author: jim.ma
Date: 2009-05-03 22:27:15 -0400 (Sun, 03 May 2009)
New Revision: 4700

Added:
   jbpm4/branches/jimma/modules/migration/
   jbpm4/branches/jimma/modules/migration/pom.xml
   jbpm4/branches/jimma/modules/migration/src/
   jbpm4/branches/jimma/modules/migration/src/main/
   jbpm4/branches/jimma/modules/migration/src/main/java/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConvertException.java
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConverterContext.java
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl4Writer.java
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java
   jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java
   jbpm4/branches/jimma/modules/migration/src/main/resources/
   jbpm4/branches/jimma/modules/migration/src/main/xsd/
   jbpm4/branches/jimma/modules/migration/src/main/xsd/jpdl-4.0.xsd
   jbpm4/branches/jimma/modules/migration/src/test/
   jbpm4/branches/jimma/modules/migration/src/test/java/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/
   jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterTest.java
   jbpm4/branches/jimma/modules/migration/src/test/resources/
   jbpm4/branches/jimma/modules/migration/src/test/resources/processdefinition.xml
Log:
Intitial and experimental code for mgiration tool

Added: jbpm4/branches/jimma/modules/migration/pom.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/pom.xml	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/pom.xml	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 1790 2008-07-31 12:13:06Z tom.baeyens at jboss.com $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <name>jBPM 4 - Migration - Tool</name>
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>migration</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <!-- Properties -->
+  <properties>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+
+    <!-- JBPM4 -->
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <version>${version}</version>
+    </dependency>
+
+
+   <dependency>
+    <groupId>org.jbpm.jbpm3</groupId>
+    <artifactId>jbpm-jpdl</artifactId>
+    <version>3.3.1-SNAPSHOT</version>
+   </dependency>
+
+    <!-- 3rd Party -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+
+
+     <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>2.0</version>
+     </dependency>
+
+     <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>2.0.3</version>
+     </dependency>
+
+  </dependencies>
+
+  <!-- Plugins -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jaxb2-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+                    <execution>
+                        <goals>
+                            <goal>xjc</goal>
+                        </goals>
+                    </execution>
+        </executions>
+        <configuration>
+               <includeSchemas>
+                   <includeSchema>**/*.xsd</includeSchema>
+                </includeSchemas>
+               <packageName>org.jbpm.jpdl4.model</packageName>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <!-- Profiles -->
+  <profiles>
+    <!-- skip tests if this is an integration test run 
+    (only examples and test-db are part of the integration test runs) -->
+    <profile>
+      <id>integration.test</id>
+      <activation>
+        <property>
+          <name>jboss.bind.address</name>
+        </property>
+      </activation>
+      <properties>
+        <skipTests>true</skipTests>
+      </properties>
+    </profile>
+  </profiles>
+
+
+   <pluginRepositories>
+      <pluginRepository>
+         <id>codehaus</id>
+         <name>codehaus</name>
+         <url>http://repository.codehaus.org</url>
+         <snapshots>
+            <enabled>false</enabled>
+         </snapshots>
+      </pluginRepository>
+   </pluginRepositories>
+
+
+</project>

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConvertException.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConvertException.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConvertException.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,43 @@
+/*
+ * 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.jpdl.internal.convert;
+
+public class ConvertException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public ConvertException() {
+        super();
+    }
+
+    public ConvertException(String msg) {
+        super(msg);
+    }
+
+
+    public ConvertException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ConvertException(Throwable cause) {
+        super(cause);
+    }
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConverterContext.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConverterContext.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/ConverterContext.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -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.jpdl.internal.convert;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ConverterContext {
+	public static final String PROCESS_FILE = "processFile"; 
+	public static final String PROCESS_FILE_URL = "processFileURL";
+	private Map<String, Object> paramMap = null;
+	
+	public void put(String key, Object value) {
+		if (paramMap == null) {
+			paramMap = new ConcurrentHashMap<String, Object>();
+		}
+		paramMap.put(key, value);
+	}
+	
+	public Object get(String key) {
+		if (paramMap == null) {
+			return null;
+		}
+		return paramMap.get(key);
+		
+	}
+	
+	public String getUasage() {
+		return "java org.jbpm.jpdl.internal.convert.JpdlConverterTool jdpl-process.xml";
+	}
+	
+	public void refresh() {
+		paramMap = null;
+	}
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl3Reader.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,52 @@
+/*
+ * 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.jpdl.internal.convert;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.jbpm.jpdl.xml.Problem;
+import org.xml.sax.InputSource;
+
+public class Jpdl3Reader extends JpdlXmlReader {
+	
+	public Jpdl3Reader(InputSource ins) {
+		super(ins);
+	}
+	
+	public boolean isValid() {
+		Iterator iter = problems.iterator();
+	    while (iter.hasNext()) {
+	      Problem problem = (Problem) iter.next();
+	      if (problem.getLevel() < problem.LEVEL_WARNING) {
+	        return false;
+	      }
+	    }
+	    return true;
+	}
+	
+	public List<Problem> getProblems() {
+		return problems;
+	}
+
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl4Writer.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl4Writer.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/Jpdl4Writer.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,61 @@
+/*
+ * 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.jpdl.internal.convert;
+
+import java.io.OutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+
+import org.jbpm.jpdl4.model.ObjectFactory;
+import org.jbpm.jpdl4.model.Process;
+public class Jpdl4Writer {
+	private Marshaller marshaller = null; 
+		
+	public void write(Process process, OutputStream out, boolean formatedOutput) throws ConvertException {
+		try {
+			getMarshaller();
+			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(formatedOutput));
+			marshaller.marshal(process, out);
+		} catch (JAXBException e) {
+			throw new ConvertException("Failed to write converted process file to", e);
+		}
+	}
+	
+	
+	public void write(Process process, OutputStream out) throws ConvertException {
+		write(process, out, false);
+	}
+	
+	private Marshaller getMarshaller() throws JAXBException {
+		if (marshaller == null) {
+			JAXBContext jc = JAXBContext.newInstance(new Class[] { ObjectFactory.class });
+			marshaller = jc.createMarshaller();
+			
+		}
+        return marshaller;
+        
+	}
+
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverter.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,163 @@
+/*
+ * 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.jpdl.internal.convert;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.def.Transition;
+import org.jbpm.graph.node.EndState;
+import org.jbpm.graph.node.StartState;
+import org.jbpm.graph.node.State;
+import org.jbpm.jpdl4.model.JavaType;
+import org.jbpm.jpdl4.model.ObjectFactory;
+import org.jbpm.jpdl4.model.Process;
+import org.jbpm.jpdl4.model.TransitionType;
+import org.xml.sax.InputSource;
+
+public class JpdlConverter {
+	private ConverterContext context;
+	private ObjectFactory objectFactory = new ObjectFactory();
+
+	public JpdlConverter(ConverterContext ctx) {
+		context = ctx;
+	}
+
+	public Process run() throws ConvertException {
+		URL url = (URL) context.get(ConverterContext.PROCESS_FILE_URL);
+		Jpdl3Reader reader = new Jpdl3Reader(new InputSource(url.toString()));
+		ProcessDefinition processDef = reader.readProcessDefinition();
+		if (!reader.isValid()) {
+			reader.getProblems();
+			// TODO:handle the exception
+		}
+		return mapProcessDef(processDef);
+
+	}
+
+	public Process mapProcessDef(ProcessDefinition def) {
+		Process process = new Process();
+		process.setName(def.getName());
+
+		for (Node node : def.getNodes()) {
+			// map start state node
+			if (node.getNodeType().equals(Node.NodeType.StartState)) {
+				StartState jpdl3start = (StartState) node;
+				Process.Start start = mapStartState(jpdl3start);
+				process.getSwimlaneAndOnAndTimer().add(start);
+			}
+
+			if (node.getNodeType().equals(Node.NodeType.State)) {
+				State jpdl3state = (State) node;
+				Process.State state = mapState(jpdl3state);
+				process.getSwimlaneAndOnAndTimer().add(state);
+			}
+
+			if (node.getNodeType().equals(Node.NodeType.EndState)) {
+				EndState jpdl3end = (EndState) node;
+				Process.End end = mapEndState(jpdl3end);
+				process.getSwimlaneAndOnAndTimer().add(end);
+			}
+
+		}
+
+		return process;
+	}
+
+	public Process.Start mapStartState(StartState jpdl3start) {
+		Process.Start start = new Process.Start();
+		start.setName(jpdl3start.getName());
+		Iterator iterator = jpdl3start.getLeavingTransitionsMap().entrySet()
+				.iterator();
+		while (iterator.hasNext()) {
+			Map.Entry entry = (Map.Entry) iterator.next();
+			Transition trans = (Transition) entry.getValue();
+			start.getTransition().add(mapTranisition(trans, false));
+		}
+		return start;
+	}
+
+	public TransitionType mapTranisition(Transition transition, boolean state) {
+		TransitionType transType = null;
+		if (state) {
+			transType = new Process.State.Transition();
+		} else {
+			transType = new TransitionType();
+		}
+		transType.setName(transition.getName());
+		// get the actions
+		Iterator ite = transition.getEvents().entrySet().iterator();
+		while (ite.hasNext()) {
+			Map.Entry<Object, Event> entry = (Map.Entry<Object, Event>) ite.next();
+			if (entry.getValue().getEventType().equals(Event.EVENTTYPE_TRANSITION)) {
+				if (entry.getValue().getActions() != null) {
+					for (Action action : (List<Action>) entry.getValue().getActions()) {
+						JavaType javaType = new JavaType();
+						javaType.setClazz(action.getActionDelegation()
+								.getClassName());
+						//TODO:Check this java method
+						javaType.setMethod("execute");
+						transType.getEventListenerGroup().add(
+								objectFactory.createOnJava(javaType));
+					}
+
+				}
+			}
+		}
+		transType.setTo(transition.getTo().getName());
+
+		return transType;
+	}
+
+	public Process.State mapState(State jpdl3state) {
+		Process.State state = new Process.State();
+		state.setName(jpdl3state.getName());
+		Iterator iterator = jpdl3state.getLeavingTransitionsMap().entrySet().iterator();
+		while (iterator.hasNext()) {
+		    Map.Entry entry = (Map.Entry)iterator.next();
+		    Transition trans = (Transition)entry.getValue();
+		    state.getTransition().add((Process.State.Transition)mapTranisition(trans, true));
+		}		
+		
+		return state;
+		
+	}
+	
+	
+	public Process.End mapEndState(EndState endState) {
+		Process.End end = new Process.End();
+		end.setName(endState.getName());
+		return end;
+	}
+
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/JpdlConverterTool.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -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.jpdl.internal.convert;
+
+import java.net.URL;
+
+import org.jbpm.util.ClassLoaderUtil;
+
+public class JpdlConverterTool {
+	public static void main(String[] args) {
+		JpdlConverterTool converter = new JpdlConverterTool();
+		ConverterContext context = converter.parseParam(args);
+		converter.run(context);
+	}
+	
+	public void run(ConverterContext context) {
+		
+	}
+	
+	public ConverterContext parseParam(String[] args) {
+		ConverterContext context = new ConverterContext();
+		context.put(ConverterContext.PROCESS_FILE, args[0]);
+		return context;
+	}
+	
+	public void validate(ConverterContext context) throws IllegalArgumentException {
+		String processFile = (String)context.get(ConverterContext.PROCESS_FILE);
+		URL resourceURL = ClassLoaderUtil.getClassLoader().getResource(processFile);
+		if (resourceURL == null) {
+		    throw new IllegalArgumentException("Process file not found: " + processFile);
+		}
+		context.put(context.PROCESS_FILE_URL, resourceURL);
+	}
+	
+}

Added: jbpm4/branches/jimma/modules/migration/src/main/xsd/jpdl-4.0.xsd
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/main/xsd/jpdl-4.0.xsd	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/main/xsd/jpdl-4.0.xsd	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,857 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://jbpm.org/4/jpdl"
+        xmlns:tns="http://jbpm.org/4/jpdl"
+        elementFormDefault="qualified"
+        attributeFormDefault="unqualified">
+        
+  <annotation>
+    <documentation>Schema for jPDL 4 process descriptions; 
+    element process is the top level element.
+      
+      TODO: Add activity pluggability.  (add the proper any's and 
+            anyAttributes)
+    
+      TODO: Pull up expression.  The expression element in the 
+            delegation group can be pulled up as an expression 
+            attribute in each use case of the delegationGroup
+    
+      TODO: Investigate if object-refs to centrally defined objects would 
+            add value over inline defined objects.
+    </documentation>
+  </annotation>
+
+  <!-- ### PROCESS DEFINITION ############################################# -->
+
+  <element name="process">
+    <annotation><documentation>A jPDL process definition description; This 
+    is the top level element in a jPDL process file.</documentation></annotation>
+    <complexType>
+      <sequence minOccurs="0" maxOccurs="unbounded">
+        <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded"/>
+        <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+        <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+        <group ref="tns:activityGroup" 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>
+      </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>
+      </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>
+      </attribute>
+      <anyAttribute processContents="skip">
+        <annotation><documentation>for extensibility
+        </documentation></annotation>
+      </anyAttribute>
+    </complexType>
+  </element>
+  
+  <!-- ### ACTIVITIES ##################################################### -->
+  
+  <group name="activityGroup">
+    <choice>
+      <!-- ~~~ START ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="start">
+        <annotation><documentation>Start event
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+
+      <!-- ~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="end">
+        <annotation><documentation>End event.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+          <attribute name="ends" default="process-instance">
+            <simpleType>
+              <restriction base="string">
+                <enumeration value="execution"/>
+                <enumeration value="process-instance"/>
+              </restriction>
+            </simpleType>
+          </attribute>
+          <attribute name="state" default="ended" type="string">
+            <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
+          </attribute>
+        </complexType>
+      </element>
+
+      <element name="end-cancel">
+        <annotation><documentation>End cancel event.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+          <attribute name="ends" default="process-instance">
+            <simpleType>
+              <restriction base="string">
+                <enumeration value="execution"/>
+                <enumeration value="process-instance"/>
+              </restriction>
+            </simpleType>
+          </attribute>
+        </complexType>
+      </element>
+
+      <element name="end-error">
+        <annotation><documentation>End cancel event.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+          <attribute name="ends" default="process-instance">
+            <simpleType>
+              <restriction base="string">
+                <enumeration value="execution"/>
+                <enumeration value="process-instance"/>
+              </restriction>
+            </simpleType>
+          </attribute>
+        </complexType>
+      </element>
+      
+      <!-- ~~~ STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="state">
+        <annotation><documentation>A wait state.  When an execution arrives in this 
+        activity, the execution will wait until an external trigger is received 
+        with execution.signal() or execution.getActivityInstance().signal()
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element name="transition" minOccurs="0" maxOccurs="unbounded">
+              <complexType>
+                <complexContent>
+                  <extension base="tns:transitionType">
+                    <sequence>
+                      <element ref="tns:timer" minOccurs="0" />
+                    </sequence>
+                  </extension>
+                </complexContent>
+              </complexType>
+            </element>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+
+      <!-- ~~~ DECISION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="decision">
+        <annotation><documentation>Decision gateway: selects one path out of many alternatives.  
+        When an execution comes in, exactly one outgoing transition is taken.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element name="handler" minOccurs="0" type="tns:wireObjectType" />
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element name="transition" minOccurs="0" maxOccurs="unbounded">
+              <complexType>
+                <complexContent>
+                  <extension base="tns:transitionType">
+                    <sequence>
+                      <element name="condition" minOccurs="0" maxOccurs="unbounded">
+                        <complexType>
+                          <attribute name="expr" type="string">
+                            <annotation><documentation>The script text that will be evaluated.  
+                            </documentation></annotation>
+                          </attribute>
+                          <attribute name="lang" type="string">
+                            <annotation><documentation>Identification of the scripting language 
+                            to use.</documentation></annotation>
+                          </attribute>
+                        </complexType>
+                      </element>
+                    </sequence>
+                  </extension>
+                </complexContent>
+              </complexType>
+              <!-- TODO add conditions -->
+            </element>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+          <attribute name="expr" type="string">
+            <annotation><documentation>The script that will be evaluated and resolve to 
+            the name of the outgoing transition.
+            </documentation></annotation>
+          </attribute>
+          <attribute name="lang" type="string">
+            <annotation><documentation>Identification of the scripting language 
+            to use for the expr attribute.</documentation></annotation>
+          </attribute>
+        </complexType>
+      </element>
+
+      <!-- ~~~ FORK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="fork">
+        <annotation><documentation>Spawns multiple concurrent paths of 
+        execution.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+    
+      <!-- ~~~ JOIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="join">
+        <annotation><documentation>Spawns multiple concurrent paths of 
+        execution.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+
+      <!-- ~~~ SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="script">
+        <annotation><documentation>Evaluates a piece of text as a script
+        </documentation></annotation>
+        <complexType>
+          <complexContent>
+            <extension base="tns:scriptType">
+              <sequence>
+                <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+                <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+              </sequence>
+              <attributeGroup ref="tns:activityAttributes" />
+            </extension>
+          </complexContent>
+        </complexType>
+      </element>
+
+      <!-- ~~~ HQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="hql">
+        <annotation><documentation>Performs a hibernate query
+        </documentation></annotation>
+        <complexType>
+          <complexContent>
+            <extension base="tns:qlType">
+              <sequence>
+                <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+                <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+              </sequence>
+              <attributeGroup ref="tns:activityAttributes" />
+            </extension>
+          </complexContent>
+        </complexType>
+      </element>
+
+      <!-- ~~~ SQL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="sql">
+        <annotation><documentation>Performs a hibernate SQL query
+        </documentation></annotation>
+        <complexType>
+          <complexContent>
+            <extension base="tns:qlType">
+              <sequence>
+                <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+                <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+              </sequence>
+              <attributeGroup ref="tns:activityAttributes" />
+            </extension>
+          </complexContent>
+        </complexType>
+      </element>
+
+      <!-- ~~~ JAVA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="java">
+        <annotation><documentation>Invokes a method on a java object.  
+        Either the java class is instantiated with reflection, or the 
+        java object is fetched from the environment.  Then values from the 
+        environment are injected into the fields and a method is executed.
+        </documentation></annotation>
+        <complexType>
+          <complexContent>
+            <extension base="tns:javaType">
+              <sequence>
+                <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+                <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+              </sequence>
+              <attributeGroup ref="tns:activityAttributes" />
+            </extension>
+          </complexContent>
+        </complexType>
+      </element>
+
+      <!-- ~~~ ESB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="esb">
+        <annotation><documentation>Invokes a service over the ESB.  
+        </documentation></annotation>
+        <complexType>
+          <complexContent>
+            <extension base="tns:esbType">
+              <sequence>
+                <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+                <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+              </sequence>
+              <attributeGroup ref="tns:activityAttributes" />
+            </extension>
+          </complexContent>
+        </complexType>
+      </element>
+
+      <!-- ~~~ TASK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="task">
+        <annotation><documentation>Creates a task in the task component.  
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <element name="assignment-handler" minOccurs="0"  type="tns:wireObjectType" />
+            <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
+            <element name="transition" minOccurs="0" maxOccurs="unbounded">
+              <complexType>
+                <complexContent>
+                  <extension base="tns:transitionType">
+                    <sequence>
+                      <element ref="tns:timer" minOccurs="0" />
+                    </sequence>
+                  </extension>
+                </complexContent>
+              </complexType>
+            </element>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+          <attributeGroup ref="tns:assignmentAttributes"/>
+          <attribute name="swimlane" type="string" />
+          <attribute name="on-transition" default="cancel">
+            <simpleType>
+              <restriction base="string">
+                <enumeration value="keep"/>
+                <enumeration value="cancel"/>
+              </restriction>
+            </simpleType>
+          </attribute>
+          <attribute name="completion" type="string" default="complete" />
+        </complexType>
+      </element>
+      
+      <!-- ~~~ SUB-PROCESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <element name="sub-process">
+        <annotation><documentation>Waits while a sub process instance is 
+        being executed and continues when the sub process instance ends.
+        </documentation></annotation>
+        <complexType>
+          <sequence minOccurs="0" maxOccurs="unbounded">
+            <element ref="tns:variable" minOccurs="0" maxOccurs="unbounded" />
+            <element ref="tns:out-variable" minOccurs="0" maxOccurs="unbounded" />
+            <element ref="tns:timer" 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 name="swimlane-mapping" minOccurs="0" maxOccurs="unbounded">
+              <complexType>
+                <attribute name="swimlane" type="string" use="required" />
+                <attribute name="sub-swimlane" type="string" use="required" />
+              </complexType>
+            </element>
+            <element name="transition" minOccurs="0" maxOccurs="unbounded">
+              <complexType>
+                <complexContent>
+                  <extension base="tns:transitionType">
+                    <sequence minOccurs="0" maxOccurs="unbounded">
+                      <element name="outcome-value">
+                        <complexType>
+                          <group ref="tns:wireObjectGroup" />
+                        </complexType>
+                      </element>
+                    </sequence>
+                  </extension>
+                </complexContent>
+              </complexType>
+            </element>
+          </sequence>
+          <attribute name="sub-process-id" type="string">
+            <annotation><documentation>Identifies the sub process by the id.  This means that a specific 
+              version of a process definition is referenced
+            </documentation></annotation>
+          </attribute>
+          <attribute name="sub-process-key" type="string">
+            <annotation><documentation>Identifies the sub process by the key.  This means that the latest 
+              version of the process definition with the given key is referenced.  The latest version 
+              of the process is looked up each time the activity executes.  
+            </documentation></annotation>
+          </attribute>
+          <attribute name="outcome" type="string">
+            <annotation><documentation>Expression that is evaluated when the sub process 
+            instance ends.  The value is then used for outcome transition mapping. 
+            </documentation></annotation>
+          </attribute>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+
+      <!-- ~~~ SUPER-STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+      <!-- 
+      <element name="super-state">
+        <annotation><documentation>Scope enclosing a number of activities.
+        </documentation></annotation>
+        <complexType>
+          <sequence>
+            <group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
+            <element ref="tns:transition" 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"/>
+          </sequence>
+          <attributeGroup ref="tns:activityAttributes" />
+        </complexType>
+      </element>
+      -->
+    </choice>
+  </group>
+  
+  <group name="wireObjectGroup">
+    <choice>
+      <element name="string">
+        <complexType>
+          <attribute name="name">
+            <annotation><documentation>the name of the string object</documentation></annotation>
+          </attribute>
+          <attribute name="value">
+            <annotation><documentation>the actual string value</documentation></annotation>
+          </attribute>
+        </complexType>
+      </element>
+      <element name="object" type="tns:wireObjectType" />
+    </choice>
+  </group>
+  
+  <complexType name="wireObjectType">
+    <sequence>
+      <element name="field" minOccurs="0" maxOccurs="unbounded">
+        <annotation><documentation>Field injections from the environment 
+        invocation.</documentation></annotation>
+        <complexType >
+          <group ref="tns:wireObjectGroup" />
+          <attribute name="name" type="string">
+            <annotation><documentation>Name of the field in which the value should be injected.
+            </documentation></annotation>
+          </attribute>
+        </complexType>
+      </element>
+    </sequence>
+    <attribute name="object" type="string">
+      <annotation><documentation>Name of the object in the environment 
+      </documentation></annotation>
+    </attribute>
+    <attribute name="class" type="string">
+      <annotation><documentation>The class to instantiate.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="name" type="string">
+      <annotation><documentation>The name of this object.
+      </documentation></annotation>
+    </attribute>
+  </complexType>
+
+  <complexType name="javaType">
+    <sequence>
+      <element name="field" minOccurs="0" maxOccurs="unbounded">
+        <annotation><documentation>Field injections from the environment 
+        invocation.</documentation></annotation>
+      </element>
+      <element name="arg" minOccurs="0" maxOccurs="unbounded">
+        <annotation><documentation>Method arguments.</documentation></annotation>
+      </element>
+    </sequence>
+    <attribute name="object" type="string">
+      <annotation><documentation>Name of the object in the environment 
+      </documentation></annotation>
+    </attribute>
+    <attribute name="method" type="string" use="required">
+      <annotation><documentation>The name of the method to invoke.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="class" type="string">
+      <annotation><documentation>The class to instantiate.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="var" type="string">
+      <annotation><documentation>The variable name to store the return value
+      </documentation></annotation>
+    </attribute>
+  </complexType>
+
+  <complexType name="scriptType">
+    <sequence>
+      <element name="text" type="string" minOccurs="0">
+        <annotation><documentation>The content of this expression element 
+        is the script text that will be evaluated.  This is mutually 
+        exclusive with the expression attribute.</documentation></annotation>
+      </element>
+    </sequence>
+    <attribute name="expr" type="string">
+      <annotation><documentation>The script text that will be evaluated.  This 
+      is mutually exclusive with the expression element.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="lang" type="string">
+      <annotation><documentation>Identification of the scripting language 
+      to use.</documentation></annotation>
+    </attribute>
+    <attribute name="var" type="string">
+      <annotation><documentation>Name of the variable in which the result 
+      of the script evaluation will be stored</documentation></annotation>
+    </attribute>
+  </complexType>
+  
+  <complexType name="qlType">
+    <sequence>
+      <element name="query" type="string">
+        <annotation><documentation>The query text.</documentation></annotation>
+      </element>
+      <element name="parameters" minOccurs="0">
+        <annotation><documentation>Query parameters.</documentation></annotation>
+        <complexType>
+          <sequence>
+            <group ref="tns:wireObjectGroup" maxOccurs="unbounded" />
+          </sequence>
+        </complexType>
+      </element>
+    </sequence>
+    <attribute name="var" type="string">
+      <annotation><documentation>Name of the variable in which the result 
+      of the script evaluation will be stored</documentation></annotation>
+    </attribute>
+    <attribute name="unique" type="string">
+      <annotation><documentation>Does this query return a unique result or a list
+      </documentation></annotation>
+    </attribute>
+  </complexType>
+  
+  <complexType name="esbType">
+    <sequence>
+      <element name="part" minOccurs="0" maxOccurs="unbounded">
+        <annotation><documentation>The content of this expression element 
+        is the script text that will be evaluated.  This is mutually 
+        exclusive with the expression attribute.</documentation></annotation>
+        <complexType>
+          <choice minOccurs="0">
+            <group ref="tns:wireObjectGroup" />
+          </choice>
+          <attribute name="name" type="string">
+            <annotation><documentation>The name of the message body part.
+            </documentation></annotation>
+          </attribute>
+          <attribute name="expr" type="string">
+            <annotation><documentation>The script text that will be evaluated and 
+            used and the object in this message body part.
+            </documentation></annotation>
+          </attribute>
+        </complexType>
+      </element>
+    </sequence>
+    <attribute name="category" type="string">
+      <annotation><documentation>The category of the service in the esb.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="service" type="string">
+      <annotation><documentation>The name of the service in the esb.
+      </documentation></annotation>
+    </attribute>
+  </complexType>
+  
+  <attributeGroup name="activityAttributes">
+    <attribute name="name" type="string">
+      <annotation><documentation>The id of this activity.  The name should be unique
+      in the complete scope of the process.</documentation></annotation>
+    </attribute>
+    <attribute name="g" type="string">
+      <annotation><documentation>Graphical information used by process designer tool.
+      </documentation></annotation>
+    </attribute>
+  </attributeGroup>
+  
+  <attributeGroup name="assignmentAttributes">
+    <annotation><documentation>the assignment attributes will be used in 
+      tasks and swimlanes to specify to whom these respectively are assigned.
+    </documentation></annotation>
+    <attribute name="assignee" type="string">
+      <annotation><documentation>Expression that resolves to a userId referencing 
+      the person to which the task or swimlane will be assigned.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="assignee-lang" type="string">
+      <annotation><documentation>Expression language for the assignee attribute.
+      </documentation></annotation>
+    </attribute>
+    <attribute name="candidate-users" type="string">
+      <annotation><documentation>Expression that resolves to a comma separated 
+      list of userId's. All the referred people will be candidates for 
+      take the task or swimlane.</documentation></annotation>
+    </attribute>
+    <attribute name="candidate-users-lang" type="string">
+      <annotation><documentation>Expression language for the 
+      candidate-users attribute.</documentation></annotation>
+    </attribute>
+    <attribute name="candidate-groups" type="string">
+      <annotation><documentation>Resolves to a comma separated list of groupId's.  
+      All the referred people will be candidates to 
+      take the task or swimlane.</documentation></annotation>
+    </attribute>
+    <attribute name="candidate-groups-lang" type="string">
+      <annotation><documentation>Expression language for the 
+      candidate-groups attribute.</documentation></annotation>
+    </attribute>
+  </attributeGroup>
+  
+  <element name="swimlane">
+    <annotation><documentation>A process role.</documentation></annotation>
+    <complexType>
+      <attribute name="name" type="string" use="required" />
+      <attributeGroup ref="tns:assignmentAttributes" />
+    </complexType>
+  </element>
+  
+  <complexType name="transitionType">
+    <annotation><documentation>The outgoing transitions.  The first in the list 
+      will be the default outgoing transition.
+    </documentation></annotation>
+    <sequence>
+      <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
+    </sequence>
+    <attribute name="name" type="string">
+      <annotation><documentation>Name of this outgoing transition</documentation></annotation>
+    </attribute>
+    <attribute name="to" type="string">
+      <annotation><documentation>Name of the destination activity of this transition. 
+      </documentation></annotation>
+    </attribute>
+    <attribute name="g" type="string">
+      <annotation><documentation>Graphical information used by process designer tool.
+      </documentation></annotation>
+    </attribute>
+  </complexType>
+  
+  <element name="transition" type="tns:transitionType">
+    <annotation><documentation>A transition from one activity to another.</documentation></annotation>
+  </element>
+  
+  <element name="on">
+    <complexType>
+      <sequence>
+        <element ref="tns:timer" minOccurs="0" />
+        <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+          <annotation><documentation>A list of event listeners that will 
+          be notified when the event is fired</documentation></annotation>
+        </group>
+      </sequence>
+      <attribute name="event" type="string">
+        <annotation><documentation>The event identification.  start, end, take or 
+        any other custom event.
+        </documentation></annotation>
+      </attribute>
+    </complexType>
+  </element>
+
+  <element name="variable">
+    <complexType>
+      <attribute name="name" type="string">
+        <annotation><documentation>The name of the variable.
+        </documentation></annotation>
+      </attribute>
+      <attribute name="init" type="string">
+        <annotation><documentation>An expression for which the resulting 
+        value will be used as initial value for the variable.
+        </documentation></annotation>
+      </attribute>
+    </complexType>
+  </element>
+
+  <element name="out-variable">
+    <complexType>
+      <attribute name="name" type="string">
+        <annotation><documentation>The name of the variable.
+        </documentation></annotation>
+      </attribute>
+      <attribute name="init" type="string">
+        <annotation><documentation>An expression that will be resolved in the 
+        inner scope and for which the resulting value will be set as a variable 
+        in the outer scope.
+        </documentation></annotation>
+      </attribute>
+    </complexType>
+  </element>
+
+  <element name="timer">
+    <complexType>
+      <sequence>
+        <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
+          <annotation><documentation>A list of event listeners that will 
+          be notified when the timer fires</documentation></annotation>
+        </group>
+      </sequence>
+      <attribute name="duedate" type="string">
+        <annotation><documentation>Timer duedate expression that defines the duedate of this 
+        timer relative to the creation time of the timer.  E.g. '2 hours' or '4 business days'
+        </documentation></annotation>
+      </attribute>
+      <attribute name="repeat" type="string">
+        <annotation><documentation>Timer duedate expression that defines repeated scheduling 
+        relative to the last timer fire event.  E.g. '2 hours' or '4 business days'
+        </documentation></annotation>
+      </attribute>
+      <attribute name="duedatetime" type="string">
+        <annotation><documentation>Absolute time in format <code>HH:mm dd/MM/yyyy</code> 
+        (see SimpleDateFormat).  The format for the absolute time can be customized in the 
+        jbpm configuration. 
+        </documentation></annotation>
+      </attribute>
+    </complexType>
+  </element>
+  
+  <group name="eventListenerGroup">
+    <choice>
+      <element name="event-listener" type="tns:wireObjectType" />
+      <element name="hql" type="tns:qlType" />
+      <element name="sql" type="tns:qlType" />
+      <element name="java" type="tns:javaType" />
+      <element name="script" type="tns:scriptType" />
+      <element name="esb" type="tns:esbType" />
+    </choice>
+  </group>
+
+  <complexType name="emailType">
+    <sequence>
+      <element name="property">
+        <annotation><documentation>Template property value</documentation></annotation>
+        <complexType>
+          <attribute name="name" type="string" />
+          <attribute name="value" type="string" />
+        </complexType>
+      </element>
+    </sequence>
+    <attribute name="to" type="string" />
+    <attribute name="type" type="string">
+      <annotation><documentation>Reference to the email template</documentation></annotation>
+    </attribute>
+  </complexType>
+
+  <complexType name="taskType" >
+    <!-- 
+    <sequence>
+      <element name="reminder">
+        <complexType>
+          <attribute name="duedate" type="string" use="required" />
+          <attribute name="repeat" type="string" />
+        </complexType>
+      </element>
+    </sequence>
+    -->
+    <attributeGroup ref="tns:assignmentAttributes" />
+    <attribute name="form" type="string">
+    </attribute>
+    <attribute name="swimlane" type="string">
+    </attribute>
+    <attribute name="description" type="string" />
+    <attribute name="duedate" type="string" />
+    <attribute name="notify" type="boolean" default="false"/>
+    <!-- 
+    <attribute name="subtasksync">
+      <simpleType>
+        <union>
+          <simpleType>
+            <restriction base="string">
+              <enumeration value="last">
+                <annotation><documentation>When the last subtask completes,
+                this task is completed.</documentation></annotation>
+              </enumeration>
+              <enumeration value="first">
+                <annotation><documentation>When the first subtask completes,
+                this task is completed.</documentation></annotation>
+              </enumeration>
+            </restriction>
+          </simpleType>
+          <simpleType>
+            <restriction base="int">
+              <annotation><documentation>The number of subtasks that 
+              have to complete before this task is considered 
+              completed.</documentation></annotation>
+            </restriction>
+          </simpleType>
+        </union>
+      </simpleType>
+    </attribute>
+    -->
+  </complexType>
+  
+  <!-- 
+  <element name="timer">
+    <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
+    Timers can give a signal to an activity instance.  The signal will correspond to a transition 
+    or to an event being fired.
+    </documentation></annotation>
+    <complexType>
+      <choice minOccurs="0" maxOccurs="unbounded">
+        <group ref="tns:eventListenerGroup">
+          <annotation><documentation>An inline list of event listeners 
+          on a timer is a short cut for defining the event separately.
+          </documentation></annotation>
+        </group>
+      </choice>
+      <attribute name="duedate" type="string" use="required" />
+      <attribute name="signal" type="string"  use="required">
+        <annotation><documentation>Refers to the signal that will be used.
+        If inline event listeners are declared, the signal name can not be 
+        the same as an event that is declared in this scope.
+        </documentation></annotation>
+      </attribute>
+      <attribute name="repeat" type="string" />
+    </complexType>
+  </element>
+
+  <simpleType name="priorityType">
+    <restriction base="string">
+      <enumeration value="highest"/>
+      <enumeration value="high"/>
+      <enumeration value="normal"/>
+      <enumeration value="low"/>
+      <enumeration value="lowest"/>
+    </restriction>
+  </simpleType>
+
+  -->
+  
+</schema>

Added: jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterTest.java
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterTest.java	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/JpdlConverterTest.java	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,49 @@
+/*
+ * 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.jpdl.internal.convert;
+
+import java.net.URL;
+import java.util.List;
+
+import org.jbpm.api.Problem;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+
+public class JpdlConverterTest extends junit.framework.TestCase {
+	public void testSimpleProcessFile() throws Exception {
+		ConverterContext context = new ConverterContext();
+		URL url = getClass().getClassLoader().getResource("processdefinition.xml");
+		context.put(ConverterContext.PROCESS_FILE_URL, url);
+		//Convert to process file to jpdl4
+		JpdlConverter converter = new JpdlConverter(context);
+		org.jbpm.jpdl4.model.Process process = converter.run();
+		Jpdl4Writer writer = new Jpdl4Writer();
+		java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
+		writer.write(process, bout, false);
+		
+		//Validate it with Jpdl4Parser
+		String jpdl4xml = new String(bout.toByteArray());
+		List<Problem> problems = new JpdlParser().createParse().setString(
+				jpdl4xml).execute().getProblems();
+		assertEquals(problems.toString(), 0, problems.size());
+	}
+
+}

Added: jbpm4/branches/jimma/modules/migration/src/test/resources/processdefinition.xml
===================================================================
--- jbpm4/branches/jimma/modules/migration/src/test/resources/processdefinition.xml	                        (rev 0)
+++ jbpm4/branches/jimma/modules/migration/src/test/resources/processdefinition.xml	2009-05-04 02:27:15 UTC (rev 4700)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition 
+  xmlns="urn:jbpm.org:jpdl-3.2"
+  name="simple">
+   <start-state name="start">
+      <transition name="to_state" to="first">
+         <action name="action" class="com.sample.action.MessageActionHandler">
+            <message>Going to the first state!</message>
+         </action>
+      </transition>
+   </start-state>
+   <state name="first">
+      <transition name="to_end" to="end">
+         <action name="action" class="com.sample.action.MessageActionHandler">
+            <message>About to finish!</message>
+         </action>
+      </transition>
+   </state>
+   <end-state name="end"></end-state>
+</process-definition>
\ No newline at end of file




More information about the jbpm-commits mailing list