[jboss-svn-commits] JBL Code SVN: r10052 - in labs/jbossesb/workspace/bburke/product: core/listeners/src/org/jboss/soa/esb/actions and 14 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 7 20:23:26 EST 2007


Author: bill.burke at jboss.com
Date: 2007-03-07 20:23:25 -0500 (Wed, 07 Mar 2007)
New Revision: 10052

Added:
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/JbpmUtil.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/JbpmAdapter.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/LogAction.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/EsbToText.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/TextBasedJmsToEsb.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JbpmJMSRouter.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JbpmProcessDefinitionMdb.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ProcessDefinitionRouterMdb.java
   labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/Decision.java
   labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JbpmRulesDecisionHandler.java
   labs/jbossesb/workspace/bburke/product/install/ejb-jar.xml
   labs/jbossesb/workspace/bburke/product/install/esb-queues-service.xml
   labs/jbossesb/workspace/bburke/product/install/esb.action.types.xml
   labs/jbossesb/workspace/bburke/product/install/jboss.xml
   labs/jbossesb/workspace/bburke/product/install/jbpm.cfg.xml
   labs/jbossesb/workspace/bburke/product/install/jbpm.hibernate.cfg.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/ejb-jar.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/JbpmJMSActionHandler.java
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/MDB.java
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/ejb-jar.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/esb-queues-service.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.old.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/MDB.java
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendEsbMessage.java
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/XPath.dsl
Removed:
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
Modified:
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
   labs/jbossesb/workspace/bburke/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
   labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
   labs/jbossesb/workspace/bburke/product/install/build.xml
   labs/jbossesb/workspace/bburke/product/install/jboss-service.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/dvdstore/RetrieveOrderAction.java
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/build.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/jbossesb.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/build.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.xml
   labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl
Log:
jbpm prototype

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/JbpmUtil.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/JbpmUtil.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/JbpmUtil.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,71 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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;
+
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JbpmUtil
+{
+   public static Object getVariable(String key, ExecutionContext ctx) throws RuntimeException
+   {
+      return getVariable(key, ctx.getContextInstance());
+   }
+   /**
+    * Look in transient or  persistence Jbpm context variables.  Throw an exception if not found.
+    *
+    * @param key
+    * @return
+    * @throws RuntimeException
+    */
+   public static Object getVariable(String key, ContextInstance ctx) throws RuntimeException
+   {
+      Object message = ctx.getTransientVariable(key);
+      if (message == null)
+      {
+          message = ctx.getVariable(key);
+      }
+      if (message == null)
+      {
+         String msg = "could not find context variable: '" + key + "' to deliever the message";
+         msg += "\nvariables:   ";
+         for (Object obj : ctx.getVariables().keySet())
+         {
+            msg += " [" + obj + "]";
+         }
+         msg += "\ntransient variables:   ";
+         for (Object obj : ctx.getTransientVariables().keySet())
+         {
+            msg += " [" + obj + "]";
+         }
+         throw new RuntimeException(msg);
+      }
+      return message;
+
+   }
+}

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/JbpmAdapter.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/JbpmAdapter.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/JbpmAdapter.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,99 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.actions;
+
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.jpdl.xml.JpdlXmlReader;
+import org.dom4j.Element;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JbpmAdapter extends Action
+{
+   protected ConfigTree tree;
+   protected ActionProcessor esbAction;
+   protected Constructor constructor;
+   protected Method[] methods;
+
+
+   public JbpmAdapter()
+   {
+      System.out.println("********* Create Jbpm Adapter ********");
+   }
+
+   @Override
+   public void read(Element actionElement, JpdlXmlReader jpdlReader)
+   {
+      String acceptPropagatedEvents = actionElement.attributeValue("accept-propagated-events");
+      if ("false".equalsIgnoreCase(acceptPropagatedEvents)
+          || "no".equalsIgnoreCase(acceptPropagatedEvents)
+          || "off".equalsIgnoreCase(acceptPropagatedEvents)) {
+        isPropagationAllowed = false;
+      }
+
+      String asyncText = actionElement.attributeValue("async");
+      if ("true".equalsIgnoreCase(asyncText)) {
+        isAsync = true;
+      }
+
+      tree = ConfigTree.fromElement(actionElement);
+      String className = actionElement.attributeValue("class");
+      try
+      {
+         Class actionClass = Thread.currentThread().getContextClassLoader().loadClass(className);
+         constructor = actionClass.getDeclaredConstructor(new Class[] {ConfigTree.class});
+         String process = actionElement.attributeValue("process");
+         if (process == null) process = "process";
+         String[] processes = process.split(",");
+         methods = new Method[processes.length];
+         for (int i = 0; i < processes.length; i++)
+         {
+            methods[i] = actionClass.getMethod(processes[i], new Class[] {Message.class});
+         }
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   @Override
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+      Message msg = (Message)executionContext.getProcessInstance().getContextInstance().getVariable("esbMessage");
+      Object obj = constructor.newInstance(tree);
+      for (Method m : methods)
+      {
+         m.invoke(obj, msg);
+      }
+   }
+}

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/LogAction.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/LogAction.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/LogAction.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.actions;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * Print message to System.out
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class LogAction implements ActionHandler
+{
+   public String message;
+
+
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+
+      System.out.println(message);
+
+   }
+}

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/EsbToText.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/EsbToText.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/EsbToText.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.actions.converters;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.context.exe.ContextInstance;
+import org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.JbpmUtil;
+
+/**
+ * converts a Esb body contents to a string
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class EsbToText implements ActionHandler
+{
+   private static PackageJmsMessageContents transformer = new PackageJmsMessageContents();
+
+   public String esbVariable = "esbMessage";
+   public String textVariable = "text";
+   public boolean isTransient = true;
+
+
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+      Message msg = (Message)JbpmUtil.getVariable(esbVariable, executionContext);
+      String text = new String(msg.getBody().getContents());
+      ContextInstance ctx = executionContext.getProcessInstance().getContextInstance();
+      if (isTransient)
+      {
+         ctx.setTransientVariable(textVariable, text);
+      }
+      else
+      {
+         ctx.setVariable(textVariable, text);
+      }
+   }
+}

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/TextBasedJmsToEsb.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/TextBasedJmsToEsb.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/converters/TextBasedJmsToEsb.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.actions.converters;
+
+import org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+import javax.jms.Message;
+
+/**
+ * converts a text-base JMS message into an Esb Message
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class TextBasedJmsToEsb implements ActionHandler
+{
+   private static PackageJmsMessageContents transformer = new PackageJmsMessageContents();
+
+   public String jmsVariable = "message";
+   public String esbVariable = "esbMessage";
+   public boolean isTransient = true;
+
+
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+      ContextInstance ctx = executionContext.getProcessInstance().getContextInstance();
+      Message msg = (Message) ctx.getVariable(jmsVariable);
+      if (isTransient)
+         executionContext.getProcessInstance().getContextInstance().setTransientVariable(esbVariable, transformer.process(msg));
+      else executionContext.getProcessInstance().getContextInstance().setVariable(esbVariable, transformer.process(msg));
+   }
+}

Modified: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JMSRouter.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -22,22 +22,6 @@
 
 package org.jboss.soa.esb.actions.routing;
 
-import java.io.Serializable;
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.actions.ActionProcessingException;
@@ -47,6 +31,12 @@
 import org.jboss.soa.esb.helpers.NamingContext;
 import org.jboss.soa.esb.util.Util;
 
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.io.Serializable;
+import java.util.List;
+
 /**
  * JSM Routing Action Processor.
  * <p/>
@@ -54,7 +44,7 @@
  * <pre>
  * &lt;action class="org.jboss.soa.esb.actions.routing.JMSRouter"&gt;
  *     jndiName="queue/A"
- *     message-prop-<i>&gt;prop-name&lt;</i>="<i>&gt;prop-value&lt;</i>" &gt;!-- (Optional)--&lt; 
+ *     message-prop-<i>&gt;prop-name&lt;</i>="<i>&gt;prop-value&lt;</i>" &gt;!-- (Optional)--&lt;
  *     unwrap="true/false" &gt;!-- (Optional - default false)--&lt;
  * /&gt;
  * </pre>
@@ -62,178 +52,219 @@
  * <p/>
  * To unwrap the message payload from the message before routing, set the "unwrap" property to "true".
  * TODO: Add support for JMS Topic destinations.
+ *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  * @since Version 4.0
  */
-public class JMSRouter extends AbstractRouter {
-    /**
-     * Logger.
-     */
-    private static Logger logger = Logger.getLogger(JMSRouter.class);
-    /**
-     * Routing properties.
-     */
-    private List<KeyValuePair> properties;
-    /**
-     * JMS Queue setup.
-     */
-    private JMSSendQueueSetup queueSetup;
-    
-    /**
-     * Public constructor.
-     * @param propertiesTree Action properties.
-     * @throws ConfigurationException Queue name not configured.
-     * @throws JMSException Unable to configure JMS destination.
-     * @throws NamingException Unable to configure JMS destination.
-     */
-    public JMSRouter(ConfigTree propertiesTree) throws ConfigurationException, NamingException, JMSException {
-    	this("JMSRouter", propertiesTree.attributesAsList());
-    }
+public class JMSRouter extends AbstractRouter
+{
+   /**
+    * Logger.
+    */
+   private static Logger logger = Logger.getLogger(JMSRouter.class);
+   /**
+    * Routing properties.
+    */
+   private List<KeyValuePair> properties;
+   /**
+    * JMS Queue setup.
+    */
+   private JMSSendQueueSetup queueSetup;
 
-    /**
-     * Public constructor.
-     * @param actionName Action name.
-     * @param properties Action properties.
-     * @throws ConfigurationException Queue name not configured.
-     * @throws JMSException Unable to configure JMS destination.
-     * @throws NamingException Unable to configure JMS destination.
-     */
-    public JMSRouter(String actionName, List<KeyValuePair> properties) throws ConfigurationException {
-    	super(actionName, properties);
-    	
-        this.properties = properties;
-        
-        String queueName = KeyValuePair.getValue("jndiName", properties);
-        if(queueName == null) {
-            throw new ConfigurationException("JMSRouter must specify a 'jndiName' property.");
-        }
-        try {
-			queueSetup = new JMSSendQueueSetup(queueName);
-		} catch (Throwable t) {
-			new ConfigurationException("Failed to configure JMS Queue for routing.", t);
-		}
-        this.properties = properties;
-    }
+   /**
+    * Public constructor.
+    *
+    * @param propertiesTree Action properties.
+    * @throws ConfigurationException Queue name not configured.
+    * @throws JMSException           Unable to configure JMS destination.
+    * @throws NamingException        Unable to configure JMS destination.
+    */
+   public JMSRouter(ConfigTree propertiesTree) throws ConfigurationException, NamingException, JMSException
+   {
+      this("JMSRouter", propertiesTree.attributesAsList());
+   }
 
-    /* (non-Javadoc)
-     * @see org.jboss.soa.esb.actions.routing.AbstractRouter#route(java.lang.Object)
-     */
-    public void route(Object message) throws ActionProcessingException {
-    	
-        if(!(message instanceof Serializable) && !(message instanceof org.jboss.soa.esb.message.Message)) {
-            throw new ActionProcessingException("Cannot send Object [" + message.getClass().getName() + "] to destination [" + queueSetup.queueName + "]. Object must be serializable.");
-        }
-        
-        try {
-        	Message jmsMessage = null;
-        	
-            // Send the message to the queue...
-            if (message instanceof org.jboss.soa.esb.message.Message) {
-            	message = Util.serialize((org.jboss.soa.esb.message.Message)message);
-            	jmsMessage = createObjectMessage(message);
-            } else if(message instanceof String) {
-            	jmsMessage = queueSetup.jmsSession.createTextMessage();
-    
-                if(logger.isDebugEnabled()) {
-                    logger.debug("Sending Text message: [" + message + "] to destination [" + queueSetup.queueName + "].");
-                }
-                ((TextMessage)jmsMessage).setText((String)message);
-            } else if(message instanceof byte[]) {
-            	jmsMessage = queueSetup.jmsSession.createBytesMessage();
-                
-                if(logger.isDebugEnabled()) {
-                    logger.debug("Sending byte[] message: [" + message + "] to destination [" + queueSetup.queueName + "].");
-                }
-                ((BytesMessage)jmsMessage).writeBytes((byte[])message);
-            } else {
-            	jmsMessage = createObjectMessage(message);
-            }
-            setStringProperties(jmsMessage);
-            queueSetup.jmsProducer.send(jmsMessage);
-        } catch(Exception e) {
-            String errorMessage = "Exception while sending message [" + message + "] to destination [" + queueSetup.queueName + "].";
-            logger.error(errorMessage, e);
-            throw new ActionProcessingException(errorMessage, e);
-        }
-    }
+   /**
+    * Public constructor.
+    *
+    * @param actionName Action name.
+    * @param properties Action properties.
+    * @throws ConfigurationException Queue name not configured.
+    * @throws JMSException           Unable to configure JMS destination.
+    * @throws NamingException        Unable to configure JMS destination.
+    */
+   public JMSRouter(String actionName, List<KeyValuePair> properties) throws ConfigurationException
+   {
+      super(actionName, properties);
 
-	private Message createObjectMessage(Object message) throws JMSException {
-		Message jmsMessage;
-		jmsMessage = queueSetup.jmsSession.createObjectMessage();
-		
-		if(logger.isDebugEnabled()) {
-		    logger.debug("Sending Object message: [" + message + "] to destination [" + queueSetup.queueName + "].");
-		}
-		((ObjectMessage)jmsMessage).setObject((Serializable) message);
-		return jmsMessage;
-	}
+      this.properties = properties;
 
-    private void setStringProperties(Message msg) throws JMSException {
-        String messagePropPrefix = "message-prop-";
+      String queueName = KeyValuePair.getValue("jndiName", properties);
+      if (queueName == null)
+      {
+         throw new ConfigurationException("JMSRouter must specify a 'jndiName' property.");
+      }
+      try
+      {
+         queueSetup = new JMSSendQueueSetup(queueName);
+      }
+      catch (Throwable t)
+      {
+         new ConfigurationException("Failed to configure JMS Queue for routing.", t);
+      }
+      this.properties = properties;
+   }
 
-        for(KeyValuePair property : properties) {
-            String key = property.getKey();
-            
-            if(key.startsWith(messagePropPrefix) && key.length() > messagePropPrefix.length()) {
-                msg.setStringProperty(key.substring(messagePropPrefix.length()), property.getValue());
-            }
-        }
-    }
-    
-    /* (non-Javadoc)
-     * @see org.jboss.soa.esb.actions.ActionProcessor#getOkNotification(java.lang.Object)
-     */
-    public Serializable getOkNotification(org.jboss.soa.esb.message.Message message) {
-        return null;
-    }
+   /* (non-Javadoc)
+   * @see org.jboss.soa.esb.actions.routing.AbstractRouter#route(java.lang.Object)
+   */
+   public void route(Object message) throws ActionProcessingException
+   {
 
-    /* (non-Javadoc)
-     * @see org.jboss.soa.esb.actions.ActionProcessor#getErrorNotification(java.lang.Object)
-     */
-    public Serializable getErrorNotification(org.jboss.soa.esb.message.Message message) {
-        return null;
-    }
+      if (!(message instanceof Serializable) && !(message instanceof org.jboss.soa.esb.message.Message))
+      {
+         throw new ActionProcessingException("Cannot send Object [" + message.getClass().getName() + "] to destination [" + queueSetup.queueName + "]. Object must be serializable.");
+      }
 
-    @Override
-    protected void finalize() throws Throwable {
-        queueSetup.close();
-        super.finalize();
-    }
-    
-    private static class JMSSendQueueSetup {
-        QueueSession jmsSession;
-        Queue jmsQueue;
-        MessageProducer jmsProducer;
-        String queueName;
-        
-        // TODO: Modify to support topic destinations too
+      try
+      {
+         Message jmsMessage = null;
 
-        private JMSSendQueueSetup(String queueName) throws NamingException, JMSException  {
-            Context m_oCtx = NamingContext.getServerContext(
-                    Configuration.getJndiServerURL(),
-                    Configuration.getJndiServerContextFactory(), 
-                    Configuration.getJndiServerPkgPrefix());           
-            QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx.lookup("ConnectionFactory");
-            QueueConnection oQconn = qcf.createQueueConnection();
+         // Send the message to the queue...
+         if (message instanceof org.jboss.soa.esb.message.Message)
+         {
+            message = Util.serialize((org.jboss.soa.esb.message.Message) message);
+            jmsMessage = createObjectMessage(message);
+         }
+         else if (message instanceof String)
+         {
+            jmsMessage = queueSetup.jmsSession.createTextMessage();
 
-            this.queueName = queueName;
-            jmsSession = oQconn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
-            try {
-            	jmsQueue = (Queue) m_oCtx.lookup(queueName);
-            } catch (NamingException ne) {
-            	jmsQueue = jmsSession.createQueue(queueName);
-            }           
-            jmsProducer = jmsSession.createSender(jmsQueue);            
-        }
-        
-        private void close() {
-            try {
-                jmsProducer.close();
-                jmsSession.close();
-            } catch (Exception e) {
-                logger.error("Unable to close JMS Queue Setup.", e);
+            if (logger.isDebugEnabled())
+            {
+               logger.debug("Sending Text message: [" + message + "] to destination [" + queueSetup.queueName + "].");
             }
-        }
-    }
+            ((TextMessage) jmsMessage).setText((String) message);
+         }
+         else if (message instanceof byte[])
+         {
+            jmsMessage = queueSetup.jmsSession.createBytesMessage();
 
+            if (logger.isDebugEnabled())
+            {
+               logger.debug("Sending byte[] message: [" + message + "] to destination [" + queueSetup.queueName + "].");
+            }
+            ((BytesMessage) jmsMessage).writeBytes((byte[]) message);
+         }
+         else
+         {
+            jmsMessage = createObjectMessage(message);
+         }
+         setStringProperties(jmsMessage);
+         queueSetup.jmsProducer.send(jmsMessage);
+      }
+      catch (Exception e)
+      {
+         String errorMessage = "Exception while sending message [" + message + "] to destination [" + queueSetup.queueName + "].";
+         logger.error(errorMessage, e);
+         throw new ActionProcessingException(errorMessage, e);
+      }
+   }
+
+   private Message createObjectMessage(Object message) throws JMSException
+   {
+      Message jmsMessage;
+      jmsMessage = queueSetup.jmsSession.createObjectMessage();
+
+      if (logger.isDebugEnabled())
+      {
+         logger.debug("Sending Object message: [" + message + "] to destination [" + queueSetup.queueName + "].");
+      }
+      ((ObjectMessage) jmsMessage).setObject((Serializable) message);
+      return jmsMessage;
+   }
+
+   private void setStringProperties(Message msg) throws JMSException
+   {
+      String messagePropPrefix = "message-prop-";
+
+      for (KeyValuePair property : properties)
+      {
+         String key = property.getKey();
+
+         if (key.startsWith(messagePropPrefix) && key.length() > messagePropPrefix.length())
+         {
+            msg.setStringProperty(key.substring(messagePropPrefix.length()), property.getValue());
+         }
+      }
+   }
+
+   /* (non-Javadoc)
+   * @see org.jboss.soa.esb.actions.ActionProcessor#getOkNotification(java.lang.Object)
+   */
+   public Serializable getOkNotification(org.jboss.soa.esb.message.Message message)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+   * @see org.jboss.soa.esb.actions.ActionProcessor#getErrorNotification(java.lang.Object)
+   */
+   public Serializable getErrorNotification(org.jboss.soa.esb.message.Message message)
+   {
+      return null;
+   }
+
+   @Override
+   protected void finalize() throws Throwable
+   {
+      queueSetup.close();
+      super.finalize();
+   }
+
+   private static class JMSSendQueueSetup
+   {
+      QueueSession jmsSession;
+      Queue jmsQueue;
+      MessageProducer jmsProducer;
+      String queueName;
+
+      // TODO: Modify to support topic destinations too
+
+      private JMSSendQueueSetup(String queueName) throws NamingException, JMSException
+      {
+         Context m_oCtx = NamingContext.getServerContext(
+                 Configuration.getJndiServerURL(),
+                 Configuration.getJndiServerContextFactory(),
+                 Configuration.getJndiServerPkgPrefix());
+         QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx.lookup("ConnectionFactory");
+         QueueConnection oQconn = qcf.createQueueConnection();
+
+         this.queueName = queueName;
+         jmsSession = oQconn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+         try
+         {
+            jmsQueue = (Queue) m_oCtx.lookup(queueName);
+         }
+         catch (NamingException ne)
+         {
+            jmsQueue = jmsSession.createQueue(queueName);
+         }
+         jmsProducer = jmsSession.createSender(jmsQueue);
+      }
+
+      private void close()
+      {
+         try
+         {
+            jmsProducer.close();
+            jmsSession.close();
+         }
+         catch (Exception e)
+         {
+            logger.error("Unable to close JMS Queue Setup.", e);
+         }
+      }
+   }
+
 }

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JbpmJMSRouter.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JbpmJMSRouter.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/actions/routing/JbpmJMSRouter.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,159 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.actions.routing;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.NamingContext;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.JbpmUtil;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.util.Util;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+import javax.naming.NamingException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.jms.*;
+import java.util.List;
+import java.util.Map;
+import java.util.Hashtable;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:bill at jboss.com">Bill Burke</a>
+ * @since Version 4.0
+ */
+public class JbpmJMSRouter  implements ActionHandler
+{
+   /**
+    * Logger.
+    */
+   private static Logger logger = Logger.getLogger(JbpmJMSRouter.class);
+
+   private Map<String, String> initialContext;
+   private String connectionFactory = "java:/ConnectionFactory";
+   private String destination;
+   private String username;
+   private String password;
+   private Map<String, String> messageProperties;
+   private String variable = "esbMessage";
+
+
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+      Object message = JbpmUtil.getVariable(variable, executionContext);
+      route(message);
+   }
+
+   private InitialContext getInitialContext() throws NamingException
+   {
+      if (initialContext == null) return new InitialContext();
+      Hashtable hash = new Hashtable();
+      hash.putAll(initialContext);
+      return new InitialContext(hash);
+   }
+
+   /* (non-Javadoc)
+   * @see org.jboss.soa.esb.actions.routing.AbstractRouter#route(java.lang.Object)
+   */
+   public void route(Object message) throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      ConnectionFactory factory = (ConnectionFactory)ctx.lookup(connectionFactory);
+      Destination dest = (Destination)ctx.lookup(destination);
+      Connection connection = null;
+      if (username != null)
+      {
+         connection = factory.createConnection(username, password);
+      }
+      else
+      {
+         connection = factory.createConnection();
+      }
+      try
+      {
+         Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+
+         if (!(message instanceof Serializable) && !(message instanceof org.jboss.soa.esb.message.Message))
+         {
+            throw new Exception("Cannot send Object [" + message.getClass().getName() + "] to destination [" + destination + "]. Object must be serializable.");
+         }
+
+         try
+      {
+         Message jmsMessage = null;
+
+            // Send the message to the queue...
+            if (message instanceof org.jboss.soa.esb.message.Message)
+            {
+               message = Util.serialize((org.jboss.soa.esb.message.Message) message);
+               jmsMessage = session.createObjectMessage((Serializable)message);
+            }
+            else if (message instanceof String)
+            {
+               jmsMessage = session.createTextMessage((String)message);
+            }
+            else if (message instanceof byte[])
+            {
+               jmsMessage = session.createBytesMessage();
+               ((BytesMessage) jmsMessage).writeBytes((byte[]) message);
+            }
+            else
+            {
+               jmsMessage = session.createObjectMessage((Serializable)message);
+            }
+            setStringProperties(jmsMessage);
+            MessageProducer producer = session.createProducer(dest);
+            producer.send(jmsMessage);
+            session.commit();
+         }
+         finally
+         {
+            session.close();
+         }
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+
+   private void setStringProperties(Message msg) throws JMSException
+   {
+
+      if (messageProperties == null) return;
+      for (String key : messageProperties.keySet())
+      {
+         String value = messageProperties.get(key);
+         msg.setStringProperty(key, value);
+      }
+   }
+
+}

Deleted: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -1,387 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.listeners.config;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.listeners.LifecycleUtil;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
-import org.xml.sax.InputSource;
-/**
- * The controller monitors changes in the jbossesb configuration file call jbossesb.xml. When
- * changes are detected it validates the XML, and when it passes validation it goes on and
- * generates the jbossesb-listener.xml and jbossesb-gateway.xml.
- * 
- * @author kstam
- *
- */
-public class ConfigurationController implements Runnable
-{
-	private static final int SLEEP_MILLIS       = 1000; // default interval between parameter reloads
-        private static final int ENDED_MILLIS       = 20000; // default interval between parameter reloads
-	private static final String JBOSSESB_XSD = "/jbossesb-1.0.xsd";
-	private final Logger mLogger = Logger.getLogger(this.getClass());
-        private final Lock endedLock = new ReentrantLock() ;
-        private final Condition endedChanged = endedLock.newCondition() ;
-        private final Condition endRequested = endedLock.newCondition() ;
-	private final String mConfigFileName;
-	private final String mValidationFileName;
-	private final File mConfigDirectory;
-        private final String mListenerConfigFile;
-        private final String mGatewayConfigFile;
-	private long mPreviousFileTimestamp;
-	private boolean mIsEndRequested;
-	private boolean ended;
-        private ManagedLifecycleController controller ;
-	
-	/**
-	 * Start the Controller externally.
-	 * @param args - arg[0] - the parameter file name
-	 */
-	
-	public static void main(String[] args)
-	{
-		ConfigurationController configurationController = new ConfigurationController(args[0],null);
-		configurationController.run();
-	}
-	/**
-	 * Construct a Configuration Manager from the named repository based
-	 * configuration. The default jbossesb-1.0.xsd will be used for validation.
-	 * 
-	 * @param configFileName - Name of the configuration repository.
-	 *   
-	 */
-	public ConfigurationController(String configFileName)
-	{
-		this(configFileName, null);
-	}
-	/**
-	 * Construct a Configuration Manager from the named repository based
-	 * configuration.
-	 * 
-	 * @param configFileName - Name of the configuration repository.
-	 * @param validationFileName - Name of the file name used for validation (xsd or dtd).
-	 *   
-	 */
-	public ConfigurationController(String configFileName, String validationFileName)
-	{
-		mConfigFileName = configFileName;
-		File configFile = new File(configFileName);
-		File parent = configFile.getParentFile();
-		mConfigDirectory = (null!=parent) ? parent : new File("");
-                final File listenerConfigFile = new File(mConfigDirectory, Generator.ESB_CONFIG_XML_FILE) ;
-                mListenerConfigFile = listenerConfigFile.getAbsolutePath() ;
-                final File gatewayConfigFile = new File(mConfigDirectory, Generator.ESB_CONFIG_GATEWAY_XML_FILE) ;
-                mGatewayConfigFile = gatewayConfigFile.getAbsolutePath() ;
-		//Try to obtain a handle to the validation file (xsd)
-		if (validationFileName==null) {
-			mValidationFileName=JBOSSESB_XSD;
-		} else {
-			mValidationFileName = validationFileName;
-		}
-		
-		processConfiguration() ;
-	}
-    /**
-     * Thread that observes the configuration (file). If the configuration is updated it is
-     * validated and new set jbossesb-listener.xml and jbossesb-gateway.xml is created for the
-     * current server.
-     */
- 	public void run() 
-	{
-		mLogger.info("Configuration Controller instance started.");
-		try {
-			if (mConfigFileName!=null) {
-                                do {
-					processConfiguration() ;
-				} while(!waitForRequestedEnd(SLEEP_MILLIS)) ;
-                                stopController() ;
-			} else {
-				mLogger.fatal("The name of the configuran file was null: " + mConfigFileName);
-			}
-		} finally {
-			mLogger.info("Exiting Config Controller...");
-			setEnded(true) ;
-		}
-	}
-
-	/**
-	 * Has the controller instance ended.
-	 * @return True if this controller instance has ended, otherwise false..
-	 */
-	public boolean hasEnded() {
-            endedLock.lock() ;
-            try
-            {
-		return ended ;
-            }
-            finally
-            {
-                endedLock.unlock() ;
-            }
-	}
-        
-        /**
-         * Set the ended flag.
-         * @param ended The value of the ended flag.
-         */
-        private void setEnded(final boolean ended)
-        {
-            endedLock.lock() ;
-            try
-            {
-                this.ended = ended ;
-                endedChanged.signalAll() ;
-            }
-            finally
-            {
-                endedLock.unlock() ;
-            }
-        }
-        
-        /**
-         * Wait until the ended flag has been set.
-         * @return true if the ended flag has been set, false otherwise
-         */
-        public boolean waitUntilEnded()
-        {
-            return waitUntilEnded(ENDED_MILLIS) ;
-        }
-        
-        /**
-         * Wait until the ended flag has been set.
-         * @param maxDelay The maximum time to wait for the flag to be set.
-         * @return true if the ended flag has been set, false otherwise
-         */
-        public boolean waitUntilEnded(final long maxDelay)
-        {
-            final long endTime = System.currentTimeMillis() + maxDelay ;
-            endedLock.lock() ;
-            try
-            {
-                try
-                {
-                    while (!ended)
-                    {
-                        final long delay = endTime - System.currentTimeMillis() ;
-                        if ((delay <= 0) || !endedChanged.await(delay, TimeUnit.MILLISECONDS))
-                        {
-                            break ;
-                        }
-                    }
-                }
-                catch (final InterruptedException ie) {} // ignore
-                
-                return ended ;
-            }
-            finally
-            {
-                endedLock.unlock() ;
-            }
-        }
-        
-        /**
-         * Wait for a request to end.
-         * @param maxDelay The maximum time to wait in milliseconds.
-         */
-        public boolean waitForRequestedEnd(final long maxDelay)
-        {
-            final long endTime = System.currentTimeMillis() + maxDelay ;
-            endedLock.lock() ;
-            try
-            {
-                try
-                {
-                    while (!mIsEndRequested)
-                    {
-                        final long delay = endTime - System.currentTimeMillis() ;
-                        if ((delay <= 0) || !endRequested.await(delay, TimeUnit.MILLISECONDS))
-                        {
-                            break ;
-                        }
-                    }
-                }
-                catch (final InterruptedException ie) {} // ignore
-                
-                return mIsEndRequested ;
-            }
-            finally
-            {
-                endedLock.unlock() ;
-            }
-        }
-	
-	/**
-	 * To request the end of processing.
-	 */
-	public void requestEnd()
-        {
-            endedLock.lock() ;
-            try
-            {
-		mIsEndRequested = true;
-                endRequested.signalAll() ;
-            }
-            finally
-            {
-                endedLock.unlock() ;
-            }
-	}
-	
-	/**
-	 * Process the configuration.
-	 */
-	private void processConfiguration()
-	{
-		if (isReloadNeeded()) { 
-			try {
-				StreamSource validationInputSource=null;
-				InputStream validationInputStream = this.getClass().getResourceAsStream(mValidationFileName);
-				//if this fails try using the 
-				if (validationInputStream==null) {
-					File validationFile = new File(mValidationFileName);
-					mLogger.debug("Validation file " + mValidationFileName + " exists?:" + validationFile.exists());
-					try {
-						validationInputStream = new FileInputStream(validationFile);
-					} catch (FileNotFoundException e) {
-						mLogger.error(e.getMessage(),e);
-						throw new IllegalStateException("ESB validation file [" + (new File(mValidationFileName)).getAbsolutePath() + "] not found.", e);
-					}
-				}
-				if (validationInputStream==null) {
-					mLogger.warn("Could not obtain validation file " + mValidationFileName);
-				} else {
-					mLogger.debug("Reading validation info from " + mValidationFileName);
-					validationInputSource = new StreamSource(validationInputStream);
-				}
-				
-				mLogger.info("loading configuration..");
-				String configXml = ParamRepositoryFactory.getInstance().get(mConfigFileName);
-				mLogger.debug("Start validation on configXml=" + configXml);
-				InputSource xmlInputSource = new InputSource(new StringReader(configXml));
-				XmlValidator validator = new XmlValidatorImpl();
-				if (validator.validate(xmlInputSource, validationInputSource)) {
-					mLogger.debug("Configuration file " + mConfigFileName + " passed validation. Starting " +
-							" the generation process of the jbossesb-listener.xml and the jbossesb-gateway.xml.");
-					Generator generator = new Generator(new ByteArrayInputStream(configXml.getBytes()));
-					generator.generate(mConfigDirectory);
-					mLogger.info("Parameter reload completed.");
-                                        stopController() ;
-                                        
-                                        final List<ManagedLifecycle> instances = LifecycleUtil.getListeners(mListenerConfigFile) ;
-                                        instances.addAll(LifecycleUtil.getGateways(mGatewayConfigFile)) ;
-                                        
-                                        controller = new ManagedLifecycleController(instances) ;
-                                        try
-                                        {
-                                            controller.start() ;
-                                        }
-                                        catch (final ManagedLifecycleException mle)
-                                        {
-                                            controller = null ;
-                                            mLogger.error("Unexpected exception starting controller", mle) ;
-                                        }
-				} else {
-					StringBuffer buffer = new StringBuffer("The configuration file "
-							+ mConfigFileName + "\n did not pass validation for the following reasons: \n");
-					int i=0;
-				    for (String error: validator.getValidationResults())
-					{
-						buffer.append("** " + ++i + ". "+ error + "\n");
-					}
-				    System.out.println(buffer);
-				    mLogger.error(buffer);
-					mLogger.info("The current configuration is kept in place until "
-							+ " validation passes.");
-				}
-			} catch (Exception e) {
-				mLogger.error("The current versions of the jbossesb-listener.xml and/or"
-						    + " jbossesb-gateway.xml are kept in place until the error is resolved: "
-						    +  e.getMessage(), e);
-			    System.out.println(e.getMessage());
-			} 
-		}
-	}
-	
-	/**
-	 * Check the file timestamp and return true when it changes. In other
-	 * words this only works for files for now.
-	 * 
-	 * @return true if the file timestamp changed.
-	 */
-	private boolean isReloadNeeded() 
-	{
-		File configFile = new File(mConfigFileName);
-		if (configFile.exists()) {
-			long currentFileTimestamp = configFile.lastModified();
-			if (mPreviousFileTimestamp==0 || currentFileTimestamp > mPreviousFileTimestamp) {
-				if (mLogger.isDebugEnabled()) {
-					mLogger.debug("The previous timestamp on the file was: " + new Date(mPreviousFileTimestamp)
-						+ " the new timestamp on the file is: " + new Date(currentFileTimestamp));
-				}
-				mPreviousFileTimestamp = currentFileTimestamp;
-				return true;
-			}
-		} else {
-			mLogger.error("The configuration file " + configFile + " could not be found.");
-		}
-		return false;
-	}
-        
-        /**
-         * Stop the controller if it is active.
-         */
-        private void stopController()
-        {
-            if (controller != null)
-            {
-                try
-                {
-                    controller.stop();
-                }
-                catch (final ManagedLifecycleException mle)
-                {
-                    mLogger.error("Unexpected exception stopping controller", mle) ;
-                    System.out.println(mle.getMessage()) ;
-                }
-                controller = null ;
-            }
-        }
-}

Modified: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -30,11 +30,14 @@
 import org.jboss.metadata.XmlFileLoader;
 import org.jboss.mx.loading.LoaderRepositoryFactory;
 import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.ObjectNameConverter;
 import org.jboss.system.ServiceControllerMBean;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.GraphSession;
+import org.jbpm.graph.def.ProcessDefinition;
 import org.w3c.dom.Element;
 
-import javax.management.ObjectName;
+import javax.naming.InitialContext;
 import java.io.File;
 import java.io.InputStream;
 import java.net.URL;
@@ -52,6 +55,10 @@
 
    private ServiceControllerMBean serviceController;
 
+   //@Resource(name="jbpm", mappedName="java:/jbpm/JbpmConfiguration")
+   protected JbpmConfiguration configuration;
+
+
    /**
     * Default CTOR used to set default values to the Suffixes and RelativeOrder
     * attributes. Those are read at subdeployer registration time by the MainDeployer
@@ -103,7 +110,7 @@
    {
       String urlStr = di.url.toString();
       return urlStr.endsWith(".esb") || urlStr.endsWith(".esb/") ||
-      urlStr.endsWith("-esb.xml");
+              urlStr.endsWith("-esb.xml");
    }
 
    /**
@@ -113,11 +120,14 @@
    {
       serviceController = (ServiceControllerMBean)
               MBeanProxyExt.create(ServiceControllerMBean.class,
-                                   ServiceControllerMBean.OBJECT_NAME, server);
+                      ServiceControllerMBean.OBJECT_NAME, server);
 
       mainDeployer.addDeployer(this);
-   }   
+      InitialContext ctx = new InitialContext();
+      configuration = (JbpmConfiguration) ctx.lookup("java:/jbpm/JbpmConfiguration");
+   }
 
+
    protected URL getDocumentUrl(DeploymentInfo di)
    {
       String urlStr = di.url.toString();
@@ -132,11 +142,11 @@
    {
       try
       {
-         if( di.url.getProtocol().equalsIgnoreCase("file") )
+         if (di.url.getProtocol().equalsIgnoreCase("file"))
          {
             File file = new File(di.url.getFile());
 
-            if( !file.isDirectory() )
+            if (!file.isDirectory())
             {
                // If not directory we watch the package
                di.watch = di.url;
@@ -155,17 +165,17 @@
 
          XmlFileLoader xfl = new XmlFileLoader();
          InputStream in = di.localCl.getResourceAsStream("META-INF/classloader.xml");
-         if( in != null )
+         if (in != null)
          {
             try
             {
                Element jboss = xfl.getDocument(in, "META-INF/classloader.xml").getDocumentElement();
                // Check for a ejb level class loading config
                Element loader = MetaData.getOptionalChild(jboss, "loader-repository");
-               if( loader != null )
+               if (loader != null)
                {
                   LoaderRepositoryFactory.LoaderRepositoryConfig config =
-                        LoaderRepositoryFactory.parseRepositoryConfig(loader);
+                          LoaderRepositoryFactory.parseRepositoryConfig(loader);
                   di.setRepositoryInfo(config);
                }
 
@@ -180,12 +190,11 @@
       {
          if (e instanceof DeploymentException)
          {
-            throw (DeploymentException) e;
+            throw(DeploymentException) e;
          }
-         throw new DeploymentException( "failed to initialize", e );
+         throw new DeploymentException("failed to initialize", e);
       }
 
-
       // invoke super-class initialization
       super.init(di);
    }
@@ -193,32 +202,50 @@
    public synchronized void create(DeploymentInfo di) throws DeploymentException
    {
       log.debug("create, " + di.shortName);
-
       try
       {
          String jbossEsbXml = Configuration.getStringFromStream(getDocumentUrl(di).openStream());
-         JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(jbossEsbXml);
-         String name = "jboss.esb:module=" + di.shortName;
-         // Build an escaped JMX name including deployment shortname
-         ObjectName esbModuleName = ObjectNameConverter.convert(name);
-         // Check that the name is not registered
-         if (server.isRegistered(esbModuleName) == true)
+         ProcessDefinition def = ProcessDefinition.parseXmlString(jbossEsbXml);
+         if (def.getName() == null) throw new DeploymentException("Process Definition must be have a name attribute for identification");
+         int hash = jbossEsbXml.hashCode();
+         String hashName = def.getName() + "-" + hash;
+         JbpmContext jbpmContext = configuration.getCurrentJbpmContext();
+         if (jbpmContext == null)
          {
-            log.debug("The ESB Module name: " + esbModuleName
-                      + "is already registered, adding uid=" + System.identityHashCode(deployment));
-            name = name + ",uid=" + System.identityHashCode(deployment);
-            esbModuleName = ObjectNameConverter.convert(name);
+            jbpmContext = configuration.createJbpmContext();
          }
-         server.registerMBean(deployment, esbModuleName);
-         di.deployedObject = esbModuleName;
-         log.debug("Deploying: " + di.url);
-         // Invoke the create life cycle method
-         serviceController.create(di.deployedObject);
+         try
+         {
+            GraphSession session = jbpmContext.getGraphSession();
+            ProcessDefinition old = null;
+            try
+            {
+               old = session.findLatestProcessDefinition(hashName);
+            }
+            catch (Exception ignored)
+            {
+            }
+            if (old != null)
+            {
+               log.info("Found old JBPM process definition in database: " + def.getName());
+               return;
+            }
+            log.info("Deploying new JBPM Process Definition: " + def.getName());
+            session.deployProcessDefinition(def);
+            def = ProcessDefinition.parseXmlString(jbossEsbXml);
+            def.setName(hashName);
+            session.deployProcessDefinition(def);
+         }
+         finally              
+         {
+            jbpmContext.close();
+         }
+
       }
       catch (Exception e)
       {
          throw new DeploymentException("Error during create of ESB Module: "
-                                       + di.url, e);
+                 + di.url, e);
       }
       super.create(di);
    }
@@ -226,55 +253,18 @@
    public synchronized void start(DeploymentInfo di)
            throws DeploymentException
    {
-      try
-      {
-         // Start application
-         log.debug("start application, deploymentInfo: " + di +
-                   ", short name: " + di.shortName +
-                   ", parent short name: " +
-                   (di.parent == null ? "null" : di.parent.shortName));
-         serviceController.start(di.deployedObject);
-      }
-      catch (Exception e)
-      {
-         stop(di);
-         destroy(di);
-         throw new DeploymentException("Could not deploy " + di.url, e);
-      }
       super.start(di);
    }
 
    public void stop(DeploymentInfo di)
            throws DeploymentException
    {
-      log.debug("init, " + di.shortName);
-      try
-      {
-         serviceController.stop(di.deployedObject);
-      }
-      catch (Exception e)
-      {
-         throw new DeploymentException("problem stopping ejb module: " +
-                                       di.url, e);
-      }
-
       super.stop(di);
    }
 
    public void destroy(DeploymentInfo di)
            throws DeploymentException
    {
-      try
-      {
-         serviceController.destroy(di.deployedObject);
-         serviceController.remove(di.deployedObject);
-      }
-      catch (Exception e)
-      {
-         throw new DeploymentException("problem destroying ejb module: " +
-                                       di.url, e);
-      }
-
       super.destroy(di);
    }
 }

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JbpmProcessDefinitionMdb.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JbpmProcessDefinitionMdb.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JbpmProcessDefinitionMdb.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.listeners.gateway;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.db.GraphSession;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.annotation.Resource;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JbpmProcessDefinitionMdb implements MessageListener
+{
+   @Resource(name="jbpm", mappedName="java:/jbpm/JbpmConfiguration")
+   protected JbpmConfiguration configuration;
+
+   @Resource(name="jbpm.process.definition")
+   protected String processDefinition;
+
+   @Resource(name="jbpm.process.variable")
+   protected String messageVariable = "message";
+
+
+   public void onMessage(Message message)
+   {
+      JbpmContext context = configuration.createJbpmContext();
+      ProcessInstance processInstance = context.newProcessInstance(processDefinition);
+      processInstance.getContextInstance().setVariable(messageVariable, message);
+      processInstance.signal();
+   }
+}

Modified: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -22,26 +22,6 @@
 
 package org.jboss.soa.esb.listeners.gateway;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Enumeration;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.addressing.EPR;
@@ -58,470 +38,419 @@
 import org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.services.registry.RegistryException;
 
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
 public class JmsGatewayListener extends AbstractThreadedManagedLifecycle
 {
 
-        /**
-         * serial version uid for this class
-         */
-        private static final long serialVersionUID = 5070422864110923930L;
-    
-        public JmsGatewayListener (ConfigTree listenerConfig) throws ConfigurationException
-	{
-            super(listenerConfig) ;
-            _config = listenerConfig;
-            _sleepForRetries = 3000; // milliseconds TODO magic number
-            checkMyParms();
-	} // __________________________________
+   /**
+    * serial version uid for this class
+    */
+   private static final long serialVersionUID = 5070422864110923930L;
 
-        
-        /**
-         * Handle the initialisation of the managed instance.
-         * 
-         * @throws ManagedLifecycleException for errors while initialisation.
-         */
-        protected void doInitialise()
-            throws ManagedLifecycleException
-        {
+   public JmsGatewayListener(ConfigTree listenerConfig) throws ConfigurationException
+   {
+      super(listenerConfig);
+      _config = listenerConfig;
+      _sleepForRetries = 3000; // milliseconds TODO magic number
+      checkMyParms();
+   } // __________________________________
+
+
+   /**
+    * Handle the initialisation of the managed instance.
+    *
+    * @throws ManagedLifecycleException for errors while initialisation.
+    */
+   protected void doInitialise()
+           throws ManagedLifecycleException
+   {
+      try
+      {
+         _targetEprs = RegistryUtil.getEprs(_targetServiceCategory, _targetServiceName);
+         if (null == _targetEprs || _targetEprs.size() < 1)
+            throw new ManagedLifecycleException("EPR <" + _targetServiceName + "> not found in registry");
+      }
+      catch (final RegistryException re)
+      {
+         throw new ManagedLifecycleException("Unexpected registry exception", re);
+      }
+
+      if (_serviceName != null)
+      {
+         try
+         {
+            RegistryUtil.register(_config, _myEpr);
+         }
+         catch (final RegistryException re)
+         {
+            throw new ManagedLifecycleException("Unexpected error during registration for epr " + _myEpr, re);
+         }
+      }
+
+      try
+      {
+         prepareMessageReceiver();
+      }
+      catch (final JMSException jmse)
+      {
+         if (_serviceName != null)
+         {
+            RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr);
+         }
+         throw new ManagedLifecycleException("Unexpected JMS error from prepareMessageReceiver", jmse);
+      }
+      catch (final ConfigurationException ce)
+      {
+         if (_serviceName != null)
+         {
+            RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr);
+         }
+         throw new ManagedLifecycleException("Unexpected configuration exception from prepareMessageReceiver", ce);
+      }
+   }
+
+   /**
+    * Execute on the thread.
+    */
+   protected void doRun()
+   {
+      if (_logger.isDebugEnabled())
+      {
+         _logger.debug("run() method of " + this.getClass().getSimpleName() +
+                 " started on thread " + Thread.currentThread().getName());
+      }
+
+      while (isRunning())
+      {
+         javax.jms.Message msgIn = receiveOne();
+         if (null != msgIn)
             try
             {
-                _targetEprs = RegistryUtil.getEprs(_targetServiceCategory,_targetServiceName);
-                if (null == _targetEprs || _targetEprs.size() < 1)
-                    throw new ManagedLifecycleException("EPR <" + _targetServiceName + "> not found in registry") ;
+               Object obj = _processMethod.invoke(_composer,
+                       new Object[]{msgIn});
+               if (null == obj)
+               {
+                  _logger.warn("Action class method <" + _processMethod
+                          .getName() + "> returned a null object");
+                  continue;
+               }
+               // try to deliver the composed message, using the
+               // appropriate courier
+               // to the target service
+               try
+               {
+                  boolean bSent = false;
+                  for (EPR current : _targetEprs)
+                  {
+                     _courier = CourierFactory.getCourier(current);
+                     try
+                     {
+                        if (_courier
+                                .deliver((org.jboss.soa.esb.message.Message) obj))
+                        {
+                           bSent = true;
+                           break;
+                        }
+                     }
+                     finally
+                     {
+                        CourierUtil.cleanCourier(_courier);
+                     }
+                  }
+                  if (!bSent)
+                  {
+                     String text = "Target service <" + _targetServiceCategory + "," + _targetServiceName + "> is not registered";
+                     throw new Exception(text);
+                  }
+               }
+               catch (ClassCastException e)
+               {
+                  _logger.error("Action class method <" + _processMethod
+                          .getName() + "> returned a non Message object",
+                          e);
+                  continue;
+               }
+               catch (CourierException e)
+               {
+                  String text = (null != _courier) ? "Courier <" + _courier
+                          .getClass().getName() + ".deliver(Message) FAILED" : "NULL courier can't deliver Message";
+                  _logger.error(text, e);
+                  continue;
+               }
+               continue;
             }
-            catch (final RegistryException re)
+            catch (InvocationTargetException e)
             {
-                throw new ManagedLifecycleException("Unexpected registry exception", re) ;
+               _logger.error("Problems invoking method <" + _processMethod
+                       .getName() + ">", e);
             }
-            
-            if (_serviceName != null)
+            catch (IllegalAccessException e)
             {
-                try
-                {
-                    RegistryUtil.register(_config, _myEpr);
-                }
-                catch (final RegistryException re)
-                {
-                    throw new ManagedLifecycleException("Unexpected error during registration for epr " + _myEpr, re);
-                }
+               _logger.error("Problems invoking method <" + _processMethod
+                       .getName() + ">", e);
             }
-            
-            try
+            catch (Exception e)
             {
-                prepareMessageReceiver();
+               _logger.error("Unexpected problem", e);
             }
-            catch (final JMSException jmse)
-            {
-                if (_serviceName != null)
-                {
-                    RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr) ;
-                }
-                throw new ManagedLifecycleException("Unexpected JMS error from prepareMessageReceiver", jmse);
-            }
-            catch (final ConfigurationException ce)
-            {
-                if (_serviceName != null)
-                {
-                    RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr) ;
-                }
-                throw new ManagedLifecycleException("Unexpected configuration exception from prepareMessageReceiver", ce);
-            }
-        }
-        
-        /**
-         * Execute on the thread.
-         */
-        protected void doRun()
-        {
-                if (_logger.isDebugEnabled())
-                {
-                    _logger.debug("run() method of " + this.getClass().getSimpleName() +
-                        " started on thread " + Thread.currentThread().getName());
-                }
+      }
 
-		while (isRunning())
-		{
-			javax.jms.Message msgIn = receiveOne();
-			if (null != msgIn)
-				try
-				{
-					Object obj = _processMethod.invoke(_composer,
-							new Object[] { msgIn });
-					if (null == obj)
-					{
-						_logger.warn("Action class method <" + _processMethod
-								.getName() + "> returned a null object");
-						continue;
-					}
-					// try to deliver the composed message, using the
-					// appropriate courier
-					// to the target service
-					try
-					{
-						boolean bSent = false;
-						for (EPR current : _targetEprs)
-						{
-							_courier = CourierFactory.getCourier(current);
-                                                        try
-                                                        {
-                                                            if (_courier
-                                                            		.deliver((org.jboss.soa.esb.message.Message) obj))
-                                                            {
-                                                            	bSent = true;
-                                                            	break;
-                                                            }
-                                                        }
-                                                        finally
-                                                        {
-                                                            CourierUtil.cleanCourier(_courier) ;
-                                                        }
-						}
-						if (!bSent)
-						{
-							String text = "Target service <" + _targetServiceCategory + "," + _targetServiceName + "> is not registered";
-							throw new Exception(text);
-						}
-					}
-					catch (ClassCastException e)
-					{
-						_logger.error("Action class method <" + _processMethod
-								.getName() + "> returned a non Message object",
-								e);
-						continue;
-					}
-					catch (CourierException e)
-					{
-						String text = (null != _courier) ? "Courier <" + _courier
-								.getClass().getName() + ".deliver(Message) FAILED" : "NULL courier can't deliver Message";
-						_logger.error(text, e);
-						continue;
-					}
-					continue;
-				}
-				catch (InvocationTargetException e)
-				{
-					_logger.error("Problems invoking method <" + _processMethod
-							.getName() + ">", e);
-				}
-				catch (IllegalAccessException e)
-				{
-					_logger.error("Problems invoking method <" + _processMethod
-							.getName() + ">", e);
-				}
-				catch (Exception e)
-				{
-					_logger.error("Unexpected problem", e);
-				}
-		}
+      _logger
+              .debug("run() method of " + this.getClass().getSimpleName() + " finished on thread " + Thread
+                      .currentThread().getName());
+   } // ________________________________
 
-		_logger
-				.debug("run() method of " + this.getClass().getSimpleName() + " finished on thread " + Thread
-						.currentThread().getName());
-	} // ________________________________
+   /**
+    * Handle the destroy of the managed instance.
+    *
+    * @throws ManagedLifecycleException for errors while destroying.
+    */
+   protected void doDestroy()
+           throws ManagedLifecycleException
+   {
+      if (_messageReceiver != null)
+      {
+         try
+         {
+            _messageReceiver.close();
+         }
+         catch (final JMSException jmse)
+         {
+         } // ignore
+      }
 
-        /**
-         * Handle the destroy of the managed instance.
-         * 
-         * @throws ManagedLifecycleException for errors while destroying.
-         */
-        protected void doDestroy()
-            throws ManagedLifecycleException
-        {
-            if (_messageReceiver != null)
-            {
-                try
-                {
-                    _messageReceiver.close();
-                }
-                catch (final JMSException jmse) {} // ignore
-            }
-            
-            if (_queueSession != null)
-            {
-                try
-                {
-                    _queueSession.close();
-                }
-                catch (final JMSException jmse) {} // ignore
-            }
-            
-            if (_queueConnection != null)
-            {
-                try
-                {
-                    _queueConnection.close();
-                }
-                catch (final JMSException jmse) {} // ignore
-            }
-            
-            if (_serviceName != null)
-            {
-                RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr) ;
-            }
-        }
+      if (_queueSession != null)
+      {
+         try
+         {
+            _queueSession.close();
+         }
+         catch (final JMSException jmse)
+         {
+         } // ignore
+      }
 
-	/**
-	 * Check for mandatory and optional attributes in parameter tree
-	 * 
-	 * @throws ConfigurationException -
-	 *             if mandatory atts are not right or actionClass not in
-	 *             classpath
-	 */
-	protected void checkMyParms () throws ConfigurationException
-	{
-		// Third arg is null - Exception will be thrown if attribute is not
-		// found
-		_targetServiceCategory = ListenerUtil.obtainAtt(_config,
-				ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, null);
-		_targetServiceName = ListenerUtil.obtainAtt(_config,
-				ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);
+      if (_queueConnection != null)
+      {
+         try
+         {
+            _queueConnection.close();
+         }
+         catch (final JMSException jmse)
+         {
+         } // ignore
+      }
 
-		_queueName = ListenerUtil.obtainAtt(_config,
-				JMSEpr.DESTINATION_NAME_TAG, null);
+      if (_serviceName != null)
+      {
+         RegistryUtil.unregister(_serviceCategory, _serviceName, _myEpr);
+      }
+   }
 
-		resolveComposerClass();
+   /**
+    * Check for mandatory and optional attributes in parameter tree
+    *
+    * @throws ConfigurationException -
+    *                                if mandatory atts are not right or actionClass not in
+    *                                classpath
+    */
+   protected void checkMyParms() throws ConfigurationException
+   {
+      // Third arg is null - Exception will be thrown if attribute is not
+      // found
+      _targetServiceCategory = ListenerUtil.obtainAtt(_config,
+              ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, null);
+      _targetServiceName = ListenerUtil.obtainAtt(_config,
+              ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);
 
-		// No problem if selector is null - everything in queue will be returned
-		_messageSelector = _config.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
-		_logger
-				.debug("No value specified for: " + JMSEpr.MESSAGE_SELECTOR_TAG + " - All messages in queue will be received by this listener");
-	} // ________________________________
+      _queueName = ListenerUtil.obtainAtt(_config,
+              JMSEpr.DESTINATION_NAME_TAG, null);
 
-	protected void resolveComposerClass () throws ConfigurationException
-	{
-		try
-		{
-            String sProcessMethod = null;
-            _composerName = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG);
-            if (null != _composerName)
-            { // class attribute
-                _composerClass = Class.forName(_composerName);
-                Constructor oConst = _composerClass.getConstructor(new Class[]
-                { ConfigTree.class });
-                _composer = oConst.newInstance(_config);
-                sProcessMethod = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_METHOD_TAG, "process");
-            }
-			else
-			{
-				_composerName = PackageJmsMessageContents.class.getName();
-				_composerClass = PackageJmsMessageContents.class;
-				_composer = new PackageJmsMessageContents();
-				sProcessMethod = "process";
-				_logger
-						.debug("No <" + ListenerTagNames.ACTION_ELEMENT_TAG + "> element found in configuration" + " -  Using default composer class : " + _composerName);
-			}
-	
-			_processMethod = _composerClass.getMethod(sProcessMethod,
-					new Class[] { Object.class });
-		}
-		catch (Exception ex)
-		{
-			throw new ConfigurationException(ex);
-		}
-	} // ________________________________
+      resolveComposerClass();
 
-	private void prepareMessageReceiver () throws ConfigurationException, JMSException
-	{
-		_queueConnection = null;
-		_queueSession = null;
-		_queue = null;
+      // No problem if selector is null - everything in queue will be returned
+      _messageSelector = _config.getAttribute(JMSEpr.MESSAGE_SELECTOR_TAG);
+      _logger
+              .debug("No value specified for: " + JMSEpr.MESSAGE_SELECTOR_TAG + " - All messages in queue will be received by this listener");
+   } // ________________________________
 
-		String sJndiURL = ListenerUtil.obtainAtt(_config, JMSEpr.JNDI_URL_TAG,
-				NamingContext.JBOSS_PROVIDER_URL);
-		if (null == _config.getAttribute(JMSEpr.JNDI_URL_TAG))
-			_logger
-					.debug("No value specified for " + JMSEpr.JNDI_URL_TAG + " attribute" + " -  Using default of: '" + sJndiURL + "'");
-		String sJndiContextFactory = ListenerUtil.obtainAtt(_config,
-				JMSEpr.JNDI_CONTEXT_FACTORY_TAG,
-				NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
-		if (null == _config.getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG))
-			_logger
-					.debug("No value specified for " + JMSEpr.JNDI_CONTEXT_FACTORY_TAG + " attribute" + " -  Using default of: '" + sJndiContextFactory + "'");
-		String sJndiPkgPrefix = ListenerUtil.obtainAtt(_config,
-				JMSEpr.JNDI_PKG_PREFIX_TAG, NamingContext.JBOSS_PROVIDER_URL);
-		if (null == _config.getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG))
-			_logger
-					.debug("No value specified for " + JMSEpr.JNDI_PKG_PREFIX_TAG + " attribute" + " -  Using default of: '" + sJndiPkgPrefix + "'");
-		Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
-				sJndiContextFactory, sJndiPkgPrefix);
-		if (null == oJndiCtx)
-			throw new ConfigurationException(
-					"Unable fo obtain jndi context <" + sJndiURL + "," + sJndiContextFactory + "," + sJndiPkgPrefix + ">");
+   protected void resolveComposerClass() throws ConfigurationException
+   {
+      try
+      {
+         String sProcessMethod = null;
+         _composerName = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG);
+         if (null != _composerName)
+         { // class attribute
+            _composerClass = Class.forName(_composerName);
+            Constructor oConst = _composerClass.getConstructor(new Class[]
+                    {ConfigTree.class});
+            _composer = oConst.newInstance(_config);
+            sProcessMethod = _config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_METHOD_TAG, "process");
+         }
+         else
+         {
+            _composerName = PackageJmsMessageContents.class.getName();
+            _composerClass = PackageJmsMessageContents.class;
+            _composer = new PackageJmsMessageContents();
+            sProcessMethod = "process";
+            _logger
+                    .debug("No <" + ListenerTagNames.ACTION_ELEMENT_TAG + "> element found in configuration" + " -  Using default composer class : " + _composerName);
+         }
 
-		String sFactClass = ListenerUtil.obtainAtt(_config,
-				JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
-		if (null == _config.getAttribute(JMSEpr.CONNECTION_FACTORY_TAG))
-			_logger
-					.debug("No value specified for " + JMSEpr.CONNECTION_FACTORY_TAG + " attribute" + " -  Using default of: '" + sFactClass + "'");
-		_serviceCategory = _config
-				.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
-		_serviceName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
-		_myEpr = (null == _serviceName) ? null : new JMSEpr(JMSEpr.QUEUE_TYPE,
-				_queueName, sFactClass, sJndiURL, sJndiContextFactory,
-				sJndiPkgPrefix, _messageSelector);
-		
-		Object tmp = null;
-		
-		try
-		{
-			tmp = oJndiCtx.lookup(sFactClass);
-		}
-		catch (NamingException ex)
-		{
-			throw new ConfigurationException(ex);
-		}
-		
-		QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+         _processMethod = _composerClass.getMethod(sProcessMethod,
+                 new Class[]{Object.class});
+      }
+      catch (Exception ex)
+      {
+         throw new ConfigurationException(ex);
+      }
+   } // ________________________________
 
-		_queueConnection = qcf.createQueueConnection();
-		_queueSession = _queueConnection.createQueueSession(false,
-				QueueSession.AUTO_ACKNOWLEDGE);
-		try
-		{
-			_queue = (Queue) oJndiCtx.lookup(_queueName);
-		}
-		catch (NamingException ne)
-		{
-			_queue = _queueSession.createQueue(_queueName);
-		}
-		_queueConnection.start();
+   private void prepareMessageReceiver() throws ConfigurationException, JMSException
+   {
+      _queueConnection = null;
+      _queueSession = null;
+      _queue = null;
 
-		_messageReceiver = _queueSession.createReceiver(_queue,
-				_messageSelector);
+      String sJndiURL = ListenerUtil.obtainAtt(_config, JMSEpr.JNDI_URL_TAG,
+              NamingContext.JBOSS_PROVIDER_URL);
+      if (null == _config.getAttribute(JMSEpr.JNDI_URL_TAG))
+         _logger
+                 .debug("No value specified for " + JMSEpr.JNDI_URL_TAG + " attribute" + " -  Using default of: '" + sJndiURL + "'");
+      String sJndiContextFactory = ListenerUtil.obtainAtt(_config,
+              JMSEpr.JNDI_CONTEXT_FACTORY_TAG,
+              NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY);
+      if (null == _config.getAttribute(JMSEpr.JNDI_CONTEXT_FACTORY_TAG))
+         _logger
+                 .debug("No value specified for " + JMSEpr.JNDI_CONTEXT_FACTORY_TAG + " attribute" + " -  Using default of: '" + sJndiContextFactory + "'");
+      String sJndiPkgPrefix = ListenerUtil.obtainAtt(_config,
+              JMSEpr.JNDI_PKG_PREFIX_TAG, NamingContext.JBOSS_PROVIDER_URL);
+      if (null == _config.getAttribute(JMSEpr.JNDI_PKG_PREFIX_TAG))
+         _logger
+                 .debug("No value specified for " + JMSEpr.JNDI_PKG_PREFIX_TAG + " attribute" + " -  Using default of: '" + sJndiPkgPrefix + "'");
+      Context oJndiCtx = NamingContext.getServerContext(sJndiURL,
+              sJndiContextFactory, sJndiPkgPrefix);
+      if (null == oJndiCtx)
+         throw new ConfigurationException(
+                 "Unable fo obtain jndi context <" + sJndiURL + "," + sJndiContextFactory + "," + sJndiPkgPrefix + ">");
 
-	} // ________________________________
+      String sFactClass = ListenerUtil.obtainAtt(_config,
+              JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
+      if (null == _config.getAttribute(JMSEpr.CONNECTION_FACTORY_TAG))
+         _logger
+                 .debug("No value specified for " + JMSEpr.CONNECTION_FACTORY_TAG + " attribute" + " -  Using default of: '" + sFactClass + "'");
+      _serviceCategory = _config
+              .getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+      _serviceName = _config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+      _myEpr = (null == _serviceName) ? null : new JMSEpr(JMSEpr.QUEUE_TYPE,
+              _queueName, sFactClass, sJndiURL, sJndiContextFactory,
+              sJndiPkgPrefix, _messageSelector);
 
-	/**
-	 * Receive one message and retry if connection
-	 * 
-	 * @return javax.jms.Message - One input message, or null
-	 */
-	protected javax.jms.Message receiveOne ()
-	{
-		while (isRunning())
-			try
-			{
-				javax.jms.Message ret = _messageReceiver.receive(200);
-				if (null != ret) return ret;
-			}
-			catch (JMSException oJ)
-			{
-				_logger.error("JMS error on receive.  Attempting JMS Destination reconnect.",oJ);
-				try
-				{
-					prepareMessageReceiver();
-				}
-				// try to reconnect to the queue
-				catch (Exception e)
-				{
-					_logger.error("Reconnecting to Queue", e);
-                                        waitForRunningStateChange(ManagedLifecycleThreadState.STOPPING, _sleepForRetries) ;
-				}
-			}
-		return null;
-	} // ________________________________
+      Object tmp = null;
 
-	/**
-	 * Default gateway action for plain jms messages <p/>It will just drop the
-	 * jms message contents into a esb Message
-	 * 
-	 * @author <a
-	 *         href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
-	 * @since Version 4.0
-	 * 
-	 */
-	private static class PackageJmsMessageContents
-	{
-		@SuppressWarnings("unchecked")
-		public Message process (Object obj) throws JMSException, IOException
-		{
-			if (!(obj instanceof javax.jms.Message))
-				throw new IllegalArgumentException(
-						"Object must be instance of javax.jms.Message");
-			byte[] bytes = getMessageContent((javax.jms.Message) obj);
-			if (null == bytes) return null;
+      try
+      {
+         tmp = oJndiCtx.lookup(sFactClass);
+      }
+      catch (NamingException ex)
+      {
+         throw new ConfigurationException(ex);
+      }
 
-			javax.jms.Message jmsMsg = (javax.jms.Message) obj;
-			Message message = MessageFactory.getInstance().getMessage();
-			message.getBody().setContents(getMessageContent(jmsMsg));
-			Enumeration<String> EE = jmsMsg.getPropertyNames();
-			if (null != EE)
-			{
-				while (EE.hasMoreElements())
-				{
-					String name = EE.nextElement();
-					Object value = jmsMsg.getObjectProperty(name);
-					if (null != value)
-						message.getProperties().setProperty(name, value);
-				}
-			}
-			return message;
-		}
+      QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
 
-		private byte[] getMessageContent (javax.jms.Message jMess) throws JMSException, IOException
-		{
-			if (jMess instanceof TextMessage)
-				return ((TextMessage) jMess).getText().getBytes();
+      _queueConnection = qcf.createQueueConnection();
+      _queueSession = _queueConnection.createQueueSession(false,
+              QueueSession.AUTO_ACKNOWLEDGE);
+      try
+      {
+         _queue = (Queue) oJndiCtx.lookup(_queueName);
+      }
+      catch (NamingException ne)
+      {
+         _queue = _queueSession.createQueue(_queueName);
+      }
+      _queueConnection.start();
 
-			if (jMess instanceof BytesMessage)
-			{
-				BytesMessage jBytes = (BytesMessage) jMess;
-				ByteArrayOutputStream out = new ByteArrayOutputStream();
-				byte[] ba = new byte[1000];
-				int iQread;
-				while (-1 != (iQread = jBytes.readBytes(ba)))
-					if (iQread > 0) out.write(ba, 0, iQread);
-				out.close();
-				return out.toByteArray();
-			}
+      _messageReceiver = _queueSession.createReceiver(_queue,
+              _messageSelector);
 
-			if (jMess instanceof ObjectMessage)
-				return ((ObjectMessage) jMess).getObject().toString()
-						.getBytes();
-			_logger
-					.warn("Message type " + jMess.getClass().getSimpleName() + " not supported - Message is ignored");
-			return null;
-		}
-	} // ____________________________________________________
+   } // ________________________________
 
-	protected final static Logger _logger = Logger
-			.getLogger(JmsGatewayListener.class);
+   /**
+    * Receive one message and retry if connection
+    *
+    * @return javax.jms.Message - One input message, or null
+    */
+   protected javax.jms.Message receiveOne()
+   {
+      while (isRunning())
+         try
+         {
+            javax.jms.Message ret = _messageReceiver.receive(200);
+            if (null != ret) return ret;
+         }
+         catch (JMSException oJ)
+         {
+            _logger.error("JMS error on receive.  Attempting JMS Destination reconnect.", oJ);
+            try
+            {
+               prepareMessageReceiver();
+            }
+            // try to reconnect to the queue
+            catch (Exception e)
+            {
+               _logger.error("Reconnecting to Queue", e);
+               waitForRunningStateChange(ManagedLifecycleThreadState.STOPPING, _sleepForRetries);
+            }
+         }
+      return null;
+   } // ________________________________
 
-	protected String _queueName;
+   protected final static Logger _logger = Logger
+           .getLogger(JmsGatewayListener.class);
 
-	protected QueueConnection _queueConnection;
+   protected String _queueName;
 
-	protected QueueSession _queueSession;
+   protected QueueConnection _queueConnection;
 
-	protected Queue _queue;
+   protected QueueSession _queueSession;
 
-	protected MessageConsumer _messageReceiver;
+   protected Queue _queue;
 
-	protected String _messageSelector;
+   protected MessageConsumer _messageReceiver;
 
-	protected ConfigTree _config;
+   protected String _messageSelector;
 
-	protected final long _sleepForRetries; // milliseconds
+   protected ConfigTree _config;
 
-	protected String _serviceCategory, _serviceName;
+   protected final long _sleepForRetries; // milliseconds
 
-	protected String _targetServiceCategory, _targetServiceName;
+   protected String _serviceCategory, _serviceName;
 
-	protected EPR _myEpr;
+   protected String _targetServiceCategory, _targetServiceName;
 
-	protected Collection<EPR> _targetEprs;
+   protected EPR _myEpr;
 
-	protected String _composerName;
+   protected Collection<EPR> _targetEprs;
 
-	protected Class _composerClass;
+   protected String _composerName;
 
-	protected Object _composer;
+   protected Class _composerClass;
 
-	protected Method _processMethod;
+   protected Object _composer;
 
+   protected Method _processMethod;
+
 	protected Courier _courier;
 }

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.listeners.gateway;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.BytesMessage;
+import javax.jms.ObjectMessage;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.util.Enumeration;
+
+/**
+    * Default gateway action for plain jms messages <p/>It will just drop the
+ * jms message contents into a esb Message
+ *
+ * @author <a
+ *         href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @since Version 4.0
+ */
+public class PackageJmsMessageContents
+{
+   @SuppressWarnings("unchecked")
+   public Message process(Object obj) throws JMSException, IOException
+   {
+      if (!(obj instanceof javax.jms.Message))
+         throw new IllegalArgumentException(
+                 "Object must be instance of javax.jms.Message");
+      byte[] bytes = getMessageContent((javax.jms.Message) obj);
+      if (null == bytes) return null;
+
+      javax.jms.Message jmsMsg = (javax.jms.Message) obj;
+      Message message = MessageFactory.getInstance().getMessage();
+      message.getBody().setContents(getMessageContent(jmsMsg));
+      Enumeration<String> EE = jmsMsg.getPropertyNames();
+      if (null != EE)
+      {
+         while (EE.hasMoreElements())
+         {
+            String name = EE.nextElement();
+            Object value = jmsMsg.getObjectProperty(name);
+            if (null != value)
+               message.getProperties().setProperty(name, value);
+         }
+      }
+      return message;
+   }
+
+   private byte[] getMessageContent(javax.jms.Message jMess) throws JMSException, IOException
+   {
+      if (jMess instanceof TextMessage)
+         return ((TextMessage) jMess).getText().getBytes();
+
+      if (jMess instanceof BytesMessage)
+      {
+         BytesMessage jBytes = (BytesMessage) jMess;
+         ByteArrayOutputStream out = new ByteArrayOutputStream();
+         byte[] ba = new byte[1000];
+         int iQread;
+         while (-1 != (iQread = jBytes.readBytes(ba)))
+            if (iQread > 0) out.write(ba, 0, iQread);
+         out.close();
+         return out.toByteArray();
+      }
+
+      if (jMess instanceof ObjectMessage)
+         return ((ObjectMessage) jMess).getObject().toString()
+                 .getBytes();
+      JmsGatewayListener._logger
+              .warn("Message type " + jMess.getClass().getSimpleName() + " not supported - Message is ignored");
+      return null;
+   }
+} // ____________________________________________________

Added: labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ProcessDefinitionRouterMdb.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ProcessDefinitionRouterMdb.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ProcessDefinitionRouterMdb.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.listeners.gateway;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.exe.ProcessInstance;
+
+import javax.jms.MessageListener;
+import javax.jms.Message;
+import javax.jms.JMSException;
+import javax.annotation.Resource;
+
+/**
+ * Process definition is in JMS message.
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProcessDefinitionRouterMdb implements MessageListener
+{
+   @Resource(name="jbpm", mappedName="java:/jbpm/JbpmConfiguration")
+   protected JbpmConfiguration configuration;
+
+   @Resource(name="jbpm.process.variable")
+   protected String messageVariable = "message";
+
+   public static final String PROCESS_DEFINITION="PROCESS_DEFINITION";
+
+
+   public void onMessage(Message message)
+   {
+      String processDefinition = null;
+      try
+      {
+         processDefinition = message.getStringProperty(PROCESS_DEFINITION);
+      }
+      catch (JMSException e)
+      {
+         throw new RuntimeException(e);
+      }
+      if (processDefinition == null) throw new RuntimeException("The message property " + PROCESS_DEFINITION + " was not set so could not route message");
+      JbpmContext context = configuration.createJbpmContext();
+      ProcessInstance processInstance = context.newProcessInstance(processDefinition);
+      processInstance.getContextInstance().setVariable(messageVariable, message);
+      processInstance.signal();
+   }
+
+}

Modified: labs/jbossesb/workspace/bburke/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -33,6 +33,8 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
+import org.dom4j.Attribute;
+
 /**
  * Objects of this class are to be used for run time configuration of ESB components 
  * <p/>  This should gradually replace the ConfigTree class
@@ -44,7 +46,8 @@
  * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
  *
  */
-public class ConfigTree implements Serializable, Cloneable
+public class
+        ConfigTree implements Serializable, Cloneable
 {
 	private static final long serialVersionUID = 1L;
 /**
@@ -490,6 +493,36 @@
 		return tree;
 	} // __________________________________
 
+   public static ConfigTree fromElement(org.dom4j.Element elem)
+   {
+      ConfigTree tree = new ConfigTree(elem.getName());
+      List NM = elem.attributes();
+      if (null!=NM)
+         for (int i1=0; i1<NM.size(); i1++)
+         {
+            org.dom4j.Attribute node = (org.dom4j.Attribute)NM.get(i1);
+            tree.setAttribute(node.getName(),node.getValue());
+         }
+      List NL = elem.elements();
+      if (null!=NL)
+         for (int i1=0; i1<NL.size(); i1++)
+         {
+            org.dom4j.Element node = (org.dom4j.Element)NL.get(i1);
+            switch (node.getNodeType())
+            {
+               case Node.ELEMENT_NODE:
+                  tree.addChild(ConfigTree.fromElement(node));
+                  break;
+               case Node.TEXT_NODE:
+                  tree.addTextChild(node.getText());
+                  break;
+            }
+         }
+
+      return tree;
+   } // __________________________________
+
+
 	private Element toElement(Document doc)
 	{
 		Element elem = doc.createElement(_name);

Added: labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/Decision.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/Decision.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/Decision.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.internal.soa.esb.services.routing.cbr;
+
+import java.io.Serializable;
+
+public class Decision implements Serializable
+{
+   private String outcome;
+
+   public String getOutcome()
+   {
+      return outcome;
+   }
+
+   public void setOutcome(String outcome)
+   {
+      this.outcome = outcome;
+   }
+}

Modified: labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouter.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -153,7 +153,7 @@
 	 * Reading the rules and dsl from files. Note that we may want to allow
 	 * other ways to set the rule, but for now it's just files.
 	 */
-	private static RuleBase readRuleBase (String rulesFile, String ruleLanguage)
+	public static RuleBase readRuleBase (String rulesFile, String ruleLanguage)
 			throws DroolsParserException, IOException, CBRException
 	{
 		// read in the rules
@@ -209,7 +209,7 @@
 	 * Reading the rules and dsl from files. Note that we may want to allow
 	 * other ways to set the rule, but for now it's just files.
 	 */
-	private static String getRules (String rulesFile, String ruleLanguage)
+	public static String getRules (String rulesFile, String ruleLanguage)
 			throws IOException
 	{
 		logger.debug("Going to hash the rule: " + rulesFile);
@@ -243,7 +243,7 @@
 
 	}
 
-	private static String getString (InputStream in) throws IOException
+	public static String getString (InputStream in) throws IOException
 	{
 		StringBuffer stringBuffer = new StringBuffer();
 		byte[] b = new byte[4096];

Added: labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JbpmRulesDecisionHandler.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JbpmRulesDecisionHandler.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/core/services/src/org/jboss/internal/soa/esb/services/routing/cbr/JbpmRulesDecisionHandler.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,122 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.internal.soa.esb.services.routing.cbr;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.drools.RuleBase;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DroolsParserException;
+import org.jboss.soa.esb.services.routing.MessageRouterException;
+import org.jboss.soa.esb.services.routing.cbr.CBRException;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.node.DecisionHandler;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JbpmRulesDecisionHandler implements DecisionHandler
+{
+   private static Map<String, RuleBase> ruleBases = new ConcurrentHashMap<String, RuleBase>();
+
+   private static Map<String, String> ruleSets = new ConcurrentHashMap<String, String>();
+
+   private static Logger logger = Logger.getLogger(JBossRulesRouter.class);
+
+
+   public List<String> assertObjects;
+   public String ruleSet;
+   public String ruleLanguage;
+   public boolean ruleReload;
+
+   public String decide(ExecutionContext executionContext) throws Exception
+   {
+      Decision decision = new Decision();
+      try
+      {
+         String newRuleSet = null;
+         boolean isRulesChanged = false;
+
+         if (ruleReload)
+         {
+            String currentRuleSet = ruleSets.get(ruleSet);
+            newRuleSet = JBossRulesRouter.getRules(ruleSet, ruleLanguage);
+            if (currentRuleSet == null || !currentRuleSet
+                    .equals(newRuleSet))
+            {
+               isRulesChanged = true;
+            }
+         }
+         RuleBase ruleBase = ruleBases.get(ruleSet);
+         if (ruleBase == null || isRulesChanged)
+         {
+            logger.log(Priority.DEBUG,
+                    "Reading ruleSet from file=" + ruleSet);
+            ruleBase = JBossRulesRouter.readRuleBase(ruleSet, ruleLanguage);
+            if (ruleBase != null) ruleBases.put(ruleSet, ruleBase);
+            if (newRuleSet == null)
+            {
+               newRuleSet = JBossRulesRouter.getRules(ruleSet, ruleLanguage);
+            }
+            if (ruleSet != null) ruleSets.put(ruleSet, newRuleSet);
+         }
+         WorkingMemory workingMemory = ruleBase.newWorkingMemory();
+         workingMemory.setGlobal("decision", decision);
+         if (assertObjects != null)
+         {
+            for (String assertObject : assertObjects)
+            {
+               workingMemory.assertObject(executionContext.getContextInstance().getVariable(assertObject));
+            }
+         }
+         else
+         {
+            for (Object assertObject : executionContext.getContextInstance().getVariables().values())
+            {
+               workingMemory.assertObject(assertObject);   
+            }
+         }
+         workingMemory.fireAllRules();
+         return decision.getOutcome();
+      }
+      catch (IOException ioe)
+      {
+         throw new MessageRouterException("Could not read the rules. " + ioe.getMessage(), ioe);
+      }
+      catch (DroolsParserException dpe)
+      {
+         throw new MessageRouterException("Could not parse the rules. " + dpe.getMessage(), dpe);
+      }
+      catch (CBRException cbre)
+      {
+         throw new MessageRouterException("Could not parse the rules. " + cbre.getMessage(), cbre);
+      }
+   }
+}

Modified: labs/jbossesb/workspace/bburke/product/install/build.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/build.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/install/build.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -170,6 +170,10 @@
       <mkdir dir="${org.jboss.esb.dist.lib}/jbossesb.sar/META-INF" />
       <copy file="jboss-service.xml"
          todir="${org.jboss.esb.dist.lib}/jbossesb.sar/META-INF"/>
+      <copy file="jbpm.cfg.xml"
+         todir="${org.jboss.esb.dist.lib}/jbossesb.sar"/>
+      <copy file="jbpm.hibernate.cfg.xml"
+         todir="${org.jboss.esb.dist.lib}/jbossesb.sar"/>
       <delete dir="${org.jboss.esb.dist.lib}/jbossesb-registry.sar" />
       <mkdir dir="${org.jboss.esb.dist.lib}/jbossesb-registry.sar" />
       <mkdir dir="${org.jboss.esb.dist.lib}/jbossesb-registry.sar/META-INF" />
@@ -182,7 +186,23 @@
       <copy file="jboss-service-registry.xml"
          tofile="${org.jboss.esb.dist.lib}/jbossesb-registry.sar/META-INF/jboss-service.xml"/>
 
-		<echo message="Building JBoss ESB dependencies sar file"/>
+      <mkdir dir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar"/>
+      <!-- this class copy is to get over a stupid (fixed) bug in ejb3 -->
+      <copy todir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar">
+         <fileset dir="../build/classes/listeners">
+            <include name="org/jboss/soa/esb/listeners/gateway/ProcessDefinitionRouterMdb.class"/>
+         </fileset>
+      </copy>
+      <mkdir dir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar/META-INF"/>
+      <copy file="ejb-jar.xml"
+         todir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar/META-INF"/>
+      <copy file="jboss.xml"
+         todir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar/META-INF"/>
+      <copy file="esb-queues-service.xml"
+         todir="${org.jboss.esb.dist.lib}/jbossesb.sar/esb-default-inbound-ejb.jar"/>
+
+
+      <echo message="Building JBoss ESB dependencies sar file"/>
 		<delete dir="${org.jboss.esb.dist.lib}/jbossesb-dependencies.sar" />
 		<mkdir dir="${org.jboss.esb.dist.lib}/jbossesb-dependencies.sar" />
 		<mkdir dir="${org.jboss.esb.dist.lib}/jbossesb-dependencies.sar/META-INF" />
@@ -204,7 +224,8 @@
 			<fileset dir="${org.jboss.esb.dist.lib}/ext" includes="${smooks.dependencies}"/>
 			<fileset dir="${org.jboss.esb.deployment.conf}" includes="smooks-cdr.lst" />
 			<!-- ftp -->
-			<fileset dir="${org.jboss.esb.dist.lib}/ext" includes="edtftpj.jar"/>
+         <fileset dir="${org.jboss.esb.dist.lib}/ext" includes="edtftpj.jar"/>
+         <fileset dir="${org.jboss.esb.dist.lib}/ext" includes="jbpm*.jar"/>
 		</copy>
 	</target>
 	

Added: labs/jbossesb/workspace/bburke/product/install/ejb-jar.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/ejb-jar.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/ejb-jar.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>ESBDefaultInbound</ejb-name>
+         <ejb-class>org.jboss.soa.esb.listeners.gateway.ProcessDefinitionRouterMdb</ejb-class>
+         <activation-config>
+            <activation-config-property>
+               <activation-config-property-name>destinationType</activation-config-property-name>
+               <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
+            </activation-config-property>
+            <activation-config-property>
+               <activation-config-property-name>destination</activation-config-property-name>
+               <activation-config-property-value>queue/esb_default_inbound</activation-config-property-value>
+            </activation-config-property>
+         </activation-config>
+      </message-driven>
+   </enterprise-beans>
+</ejb-jar>

Added: labs/jbossesb/workspace/bburke/product/install/esb-queues-service.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/esb-queues-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/esb-queues-service.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=esb_default_inbound">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+</server>

Added: labs/jbossesb/workspace/bburke/product/install/esb.action.types.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/esb.action.types.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/esb.action.types.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,8 @@
+<action-types>
+  <action-type element="action"       class="org.jbpm.graph.def.Action" />
+  <action-type element="create-timer" class="org.jbpm.scheduler.def.CreateTimerAction" />
+  <action-type element="cancel-timer" class="org.jbpm.scheduler.def.CancelTimerAction" />
+  <action-type element="script"       class="org.jbpm.graph.action.Script" />
+  <action-type element="esb-action"   class="org.jboss.soa.esb.actions.JbpmAdapter
+  " />
+</action-types>

Modified: labs/jbossesb/workspace/bburke/product/install/jboss-service.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/jboss-service.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/install/jboss-service.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -9,7 +9,13 @@
       <depends>jboss.esb:service=JBossESBDependencies</depends>
        <depends>jboss.jca:service=DataSourceBinding,name=juddiDB</depends>
    </mbean>
-  <mbean code="org.jboss.soa.esb.listeners.config.JBoss4ESBDeployer"
+     <mbean code="org.jbpm.db.jmx.JbpmService"
+            name="jboss.jbpm:name=DefaultJbpm,service=JbpmService"
+            description="Default jBPM Service">
+       <attribute name="JndiName">java:/jbpm/JbpmConfiguration</attribute>
+       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+     </mbean>
+   <mbean code="org.jboss.soa.esb.listeners.config.JBoss4ESBDeployer"
   	     name="jboss.esb:service=ESBDeployer">
     <depends>jboss.esb:service=JBossESBDependencies</depends>
     <depends>jboss.esb:service=ESBRegistry</depends>

Added: labs/jbossesb/workspace/bburke/product/install/jboss.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/jboss.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/jboss.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<jboss>
+   <enterprise-beans>
+      <session>
+         <ejb-name>ESBDefaultInbound</ejb-name>
+         <depends>jboss.mq.destination:service=Queue,name=esb_default_inbound</depends>
+         <depends>jboss.mq:service=JMSProviderLoader,name=JMSProvider</depends>
+      </session>
+   </enterprise-beans>
+</jboss>

Added: labs/jbossesb/workspace/bburke/product/install/jbpm.cfg.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/jbpm.cfg.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/jbpm.cfg.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,10 @@
+<jbpm-configuration>
+
+  <!-- 
+    The default configurations can be found in org/jbpm/default.jbpm.cfg.xml 
+    Those configurations can be overwritten by putting this file called 
+    jbpm.cfg.xml on the root of the classpath and put in the customized values.
+  -->
+  <string name='resource.hibernate.cfg.xml' value='jbpm.hibernate.cfg.xml' />" 
+
+</jbpm-configuration>

Added: labs/jbossesb/workspace/bburke/product/install/jbpm.hibernate.cfg.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/install/jbpm.hibernate.cfg.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/install/jbpm.hibernate.cfg.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,166 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+  <session-factory>
+
+    <!-- jdbc connection properties -->
+    
+    <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+    <property name="hibernate.connection.datasource">java:/DefaultDS</property>
+
+    <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+    <property name="hibernate.hbm2ddl.auto">update</property>
+    <!-- other hibernate properties 
+    <property name="hibernate.show_sql">true</property>
+    <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">true</property>
+    -->
+
+    <!-- ############################################ -->
+    <!-- # mapping files with external dependencies # -->
+    <!-- ############################################ -->
+
+    <!-- following mapping file has a dependendy on   -->
+    <!-- 'bsh-{version}.jar'.                         -->
+    <!-- uncomment this if you don't have bsh on your -->
+    <!-- classpath.  you won't be able to use the     -->
+    <!-- script element in process definition files   -->
+    <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
+
+    <!-- following mapping files have a dependendy on  -->
+    <!-- 'jbpm-identity-{version}.jar', mapping files  -->
+    <!-- of the pluggable jbpm identity component.     -->
+    <!-- comment out the following 3 lines if you don't-->
+    <!-- want to use the default jBPM identity mgmgt   -->
+    <!-- component                                     -->
+    <mapping resource="org/jbpm/identity/User.hbm.xml"/>
+    <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
+    <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
+
+    <!-- ###################### -->
+    <!-- # jbpm mapping files # -->
+    <!-- ###################### -->
+
+    <!-- hql queries and type defs -->
+    <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
+    
+    <!-- graph.def mapping files -->
+    <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
+    <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
+
+    <!-- graph.node mapping files -->
+    <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>
+
+    <!-- context.def mapping files -->
+    <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
+    <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>
+
+    <!-- taskmgmt.def mapping files -->
+    <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>
+
+    <!-- module.def mapping files -->
+    <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>
+
+    <!-- bytes mapping files -->
+    <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>
+
+    <!-- file.def mapping files -->
+    <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>
+
+    <!-- scheduler.def mapping files -->
+    <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
+    <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>
+
+    <!-- graph.exe mapping files -->
+    <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>
+
+    <!-- module.exe mapping files -->
+    <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>
+        
+    <!-- context.exe mapping files -->
+    <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
+
+    <!-- msg.db mapping files -->
+    <mapping resource="org/jbpm/msg/Message.hbm.xml"/>
+    <mapping resource="org/jbpm/msg/db/TextMessage.hbm.xml"/>
+    <mapping resource="org/jbpm/command/ExecuteActionCommand.hbm.xml"/>
+    <mapping resource="org/jbpm/command/ExecuteNodeCommand.hbm.xml"/>
+    <mapping resource="org/jbpm/command/SignalCommand.hbm.xml"/>
+    <mapping resource="org/jbpm/command/TaskInstanceEndCommand.hbm.xml"/>
+
+    <!-- taskmgmt.exe mapping files -->
+    <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>
+
+    <!-- scheduler.exe mapping files -->
+    <mapping resource="org/jbpm/scheduler/exe/Timer.hbm.xml"/>
+
+    <!-- logging mapping files -->
+    <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
+    <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
+    <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
+    <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
+    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>
+    
+  </session-factory>
+</hibernate-configuration>

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/dvdstore/RetrieveOrderAction.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/dvdstore/RetrieveOrderAction.java	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/aggregator/src/org/jboss/soa/esb/dvdstore/RetrieveOrderAction.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -36,7 +36,8 @@
  * This action uses bean value objects that were prepopulated by Smooks in an earlier action on the pipline.
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
-public class RetrieveOrderAction implements ActionProcessor {
+public class
+        RetrieveOrderAction implements ActionProcessor {
 
 	public RetrieveOrderAction(ConfigTree configTree) {
 		

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/build.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/build.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/build.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -54,15 +54,26 @@
            includes="**/*.class"/>
       <mkdir dir="META-INF"/>
       <copy file="jbossesb.xml" tofile="META-INF/jboss-esb.xml"/>
+      <copy file="ejb-jar.xml" tofile="META-INF/ejb-jar.xml"/>
       <jar destfile="${build.dir}/${ant.project.name}.esb">
          <fileset dir="${build.dir}">
             <include name="**/*.class"/>
+            <exclude name="**/MDB.class"/>
          </fileset>
          <fileset dir=".">
             <include name="esb-queues-service.xml"/>
-            <include name="META-INF/*.xml"/>
+            <include name="META-INF/jboss-esb.xml"/>
          </fileset>
       </jar>
+      <jar destfile="${build.dir}/${ant.project.name}-ejb.jar">
+         <fileset dir="${build.dir}">
+            <include name="${ant.project.name}.esb"/>
+            <include name="**/MDB.class"/>
+         </fileset>
+         <fileset dir=".">
+            <include name="META-INF/ejb-jar.xml"/>
+         </fileset>
+      </jar>
    </target>
 
    <target name="run" depends="jars">
@@ -75,7 +86,7 @@
 
    <target name="deployToJBoss" depends="jars">
       <echo>Deploys the project to the JBoss Application Server ESB SAR</echo>
-      <copy file="${build.dir}/${ant.project.name}.esb" overwrite="true"
+      <copy file="${build.dir}/${ant.project.name}-ejb.jar" overwrite="true"
             todir="${jbosshome.dir}/server/default/deploy/"
               />
       <echo>Check your AS console to see if everything deployed properly then run 'ant runtest'</echo>

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/ejb-jar.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/ejb-jar.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/ejb-jar.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>HelloWorldGateway</ejb-name>
+         <ejb-class>quickstart.helloworld.MDB</ejb-class>
+         <messaging-type>javax.jms.MessageListener</messaging-type>
+         <activation-config>
+            <activation-config-property>
+               <activation-config-property-name>destinationType</activation-config-property-name>
+               <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
+            </activation-config-property>
+            <activation-config-property>
+               <activation-config-property-name>destination</activation-config-property-name>
+               <activation-config-property-value>queue/quickstart_helloworld_Request</activation-config-property-value>
+            </activation-config-property>
+         </activation-config>
+         <env-entry>
+            <env-entry-name>jbpm.process.definition</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>helloworld</env-entry-value>
+         </env-entry>
+      </message-driven>
+   </enterprise-beans>
+</ejb-jar>

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/jbossesb.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/jbossesb.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/jbossesb.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -1,50 +1,8 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.xsd" parameterReloadSecs="5">
-
-    <providers>
-          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
-                      jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
-                      jndi-URL="localhost" >
-                      
-              <jms-bus busid="quickstartGwChannel">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/quickstart_helloworld_Request"
-                   />
-              </jms-bus>
-              <jms-bus busid="quickstartEsbChannel">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/EsbChannel"
-                  />
-              </jms-bus>
-
-          </jms-provider>
-      </providers>
-      
-      <services>
-        <service 
-        	category="FirstServiceESB" 
-        	name="SimpleListener" 
-        	description="Hello World">
-            <listeners>
-                <jms-listener name="JMS-Gateway"
-                    busidref="quickstartGwChannel"
-                    maxThreads="1"
-                    is-gateway="true"
-                />
-                <jms-listener name="helloWorld"
-                              busidref="quickstartEsbChannel"
-                              maxThreads="1"
-                />
-            </listeners>
-            <actions>
-                   <action name="action1" 
-                   	class="quickstart.helloworld.MyJMSListenerAction" 
-                   	process="displayMessage" 
-                   	/>      
-            </actions>
-        </service>
-      </services>
-     
-</jbossesb>
+<process-definition name="helloworld">
+  <start-state>
+     <transition to='end'>
+       <action class='quickstart.helloworld.JbpmJMSActionHandler'/>
+     </transition>
+  </start-state>
+  <end-state name='end' />
+</process-definition>

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/JbpmJMSActionHandler.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/JbpmJMSActionHandler.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/JbpmJMSActionHandler.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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 quickstart.helloworld;
+
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JbpmJMSActionHandler implements ActionHandler
+{
+
+   public void execute(ExecutionContext executionContext) throws Exception
+   {
+      executionContext.getJbpmContext();
+      ObjectMessage msg = (ObjectMessage)executionContext.getContextInstance().getVariable("message");
+      System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+      System.out.println("\nBody: " + msg.getObject());
+      System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+   }
+}

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/MDB.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/MDB.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/helloworld/src/quickstart/helloworld/MDB.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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 quickstart.helloworld;
+
+import org.jboss.soa.esb.listeners.gateway.JbpmProcessDefinitionMdb;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class MDB extends JbpmProcessDefinitionMdb
+{
+}

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/build.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/build.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/build.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -50,12 +50,35 @@
 
   <target name="jars" depends="compile">
 	<delete file="${build.dir}/${ant.project.name}.jar"/>
-    <jar destfile="${build.dir}/${ant.project.name}.jar"
-		basedir="${build.dir}"
-		includes="**/*.class"/>
-  	<!-- Rules files must be jarred and on the classpath -->
-    <jar destfile="${build.dir}/${ant.project.name}_rules.jar"
-		basedir="${basedir}/src/services/rules" includes="*.*"/>
+     <jar destfile="${build.dir}/${ant.project.name}.jar"
+          basedir="${build.dir}"
+          includes="**/*.class"/>
+     <mkdir dir="META-INF"/>
+     <copy file="jbossesb.xml" tofile="META-INF/jboss-esb.xml"/>
+     <copy file="ejb-jar.xml" tofile="META-INF/ejb-jar.xml"/>
+     <jar destfile="${build.dir}/${ant.project.name}.esb">
+        <fileset dir="${basedir}/src/services/rules">
+           <include name="*.*"/>
+        </fileset>
+        <fileset dir="${build.dir}">
+           <include name="**/*.class"/>
+           <exclude name="**/MDB.class"/>
+        </fileset>
+        <fileset dir=".">
+           <include name="esb-queues-service.xml"/>
+           <include name="META-INF/jboss-esb.xml"/>
+        </fileset>
+     </jar>
+     <jar destfile="${build.dir}/${ant.project.name}-ejb.jar">
+        <fileset dir="${build.dir}">
+           <include name="${ant.project.name}.esb"/>
+           <include name="**/MDB.class"/>
+        </fileset>
+        <fileset dir=".">
+           <include name="META-INF/ejb-jar.xml"/>
+        </fileset>
+     </jar>
+
   </target>
 
   <target name="run" depends="jars">
@@ -66,20 +89,13 @@
 		  	 </java>
   </target>
 
-  <target name="deployToSAR" depends="jars">
-		    <echo>Deploys the project to the JBoss Application Server ESB SAR</echo>
-		  	<copy file="${build.dir}/${ant.project.name}.jar" overwrite="true"
-		  		todir="${jbosshome.dir}/server/default/deploy/jbossesb.sar"	
-		  	/>
-  			<copy file="${build.dir}/${ant.project.name}_rules.jar" overwrite="true"
-  			  		todir="${jbosshome.dir}/server/default/deploy/jbossesb.sar"	
-  			  	/>
-		  	<copy file="jbossesb.xml" overwrite="true"
-		  		todir="${jbosshome.dir}/server/default/conf"
-		  	/>
-		  	<touch file="${jbosshome.dir}/server/default/deploy/jbossesb.sar/META-INF/jboss-service.xml"/>
-		  	<echo>Check your AS console to see if everything deployed properly then run 'ant runtest'</echo>
-  </target>
+   <target name="deployToJBoss" depends="jars">
+      <echo>Deploys the project to the JBoss Application Server ESB SAR</echo>
+      <copy file="${build.dir}/${ant.project.name}-ejb.jar" overwrite="true"
+            todir="${jbosshome.dir}/server/default/deploy/"
+              />
+      <echo>Check your AS console to see if everything deployed properly then run 'ant runtest'</echo>
+   </target>
 	
   <target name="runtest">
      <echo>Runs Test JMS Sender</echo>
@@ -91,7 +107,7 @@
   <target name="receiveExpress">
 	 <echo>Runs Test JMS Receiver</echo>
 	 <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
-	  	<arg value="queue/CBRExpressFreeShippingAlert"/>
+	  	<arg value="queue/CBRExpressFreeShipping"/>
 		<classpath refid="classpath"/>
 	 </java>
   </target>  
@@ -99,7 +115,7 @@
   <target name="receiveNormal">
 	 <echo>Runs Test JMS Receiver</echo>
 	 <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
-	   	<arg value="queue/CBRNormalShippingAlert"/>
+	   	<arg value="queue/CBRNormalShipping"/>
 		<classpath refid="classpath"/>
 	 </java>
    </target>  

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/ejb-jar.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/ejb-jar.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/ejb-jar.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>SimpleContentBasedRouting</ejb-name>
+         <ejb-class>quickstart.MDB</ejb-class>
+         <messaging-type>javax.jms.MessageListener</messaging-type>
+         <activation-config>
+            <activation-config-property>
+               <activation-config-property-name>destinationType</activation-config-property-name>
+               <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
+            </activation-config-property>
+            <activation-config-property>
+               <activation-config-property-name>destination</activation-config-property-name>
+               <activation-config-property-value>queue/quickstart_simple_cbr_Request</activation-config-property-value>
+            </activation-config-property>
+         </activation-config>
+         <env-entry>
+            <env-entry-name>jbpm.process.definition</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>simple_cbr</env-entry-value>
+         </env-entry>
+      </message-driven>
+   </enterprise-beans>
+</ejb-jar>

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/esb-queues-service.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/esb-queues-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/esb-queues-service.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=quickstart_simple_cbr_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+   <mbean code="org.jboss.mq.server.jmx.Queue"
+     name="jboss.mq.destination:service=Queue,name=CBRExpressFreeShipping">
+     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.mq.server.jmx.Queue"
+     name="jboss.mq.destination:service=Queue,name=CBRNormalShipping">
+     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+   </mbean>
+</server>

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.old.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.old.xml	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.old.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,120 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
+                      jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+                      jndi-URL="localhost" >
+                      
+              <jms-bus busid="quickstartGwChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_simple_cbr_Request"
+                   />
+              </jms-bus>
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/B"
+                  />
+              </jms-bus>
+              <jms-bus busid="CBRNormalShipping">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/CBRNormalShipping"
+                  />
+              </jms-bus>
+              <jms-bus busid="CBRExpressFreeShipping">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/CBRExpressFreeShipping"
+                  />
+              </jms-bus>
+			  
+          </jms-provider>
+      </providers>
+      
+      <services>
+          
+        <!--  ESB CBR Service -->
+        <service 
+        	category="MyFirstCBRServicesESB" 
+        	name="FirstCBRServiceESB" 
+        	description="ESB Listener" >
+        	<listeners>
+        	    <!--  Gateway -->
+        	    <jms-listener name="the-gateway"
+        	        busidref="quickstartGwChannel"
+        	        maxThreads="1"
+        	        is-gateway="true"
+        	    />         
+                  <jms-listener name="XPathContentBasedRouter"
+                              busidref="quickstartEsbChannel"
+                              maxThreads="1">          
+	             </jms-listener>
+             </listeners>
+            <actions>
+                <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
+                    <property name="ruleSet" value="MyESBRules-XPath.drl"/>
+                    <property name="ruleLanguage" value="XPathLanguage.dsl"/>
+                    <property name="ruleReload" value="true"/>
+                    <property name="destinations">
+                        <route-to destination-name="express" service-category="ExpressShipping" service-name="ExpressShippingService"/>
+                        <route-to destination-name="normal"  service-category="NormalShipping"  service-name="NormalShippingService"/>
+                    </property>  
+                </action>
+            </actions>
+        </service>
+        
+        <!--  Normal Shipping -->
+        <service
+  	      category="NormalShipping"
+  	      name="NormalShippingService"
+  	      description="Normal Shipping Service">
+  	      <listeners>
+  	        <jms-listener
+  	       	  name="CBRNormalShipping"
+  	       	  busidref="CBRNormalShipping"
+  	       	  maxThreads="1"
+  	         />
+  	      </listeners>
+  	      <actions>
+               <action name="displayMessageAction" 
+                   	class="quickstart.MyJMSListenerAction" 
+                   	process="displayMessage" 
+                   	/>   
+                <!-- This can be replaced with notification -->
+                <action name="route"
+                   class="quickstart.RouteNormalShipping"
+                   process="sendResponse"
+                />   
+           </actions>
+  	    </service>
+  	    
+        <!--  Express Shipping -->
+          <service
+  	      category="ExpressShipping"
+  	      name="ExpressShippingService"
+  	      description="Express Shipping Service">
+  	      <listeners>
+  	        <jms-listener
+  	       	  name="CBRExpressFreeShipping"
+  	       	  busidref="CBRExpressFreeShipping"
+  	       	  maxThreads="1"
+  	         />
+  	      </listeners>
+  	        <actions>
+               <action name="displayMessageAction" 
+                   	class="quickstart.MyJMSListenerAction" 
+                   	process="displayMessage" 
+                   	/>   
+                <!-- This can be replaced with notification -->
+                <action name="route"
+                   class="quickstart.RouteExpressShipping"
+                   process="sendResponse"
+                />   
+           </actions>
+  	    </service>
+      </services>
+     
+</jbossesb>

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.xml
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.xml	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/jbossesb.xml	2007-03-08 01:23:25 UTC (rev 10052)
@@ -1,120 +1,52 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.xsd" parameterReloadSecs="5">
+<process-definition name="simple_cbr">
+   <start-state>
+      <transition to='content-router'>
+         <action class='org.jboss.soa.esb.actions.converters.TextBasedJmsToEsb'>
+            <!-- these default to message and esbMessage, just here for explanatory purposes -->
+            <jmsVariable>message</jmsVariable>
+            <esbVariable>esbMessage</esbVariable>
+         </action>
+      </transition>
+   </start-state>
+   <decision name="content-router">
 
-    <providers>
-          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
-                      jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
-                      jndi-URL="localhost" >
-                      
-              <jms-bus busid="quickstartGwChannel">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/quickstart_simple_cbr_Request"
-                   />
-              </jms-bus>
-              <jms-bus busid="quickstartEsbChannel">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/B"
-                  />
-              </jms-bus>
-              <jms-bus busid="CBRNormalShipping">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/CBRNormalShipping"
-                  />
-              </jms-bus>
-              <jms-bus busid="CBRExpressFreeShipping">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/CBRExpressFreeShipping"
-                  />
-              </jms-bus>
-			  
-          </jms-provider>
-      </providers>
-      
-      <services>
-          
-        <!--  ESB CBR Service -->
-        <service 
-        	category="MyFirstCBRServicesESB" 
-        	name="FirstCBRServiceESB" 
-        	description="ESB Listener" >
-        	<listeners>
-        	    <!--  Gateway -->
-        	    <jms-listener name="the-gateway"
-        	        busidref="quickstartGwChannel"
-        	        maxThreads="1"
-        	        is-gateway="true"
-        	    />         
-                  <jms-listener name="XPathContentBasedRouter"
-                              busidref="quickstartEsbChannel"
-                              maxThreads="1">          
-	             </jms-listener>
-             </listeners>
-            <actions>
-                <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
-                    <property name="ruleSet" value="MyESBRules-XPath.drl"/>
-                    <property name="ruleLanguage" value="XPathLanguage.dsl"/>
-                    <property name="ruleReload" value="true"/>
-                    <property name="destinations">
-                        <route-to destination-name="express" service-category="ExpressShipping" service-name="ExpressShippingService"/>
-                        <route-to destination-name="normal"  service-category="NormalShipping"  service-name="NormalShippingService"/>
-                    </property>  
-                </action>
-            </actions>
-        </service>
-        
-        <!--  Normal Shipping -->
-        <service
-  	      category="NormalShipping"
-  	      name="NormalShippingService"
-  	      description="Normal Shipping Service">
-  	      <listeners>
-  	        <jms-listener
-  	       	  name="CBRNormalShipping"
-  	       	  busidref="CBRNormalShipping"
-  	       	  maxThreads="1"
-  	         />
-  	      </listeners>
-  	      <actions>
-               <action name="displayMessageAction" 
-                   	class="quickstart.MyJMSListenerAction" 
-                   	process="displayMessage" 
-                   	/>   
-                <!-- This can be replaced with notification -->
-                <action name="route"
-                   class="quickstart.RouteNormalShipping"
-                   process="sendResponse"
-                />   
-           </actions>
-  	    </service>
-  	    
-        <!--  Express Shipping -->
-          <service
-  	      category="ExpressShipping"
-  	      name="ExpressShippingService"
-  	      description="Express Shipping Service">
-  	      <listeners>
-  	        <jms-listener
-  	       	  name="CBRExpressFreeShipping"
-  	       	  busidref="CBRExpressFreeShipping"
-  	       	  maxThreads="1"
-  	         />
-  	      </listeners>
-  	        <actions>
-               <action name="displayMessageAction" 
-                   	class="quickstart.MyJMSListenerAction" 
-                   	process="displayMessage" 
-                   	/>   
-                <!-- This can be replaced with notification -->
-                <action name="route"
-                   class="quickstart.RouteExpressShipping"
-                   process="sendResponse"
-                />   
-           </actions>
-  	    </service>
-      </services>
-     
-</jbossesb>
+      <handler class="org.jboss.internal.soa.esb.services.routing.cbr.JbpmRulesDecisionHandler">
+         <ruleSet>MyESBRules-XPath.drl</ruleSet>
+         <ruleLanguage>XPath.dsl</ruleLanguage>
+      </handler>
+
+      <event type="node-leave">
+         <action class='org.jboss.soa.esb.actions.converters.EsbToText'>
+            <esbVariable>esbMessage</esbVariable>
+            <textVariable>text</textVariable>
+         </action>
+      </event>
+      <transition name="express" to="express"/>
+      <transition name="normal" to="normal"/>
+   </decision>
+   <node name="express">
+      <event type="node-enter">
+         <action class="org.jboss.soa.esb.actions.LogAction">
+            <message>EXPRESS</message>
+         </action>
+         <action class="org.jboss.soa.esb.actions.routing.JbpmJMSRouter">
+            <variable>text</variable>
+            <destination>queue/CBRExpressFreeShipping</destination>
+         </action>
+      </event>
+      <transition to="end"/>
+   </node>
+   <node name="normal">
+      <event type="node-enter">
+         <action class="org.jboss.soa.esb.actions.LogAction">
+            <message>NORMAL</message>
+         </action>
+         <action class="org.jboss.soa.esb.actions.routing.JbpmJMSRouter">
+            <variable>text</variable>
+            <destination>queue/CBRNormalShipping</destination>
+         </action>
+      </event>
+      <transition to="end"/>
+   </node>
+   <end-state name='end'/>
+</process-definition>

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/MDB.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/MDB.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/MDB.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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 quickstart;
+
+import org.jboss.soa.esb.listeners.gateway.JbpmProcessDefinitionMdb;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class MDB extends JbpmProcessDefinitionMdb
+{
+}

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendEsbMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendEsbMessage.java	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,107 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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 quickstart.test;
+
+import javax.jms.*;
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import java.io.IOException;
+import java.io.FileReader;
+import java.io.File;
+
+public class SendEsbMessage
+{
+    QueueConnection conn;
+    QueueSession session;
+    Queue que;
+
+
+    public void setupConnection() throws JMSException, NamingException
+    {
+    	InitialContext iniCtx = new InitialContext();
+    	Object tmp = iniCtx.lookup("ConnectionFactory");
+    	QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+    	conn = qcf.createQueueConnection();
+    	que = (Queue) iniCtx.lookup("queue/esb_default_inbound");
+    	session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    	conn.start();
+    	System.out.println("Connection Started");
+    }
+
+    public void stop() throws JMSException
+    {
+        conn.stop();
+        session.close();
+        conn.close();
+    }
+
+    public void sendAMessage(String msg) throws JMSException {
+
+        QueueSender send = session.createSender(que);
+        ObjectMessage tm = session.createObjectMessage(msg);
+        tm.setStringProperty("PROCESS_DEFINITION", "simple_cbr");
+        send.send(tm);
+        send.close();
+    }
+    public String readAsciiFile(String fileName) throws IOException
+    {
+		  FileReader fr = null;
+		  char[] thechars = null;
+
+		  try {
+			  File thefile = new File( fileName );
+			  fr = new FileReader( thefile );
+			  int size = (int) thefile.length();
+			  thechars = new char[size];
+
+			  int count, index = 0;
+
+			  // 	read in the bytes from the input stream
+			  while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+				  size -= count;
+				  index += count;
+			  }
+			} catch(Exception e) {
+				System.out.println(e);
+			}
+			finally {
+				if( fr != null )
+		        fr.close();
+			}
+			return new String(thechars);
+
+    } // readAsciiFile
+
+    public static void main(String args[]) throws Exception
+    {
+    	SendEsbMessage sm = new SendEsbMessage();
+    	sm.setupConnection();
+    	String fileContent = sm.readAsciiFile("SampleOrder.xml");
+    	System.out.println("---------------------------------------------");
+    	System.out.println(fileContent);
+    	System.out.println("---------------------------------------------");
+    	sm.sendAMessage(fileContent);
+    	sm.stop();
+
+    }
+
+}

Modified: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl	2007-03-07 22:35:27 UTC (rev 10051)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl	2007-03-08 01:23:25 UTC (rev 10052)
@@ -4,21 +4,22 @@
 #list any import classes here.
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageType;
+import org.jboss.internal.soa.esb.services.routing.cbr.Decision;
 
 expander XPathLanguage.dsl
 
 #declare any global variables here
-global java.util.List destinations;
+global Decision decision
 
 rule "Routing Rule using XPATH"
 	
 	when
 		xpathGreaterThan "/Order/@totalAmount", "50.0"
 	then 
-	    Log : "EXPRESS";
+	   Log : "EXPRESS";
 		Log : "EXPRESS";
 		Log : "Really It's EXPRESS Shipping";
-		Destination : "express";
+		Decision : "express"
 		
 end
 
@@ -29,5 +30,5 @@
 	    Log : "NORMAL";
 		Log : "NORMAL";
 		Log : "Really It's NORMAL Shipping";
-		Destination : "normal";
+		Decision : "normal"
 end
\ No newline at end of file

Added: labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/XPath.dsl
===================================================================
--- labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/XPath.dsl	                        (rev 0)
+++ labs/jbossesb/workspace/bburke/product/samples/quickstarts/simple_cbr/src/services/rules/XPath.dsl	2007-03-08 01:23:25 UTC (rev 10052)
@@ -0,0 +1,7 @@
+#JBossESB Content Based Routing using XPath DSL
+[when]xpathMatch "{xpath}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentMatches(msg, "{xpath}") )
+[when]xpathEquals "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentEquals(msg, "{xpath}", "{value}") )
+[when]xpathGreaterThan "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentGreaterThan(msg, "{xpath}", "{value}") )
+[when]xpathLessThan "{xpath}", "{value}"=msg : Message( type == MessageType.JBOSS_XML ) and eval( org.jboss.internal.soa.esb.services.routing.cbr.DslHelper.xmlContentLessThan(msg, "{xpath}", "{value}") )
+[then]Log : "{message}"=System.out.println("{message}");
+[then]Decision : "{message}"=decision.setOutcome("{message}");




More information about the jboss-svn-commits mailing list