Author: alex.guizar(a)jboss.com
Date: 2009-10-08 18:51:44 -0400 (Thu, 08 Oct 2009)
New Revision: 5721
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2574/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2574/JBPM2574Test.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/gpd.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/processdefinition.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/gpd.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml
Removed:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/EsbActionHandler.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/file/def/FileDefinition.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/FileArchiveParser.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/IoUtil.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/file/def/FileDefinitionFileSystemConfigTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml
Log:
[JBPM-2574] throw ClassNotFoundException instead of JbpmException when process class
loader attempts to load inexistent class
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/file/def/FileDefinition.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/file/def/FileDefinition.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/file/def/FileDefinition.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -22,7 +22,6 @@
package org.jbpm.file.def;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -48,7 +47,7 @@
public class FileDefinition extends ModuleDefinition {
private static final long serialVersionUID = 1L;
-
+
static String getRootDir() {
String rootDir = null;
if (JbpmConfiguration.Configs.hasObject("jbpm.files.dir")) {
@@ -57,13 +56,9 @@
return rootDir;
}
- String dir = null;
+ String dir;
+ Map processFiles;
- Map processFiles = null;
-
- public FileDefinition() {
- }
-
public ModuleInstance createInstance() {
return null;
}
@@ -74,30 +69,60 @@
* add a file to this definition.
*/
public void addFile(String name, byte[] bytes) {
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- addFile(name, bais);
+ try {
+ if (isStoredOnFileSystem()) {
+ storeFileInFileSystem(name, bytes);
+ }
+ else {
+ // it is stored in the database
+ storeFileInDb(name, bytes);
+ }
+ }
+ catch (IOException e) {
+ throw new JbpmException("file '" + name + "' could not be
stored", e);
+ }
}
+ void storeFileInFileSystem(String name, byte[] bytes) throws IOException {
+ File filePath = getFilePath(name);
+ log.trace("storing '" + name + "' to file '" +
filePath + "'");
+
+ FileOutputStream fos = new FileOutputStream(filePath);
+ fos.write(bytes);
+ fos.close();
+ }
+
+ void storeFileInDb(String name, byte[] bytes) {
+ if (processFiles == null) {
+ processFiles = new HashMap();
+ }
+ log.trace("preparing '" + name + "' for storage in the
database");
+ processFiles.put(name, new ByteArray(name, bytes));
+ }
+
/**
* add a file to this definition.
*/
public void addFile(String name, InputStream is) {
try {
if (isStoredOnFileSystem()) {
- storeFileOnFileSystem(name, is);
-
- } else { // its stored in the database
+ storeFileInFileSystem(name, is);
+ }
+ else {
+ // it is stored in the database
storeFileInDb(name, is);
}
- } catch (Exception e) {
+ }
+ catch (IOException e) {
throw new JbpmException("file '" + name + "' could not be
stored", e);
}
}
- void storeFileOnFileSystem(String name, InputStream is) throws FileNotFoundException,
IOException {
- String fileName = getFilePath(name);
- log.trace("storing file '" + name + "' on file system to
'" + fileName + "'");
- FileOutputStream fos = new FileOutputStream(fileName);
+ void storeFileInFileSystem(String name, InputStream is) throws IOException {
+ File filePath = getFilePath(name);
+ log.trace("storing '" + name + "' to file '" +
filePath + "'");
+
+ FileOutputStream fos = new FileOutputStream(filePath);
IoUtil.transfer(is, fos);
fos.close();
}
@@ -106,45 +131,39 @@
if (processFiles == null) {
processFiles = new HashMap();
}
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- log.trace("preparing file '" + name + "' for storage in the
database");
- IoUtil.transfer(is, baos);
- processFiles.put(name, new ByteArray(name, baos.toByteArray()));
+ log.trace("preparing '" + name + "' for storage in the
database");
+ processFiles.put(name, new ByteArray(name, IoUtil.readBytes(is)));
}
- // retrieving files //////////////////////////////////////////////////////////
-
/**
- * retrieve a file of this definition as an inputstream.
+ * retrieve a file of this definition as an input stream.
*/
public InputStream getInputStream(String name) {
- InputStream inputStream = null;
- try {
- if (isStoredOnFileSystem()) {
- inputStream = getInputStreamFromFileSystem(name);
- } else { // its stored in the database
- inputStream = getInputStreamFromDb(name);
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't get inputstream for file '" +
name + "'", e);
+ InputStream inputStream;
+ if (isStoredOnFileSystem()) {
+ inputStream = getInputStreamFromFileSystem(name);
}
+ else {
+ // it is stored in the database
+ inputStream = getInputStreamFromDb(name);
+ }
return inputStream;
}
public boolean hasFile(String name) {
if (isStoredOnFileSystem()) {
- return new File(getFilePath(name)).exists();
- } else {
- return processFiles == null ? false : processFiles.containsKey(name);
+ return getFilePath(name).exists();
}
+ else {
+ return processFiles != null ? processFiles.containsKey(name) : false;
+ }
}
public Map getInputStreamMap() {
HashMap result = new HashMap();
if (processFiles != null) {
- Iterator iterator = processFiles.keySet().iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
+ for (Iterator iter = processFiles.keySet().iterator(); iter.hasNext();) {
+ String name = (String) iter.next();
result.put(name, getInputStream(name));
}
}
@@ -154,79 +173,84 @@
public Map getBytesMap() {
HashMap result = new HashMap();
if (processFiles != null) {
- Iterator iterator = processFiles.keySet().iterator();
- while (iterator.hasNext()) {
- String name = (String) iterator.next();
+ for (Iterator iter = processFiles.keySet().iterator(); iter.hasNext();) {
+ String name = (String) iter.next();
result.put(name, getBytes(name));
}
}
return result;
}
- private InputStream getInputStreamFromFileSystem(String name) throws
FileNotFoundException {
- InputStream inputStream = null;
- String fileName = getFilePath(name);
- log.trace("loading file '" + name + "' from file system
'" + fileName + "'");
- inputStream = new FileInputStream(fileName);
- return inputStream;
+ private InputStream getInputStreamFromFileSystem(String name) {
+ try {
+ File filePath = getFilePath(name);
+ if (log.isTraceEnabled())
+ log.trace("loading '" + name + "' from file '" +
filePath + "'");
+ return filePath.canRead() ? new FileInputStream(filePath) : null;
+ }
+ catch (FileNotFoundException e) {
+ return null;
+ }
}
private InputStream getInputStreamFromDb(String name) {
- InputStream inputStream = null;
- log.trace("loading file '" + name + "' from database");
- ByteArray byteArray = getByteArray(name);
- if (byteArray != null) {
- inputStream = new ByteArrayInputStream(byteArray.getBytes());
- }
- return inputStream;
+ if (log.isTraceEnabled()) log.trace("loading '" + name + "'
from database");
+ byte[] bytes = getBytesFromDb(name);
+ return bytes != null ? new ByteArrayInputStream(bytes) : null;
}
/**
* retrieve a file of this definition as a byte array.
*/
public byte[] getBytes(String name) {
- byte[] bytes = null;
- try {
- if (isStoredOnFileSystem()) {
- bytes = getBytesFromFileSystem(name);
- } else { // its stored in the database
- bytes = getBytesFromDb(name);
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't get value for file '" + name +
"'", e);
+ byte[] bytes;
+ if (isStoredOnFileSystem()) {
+ bytes = getBytesFromFileSystem(name);
}
+ else {
+ // it is stored in the database
+ bytes = getBytesFromDb(name);
+ }
return bytes;
}
- byte[] getBytesFromFileSystem(String name) throws IOException {
- byte[] bytes = null;
+ byte[] getBytesFromFileSystem(String name) {
InputStream in = getInputStreamFromFileSystem(name);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- IoUtil.transfer(in, out);
- bytes = out.toByteArray();
- return bytes;
+ if (in == null) return null;
+
+ try {
+ return IoUtil.readBytes(in);
+ }
+ catch (IOException e) {
+ return null;
+ }
+ finally {
+ try {
+ in.close();
+ }
+ catch (IOException e) {
+ // disregard exception on close
+ }
+ }
}
byte[] getBytesFromDb(String name) {
- byte[] bytes;
- ByteArray byteArray = getByteArray(name);
- bytes = byteArray.getBytes();
- return bytes;
+ if (processFiles != null) {
+ ByteArray byteArray = (ByteArray) processFiles.get(name);
+ if (byteArray != null) return byteArray.getBytes();
+ }
+ return null;
}
- ByteArray getByteArray(String name) {
- return (ByteArray) (processFiles != null ? processFiles.get(name) : null);
- }
-
boolean isStoredOnFileSystem() {
String rootDir = getRootDir();
boolean isStoredOnFileSystem = (rootDir != null);
- // if files should be stored on the file system and no directory has been
- // created yet...
- if ((isStoredOnFileSystem) && (dir == null)) {
+ // if files should be stored on the file system
+ // and no directory has been created yet...
+ if (isStoredOnFileSystem && dir == null) {
// create a new directory
dir = findNewDirName();
- new File(rootDir + "/" + dir).mkdirs();
+ new File(rootDir, dir).mkdirs();
}
return isStoredOnFileSystem;
}
@@ -254,11 +278,15 @@
return newDirName;
}
- String getFilePath(String name) {
- String filePath = getRootDir() + "/" + dir + "/" + name;
- new File(filePath).getParentFile().mkdirs();
+ File getFilePath(String name) {
+ File filePath = new File(getRootDir()
+ + File.separatorChar
+ + dir
+ + File.separatorChar
+ + name);
+ filePath.getParentFile().mkdirs();
return filePath;
}
-
+
private static final Log log = LogFactory.getLog(FileDefinition.class);
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/FileArchiveParser.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/FileArchiveParser.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/FileArchiveParser.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -21,27 +21,29 @@
*/
package org.jbpm.jpdl.par;
-import java.util.*;
-import org.jbpm.file.def.*;
-import org.jbpm.graph.def.*;
+import java.util.Iterator;
+import java.util.Map;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.graph.def.ProcessDefinition;
+
public class FileArchiveParser implements ProcessArchiveParser {
private static final long serialVersionUID = 1L;
public ProcessDefinition readFromArchive(ProcessArchive processArchive,
ProcessDefinition processDefinition) {
- FileDefinition fileDefinition = (FileDefinition)
processDefinition.getDefinition(FileDefinition.class);
Map entries = processArchive.getEntries();
- Iterator iter = entries.keySet().iterator();
- while (iter.hasNext()) {
- String entryName = (String) iter.next();
+ if (!entries.isEmpty()) {
+ // get or create file definition
+ FileDefinition fileDefinition = processDefinition.getFileDefinition();
if (fileDefinition == null) {
fileDefinition = new FileDefinition();
processDefinition.addDefinition(fileDefinition);
}
- byte[] entry = (byte[]) entries.get(entryName);
- if(entry != null) {
- fileDefinition.addFile(entryName, entry);
+ // add file entries to definition
+ for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ fileDefinition.addFile((String) entry.getKey(), (byte[]) entry.getValue());
}
}
return processDefinition;
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/IoUtil.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/IoUtil.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/IoUtil.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -26,40 +26,25 @@
import java.io.InputStream;
import java.io.OutputStream;
-public class IoUtil
-{
+public class IoUtil {
+
private static final int BUFFERSIZE = 4096;
// hide default constructor
- private IoUtil()
- {
+ private IoUtil() {
}
- public static byte[] readBytes(InputStream inputStream) throws IOException
- {
- if (inputStream == null)
- throw new IllegalArgumentException("InputStream cannot be null");
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- transfer(inputStream, outputStream);
- byte[] bytes = outputStream.toByteArray();
- outputStream.close();
- return bytes;
+ public static byte[] readBytes(InputStream in) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ transfer(in, out);
+ return out.toByteArray();
}
- public static int transfer(InputStream in, OutputStream out) throws IOException
- {
- if (in == null || out == null)
- throw new IllegalArgumentException("In/OutStream cannot be null");
-
+ public static int transfer(InputStream in, OutputStream out) throws IOException {
int total = 0;
byte[] buffer = new byte[BUFFERSIZE];
- int bytesRead = in.read(buffer);
- while (bytesRead != -1)
- {
+ for (int bytesRead; (bytesRead = in.read(buffer)) != -1; total += bytesRead) {
out.write(buffer, 0, bytesRead);
- total += bytesRead;
- bytesRead = in.read(buffer);
}
return total;
}
Copied:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
(from rev 5670,
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/EsbActionHandler.java)
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,73 @@
+/*
+ * 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.soa.esb.services.jbpm.actionhandlers;
+
+import java.util.Iterator;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.dom4j.Element;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class EsbActionHandler implements ActionHandler {
+
+ private String esbCategoryName;
+ private String esbServiceName;
+ private Element bpmToEsbVars;
+ private Element esbToBpmVars;
+ private String exceptionTransition;
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = LogFactory.getLog(EsbActionHandler.class);
+
+ public void execute(ExecutionContext executionContext) {
+ log.debug("'invoking' " + esbCategoryName + "::" +
esbServiceName);
+ try {
+ for (Iterator i = bpmToEsbVars.elementIterator(); i.hasNext();) {
+ Element bpmToEsbVar = (Element) i.next();
+ String var = bpmToEsbVar.attributeValue("bpm");
+ Object value = executionContext.getVariable(var);
+ log.debug("read " + value + " from variable " + var);
+ }
+ Random random = new Random();
+ for (Iterator i = esbToBpmVars.elementIterator(); i.hasNext();) {
+ Element esbToBpmVar = (Element) i.next();
+ String var = esbToBpmVar.attributeValue("bpm");
+ byte[] value = new byte[random.nextInt(2048)];
+ random.nextBytes(value);
+ executionContext.setVariable(var, value);
+ log.debug("wrote " + value.length + " bytes to variable " +
var);
+ }
+ executionContext.leaveNode();
+ }
+ catch (RuntimeException e) {
+ executionContext.leaveNode(exceptionTransition);
+ }
+ }
+
+}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/file/def/FileDefinitionFileSystemConfigTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/file/def/FileDefinitionFileSystemConfigTest.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/file/def/FileDefinitionFileSystemConfigTest.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -26,24 +26,23 @@
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
-public class FileDefinitionFileSystemConfigTest extends FileDefinitionDbConfigTest
-{
+public class FileDefinitionFileSystemConfigTest extends FileDefinitionDbConfigTest {
JbpmContext jbpmContext = null;
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
super.setUp();
ProtectionDomain clazz =
FileDefinitionFileSystemConfigTest.class.getProtectionDomain();
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context name='default.jbpm.context' />" +
- " <string name='jbpm.files.dir'>" +
clazz.getCodeSource().getLocation().getFile().toString() + "</string>" +
- "</jbpm-configuration>");
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration
+ .parseXmlString("<jbpm-configuration>"
+ + " <jbpm-context name='default.jbpm.context' />"
+ + " <string name='jbpm.files.dir'>"
+ + clazz.getCodeSource().getLocation().getFile().toString()
+ + "</string>"
+ + "</jbpm-configuration>");
jbpmContext = jbpmConfiguration.createJbpmContext();
}
- protected void tearDown() throws Exception
- {
+ protected void tearDown() throws Exception {
jbpmContext.close();
super.tearDown();
}
Deleted:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/EsbActionHandler.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/EsbActionHandler.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/EsbActionHandler.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -1,67 +0,0 @@
-/*
- * 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.jbpm2094;
-
-import java.util.Iterator;
-import java.util.Random;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.dom4j.Element;
-
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-
-/**
- * @author Alejandro Guizar
- */
-public class EsbActionHandler implements ActionHandler {
-
- private String esbCategoryName;
- private String esbServiceName;
- private Element bpmToEsbVars;
- private Element esbToBpmVars;
-
- private static final long serialVersionUID = 1L;
- private static final Log log = LogFactory.getLog(EsbActionHandler.class);
-
- public void execute(ExecutionContext executionContext) throws Exception {
- log.debug("simulating invocation of " + esbCategoryName + "::" +
esbServiceName);
- for (Iterator i = bpmToEsbVars.elementIterator(); i.hasNext();) {
- Element bpmToEsbVar = (Element) i.next();
- String var = bpmToEsbVar.attributeValue("bpm");
- Object value = executionContext.getVariable(var);
- log.debug("read " + value + " from variable " + var);
- }
- Random random = new Random();
- for (Iterator i = esbToBpmVars.elementIterator(); i.hasNext();) {
- Element esbToBpmVar = (Element) i.next();
- String var = esbToBpmVar.attributeValue("bpm");
- byte[] value = new byte[random.nextInt(2048)];
- random.nextBytes(value);
- executionContext.setVariable(var, value);
- log.debug("wrote " + value.length + " bytes to variable " +
var);
- }
- executionContext.leaveNode();
- }
-
-}
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2574/JBPM2574Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2574/JBPM2574Test.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2574/JBPM2574Test.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,45 @@
+package org.jbpm.jbpm2574;
+
+import org.jbpm.JbpmException;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.file.def.FileDefinition;
+import org.jbpm.graph.def.DelegationException;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Attempt to load inexistent class throws {@link JbpmException} instead of
+ * {@link ClassNotFoundException}
+ *
+ * @see <a
href="https://jira.jboss.org/jira/browse/JBPM-2574">JBPM-257...
+ * @author Alejandro Guizar
+ */
+public class JBPM2574Test extends AbstractDbTestCase {
+
+ private long processDefinitionId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ ProcessDefinition processDefinition = ProcessDefinition
+ .parseXmlResource("org/jbpm/jbpm2574/processdefinition.xml");
+ processDefinition.addDefinition(new FileDefinition());
+ jbpmContext.deployProcessDefinition(processDefinition);
+ processDefinitionId = processDefinition.getId();
+ }
+
+ protected void tearDown() throws Exception {
+ graphSession.deleteProcessDefinition(processDefinitionId);
+ super.tearDown();
+ }
+
+ public void testLoadInexistentClass() {
+ try {
+ ProcessInstance processInstance =
jbpmContext.newProcessInstance("scripted");
+ processInstance.signal();
+ }
+ catch (DelegationException e) {
+ assert e.getCause() instanceof ClassNotFoundException : e.getCause();
+ }
+ }
+}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/scheduler/exe/UnsafeSessionUsageTest.java 2009-10-08
22:51:44 UTC (rev 5721)
@@ -23,17 +23,15 @@
"</process-definition>"
);
processDefinition = saveAndReload(processDefinition);
- try
- {
+ try {
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
-
+
jbpmContext.save(processInstance);
- processJobs(5000);
+ processJobs(60 * 1000);
}
- finally
- {
+ finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -7,7 +7,7 @@
</start-state>
<node async="true" name="Receive Order">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service1</esbCategoryName>
<esbServiceName>Service1</esbServiceName>
<bpmToEsbVars>
@@ -21,7 +21,7 @@
</node>
<node name="Validate Order">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service2</esbCategoryName>
<esbServiceName>Service2</esbServiceName>
<bpmToEsbVars>
@@ -41,7 +41,7 @@
</fork>
<node async="true" name="Los Angeles WHSE">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service5</esbCategoryName>
<esbServiceName>Service5</esbServiceName>
<bpmToEsbVars>
@@ -55,7 +55,7 @@
</node>
<node name="Dallas WHSE">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service6</esbCategoryName>
<esbServiceName>Service6</esbServiceName>
<bpmToEsbVars>
@@ -69,7 +69,7 @@
</node>
<node async="true" name="Atlanta WHSE">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service7</esbCategoryName>
<esbServiceName>Service7</esbServiceName>
<bpmToEsbVars>
@@ -87,7 +87,7 @@
</join>
<node name="Shipment Notice">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_ResultsService
</esbCategoryName>
<esbServiceName>ResultsService</esbServiceName>
@@ -106,7 +106,7 @@
<end-state name="End"/>
<node async="true" name="Inventory Check">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
<esbServiceName>Service4</esbServiceName>
<bpmToEsbVars>
@@ -120,7 +120,7 @@
</node>
<node name="Credit Check">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
<esbServiceName>Service3</esbServiceName>
<bpmToEsbVars>
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml 2009-10-08
11:31:17 UTC (rev 5720)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -7,7 +7,7 @@
</start-state>
<node async="true" name="Receive Order">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service1</esbCategoryName>
<esbServiceName>Service1</esbServiceName>
<bpmToEsbVars>
@@ -21,7 +21,7 @@
</node>
<node name="Validate Order">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service2</esbCategoryName>
<esbServiceName>Service2</esbServiceName>
<bpmToEsbVars>
@@ -47,7 +47,7 @@
</state>
<node name="Dallas WHSE">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service6</esbCategoryName>
<esbServiceName>Service6</esbServiceName>
<bpmToEsbVars>
@@ -61,7 +61,7 @@
</node>
<node async="true" name="Atlanta WHSE">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service7</esbCategoryName>
<esbServiceName>Service7</esbServiceName>
<bpmToEsbVars>
@@ -79,7 +79,7 @@
</join>
<node name="Shipment Notice">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_ResultsService
</esbCategoryName>
<esbServiceName>ResultsService</esbServiceName>
@@ -98,7 +98,7 @@
<end-state name="End"/>
<node async="true" name="Inventory Check">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
<esbServiceName>Service4</esbServiceName>
<bpmToEsbVars>
@@ -112,7 +112,7 @@
</node>
<node name="Credit Check">
- <action class="org.jbpm.jbpm2094.EsbActionHandler">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
<esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
<esbServiceName>Service3</esbServiceName>
<bpmToEsbVars>
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/gpd.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/gpd.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/gpd.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="CMTE CNND Ingest Content" width="912"
height="1048">
+ <node name="Start Content Ingestion" x="242" y="48"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Categorize Content" x="243" y="128"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-224" h1="0" w2="-1"
h2="-353"/>
+ </edge>
+ </node>
+ <node name="ValidateContent" x="240" y="458"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="RejectContent" x="448" y="384"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Diff Content" x="240" y="615"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-221" h1="-1" w2="0"
h2="152"/>
+ </edge>
+ </node>
+ <node name="Store Content" x="239" y="763"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-220" h1="0" w2="0"
h2="301"/>
+ </edge>
+ </node>
+ <node name="Content is valid?" x="241" y="535"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="207" h1="0" w2="0"
h2="151"/>
+ </edge>
+ </node>
+ <node name="Content is diff?" x="239" y="690"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Content mapped to category?" x="212"
y="211" width="196" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="204" h1="-1" w2="0"
h2="-174"/>
+ </edge>
+ </node>
+ <node name="Split Content" x="240" y="840"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-221" h1="-1" w2="0"
h2="377"/>
+ </edge>
+ </node>
+ <node name="More items?" x="240" y="911"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Diff Item" x="241" y="988"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-1" h1="31" w2="221"
h2="561"/>
+ <bendpoint w1="-297" h1="31" w2="-75"
h2="561"/>
+ <bendpoint w1="-297" h1="-150" w2="-75"
h2="380"/>
+ <bendpoint w1="-222" h1="-149" w2="0"
h2="381"/>
+ </edge>
+ </node>
+ <node name="Store Item" x="20" y="911"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Has item changed?" x="19" y="988"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Convert to XML" x="243" y="294"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ <bendpoint w1="-224" h1="0" w2="-1"
h2="-187"/>
+ </edge>
+ </node>
+ <node name="Error converting ?" x="242" y="384"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="Generate RSS" x="454" y="911"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="End Content Ingestion" x="453" y="690"
width="132" height="36"/>
+ <node name="Content Rejected" x="626" y="384"
width="132" height="36"/>
+ <node name="ExceptionHandling" x="19" y="458"
width="132" height="36"/>
+</root-container>
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/processdefinition.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/actual/processdefinition.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,291 @@
+<?xml version="1.0"?>
+
+<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="CMTE CNND
Ingest Content">
+ <event type="process-start">
+ <script>
+ System.out.println("==========> starting process: "+ node);
+ </script>
+ </event>
+ <event type="node-enter">
+ <script>
+ System.out.println("==========> entering node: "+node);
+ </script>
+ </event>
+
+ <start-state name="Start Content Ingestion">
+ <transition to="Categorize Content" name="to Categorize
Content"/>
+ </start-state>
+
+ <node name="Categorize Content">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <esbServiceName>Categorize Content</esbServiceName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ <mapping bpm="full_content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_reject_reason"
esb="content_reject_reason"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <event type="node-enter">
+ <script>
+ System.out.println("entering node: "+node);
+ </script>
+ </event>
+ <transition to="Content mapped to category?" name=""/>
+ <transition name="exception" to="ExceptionHandling"/>
+ </node>
+
+ <node name="ValidateContent">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>Validate Content</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="content_is_valid"
esb="content_is_valid"/>
+ <mapping bpm="content_reject_reason"
esb="content_reject_reason"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <transition to="Content is valid?"/>
+ <transition name="exception" to="ExceptionHandling"/>
+ </node>
+
+ <node name="RejectContent">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>Reject Content</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_reject_reason"
esb="content_reject_reason"/>
+ </bpmToEsbVars>
+ </action>
+ <transition to="Content Rejected"/>
+ </node>
+
+ <node name="Diff Content">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <esbServiceName>Diff Content</esbServiceName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="content_hash_code"
esb="content_hash_code"/>
+ <mapping bpm="content_is_diff" esb="content_is_diff"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <transition to="Content is diff?"/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <node name="Store Content">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>Store Content</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ <mapping bpm="content_hash_code"
esb="content_hash_code"/>
+ </bpmToEsbVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <transition to="Split Content"/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <decision name="Content is valid?">
+ <transition to="Diff Content" name="Yes">
+ <condition expression="#{content_is_valid == true}"/>
+ </transition>
+ <transition to="RejectContent" name="No">
+ <condition expression="#{content_is_valid != true}"/>
+ </transition>
+ </decision>
+
+ <decision name="Content is diff?">
+ <transition to="Store Content" name="Yes">
+ <condition expression="#{content_is_diff == true}"/>
+ </transition>
+ <transition to="End Content Ingestion" name="No">
+ <condition expression="#{content_is_diff == false}"/>
+ </transition>
+ </decision>
+
+ <decision name="Content mapped to category?">
+ <transition to="Convert to XML" name="Yes">
+ <condition expression="#{content_category != void}"/>
+ </transition>
+ <transition to="RejectContent" name="No">
+ <condition expression="#{content_category == void}"/>
+ </transition>
+ </decision>
+
+ <node name="Split Content">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ </bpmToEsbVars>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <esbServiceName>Split Content</esbServiceName>
+ <esbToBpmVars>
+ <mapping bpm="split_content_map"
esb="split_content_map"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <event type="node-leave">
+ <script name="Count number of items">
+ <expression>
+ num_items = 0;
+ cur_item = 0;
+ if (split_content_map != null)
+ {
+ num_items = split_content_map.size();
+ }
+ </expression>
+ <variable name='split_content_map' access='read'
mapped-name='split_content_map'/>
+ <variable name='num_items' access='write'
mapped-name='num_items'/>
+ <variable name='cur_item' access='write'
mapped-name='cur_item'/>
+ </script>
+ </event>
+ <transition to="More items?"/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <decision name="More items?">
+ <transition to="Generate RSS" name="No">
+ <condition expression="#{cur_item == num_items}"/>
+ </transition>
+ <transition to="Diff Item" name="Yes">
+ <condition expression="#{cur_item < num_items}"/>
+ </transition>
+ </decision>
+
+ <node name="Diff Item">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <esbServiceName>Diff Content</esbServiceName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_feed_key"
esb="content_feed_key"/>
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="content_hash_code"
esb="content_hash_code"/>
+ <mapping bpm="content_is_diff" esb="content_is_diff"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <event type="node-enter">
+ <script name="Get item from list">
+ <expression>
+ content_feed_key = split_content_map.keySet().toArray()[cur_item];
+ content_file_name = split_content_map.get(content_feed_key);
+ </expression>
+ <variable name='content_feed_key' access='write'
mapped-name='content_feed_key'/>
+ <variable name='content_file_name' access='write'
mapped-name='content_file_name'/>
+ <variable name='split_content_map' access='read'
mapped-name='split_content_map'/>
+ <variable name='cur_item' access='read'
mapped-name='cur_item'/>
+ </script>
+ </event>
+ <event type="node-leave">
+ <script name="Increment item counter">
+ <expression>cur_item = cur_item + 1;</expression>
+ <variable name='cur_item' access='read'
mapped-name='cur_item'/>
+ <variable name='cur_item' access='write'
mapped-name='cur_item'/>
+ </script>
+ </event>
+ <transition to="Has item changed?"/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <node name="Store Item">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>Store Content</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_hash_code"
esb="content_hash_code"/>
+ <mapping bpm="content_feed_key"
esb="content_feed_key"/>
+ </bpmToEsbVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <transition to="More items?"/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <decision name="Has item changed?">
+ <transition to="Store Item" name="Yes">
+ <condition expression="#{content_is_diff == true}"/>
+ </transition>
+ <transition to="More items?" name="No">
+ <condition expression="#{content_is_diff == false}"/>
+ </transition>
+ </decision>
+
+ <node name="Convert to XML">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>Convert Content</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="content_file_name"
esb="content_file_name"/>
+ <mapping bpm="content_reject_reason"
esb="content_reject_reason"/>
+ </esbToBpmVars>
+ <exceptionTransition>exception</exceptionTransition>
+ </action>
+ <transition to="Error converting ?" name=""/>
+ <transition to="ExceptionHandling" name="exception"/>
+ </node>
+
+ <decision name="Error converting ?">
+ <transition to="ValidateContent">
+ <condition expression="#{content_reject_reason == void}"/>
+ </transition>
+ <transition to="RejectContent" name="Yes">
+ <condition expression="#{content_reject_reason != void}"/>
+ </transition>
+ </decision>
+
+ <node name="Generate RSS">
+ <transition to="End Content Ingestion">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
+ <esbServiceName>Generate RSS</esbServiceName>
+ <esbCategoryName>CMTE CNND</esbCategoryName>
+ <bpmToEsbVars>
+ <mapping bpm="full_content_file_name"
esb="full_content_file_name"/>
+ <mapping bpm="content_category_id"
esb="content_category_id"/>
+ <mapping bpm="content_category"
esb="content_category"/>
+ </bpmToEsbVars>
+ </action>
+ </transition>
+ </node>
+
+ <end-state name="End Content Ingestion"/>
+
+ <end-state name="Content Rejected"/>
+
+ <end-state name="ExceptionHandling"/>
+</process-definition>
\ No newline at end of file
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/gpd.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/gpd.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="scripted" width="930"
height="529">
+ <node name="start" x="134" y="48"
width="132" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="esb" x="135" y="129" width="132"
height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="end" x="134" y="208" width="132"
height="36"/>
+</root-container>
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2574/processdefinition.xml 2009-10-08
22:51:44 UTC (rev 5721)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="" name="scripted">
+
+
+ <start-state name="start">
+ <transition to="esb"></transition>
+ </start-state>
+
+
+ <node name="esb">
+ <action
class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbServiceName>
+ paybills
+ </esbServiceName>
+ <esbCategoryName>
+ annoyances
+ </esbCategoryName>
+ </action>
+ <transition to="end"></transition>
+ </node>
+
+
+ <end-state name="end"></end-state>
+
+
+ <event type="node-enter">
+ <action class="org.jbpm.no.such.Class"></action>
+ </event>
+
+
+</process-definition>
\ No newline at end of file