[jbpm-commits] JBoss JBPM SVN: r1739 - in jbossbpm/spec/trunk/modules: api/src/main/java/org/jboss/bpm/model and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Jul 28 13:11:43 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-07-28 13:11:43 -0400 (Mon, 28 Jul 2008)
New Revision: 1739
Added:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ObjectNameFactory.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EntityImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParticipantImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RoleImpl.java
Removed:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MessageReceiver.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java
Modified:
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageBuilder.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Participant.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/SignalHandler.java
jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
jbossbpm/spec/trunk/modules/dialects/stp/src/test/resources/jbpm-beans.xml
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageBuilderImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java
jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml
Log:
Add MessageListener
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -25,7 +25,6 @@
import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.Signal;
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
@@ -94,12 +93,6 @@
return handler;
}
- protected void throwSignal(Signal signal)
- {
- SignalManager sm = SignalManager.locateSignalManager();
- sm.throwSignal(signal);
- }
-
private HandlerSupport getHandlerSupport(FlowObject fo)
{
if (fo instanceof HandlerSupport == false)
Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.client;
+
+import javax.management.ObjectName;
+
+import org.jboss.bpm.model.Message;
+
+//$Id$
+
+/**
+ * A MessageListener that can be registered with the ProcessEngine
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface MessageListener
+{
+ /**
+ * Get the id for this listener
+ */
+ ObjectName getMessageListenerID();
+
+ /**
+ * Catch a message from the process that this listener is registered with
+ */
+ void catchMessage(Message message);
+}
\ No newline at end of file
Property changes on: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/MessageListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ObjectNameFactory.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ObjectNameFactory.java (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ObjectNameFactory.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.client;
+
+// $Id$
+
+import java.util.Hashtable;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A simple factory for creating safe object names.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-May-2006
+ */
+public class ObjectNameFactory
+{
+ public static ObjectName create(String name)
+ {
+ try
+ {
+ return new ObjectName(name);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + name + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, String key, String value)
+ {
+ try
+ {
+ return new ObjectName(domain, key, value);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, Hashtable table)
+ {
+ try
+ {
+ return new ObjectName(domain, table);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
+ }
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ObjectNameFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -21,6 +21,20 @@
*/
package org.jboss.bpm.client;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Message;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Signal;
+
// $Id$
/**
@@ -36,15 +50,21 @@
/** The default bean config: jbpm-beans.xml */
public static final String JBPM_ENGINE_CONFIG = "jbpm-beans.xml";
+ // provide logging
+ private static final Log log = LogFactory.getLog(ProcessEngine.class);
+
// Injected through the MC
protected ProcessManager processManager;
// Injected through the MC
- protected SignalManager signalManager;
- // Injected through the MC
protected ExecutionManager executionManager;
// Flag to indicate that the Engine is shutting down
private boolean prepareForShutdown;
+ // The map of registered signal listeners
+ private Map<String, Set<SignalListener>> signalListeners = new HashMap<String, Set<SignalListener>>();
+ // The set of registered message listeners
+ private Set<MessageListener> messageListeners = new HashSet<MessageListener>();
+
// Hide public constructor
protected ProcessEngine()
{
@@ -76,6 +96,7 @@
/**
* Get the configured instance of the ProcessManager
+ *
* @return The ProcessManager
*/
public ProcessManager getProcessManager()
@@ -87,19 +108,8 @@
}
/**
- * Get the configured instance of the SignalManager
- * @return The SignalManager
- */
- public SignalManager getSignalManager()
- {
- if (signalManager == null)
- throw new IllegalStateException("SignalManager not available through kernel configuration");
-
- return signalManager;
- }
-
- /**
* Get the configured instance of the ExecutionManager
+ *
* @return The ExecutionManager
*/
public ExecutionManager getExecutionManager()
@@ -109,4 +119,113 @@
return executionManager;
}
+
+ /**
+ * Add a SignalListener for a given process
+ */
+ public void addSignalListener(String procName, SignalListener listener)
+ {
+ log.debug("addSignalListener: " + listener);
+ Set<SignalListener> set = signalListeners.get(procName);
+ if (set == null)
+ {
+ set = new HashSet<SignalListener>();
+ signalListeners.put(procName, set);
+ }
+ set.add(listener);
+ }
+
+ /**
+ * Remove an SignalListener for a given process
+ */
+ public void removeSignalListener(String procName, SignalListener listener)
+ {
+ log.debug("removeSignalListener: " + listener);
+ Set<SignalListener> set = signalListeners.get(procName);
+ if (set != null)
+ {
+ set.remove(listener);
+ }
+ }
+
+ /** Remove all SignalListener for a given process */
+ public void removeSignalListeners(String procName)
+ {
+ log.debug("removeSignalListeners: " + procName);
+ signalListeners.remove(procName);
+ }
+
+ /** Throw a signal to all registered listeners */
+ public void throwSignal(Signal signal)
+ {
+ log.debug("throwSignal: " + signal);
+ String procName = signal.getProcessName();
+ Set<SignalListener> set = signalListeners.get(procName);
+ if (set != null)
+ {
+ for (SignalListener listener : set)
+ {
+ listener.catchSignal(signal);
+ }
+ }
+ }
+
+ /**
+ * Add a MessageListener
+ */
+ public void addMessageListener(MessageListener listener)
+ {
+ log.debug("addMessageListener: " + listener);
+ messageListeners.add(listener);
+ }
+
+ /**
+ * Remove an MessageListener
+ */
+ public void removeMessageListener(MessageListener listener)
+ {
+ log.debug("removeMessageListener: " + listener);
+ messageListeners.remove(listener);
+ }
+
+ /**
+ * Send a message to a given {@link Task} or @{link Event}
+ */
+ public void sendMessage(ObjectName procID, String targetName, Message msg)
+ {
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ Process proc = pm.getProcessByID(procID);
+ FlowObject target = proc.findFlowObject(targetName);
+ if (target == null)
+ throw new IllegalArgumentException("Cannot find message target: " + targetName);
+ if (target instanceof MessageListener == false)
+ throw new IllegalArgumentException("Message target is not a valid message receiver: " + targetName);
+
+ MessageListener msgListener = (MessageListener)target;
+ msgListener.catchMessage(msg);
+ }
+
+ /**
+ * Send a message to a given {@link MessageListener}
+ */
+ public void sendMessage(ObjectName listenerID, Message msg)
+ {
+ MessageListener msgListener = null;
+ for (MessageListener auxListener : messageListeners)
+ {
+ if (auxListener.getMessageListenerID().equals(listenerID))
+ {
+ msgListener = auxListener;
+ break;
+ }
+ }
+ if (msgListener != null)
+ {
+ msgListener.catchMessage(msg);
+ }
+ else
+ {
+ log.warn("No message listener registered: " + listenerID);
+ }
+ }
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -41,12 +41,9 @@
import org.jboss.bpm.BPMException;
import org.jboss.bpm.EngineShutdownException;
import org.jboss.bpm.ProcessTimeoutException;
-import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.Process.Status;
import org.jboss.bpm.runtime.Attachments;
-import org.jboss.bpm.runtime.MessageReceiver;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -191,21 +188,6 @@
public abstract void startProcess(String name, Attachments att);
/**
- * Send a message to a given {@link MessageReceiver}
- */
- public void sendMessage(ObjectName procID, String toName, Message msg)
- {
- Process proc = getProcessByID(procID);
- FlowObject target = proc.findFlowObject(toName);
- if (target == null)
- throw new IllegalArgumentException("Cannot find message target: " + toName);
- if (target instanceof MessageReceiver == false)
- throw new IllegalArgumentException("Message target is not a valid message receiver: " + toName);
-
- ((MessageReceiver)target).receiveMessage(msg);
- }
-
- /**
* Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
* arrive at an End Event. The Process will be in a running state until all Tokens are consumed.
* <p/>
Deleted: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -1,121 +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.jboss.bpm.client;
-
-//$Id$
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.model.Signal;
-
-/**
- * The signal manager is the entry point for signal processing
- *
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public abstract class SignalManager
-{
- // provide logging
- private static final Log log = LogFactory.getLog(SignalManager.class);
-
- // Injected through the MC
- protected ProcessEngine engine;
- // The map of registered signal listeners
- private Map<String, Set<SignalListener>> listeners = new HashMap<String, Set<SignalListener>>();
-
- // Hide public constructor
- protected SignalManager()
- {
- }
-
- /**
- * Get the associated process engine
- */
- public ProcessEngine getProcessEngine()
- {
- if (engine == null)
- throw new IllegalStateException("ProcessEngine not available through kernel configuration");
-
- return engine;
- }
-
- /**
- * Locate the signal manager
- */
- public static SignalManager locateSignalManager()
- {
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- return engine.getSignalManager();
- }
-
- /** Add a signal listener for a given process */
- public void addListener(String procName, SignalListener listener)
- {
- log.debug("addListener: " + listener);
- Set<SignalListener> set = listeners.get(procName);
- if (set == null)
- {
- set = new HashSet<SignalListener>();
- listeners.put(procName, set);
- }
- set.add(listener);
- }
-
- /** Remove an signal listener for a given process */
- public void removeListener(String procName, SignalListener listener)
- {
- log.debug("removeListener: " + listener);
- Set<SignalListener> set = listeners.get(procName);
- if (set != null)
- {
- set.remove(listener);
- }
- }
-
- /** Remove all signal listeners for a given process */
- public void removeListeners(String procName)
- {
- log.debug("removeListeners: " + procName);
- listeners.remove(procName);
- }
-
- /** Throw a signal to all registered listeners */
- public void throwSignal(Signal signal)
- {
- log.debug("throwSignal: " + signal);
- String procName = signal.getProcessName();
- Set<SignalListener> set = listeners.get(procName);
- if (set != null)
- {
- for (SignalListener listener : set)
- {
- listener.catchSignal(signal);
- }
- }
- }
-}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageBuilder.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageBuilder.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -21,6 +21,8 @@
*/
package org.jboss.bpm.model;
+import javax.management.ObjectName;
+
//$Id$
/**
@@ -34,7 +36,7 @@
/**
* Create a {@link Message} with a given name
*/
- MessageBuilder newMessage(String name);
+ MessageBuilder newMessage(String messageName, ObjectName targetID);
/**
* Add a message property
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Participant.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Participant.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Participant.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -24,10 +24,9 @@
//$Id$
/**
- * A Participant, which is used in the definition of attributes for a @{link Pool},
+ * A Participant, which is used in the definition of attributes for a @{link Pool}, @{link Message}, and @{link
+ * WebService}
*
- * @{link Message}, and @{link WebService}
- *
* @author thomas.diesler at jboss.com
* @since 21-Jul-2008
*/
@@ -37,17 +36,17 @@
{
Role, Entity
}
-
+
/**
* Get the type of this participant
*/
ParticipantType getParticipantType();
-
+
/**
* If the ParticipantType = Role, then a Role MUST be identified.
*/
Role getRoleRef();
-
+
/**
* If the ParticipantType = Entity, then an Entity MUST be identified.
*/
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -158,9 +158,4 @@
* This method until the process ends with a given timeout.
*/
void waitForEnd(long timeout);
-
- /**
- * Send a message to a given @{link Task} or @{link Event}
- */
- void sendMessage(String toName, Message msg);
}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -21,7 +21,9 @@
*/
package org.jboss.bpm.model;
+import javax.management.ObjectName;
+
//$Id$
/**
@@ -32,7 +34,7 @@
*/
public interface TaskBuilder extends ActivityBuilder
{
- TaskBuilder addMessageRef(String name);
+ TaskBuilder addMessageRef(String messageName, ObjectName targetID);
- TaskBuilder addMessageProperty(String name, String value, boolean isCorrelation);
+ TaskBuilder addMessageProperty(String propName, String propValue, boolean isCorrelation);
}
\ No newline at end of file
Deleted: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MessageReceiver.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MessageReceiver.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MessageReceiver.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -1,37 +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.jboss.bpm.runtime;
-
-import org.jboss.bpm.model.Message;
-
-//$Id$
-
-/**
- * The {@link FlowScheduler} that can be manipulated.
- *
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public interface MessageReceiver
-{
- void receiveMessage(Message message);
-}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/SignalHandler.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/SignalHandler.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/SignalHandler.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -24,13 +24,12 @@
//$Id$
import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.FlowObject;
import org.jboss.bpm.model.Signal;
/**
* The {@link ProcessEngine} invokes the SignalHandler on an {@link HandlerSupport}
- * {@link FlowObject} to send {@link Signal}s to the {@link SignalManager}.
+ * {@link FlowObject} to send {@link Signal}s.
*
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -28,16 +28,22 @@
import java.util.Collections;
import java.util.List;
+import javax.management.ObjectName;
+
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.BPMException;
+import org.jboss.bpm.client.MessageListener;
+import org.jboss.bpm.client.ObjectNameFactory;
import org.jboss.bpm.client.SignalListener;
import org.jboss.bpm.client.internal.EmbeddedBeansDeployer;
+import org.jboss.bpm.model.BPMNElement;
+import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.Signal;
-public abstract class AbstractAPITestCase extends TestCase implements SignalListener
+public abstract class AbstractAPITestCase extends TestCase implements SignalListener, MessageListener
{
// provide logging
private static final Log log = LogFactory.getLog(AbstractAPITestCase.class);
@@ -46,6 +52,8 @@
private EmbeddedBeansDeployer deployer;
// The signals caught by this test case
private List<Signal> signals = new ArrayList<Signal>();
+ // The messages caught by this test case
+ private List<Message> messages = new ArrayList<Message>();
/** Overwrite to provide beans config */
protected abstract String getBeansConfig();
@@ -112,4 +120,20 @@
{
return Collections.unmodifiableList(signals);
}
+
+ public ObjectName getMessageListenerID()
+ {
+ return ObjectNameFactory.create(BPMNElement.ID_DOMAIN, "test", getName());
+ }
+
+ public void catchMessage(Message message)
+ {
+ messages.add(message);
+ log.debug("catchMessage: " + message);
+ }
+
+ public List<Message> getMessages()
+ {
+ return Collections.unmodifiableList(messages);
+ }
}
Modified: jbossbpm/spec/trunk/modules/dialects/stp/src/test/resources/jbpm-beans.xml
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/stp/src/test/resources/jbpm-beans.xml 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/dialects/stp/src/test/resources/jbpm-beans.xml 2008-07-28 17:11:43 UTC (rev 1739)
@@ -3,15 +3,19 @@
<!-- The KernelLocator -->
<bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator"/>
+ <!-- The ProcessBuilderFactory -->
+ <bean name="jBPMProcessBuilderFactory" class="org.jboss.bpm.model.internal.ProcessBuilderFactoryImpl"/>
+
<!-- The ProcessEngine -->
<bean name="jBPMProcessEngine" class="org.jboss.bpm.client.internal.ProcessEngineImpl">
<property name="processManager"><inject bean="jBPMProcessManager"/></property>
<property name="executionManager"><inject bean="jBPMExecutionManager"/></property>
- <property name="signalManager"><inject bean="jBPMSignalManager"/></property>
</bean>
- <!-- The ProcessBuilderFactory -->
- <bean name="jBPMProcessBuilderFactory" class="org.jboss.bpm.model.internal.ProcessBuilderFactoryImpl"/>
+ <!-- The ExecutionManager -->
+ <bean name="jBPMExecutionManager" class="org.jboss.bpm.client.internal.ExecutionManagerImpl">
+ <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
+ </bean>
<!-- The ProcessManager -->
<bean name="jBPMProcessManager" class="org.jboss.bpm.client.internal.ProcessManagerImpl">
@@ -34,13 +38,4 @@
</property>
</bean>
- <!-- The ExecutionManager -->
- <bean name="jBPMExecutionManager" class="org.jboss.bpm.client.internal.ExecutionManagerImpl">
- <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
- </bean>
-
- <!-- The SignalManager -->
- <bean name="jBPMSignalManager" class="org.jboss.bpm.client.internal.SignalManagerImpl">
- <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
- </bean>
</deployment>
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -77,7 +77,7 @@
{
RuntimeProcess rtProc = new RuntimeProcessImpl(proc);
- throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
+ engine.throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
MutableFlowScheduler flowScheduler = rtProc.getFlowScheduler();
try
{
@@ -102,12 +102,12 @@
// Execute the FlowObject's ExecutionHandler
try
{
- throwSignal(sigHandler.getEnterSignal());
+ engine.throwSignal(sigHandler.getEnterSignal());
executable.execute(token);
}
finally
{
- throwSignal(sigHandler.getExitSignal());
+ engine.throwSignal(sigHandler.getExitSignal());
}
// Remove the head tuple
@@ -126,7 +126,7 @@
}
finally
{
- throwSignal(new Signal(proc, Signal.Type.EXIT_PROCESS));
+ engine.throwSignal(new Signal(proc, Signal.Type.EXIT_PROCESS));
}
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/ProcessEngineImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -26,7 +26,6 @@
import org.jboss.bpm.client.ExecutionManager;
import org.jboss.bpm.client.ProcessEngine;
import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.client.SignalManager;
/**
* A process engine with public access
@@ -45,9 +44,4 @@
{
this.executionManager = executionManager;
}
-
- public void setSignalManager(SignalManager signalManager)
- {
- this.signalManager = signalManager;
- }
}
Deleted: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/client/internal/SignalManagerImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -1,48 +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.jboss.bpm.client.internal;
-
-// $Id$
-
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.SignalManager;
-import org.jboss.bpm.model.Signal;
-
-/**
- * An implementation of a signal manager
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class SignalManagerImpl extends SignalManager
-{
- public void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-
- @Override
- public void throwSignal(Signal signal)
- {
- super.throwSignal(signal);
- }
-}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -23,10 +23,9 @@
//$Id$
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.client.ObjectNameFactory;
import org.jboss.bpm.model.BPMNElement;
import org.jboss.bpm.model.Event;
import org.jboss.bpm.model.Flow;
@@ -44,7 +43,7 @@
public class BPMNElementImpl implements BPMNElement
{
private static final long serialVersionUID = 1L;
-
+
private ObjectName id;
private Process process;
@@ -74,43 +73,36 @@
protected void assignElementID()
{
- try
+ StringBuilder str = new StringBuilder(ID_DOMAIN + ":");
+ if (this instanceof Event)
{
- StringBuilder str = new StringBuilder(ID_DOMAIN + ":");
- if (this instanceof Event)
- {
- str.append("type=Event");
- }
- else if (this instanceof Process)
- {
- str.append("type=Process");
- }
- else if (this instanceof Task)
- {
- str.append("type=Task");
- }
- else if (this instanceof Gateway)
- {
- str.append("type=Gateway");
- }
- else if (this instanceof Flow)
- {
- str.append("type=Flow");
- }
- else
- {
- str.append("type=Other");
- }
- if (this instanceof NameSupport)
- {
- str.append(",name=" + ((NameSupport)this).getName());
- }
- str.append(",id=" + new UID());
- this.id = new ObjectName(str.toString());
+ str.append("type=Event");
}
- catch (MalformedObjectNameException ex)
+ else if (this instanceof Process)
{
- throw new InvalidProcessException("Cannot assign id", ex);
+ str.append("type=Process");
}
+ else if (this instanceof Task)
+ {
+ str.append("type=Task");
+ }
+ else if (this instanceof Gateway)
+ {
+ str.append("type=Gateway");
+ }
+ else if (this instanceof Flow)
+ {
+ str.append("type=Flow");
+ }
+ else
+ {
+ str.append("type=Other");
+ }
+ if (this instanceof NameSupport)
+ {
+ str.append(",name=" + ((NameSupport)this).getName());
+ }
+ str.append(",id=" + new UID());
+ this.id = ObjectNameFactory.create(str.toString());
}
}
\ No newline at end of file
Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EntityImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EntityImpl.java (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EntityImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Entity;
+
+//$Id$
+
+/**
+ * An Entity, which is used in the definition of attributes for a @{link Participant}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 21-Jul-2008
+ */
+public class EntityImpl extends ParticipantImpl implements Entity
+{
+ private String name;
+
+ public EntityImpl(String name)
+ {
+ this.name = name;
+ this.entityRef = this;
+ }
+
+ public ParticipantType getParticipantType()
+ {
+ return ParticipantType.Entity;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/EntityImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageBuilderImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageBuilderImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -23,6 +23,8 @@
//$Id$
+import javax.management.ObjectName;
+
import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.MessageBuilder;
import org.jboss.bpm.model.Property;
@@ -37,9 +39,9 @@
{
private MessageImpl message;
- public MessageBuilder newMessage(String name)
+ public MessageBuilder newMessage(String name, ObjectName targetID)
{
- message = new MessageImpl(name);
+ message = new MessageImpl(name, targetID);
return this;
}
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -25,6 +25,8 @@
import java.util.Collections;
import java.util.List;
+import javax.management.ObjectName;
+
import org.jboss.bpm.NotImplementedException;
import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.Participant;
@@ -45,11 +47,14 @@
public class MessageImpl extends SupportingElementImpl implements Message, MutablePropertySupport
{
private String name;
+ private ObjectName sourceID;
+ private ObjectName targetID;
private List<Property> props = new ArrayList<Property>();
- public MessageImpl(String name)
+ public MessageImpl(String name, ObjectName targetID)
{
this.name = name;
+ this.targetID = targetID;
}
/**
Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParticipantImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParticipantImpl.java (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParticipantImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Entity;
+import org.jboss.bpm.model.Participant;
+import org.jboss.bpm.model.Role;
+
+//$Id$
+
+/**
+ * A Participant, which is used in the definition of attributes for a @{link Pool}, @{link Message}, and @{link
+ * WebService}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 21-Jul-2008
+ */
+public abstract class ParticipantImpl extends SupportingElementImpl implements Participant
+{
+ protected Entity entityRef;
+ protected Role roleRef;
+
+ public Entity getEntityRef()
+ {
+ return entityRef;
+ }
+
+ public Role getRoleRef()
+ {
+ return roleRef;
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParticipantImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -230,12 +230,6 @@
this.status = status;
}
- public void sendMessage(String toName, Message msg)
- {
- ProcessManager pm = ProcessManager.locateProcessManager();
- pm.sendMessage(getID(), toName, msg);
- }
-
/**
* Set the process state
*/
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -24,22 +24,20 @@
import java.util.ArrayList;
import java.util.List;
+import javax.management.ObjectName;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.InvalidProcessException;
import org.jboss.bpm.NotImplementedException;
import org.jboss.bpm.ProcessTimeoutException;
+import org.jboss.bpm.client.MessageListener;
import org.jboss.bpm.model.Expression;
-import org.jboss.bpm.model.InputSet;
import org.jboss.bpm.model.Message;
-import org.jboss.bpm.model.OutputSet;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.Property;
import org.jboss.bpm.model.ReceiveTask;
-import org.jboss.bpm.model.Task;
import org.jboss.bpm.runtime.ExecutionContext;
-import org.jboss.bpm.runtime.ExecutionHandler;
-import org.jboss.bpm.runtime.MessageReceiver;
import org.jboss.bpm.runtime.Token;
//$Id$
@@ -50,7 +48,7 @@
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
-public class ReceiveTaskImpl extends TaskImpl implements ReceiveTask, MessageReceiver
+public class ReceiveTaskImpl extends TaskImpl implements ReceiveTask, MessageListener
{
private static final int RECEIVE_TIMEOUT = 5000;
@@ -93,8 +91,13 @@
throw new NotImplementedException();
}
- public void receiveMessage(Message message)
+ public ObjectName getMessageListenerID()
{
+ return getID();
+ }
+
+ public void catchMessage(Message message)
+ {
String msgName = message.getName();
if (messageRef.getName().equals(msgName))
{
Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RoleImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RoleImpl.java (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RoleImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Role;
+
+//$Id$
+
+/**
+ * A Role, which is used in the definition of attributes for a @{link Participant}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 21-Jul-2008
+ */
+public class RoleImpl extends ParticipantImpl implements Role
+{
+ private String name;
+
+ public RoleImpl(String name)
+ {
+ this.name = name;
+ this.roleRef = this;
+ }
+
+ public ParticipantType getParticipantType()
+ {
+ return ParticipantType.Role;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/RoleImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SendTaskImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -90,7 +90,7 @@
{
MessageBuilderFactory factory = MessageBuilderFactory.newInstance();
MessageBuilder msgBuilder = factory.newMessageBuilder();
- msgBuilder.newMessage(messageRef.getName());
+ msgBuilder.newMessage(messageRef.getName(), null);
// Copy the properties from the execution context
// to the send message
Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -23,6 +23,8 @@
//$Id$
+import javax.management.ObjectName;
+
import org.jboss.bpm.model.Property;
import org.jboss.bpm.model.Task;
import org.jboss.bpm.model.TaskBuilder;
@@ -42,9 +44,9 @@
super(proc, flowObject);
}
- public TaskBuilder addMessageRef(String name)
+ public TaskBuilder addMessageRef(String messageName, ObjectName targetID)
{
- message = new MessageImpl(name);
+ message = new MessageImpl(messageName, targetID);
if (flowObject instanceof ReceiveTaskImpl)
{
((ReceiveTaskImpl)flowObject).setMessageRef(message);
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -25,9 +25,14 @@
import java.net.URL;
+import javax.management.ObjectName;
+
+import org.jboss.bpm.client.ObjectNameFactory;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessEngineLocator;
import org.jboss.bpm.client.ProcessManager;
import org.jboss.bpm.client.SignalListener;
-import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.BPMNElement;
import org.jboss.bpm.model.GatewayBuilder;
import org.jboss.bpm.model.Message;
import org.jboss.bpm.model.MessageBuilder;
@@ -51,12 +56,17 @@
public class AirticketTest extends DefaultEngineTestCase
{
@Override
+ public ObjectName getMessageListenerID()
+ {
+ return ObjectNameFactory.create(BPMNElement.ID_DOMAIN, "test", "AirticketTest");
+ }
+
+ @Override
protected void setUp() throws Exception
{
super.setUp();
// Add a signal listener
- SignalManager sm = SignalManager.locateSignalManager();
SignalListener sl = new SignalListener()
{
public void catchSignal(Signal signal)
@@ -64,7 +74,8 @@
System.out.println(signal);
}
};
- sm.addListener("Airticket", sl);
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.addSignalListener("Airticket", sl);
}
public void _testProcessStart() throws Exception
@@ -80,18 +91,38 @@
proc.waitForEnd();
}
- public void testDynamicProcess() throws Exception
+ public void testValidRequest() throws Exception
{
- ProcessBuilderFactory procFactory = ProcessBuilderFactory.newInstance();
- MessageBuilderFactory msgFactory = MessageBuilderFactory.newInstance();
+ Process proc = buildDynamicProcess();
+ proc.startProcess();
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.sendMessage(proc.getID(), "ReceiveReqTask", getValidRequestMessage());
+
+ proc.waitForEnd();
+ }
+
+ public void testInvalidRequest() throws Exception
+ {
+ Process proc = buildDynamicProcess();
+ proc.startProcess();
+
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.sendMessage(proc.getID(), "ReceiveReqTask", getInvalidRequestMessage());
+
+ proc.waitForEnd();
+ }
+
+ private Process buildDynamicProcess()
+ {
// Create a Process through the ProcessBuilder
+ ProcessBuilderFactory procFactory = ProcessBuilderFactory.newInstance();
ProcessBuilder procBuilder = procFactory.newProcessBuilder();
procBuilder.addProcess("Airticket").addStartEvent().addSequenceFlow("ReceiveReqTask");
// Build the ReceiveReq Task
TaskBuilder taskBuilder = procBuilder.addTask("ReceiveReqTask", TaskType.Receive);
- taskBuilder.addMessageRef("ReqDataMsg").
+ taskBuilder.addMessageRef("ReqDataMsg", getMessageListenerID()).
addMessageProperty("Name", null, true).
addMessageProperty("From", null, true).
addMessageProperty("To", null, true).
@@ -123,7 +154,7 @@
// Build the SendInvalid Task
taskBuilder = procBuilder.addTask("SendInvalidTask", TaskType.Send);
- taskBuilder.addMessageRef("InvalidDataMsg").
+ taskBuilder.addMessageRef("InvalidDataMsg", getMessageListenerID()).
addMessageProperty("Name", null, true).
addMessageProperty("From", null, true).
addMessageProperty("To", null, true).
@@ -133,24 +164,36 @@
// Add the EndEvent get the Process
Process proc = procBuilder.addEndEvent("End").getProcess();
-
- // Register the Process with the ProcessManager
ProcessManager pm = ProcessManager.locateProcessManager();
pm.registerProcess(proc);
-
- proc.startProcess();
-
+ return proc;
+ }
+
+ private Message getValidRequestMessage()
+ {
+ MessageBuilderFactory msgFactory = MessageBuilderFactory.newInstance();
MessageBuilder msgBuilder = msgFactory.newMessageBuilder();
- Message msg = msgBuilder.newMessage("ReqDataMsg").
+ Message msg = msgBuilder.newMessage("ReqDataMsg", null).
addProperty("Name", "Kermit").
addProperty("From", "MUC").
addProperty("To", "NYC").
addProperty("Date", "25-Jul-2008").
addProperty("Seats", "1").
getMessage();
-
- proc.sendMessage("ReceiveReqTask", msg);
-
- proc.waitForEnd();
+ return msg;
}
-}
+
+ private Message getInvalidRequestMessage()
+ {
+ MessageBuilderFactory msgFactory = MessageBuilderFactory.newInstance();
+ MessageBuilder msgBuilder = msgFactory.newMessageBuilder();
+ Message msg = msgBuilder.newMessage("ReqDataMsg", null).
+ addProperty("Name", "Kermit").
+ addProperty("From", "MUC").
+ addProperty("To", "NYC").
+ addProperty("Date", "25-Jul-2008").
+ addProperty("Seats", "0"). // Invalid number of seats
+ getMessage();
+ return msg;
+ }
+}
\ No newline at end of file
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -27,8 +27,9 @@
import java.util.List;
import java.util.concurrent.ExecutionException;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessEngineLocator;
import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
@@ -50,8 +51,8 @@
protected void setUp() throws Exception
{
super.setUp();
- SignalManager em = SignalManager.locateSignalManager();
- em.addListener(getName(), this);
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.addSignalListener(getName(), this);
}
/**
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -27,13 +27,13 @@
import java.util.List;
import java.util.concurrent.ExecutionException;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessEngineLocator;
import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
import org.jboss.bpm.model.Signal;
-import org.jboss.bpm.model.Task;
import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
@@ -49,8 +49,8 @@
protected void setUp() throws Exception
{
super.setUp();
- SignalManager em = SignalManager.locateSignalManager();
- em.addListener(getName(), this);
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.addSignalListener(getName(), this);
}
/**
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-28 17:11:43 UTC (rev 1739)
@@ -27,13 +27,13 @@
import java.util.List;
import java.util.concurrent.ExecutionException;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessEngineLocator;
import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.model.ProcessBuilderFactory;
import org.jboss.bpm.model.Signal;
-import org.jboss.bpm.model.Task;
import org.jboss.bpm.model.Task.TaskType;
import org.jboss.bpm.test.DefaultEngineTestCase;
@@ -49,8 +49,8 @@
protected void setUp() throws Exception
{
super.setUp();
- SignalManager em = SignalManager.locateSignalManager();
- em.addListener(getName(), this);
+ ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
+ engine.addSignalListener(getName(), this);
}
/**
Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml 2008-07-28 15:46:17 UTC (rev 1738)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/resources/jbpm-beans.xml 2008-07-28 17:11:43 UTC (rev 1739)
@@ -3,17 +3,21 @@
<!-- The KernelLocator -->
<bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator"/>
+ <!-- The Builder Factories -->
+ <bean name="jBPMProcessBuilderFactory" class="org.jboss.bpm.model.internal.ProcessBuilderFactoryImpl"/>
+ <bean name="jBPMMessageBuilderFactory" class="org.jboss.bpm.model.internal.MessageBuilderFactoryImpl"/>
+ <bean name="jBPMPropertyBuilderFactory" class="org.jboss.bpm.model.internal.PropertyBuilderFactoryImpl"/>
+
<!-- The ProcessEngine -->
<bean name="jBPMProcessEngine" class="org.jboss.bpm.client.internal.ProcessEngineImpl">
<property name="processManager"><inject bean="jBPMProcessManager"/></property>
<property name="executionManager"><inject bean="jBPMExecutionManager"/></property>
- <property name="signalManager"><inject bean="jBPMSignalManager"/></property>
</bean>
- <!-- The Builder Factories -->
- <bean name="jBPMProcessBuilderFactory" class="org.jboss.bpm.model.internal.ProcessBuilderFactoryImpl"/>
- <bean name="jBPMMessageBuilderFactory" class="org.jboss.bpm.model.internal.MessageBuilderFactoryImpl"/>
- <bean name="jBPMPropertyBuilderFactory" class="org.jboss.bpm.model.internal.PropertyBuilderFactoryImpl"/>
+ <!-- The ExecutionManager -->
+ <bean name="jBPMExecutionManager" class="org.jboss.bpm.client.internal.ExecutionManagerImpl">
+ <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
+ </bean>
<!-- The ProcessManager -->
<bean name="jBPMProcessManager" class="org.jboss.bpm.client.internal.ProcessManagerImpl">
@@ -45,13 +49,4 @@
</property>
</bean>
- <!-- The ExecutionManager -->
- <bean name="jBPMExecutionManager" class="org.jboss.bpm.client.internal.ExecutionManagerImpl">
- <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
- </bean>
-
- <!-- The SignalManager -->
- <bean name="jBPMSignalManager" class="org.jboss.bpm.client.internal.SignalManagerImpl">
- <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
- </bean>
</deployment>
\ No newline at end of file
More information about the jbpm-commits
mailing list