[jboss-svn-commits] JBL Code SVN: r23932 - in labs/jbossesb/workspace/mlittle/legstar/product: rosetta/src/org/jboss/internal/soa/esb/couriers and 21 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 18 21:08:53 EST 2008


Author: jim.ma
Date: 2008-11-18 21:08:53 -0500 (Tue, 18 Nov 2008)
New Revision: 23932

Added:
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/DefaultHttpReplyToEpr.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpESBListenerServlet.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatServer.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/HttpMessageAwareListener.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/build.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/deployment.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbm-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbmq-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jboss-esb.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbossesb-properties.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jndi.properties
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/juddi.properties
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/lib/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/log4j.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/readme.txt
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction2.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/test/
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/test/SendEsbMessage.java
Removed:
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction2.java
Modified:
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java
   labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt
   labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java
Log:
Added tomcat ESB listener and sample for it

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/DefaultHttpReplyToEpr.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/DefaultHttpReplyToEpr.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/DefaultHttpReplyToEpr.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -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 org.jboss.internal.soa.esb.addressing.eprs;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.internal.soa.esb.couriers.HttpCourier;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+
+
+
+public class DefaultHttpReplyToEpr extends HTTPEpr{
+	public DefaultHttpReplyToEpr(HTTPEpr epr) {
+		super(epr);
+		URI uri = null;
+		try {
+			uri = epr.getURI();
+			URI replyURI = URI.create(uri.toString() + "/" + HttpCourier.REPLY_EPR_NAME);
+			this.setURI(replyURI);
+		} catch (URISyntaxException e) {
+			throw new RuntimeException("Unexpected Exception creating replyTo HTTPEpr.", e);
+		}
+
+		
+	}
+
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.couriers;
+
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.util.Util;
+/**
+ * Deliver the ESB message to http endpoint and pickup ESB message from Http endpoint 
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class HttpCourier implements PickUpOnlyCourier, DeliverOnlyCourier {
+	
+	public ConcurrentLinkedQueue<Message> queue = new ConcurrentLinkedQueue<Message>();
+	
+	public static String REPLY_EPR_NAME = "reply";
+	
+	public static String GET_REPLY_NAME = "get";
+	
+	protected static Logger logger = Logger.getLogger(InVMCourier.class);
+	
+	private HTTPEpr epr;
+	
+	private HttpClient httpClient = null;
+	
+	public HttpCourier(HTTPEpr epr) {
+		this.epr = epr;
+		HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
+		HttpConnectionManagerParams params = new HttpConnectionManagerParams() ;
+		params.setMaxTotalConnections(Integer.parseInt(epr.getThreads())) ;
+		connectionManager.setParams(params);
+		httpClient = new HttpClient(connectionManager);
+	}
+	public boolean deliver(Message message) {
+		if (message == null) {
+            return false;
+        }
+	    
+	    PostMethod method = null;
+		try {
+			//TODO:revisit it to see if the "/" can be removed
+			method = new PostMethod(epr.getURI().toString() + "/");
+			java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
+
+			new ObjectOutputStream(bout).writeObject(Util.serialize(message));
+			bout.flush();
+			ByteArrayRequestEntity bytesEntity = new ByteArrayRequestEntity(
+					bout.toByteArray());
+			method.setRequestEntity(bytesEntity);
+
+		} catch (Exception e) {
+			logger.error("Failed to serialize message :[ " + message + "]");
+			return false;
+		}
+
+		try {
+			httpClient.executeMethod(method);
+		} catch (Exception e) {
+			logger.error("Failed to deliver message :[ " + message + "] to endpoint " + epr);
+			return false;
+
+		} finally {
+			method.releaseConnection();
+		}
+
+		return true;
+	}
+	
+	public Message pickup(long millis) {
+		Message message = null;
+		if (epr.isReplyEpr()) {
+			PostMethod method = null;
+			try {
+				method = new PostMethod(epr.getURI().toString() + "/" + GET_REPLY_NAME);
+				httpClient.executeMethod(method);
+				byte[] responseBytes = method.getResponseBody();
+				if (responseBytes == null || responseBytes.length == 0) {
+					return null;
+				}
+
+				java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(
+						responseBytes);
+				Serializable serial = (Serializable) new ObjectInputStream(bin)
+						.readObject();
+				message = Util.deserialize(serial);
+			} catch (Exception e) {
+				logger.error("Failed to pickup message from " + epr); 
+			} finally {
+				method.releaseConnection();
+			}
+		} else {
+
+			synchronized (queue) {
+				message = queue.poll();
+				if (message == null) {
+					try {
+						queue.wait(millis);
+					} catch (InterruptedException e) {
+						
+					}
+					message = queue.poll();
+				}
+
+			}
+		}
+		return message;
+	}
+	
+	
+    public void cleanup() {
+    }
+	
+}  

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpESBListenerServlet.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpESBListenerServlet.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpESBListenerServlet.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.couriers;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.util.ContextObjectInputStream;
+import org.jboss.soa.esb.util.Util;
+
+
+/**
+ * This servlet processes the ESB message delivered to http endpoint and prepare the 
+ * reply message to client
+ * <p> It will server for these request url :
+ * <p> http://localhost:8765/tomcat/listener/
+ * <p> http://localhost:8765/tomcat/listener/reply
+ * <p> http://localhost:8765/tomcat/listener/reply/get
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ */
+public class HttpESBListenerServlet extends HttpServlet {
+    HttpCourier requestCourier = null;
+    HttpCourier responseCourier = null;
+	public void init() throws ServletException {
+		
+	}
+	
+	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+    throws ServletException, IOException {
+		service(req,resp);
+	}
+	
+	
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+    throws ServletException, IOException {
+		service(req,resp);
+	}
+	
+	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		String requestInfo = req.getServletPath();
+		if ("/".equals(requestInfo)) {
+			addRequestMessage(req, resp);
+		} else	if (("/"+ HttpCourier.REPLY_EPR_NAME + "/") .equals(requestInfo) ) {
+			addResponseMessage(req, resp);
+		} else	if (("/"+ HttpCourier.REPLY_EPR_NAME + "/" + HttpCourier.GET_REPLY_NAME).equals(requestInfo)) {
+			getResponseMessage(req, resp);
+		} else {
+			resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+		}
+		
+
+	}
+	
+	public void addRequestMessage(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		if (requestCourier == null) {
+			String server = req.getServerName();
+		    int port = req.getServerPort();
+		    String context = req.getContextPath();
+		    String requestURI = "http://" + server + ":" + port + context;
+		    URI uri = null;
+			try {
+				uri = new URI(requestURI);
+				HTTPEpr epr = new HTTPEpr(uri);
+			    requestCourier = CourierFactory.getInstance().getHttpCourier(epr);
+			} catch (URISyntaxException e) {
+				//expected , do nothing
+			}
+            
+		}
+		
+		Serializable serial;
+		try {
+			serial = (Serializable) new ContextObjectInputStream(req.getInputStream()).readObject();
+		} catch (Exception e1) {
+			
+			throw new ServletException(e1);
+		}
+		try {
+			Message msg = Util.deserialize(serial);
+			synchronized (requestCourier.queue) {
+				requestCourier.queue.offer(msg);
+				requestCourier.queue.notify();
+			}
+		} catch (Exception e) {
+			throw new ServletException("Error when deserialize the request ESB message");
+			
+		}
+	}
+	
+	public void addResponseMessage(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		if (responseCourier == null) {
+			String server = req.getServerName();
+		    int port = req.getServerPort();
+		    String context = req.getContextPath();
+		    String requestURI = "http://" + server + ":" + port + context + "/" + HttpCourier.REPLY_EPR_NAME;
+		    URI uri = null;
+			try {
+				uri = new URI(requestURI);
+				HTTPEpr epr = new HTTPEpr(uri);
+			    responseCourier = CourierFactory.getInstance().getHttpCourier(epr);
+
+			} catch (URISyntaxException e) {
+				//Do nothing
+			}
+					} 
+		Serializable serial = null;
+		try {
+			serial = (Serializable) new ContextObjectInputStream(req.getInputStream()).readObject();
+		} catch (ClassNotFoundException e1) {
+			throw new ServletException(e1);
+		}
+		try {
+			Message msg = Util.deserialize(serial);
+			synchronized (responseCourier.queue) {
+				responseCourier.queue.offer(msg);
+				responseCourier.queue.notify();
+			}
+		} catch (Exception e) {
+			throw new ServletException("Error when deserialize the request ESB message");
+			
+		}
+	}
+	
+	public void getResponseMessage(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		if (responseCourier == null) {
+			return;
+		}
+		Message msg = null;
+		synchronized (responseCourier.queue) {
+			msg = responseCourier.queue.poll();
+			if (msg == null) {
+				try {
+					responseCourier.queue.wait(2000);
+				} catch (InterruptedException e) {
+					//Do nothing
+				}
+				msg = responseCourier.queue.poll();
+			}
+		}
+		if (msg == null) {
+			return;
+		}
+		java.io.OutputStream output = resp.getOutputStream();
+		try {
+			new ObjectOutputStream(output).writeObject(Util.serialize(msg));
+		} catch (ParserConfigurationException e) {
+			throw new ServletException(e);
+		}
+		output.flush();
+		
+	}	
+
+}

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -26,6 +26,7 @@
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.addressing.MalformedEPRException;
 import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
 import org.jboss.soa.esb.addressing.eprs.InVMEpr;
 import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
@@ -126,10 +127,14 @@
 			return null;
         if (epr instanceof InVMEpr)
             return CourierFactory.getInstance().getInVMCourier((InVMEpr) epr);
-		if (epr instanceof JMSEpr)
+		if (epr instanceof HTTPEpr)
+			return CourierFactory.getInstance().getHttpCourier((HTTPEpr)epr);
+        
+        if (epr instanceof JMSEpr)
 			return new JmsCourier((JMSEpr) epr, pickUpOnly);
 		if (epr instanceof FileEpr)
 			return new FileCourier((FileEpr) epr, pickUpOnly);
+		
 		if (epr instanceof JDBCEpr)
 			return new SqlTableCourier((JDBCEpr) epr, pickUpOnly);
 
@@ -145,9 +150,11 @@
 		String addr = null;
 
 		addr = epr.getAddr().getAddress();
-        if (addr.startsWith(InVMEpr.INVM_PROTOCOL))
+        if (addr.startsWith(InVMEpr.INVM_PROTOCOL))        	
             return CourierFactory.getInstance().getInVMCourier(new InVMEpr(epr));
-		if (addr.startsWith(JMSEpr.JMS_PROTOCOL))
+        if (addr.startsWith(HTTPEpr.HTTP_PROTOCOL))
+        	return CourierFactory.getInstance().getHttpCourier(new HTTPEpr(epr));
+        if (addr.startsWith(JMSEpr.JMS_PROTOCOL))
 			return new JmsCourier(new JMSEpr(epr), pickUpOnly);
 		if (addr.startsWith(JDBCEpr.JDBC_PROTOCOL))
 			return new SqlTableCourier(new JDBCEpr(epr), pickUpOnly);

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -30,6 +30,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
+import org.jboss.internal.soa.esb.couriers.HttpCourier;
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.addressing.PortReference;
 import org.w3c.dom.Element;
@@ -43,7 +44,10 @@
  */
 public class HTTPEpr extends EPR
 {
-
+	public static final String HTTP_PROTOCOL = "http";
+	
+	protected String maxThreads = "50";
+	
 	public HTTPEpr (EPR epr)
 	{
 		super(epr);
@@ -112,6 +116,25 @@
             }
 	}
 	
+	public void setThreads (String threads) {
+		maxThreads = threads;
+	}
+	
+	public String getThreads() {
+		return maxThreads;
+	}
+	
+	public boolean isReplyEpr() {
+		try {
+			if (getURI().toString().endsWith(HttpCourier.REPLY_EPR_NAME)) {
+				return true;
+			}
+		} catch (URISyntaxException e) {
+			//do nothing
+		}
+        return false;
+	}   
+	
 	public String toString ()
 	{
 		return "HTTPEpr [ "+super.getAddr().extendedToString()+" ]";

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -59,6 +59,8 @@
 		throw new IllegalArgumentException("toEpr must not be null");
         if (toEpr instanceof InVMEpr)
         return new DefaultInVMReplyToEpr((InVMEpr) toEpr);
+        if (toEpr instanceof HTTPEpr)
+            return new DefaultHttpReplyToEpr((HTTPEpr) toEpr);
 	    if (toEpr instanceof JMSEpr)
 		return new DefaultJmsReplyToEpr((JMSEpr) toEpr);
 	    // Check for SFTPEpr first, as it extends FTPEpr

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -26,6 +26,8 @@
  * @author - kstam at redhat.com
  *
  */
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -33,10 +35,12 @@
 import java.util.Map.Entry;
 
 import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.HttpCourier;
 import org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl;
 import org.jboss.internal.soa.esb.couriers.InVMCourier;
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
 import org.jboss.soa.esb.addressing.eprs.InVMEpr;
 import org.jboss.soa.esb.lifecycle.LifecyclePriorities;
 import org.jboss.soa.esb.lifecycle.LifecycleResource;
@@ -67,6 +71,12 @@
      * We handle this
      */
     private final Map<String, InVMCourier> inVMCouriers = new ConcurrentHashMap<String, InVMCourier>();
+    
+    
+    /**Http Couiers 
+     * 
+     */
+    private final Map<String, HttpCourier> httpCouriers = new ConcurrentHashMap<String, HttpCourier>();
 
     /**
      * Factory singleton instance.
@@ -137,7 +147,12 @@
             TwoWayCourierImpl courier = new TwoWayCourierImpl(null, CourierFactory.getInstance().getInVMCourier((InVMEpr) replyToEPR));
             courier.setReplyToEpr(replyToEPR);
             return courier;
-        } else {
+        } else if(replyToEPR instanceof HTTPEpr) {
+        	TwoWayCourierImpl courier = new TwoWayCourierImpl(null, CourierFactory.getInstance().getHttpCourier((HTTPEpr) replyToEPR));
+            courier.setReplyToEpr(replyToEPR);
+            return courier;
+        
+	    } else {
             return getCourier(null, replyToEPR);
         }    
     }
@@ -155,6 +170,25 @@
 
         return courier;
     }
+    
+    
+    public synchronized HttpCourier getHttpCourier(HTTPEpr epr) {
+        URI uri = null;
+		try {
+			uri = epr.getURI();
+		} catch (URISyntaxException e) {
+			//DO nothing
+		}
+        HttpCourier courier = httpCouriers.get(uri.toString());
+        if (courier == null) {
+            courier = new HttpCourier(epr);
+            httpCouriers.put(uri.toString(), courier);
+        }
+        return courier;
+    }
+    
+    
+    
 
     /**
 	 * Obtain a courier which can perform both deliveries and pickups and prime it with 

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -129,4 +129,10 @@
 
     /** Reply Listener */
     public static final String REPLY_LISTENER_TIMEOUT_TAG   = "replyListenerTimeout";
+    
+    /** Tomcat Listener */
+    public static final String HOST_TAG = "host";
+    public static final String PORT_TAG = "port";
+    public static final String CONTEXT_TAG = "context";
+    
 }

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerUtil.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -82,6 +82,8 @@
 		{
             if (InVMEpr.INVM_PROTOCOL.equals(protocol))
                 return inVMEprFromElement(tree);
+            if ("http".equals(protocol))
+				return httpEprFromElement(tree);
 			if ("jms".equals(protocol))
 				return jmsEprFromElement(tree);
 			if ("file".equals(protocol))
@@ -132,6 +134,24 @@
         }
     }
 
+    public static HTTPEpr httpEprFromElement (ConfigTree tree) throws ConfigurationException
+    {
+
+        String protocol = tree.getRequiredAttribute(ListenerTagNames.PROTOCOL_TAG);
+		String host = tree.getRequiredAttribute(ListenerTagNames.HOST_TAG);
+		String port = tree.getRequiredAttribute(ListenerTagNames.PORT_TAG);
+		String context = tree.getRequiredAttribute(ListenerTagNames.CONTEXT_TAG);
+        String uri = protocol + "://" + host + ":" + port + context;
+        try {
+			return new HTTPEpr(new URI(uri));
+		} catch (URISyntaxException e) {
+			new ConfigurationException("Error when create HTTPEpr : " + uri);
+		}
+        return null;
+    }
+    
+    
+    
 	public static JMSEpr jmsEprFromElement(ConfigTree tree)
 			throws ConfigurationException
 	{

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/ESBAwareGenerator.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -39,6 +39,7 @@
 import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlListenerDocument.SqlListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.SqlProviderDocument.SqlProvider;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.ScheduledListenerDocument.ScheduledListener;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatListenerDocument.TomcatListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.*;
 import org.jboss.soa.esb.listeners.config.mappers.*;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
@@ -204,7 +205,9 @@
             return;
         } else if (listener instanceof GroovyListenerDocument.GroovyListener) {
             listenerConfigTree = GroovyListenerMapper.map(root, (GroovyListenerDocument.GroovyListener)listener, model);
-		} else {
+		} else if (listener instanceof TomcatListener) {
+			listenerConfigTree = TomcatListenerMapper.map(root, (TomcatListener) listener, model);   
+	    } else {
 			listenerConfigTree = UntypedListenerMapper.map(root, listener, model);
 		}
 

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/TomcatListenerMapper.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -20,6 +20,8 @@
 package org.jboss.soa.esb.listeners.config.mappers;
 
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.dom.YADOMUtil;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
@@ -28,6 +30,8 @@
 import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatListenerDocument.TomcatListener;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.TomcatProviderDocument.TomcatProvider;
 import org.jboss.soa.esb.listeners.gateway.TomcatGatewayListener;
+import org.jboss.soa.esb.listeners.message.HttpMessageAwareListener;
+import org.jboss.soa.esb.listeners.message.MessageAwareListener;
 import org.w3c.dom.Element;
 
 /**
@@ -47,7 +51,7 @@
         Element listenerNode = YADOMUtil.addElement(root, "listener");
         TomcatBus bus;
         TomcatProvider provider;
-
+        
         listenerNode.setAttribute("name", listener.getName());
 
         try {
@@ -57,6 +61,7 @@
         }
         try {
             provider = (TomcatProvider) model.getProvider(bus);
+            
         } catch (ClassCastException e) {
             throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "].  Should be contained within a <http-provider> instance.  Unexpected exception - this should have caused a validation error!");
         }
@@ -90,7 +95,20 @@
             listenerNode.setAttribute(TomcatGatewayListener.REQUEST_CONTEXT_TAG, bus.getContext());
             listenerNode.setAttribute(TomcatGatewayListener.SERVER_PORT_TAG, Integer.toString(port));
         } else {
-            throw new ConfigurationException("Invalid <tomcat-listener> config [" + listener.getName() + "].  <tomcat-listener> is currently only supported as a gateway listener.");
+			Element eprNode = YADOMUtil.addElement(listenerNode, ListenerTagNames.EPR_TAG);
+
+			
+			// Map EPR related attributes onto the EPR - from the bus and provider and listener...
+			//mapJmsEprProperties(eprNode, provider, messageFilter);
+			eprNode.setAttribute(ListenerTagNames.PROTOCOL_TAG, HTTPEpr.HTTP_PROTOCOL);
+             
+			eprNode.setAttribute(ListenerTagNames.HOST_TAG, provider.getHost());
+			
+			eprNode.setAttribute(ListenerTagNames.PORT_TAG, Integer.toString(provider.getPort()));
+			eprNode.setAttribute(ListenerTagNames.CONTEXT_TAG, bus.getContext());
+			
+			listenerNode.setAttribute(ListenerTagNames.LISTENER_CLASS_TAG, HttpMessageAwareListener.class.getName());
+			YADOMUtil.removeEmptyAttributes(eprNode);
         }
 
         return listenerNode;

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatGatewayListener.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -20,35 +20,18 @@
 package org.jboss.soa.esb.listeners.gateway;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import javax.management.Attribute;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 
-import org.apache.catalina.Container;
 import org.apache.catalina.LifecycleException;
-import org.apache.catalina.connector.Connector;
 import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.core.StandardEngine;
-import org.apache.catalina.core.StandardHost;
-import org.apache.catalina.core.StandardServer;
-import org.apache.catalina.core.StandardService;
 import org.apache.catalina.core.StandardWrapper;
 import org.apache.catalina.loader.WebappLoader;
-import org.apache.catalina.servlets.DefaultServlet;
 import org.apache.catalina.startup.ContextConfig;
 import org.apache.log4j.Logger;
-import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.modeler.Registry;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.addressing.EPR;
@@ -72,13 +55,13 @@
  * components through jboss JMX console.  When this listener is stoped, these components will be 
  * destoried automatically.
  * 
- * <p>The different tomcat listener can be started in same port with different context.for example: 
+ * <p>The different tomcat listner can be started in same port with different context.for example: 
  * <code> http://localhost:8765/jbossesb/servicecategory/servicename </code>
  *
  * <p>This class uses the {@link org.jboss.soa.esb.listeners.gateway.TomcatMessageComposer}
  * by default.
  * @see org.jboss.soa.esb.listeners.gateway.TomcatMessageComposer
- * @see org.jboss.soa.esb.listeners.gateway.TomcatDispatchServlet 
+ * @see Torg.jboss.soa.esb.listeners.gateway.TomcatDispatchServlet 
  * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
  */
 public class TomcatGatewayListener extends AbstractManagedLifecycle {
@@ -101,16 +84,6 @@
 	/**The tag used to read the dispatch servlet class name value from configuration */	
 	public static String DISPATCH_SERVLET_CLASS = "dispatch_servlet";
 	
-	/**Record the count that the same host name is referenced by other Tomcat listener instance */
-	public static Map<String, Integer> hostReference= new java.util.HashMap<String, Integer>(); 
-	
-	/**Record the count that the same connector/port is referenced by other Tomcat listener instance */
-	public static Map<String, Integer> connectorReference= new java.util.HashMap<String, Integer>(); 
-	
-	
-	/**JMX domain name for tomcat listener*/
-	public static String DOMAIN_NAME = "jboss.esb.tomcat";
-
 	/**Http host value*/
 	public String host = null;
 	
@@ -120,9 +93,6 @@
 	/**listener contenxt */
 	public String httpContext = null;
 
-	/**Recored if this listener is already intilized*/
-	private boolean initialized = false;
-
 	/** Endpoint reference that presents this listener */
 	private EPR endpointReference = null;
 	
@@ -131,10 +101,7 @@
 	
 	/**Service name*/
 	private String serviceName = null;
-	
-	/** MBean server */
-	private MBeanServer mbeanServer = null;
-	
+		
 	/**The new created tomcat standard context, it reprents a web app*/
 	private StandardContext ctx = null;
 			
@@ -149,11 +116,12 @@
 	 * @param config The listener configuration
 	 * @throws ConfigurationException Exception during construction
 	 */
+	@SuppressWarnings("unchecked")
 	public TomcatGatewayListener(ConfigTree config) throws ConfigurationException {
 		super(config);
-		host = config.getAttribute(this.SERVER_HOST_TAG);
-		port = config.getAttribute(this.SERVER_PORT_TAG);
-		httpContext = config.getAttribute(this.REQUEST_CONTEXT_TAG);		
+		host = config.getAttribute(SERVER_HOST_TAG);
+		port = config.getAttribute(SERVER_PORT_TAG);
+		httpContext = config.getAttribute(REQUEST_CONTEXT_TAG);		
 		serviceCategory = config.getAttribute(ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG);
 		serviceName = config.getAttribute(ListenerTagNames.TARGET_SERVICE_NAME_TAG);
 		
@@ -173,16 +141,13 @@
 		}
 		
 		
-		mbeanServer = MBeanServerLocator.locateJBoss();
-		
 		//Check if the context already exists
 		try {
-			ObjectName contextName = new ObjectName("jboss.esb.tomcat:host=" + host + ",path=" + httpContext + ",*");
-			Set contexts  = mbeanServer.queryNames(contextName, null);
+			Set contexts = TomcatServer.getInstance().queryObjects(TomcatServer.DOMAIN_NAME + ":host=" + host + ",path=" + httpContext + ",*");
 			if (contexts.size() > 0) {
 				throw new ConfigurationException("There is already an http context named " + httpContext + ", choose another one"); 
 			}
-		} catch (MalformedObjectNameException e) {
+		} catch (Exception e) {
 			throw new ConfigurationException(e);
 		}
 		
@@ -239,34 +204,7 @@
 	 * @see org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle#doInitialise()
 	 */
 	protected void doInitialise() throws ManagedLifecycleException {
-		if (isInitialized()) {
-			throw new ManagedLifecycleException(
-					"Unexpected request to initialise JBoss Remoting Gateway listener '" + getConfig().getName() + "'.  Gateway already initialised.");
-		}
-		//TODO: Revisit it to see if it can be moved to ESB service initilize
-		try {
-			Set services = mbeanServer.queryMBeans(new ObjectName(DOMAIN_NAME + ":type=Service"), null);
-            if (services.size() == 0) {
-				StandardService service = new StandardService();
-				service.setName("jboss.esb.catalina");
-				Registry.getRegistry().registerComponent(service, new ObjectName(DOMAIN_NAME + ":type=Service"), null);
-			}
-
-			Set engines = mbeanServer.queryMBeans(new ObjectName(DOMAIN_NAME + ":type=Engine"), null);
-			if (engines.size() == 0) {
-				StandardEngine engine = new StandardEngine();
-				engine.setDefaultHost("localhost");
-				engine.setDomain(DOMAIN_NAME);
-				engine.setName(DOMAIN_NAME + ".engine");
-				mbeanServer.setAttribute(new ObjectName(DOMAIN_NAME + ":type=Service"), new Attribute("container", engine));
-				Registry.getRegistry().registerComponent(engine, new ObjectName(DOMAIN_NAME + ":type=Engine"), null);
-			}
-			mbeanServer.invoke(new ObjectName(DOMAIN_NAME + ":type=Service"), "start", new Object[] {}, new String[] {});
-
-		} catch (Exception e) {
-			throw new ManagedLifecycleException("Tomcat gateway listner initialization failed", e);
-		} 
-		initialized = true;
+		
 	}
 
 	/*
@@ -286,67 +224,16 @@
 	 * @throws Exception For error during start tomcat context
 	 */
 	@SuppressWarnings("unchecked")
-	protected void startHttpServer() throws Exception {				
-		ObjectName hostName = new ObjectName(DOMAIN_NAME + ":host=" + host + ",type=Host");
-		ObjectName stardardEngineName = new ObjectName(DOMAIN_NAME + ":type=Engine");
-		ObjectName standardServiceName = new ObjectName(DOMAIN_NAME + ":type=Service");
-		ObjectName connectorName = new ObjectName(DOMAIN_NAME + ":*,port=" + port + ",type=Connector");
-		//Check if it needs to create host
-		Set hosts = mbeanServer.queryNames(hostName, null);
-		if (hosts.size() == 0) {
-			StandardHost newHost = new StandardHost();
-			newHost.setName(host);
-			mbeanServer.invoke(stardardEngineName, "addChild",
-					new Object[] { newHost }, new String[] { Container.class
-							.getName() });
-		    synchronized (hostReference) {
-				hostReference.put(host, 1);
-			}
-
-		} else {
-			updateReference(hostReference, host, 1);
-			
-		}
+	protected void startHttpServer() throws Exception {
+        TomcatServer.getInstance().createHost(host);
 		
-		// Check is it needs create connector
-		Set connectors = mbeanServer.queryNames(connectorName, null);
-		if (connectors.size() == 0) {
-			Connector connector = null;
-			connector = new Connector("org.apache.coyote.http11.Http11Protocol");
-			connector.setPort(Integer.parseInt(port));
-			String maxThreads = getConfig().getAttribute(ListenerTagNames.MAX_THREADS_TAG);
-			if (maxThreads != null) {
-				connector.setProperty("maxThreads", maxThreads);
-			}
-			
-			//Set Property			
-			List<KeyValuePair> properties = getConfig().childPropertyList();
-			for (KeyValuePair property : properties) {	           			
-				boolean effected = IntrospectionUtils.setProperty(connector, property.getKey(), property.getValue());
-				if (!effected) {
-					connector.setProperty(property.getKey(), property.getValue());
-				}
-			}		
-			mbeanServer.invoke(standardServiceName, "addConnector",
-					new Object[] { connector }, new String[] { Connector.class
-							.getName() });
-			protocol = connector.getScheme();
-		    synchronized (connectorReference) {
-				connectorReference.put(port, 1);
-			}
-
-		} else {
-			ObjectName obj = (ObjectName)connectors.iterator().next();
-			try {
-		        protocol = mbeanServer.getAttribute(obj, "schema");
-			} catch (Exception e) {
-                //do nothing and use default http
-				protocol = "http";
-			} 
-			updateReference(connectorReference, port, 1);
+		List<KeyValuePair> properties = getConfig().childPropertyList();
+		String maxThreads = getConfig().getAttribute(ListenerTagNames.MAX_THREADS_TAG);
+		if (maxThreads != null) {
+			properties.add(new KeyValuePair("maxThreads", maxThreads)); 
 		}
+		TomcatServer.getInstance().createConnector(port, properties);
 		
-        //Create context
 		ctx = new StandardContext();
 		ctx.setLoader(new WebappLoader(getClass().getClassLoader()));
 		ContextConfig ctxCfg = new ContextConfig();
@@ -356,7 +243,20 @@
 		ctx.setPath(httpContext);
 		ctx.setDocBase(".");
 		initWebappDefaults(ctx);
-		mbeanServer.invoke(hostName, "addChild", new Object[] { ctx }, new String[] { Container.class.getName() });
+		TomcatServer.getInstance().addContext(host, ctx);
+		
+		String connectorName = TomcatServer.DOMAIN_NAME + ":*,port=" + port + ",type=Connector";
+		Set connectors = TomcatServer.getInstance().queryObjects(connectorName);
+		if (connectors.isEmpty()) {
+			throw new javax.management.InstanceNotFoundException("ObjectName: "+ connectorName + "Not found");
+		}
+		ObjectName obj = (ObjectName)connectors.iterator().next();
+		try {
+	        protocol = MBeanServerLocator.locateJBoss().getAttribute(obj, "schema");
+		} catch (Exception e) {
+            //do nothing and use default http
+			protocol = "http";
+		} 
 
 	}
 
@@ -393,52 +293,10 @@
 	 */
 	public void stopHttpServer() throws Exception {
 		//Destroy the created context
-		ObjectName contextName = new ObjectName(DOMAIN_NAME + ":j2eeType=WebModule,name=//" + host + this.httpContext + ",*"); 
-		Set engines = mbeanServer.queryNames(contextName, null);
-		if (engines.isEmpty()) {
-			throw new InstanceNotFoundException("HttpContext:" + httpContext + "not found");
-		}
-		contextName = (ObjectName)engines.iterator().next();
-		mbeanServer.invoke(contextName, "destroy", new Object[] {}, new String[] {});
-		
-		//Decrese the host and connector reference
-		updateReference(hostReference, host, -1);
-		updateReference(connectorReference, port, -1);
-		
-		Object obj = hostReference.get(host);
-		
-		if (obj != null && (Integer)obj == 0) {
-			ObjectName standardHostName = new ObjectName(DOMAIN_NAME + ":host=" + host + ",type=Host");
-			try {
-				mbeanServer.invoke(standardHostName, "destroy", new Object[] {}, new String[] {});
-			} catch (InstanceNotFoundException e) {
-				logger.warn("Unable to destroy the Host " + standardHostName.getCanonicalName(), e);
-			} 			
-		}
-		
-		obj = connectorReference.get(port) ;
-		
-		if (obj != null && (Integer)obj == 0) {
-			ObjectName connectorName = new ObjectName(DOMAIN_NAME + ":port=" + port + ",type=Connector");
-			try {
-				mbeanServer.invoke(connectorName, "destroy", new Object[] {}, new String[] {});
-			} catch (InstanceNotFoundException e) {
-                //Ignore it
-				logger.warn("Unable to destroy the Host " + connectorName.getCanonicalName(), e);
-
-			} 		
-		}
+        TomcatServer.getInstance().destroyContext(host, port, httpContext);
 	
 	}
 	
-	
-	/**If this listener initialized
-	 * @return true if initialized
-	 */
-	public boolean isInitialized() {
-		return initialized;
-	}
-
 	/**Get the uncomposed message delivery dapater
 	 * @return uncomposed message delivery adapter 
 	 * @throws ConfigurationException For configuation error 
@@ -474,22 +332,5 @@
 		}
 		ctx.addServletMapping("/", "default");
 	}
-	
-	/**Update the reference value
-	 * @param refrenceMap The reference map
-	 * @param key Update key
-	 * @param increment Update value
-	 */
-	@SuppressWarnings("unchecked")
-	public void updateReference(Map refrenceMap, String key , int increment) {
-		synchronized (refrenceMap) {
-			if (refrenceMap.get(key) != null) {
-				int count = (Integer) refrenceMap.get(key);
-				if (count == 0) {
-					return;
-				}
-				refrenceMap.put(key, count + increment);
-			}
-		}
-	}
-}
+
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatServer.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatServer.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/TomcatServer.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.gateway;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardService;
+import org.apache.tomcat.util.IntrospectionUtils;
+import org.apache.tomcat.util.modeler.Registry;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+/**
+ * This class creates and starts the jboss esb tomcat engine. The tomcat Connector 
+ * , Host , StandardContext are also can be created with this class. 
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ *
+ */
+public class TomcatServer {
+	/**Record the count that the same host name is referenced by other Tomcat listener instance */
+	public static Map<String, Integer> hostReference= new java.util.HashMap<String, Integer>(); 
+	
+	/**Record the count that the same connector/port is referenced by other Tomcat listener instance */
+	public static Map<String, Integer> connectorReference= new java.util.HashMap<String, Integer>(); 
+	
+	
+	/**JMX domain name for tomcat listener*/
+	public static String DOMAIN_NAME = "jboss.esb.tomcat";
+    
+	/**MBean sever*/
+	private static MBeanServer mbeanServer = null;
+	
+	/**TomcatServer instance*/
+	private static TomcatServer instance = null;
+	
+	private TomcatServer() {
+		
+	}
+	
+	public static TomcatServer getInstance() {
+		if (instance != null) {
+			return instance;
+		}
+		
+		synchronized(TomcatServer.class) {
+			mbeanServer = MBeanServerLocator.locateJBoss();
+			instance = new TomcatServer();
+			instance.createEngine();
+		}
+		return instance;
+		
+	}
+	
+	
+	/**
+	 * Create a tomcat engine and also register it in JMX server
+	 * If there is exception , it will throw RuntimeException 
+	 */
+	@SuppressWarnings("unchecked")
+	private void createEngine() {
+		try {
+			Set services = mbeanServer.queryMBeans(new ObjectName(DOMAIN_NAME
+					+ ":type=Service"), null);
+			if (services.size() == 0) {
+				StandardService service = new StandardService();
+				service.setName("jboss.esb.catalina");
+				Registry.getRegistry().registerComponent(service,
+						new ObjectName(DOMAIN_NAME + ":type=Service"), null);
+			}
+
+			Set engines = mbeanServer.queryMBeans(new ObjectName(DOMAIN_NAME
+					+ ":type=Engine"), null);
+			if (engines.size() == 0) {
+				StandardEngine engine = new StandardEngine();
+				engine.setDefaultHost("localhost");
+				engine.setDomain(DOMAIN_NAME);
+				engine.setName(DOMAIN_NAME + ".engine");
+				mbeanServer.setAttribute(new ObjectName(DOMAIN_NAME
+						+ ":type=Service"), new Attribute("container", engine));
+				Registry.getRegistry().registerComponent(engine,
+						new ObjectName(DOMAIN_NAME + ":type=Engine"), null);
+			}
+			mbeanServer.invoke(new ObjectName(DOMAIN_NAME + ":type=Service"),
+					"start", new Object[] {}, new String[] {});
+		} catch (Exception e) {
+			throw new RuntimeException("Failed to create tomcat engine in ESB", e);
+		}
+
+		
+	}
+	
+	/**
+	 * Add a tomcat StandardHost to tomcat engine
+	 * @param host host name
+	 * @throws Exception If there is error occured
+	 */
+	@SuppressWarnings("unchecked")
+	public void createHost(String host) throws Exception {
+		ObjectName hostName = new ObjectName(DOMAIN_NAME + ":host=" + host + ",type=Host");
+		ObjectName stardardEngineName = new ObjectName(DOMAIN_NAME + ":type=Engine");
+		
+		//Check if it needs to create host
+		Set hosts = mbeanServer.queryNames(hostName, null);
+		if (hosts.size() == 0) {
+			StandardHost newHost = new StandardHost();
+			newHost.setName(host);
+			mbeanServer.invoke(stardardEngineName, "addChild", new Object[] { newHost }, new String[] { Container.class .getName() });
+		    synchronized (hostReference) {
+				hostReference.put(host, 1);
+			}
+
+		} else {
+			updateReference(hostReference, host, 1);
+			
+		}
+	}
+	
+	/**
+	 * Add a tomcat Connector to tomcat Enginer/Service
+	 * @param port the connector port 
+	 * @param properties The properties to configure this connector 
+	 * @throws Exception when error is occured
+	 */
+	@SuppressWarnings("unchecked")
+	public void createConnector(String port, List<KeyValuePair> properties) throws Exception {
+		ObjectName standardServiceName = new ObjectName(DOMAIN_NAME + ":type=Service");
+		ObjectName connectorName = new ObjectName(DOMAIN_NAME + ":*,port=" + port + ",type=Connector");
+		Set connectors = mbeanServer.queryNames(connectorName, null);
+		if (connectors.size() == 0) {
+			Connector connector = null;
+			connector = new Connector("org.apache.coyote.http11.Http11Protocol");
+			connector.setPort(Integer.parseInt(port));
+			
+			for (KeyValuePair property : properties) {	           			
+				boolean effected = IntrospectionUtils.setProperty(connector, property.getKey(), property.getValue());
+				if (!effected) {
+					connector.setProperty(property.getKey(), property.getValue());
+				}
+			}		
+			mbeanServer.invoke(standardServiceName, "addConnector",
+					new Object[] { connector }, new String[] { Connector.class
+							.getName() });
+		    synchronized (connectorReference) {
+				connectorReference.put(port, 1);
+			}
+
+		} else {			
+			updateReference(connectorReference, port, 1);
+		}
+	}
+
+	
+	/**
+	 * Add a StandardContext to a specific host
+	 * @param host the host name
+	 * @param ctx new created StandardContext
+	 * @throws Exception when error occurs
+	 */
+	public void addContext(String host, StandardContext ctx) throws Exception {
+		ObjectName hostName = new ObjectName(DOMAIN_NAME + ":host=" + host + ",type=Host");
+		mbeanServer.invoke(hostName, "addChild", new Object[] { ctx }, new String[] { Container.class.getName() });
+
+	}
+	
+
+	/**
+	 * Destroy the created context. This method will also check if this context's parent StandardHost 
+	 * and Connector can be destroyed also. There are reference counters for Connector and Host 
+	 * @param host host name
+	 * @param port port number
+	 * @param httpContext the new created httpContext name
+	 * @throws Exception if failed to destroy
+	 */
+	@SuppressWarnings("unchecked")
+	public void destroyContext(String host, String port, String httpContext)
+			throws Exception {
+		ObjectName contextName = new ObjectName(DOMAIN_NAME
+				+ ":j2eeType=WebModule,name=//" + host + httpContext
+				+ ",*");
+		Set engines = mbeanServer.queryNames(contextName, null);
+		if (engines.isEmpty()) {
+			throw new InstanceNotFoundException("HttpContext:" + httpContext + "not found");
+		}
+		contextName = (ObjectName) engines.iterator().next();
+		mbeanServer.invoke(contextName, "destroy", new Object[] {},
+				new String[] {});
+
+		// Decrese the host and connector reference
+		updateReference(hostReference, host, -1);
+		updateReference(connectorReference, port, -1);
+
+		Object obj = hostReference.get(host);
+
+		if (obj != null && (Integer) obj == 0) {
+			ObjectName standardHostName = new ObjectName(DOMAIN_NAME + ":host="
+					+ host + ",type=Host");
+
+		    mbeanServer.invoke(standardHostName, "destroy", new Object[] {}, new String[] {});
+		}
+
+		obj = connectorReference.get(port);
+
+		if (obj != null && (Integer) obj == 0) {
+			ObjectName connectorName = new ObjectName(DOMAIN_NAME + ":port="
+					+ port + ",type=Connector");
+			mbeanServer.invoke(connectorName, "destroy", new Object[] {}, new String[] {});
+		}
+	}
+
+	/**
+	 * Query objects
+	 * @param objectName
+	 * @return Set contains ObjectName
+	 * @throws Exception error occurs
+	 */
+	@SuppressWarnings("unchecked")
+	public Set queryObjects(String objectName) throws Exception {
+		ObjectName name = new ObjectName(objectName);
+		Set objects  = mbeanServer.queryNames(name, null);
+		return objects;
+	}
+	
+	/**Update the reference value
+	 * @param refrenceMap The reference map
+	 * @param key Update key
+	 * @param increment Update value
+	 */
+	@SuppressWarnings("unchecked")
+	public void updateReference(Map refrenceMap, String key , int increment) {
+		synchronized (refrenceMap) {
+			if (refrenceMap.get(key) != null) {
+				int count = (Integer) refrenceMap.get(key);
+				if (count == 0) {
+					return;
+				}
+				refrenceMap.put(key, count + increment);
+			}
+		}
+	}
+}
+
+

Added: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/HttpMessageAwareListener.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/HttpMessageAwareListener.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/HttpMessageAwareListener.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,145 @@
+/*
+ * 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.message;
+
+import java.util.List;
+
+import javax.management.MBeanServer;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardWrapper;
+import org.apache.catalina.loader.WebappLoader;
+import org.apache.catalina.startup.ContextConfig;
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.gateway.TomcatServer;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+
+/**
+ * This class extends MessageAwareListener. It starts the TomcatServer in doStart() and 
+ * destroy created tomcat artifacts in doStop().
+ * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
+ *
+ */
+ 
+public class HttpMessageAwareListener extends MessageAwareListener {
+	private static final long serialVersionUID = 1L;
+	
+	private static Logger logger = Logger.getLogger(HttpMessageAwareListener.class);
+	
+	/**JMX domain name for tomcat listener*/
+	public static String DOMAIN_NAME = "jboss.esb.tomcat";
+	
+	public MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+	
+	public StandardContext  ctx = null;
+	
+	public String host = null;
+	public String port = null;
+	public String httpContext = null;
+	
+	public String dispatchServletClassName = "";
+
+	public HttpMessageAwareListener(final ConfigTree config)
+			throws ConfigurationException {
+		super(config);
+		List<KeyValuePair> properties = getConfig().childPropertyList();
+		String maxThreads = getConfig().getAttribute(ListenerTagNames.MAX_THREADS_TAG);
+		if (maxThreads != null && getEpr() != null) {
+			HTTPEpr epr = (HTTPEpr)getEpr();
+			epr.setThreads(maxThreads);
+		}
+		ConfigTree eprElement = config.getFirstChild(ListenerTagNames.EPR_TAG);
+		host = eprElement.getAttribute(ListenerTagNames.HOST_TAG, "localhost");
+		port = eprElement.getAttribute(ListenerTagNames.PORT_TAG);
+		httpContext = eprElement.getAttribute(ListenerTagNames.CONTEXT_TAG);
+	}
+
+	protected void doStart() throws ManagedLifecycleException {
+		super.doStart();
+		try {
+			this.startHttpServer();
+		} catch (Exception e) {
+			throw new ManagedLifecycleException("Failed to start MessageAwareListener", e);
+			
+		}		
+	}
+	protected void doStop() throws ManagedLifecycleException {
+		super.doStop();
+		try {
+			stopHttpServer();
+		} catch (Exception e) {
+			 throw new ManagedLifecycleException("Failed to stop MessageAwareListener", e) ;
+		}
+	}
+	
+	
+	/**
+	 * Start the tomcat http server.It will check if it really needs to create
+	 * Tomcat connector and host. Then add these new tomcat component to tomcat Engine 
+	 * tree through JMX server.
+	 * @throws Exception For error during start tomcat context
+	 */
+	@SuppressWarnings("unchecked")
+	protected void startHttpServer() throws Exception {	
+        TomcatServer.getInstance().createHost(host);
+		List<KeyValuePair> properties = getConfig().childPropertyList();
+		TomcatServer.getInstance().createConnector(port, properties);
+		
+		ctx = new StandardContext();
+		ctx.setLoader(new WebappLoader(getClass().getClassLoader()));
+		ContextConfig ctxCfg = new ContextConfig();
+		ctx.addLifecycleListener(ctxCfg);
+		
+		ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
+		ctx.setPath(httpContext);
+		ctx.setDocBase(".");
+		initWebappDefaults(ctx);
+		TomcatServer.getInstance().addContext(host, ctx);
+	}
+		
+     protected void initWebappDefaults(StandardContext ctx) throws Exception {
+		StandardWrapper sw = (StandardWrapper) ctx.createWrapper();
+		sw.setServletClass("org.jboss.internal.soa.esb.couriers.HttpESBListenerServlet");
+		sw.setName("default");
+		ctx.addChild(sw);
+		sw.addInitParameter("listings", "false");
+		sw.setLoadOnStartup(1);
+		try {
+			sw.start();
+		} catch (LifecycleException e) {
+			logger.error("Unexpected error when start the default servlet");
+			throw e;
+		}
+		ctx.addServletMapping("/", "default");
+	}	
+		
+	public void stopHttpServer() throws Exception {
+        TomcatServer.getInstance().destroyContext(host, port, httpContext);
+	}
+}

Modified: labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -106,6 +106,10 @@
             _config = config ;
             checkMyParms() ;
 	}
+	
+	protected EPR getEpr() {
+		return this._epr;
+	}
 
 	/**
 	 * Check for mandatory and optional attributes in parameter tree

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/build.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/build.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/build.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,10 @@
+<project name="Quickstart_tomcat_listener" default="run" basedir=".">
+	
+	<description> 
+		${ant.project.name}
+		${line.separator}
+	</description>
+	
+	<!-- Import the base Ant build script... -->
+	<import file="../conf/base-build.xml"/> 	
+</project>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/deployment.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/deployment.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,6 @@
+<jbossesb-deployment>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbm-queue-service.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+  
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+
+
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+  
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+</server>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbmq-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbmq-queue-service.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+  
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+
+
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+  
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+</server>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jboss-esb.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,86 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_tomcatlistener_Request_esb"
+                  />
+              </jms-bus>
+              <jms-bus busid="quickstartEsbChannel1">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_tomcatlistener_Request_esb1"
+                  />
+              </jms-bus>
+          </jms-provider>   
+          
+         <tomcat-provider name="HTTP" host="localhost" port="8765">
+            <!--property name="maxThreads" value="150"/>
+            <property name="scheme" value="https"/>
+            <property name="secure" value="true"/>
+            <property name="SSLEnabled" value="true"/>
+            <property name="Keystore" value="./key/.keystore"/>
+            <property name="Keystore" value="./key/.keystore"/>
+            <property name="Keypass" value="changeit"/>
+            <property name="allowTrace" value="true"/-->
+            <tomcat-bus busid="HTTP-1" context="/jbossesb/tomcatgateway/serviceA" />
+
+            <tomcat-bus busid="HTTP-2" context="/jbossesb/tomcatgateway/serviceB" />
+         </tomcat-provider>
+      </providers>
+                      
+      <services>
+        <service 
+        	category="tomcatgateway" 
+        	name="service" 
+        	description="Hello World">
+            <listeners>                
+                <tomcat-listener name="A1-HTTP"
+                    busidref="HTTP-1"
+                    maxThreads="100"
+                    is-gateway="true">
+                <!--property name="synchronous" value="false"/>
+                <property name="asyncResponse" value="/response.txt"/-->
+               </tomcat-listener>	
+                <jms-listener name="JMS-Gateway"
+                	busidref="quickstartEsbChannel" 
+                	/>    
+            </listeners>
+            <actions mep="RequestResponse">
+                   <action name="action1" 
+                   	class="org.jboss.soa.esb.samples.quickstart.tomcatgateway.MyAction" 
+                   	process="displayMessage" 
+                   	/>                       
+            </actions>
+        </service>
+
+
+        <service 
+        	category="tomcatgateway" 
+        	name="service2" 
+        	description="Hello World2">
+            <listeners>                
+                <tomcat-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="10"
+                    is-gateway="true">
+                <!--property name="synchronous" value="false"/>
+                <property name="asyncResponse" value="/response.txt"/-->
+               </tomcat-listener>	
+                <jms-listener name="JMS-Gateway1"
+                	busidref="quickstartEsbChannel1" 
+                	/>    
+            </listeners>
+            <actions mep="RequestResponse">
+                   <action name="action1" 
+                   	class="org.jboss.soa.esb.samples.quickstart.tomcatgateway.MyAction2" 
+                   	process="displayMessage" 
+                   	/>                       
+            </actions>
+        </service>
+
+      </services>
+</jbossesb>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbossesb-properties.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jbossesb-properties.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2006, JBoss Inc., and others contributors as indicated 
+  by the @authors tag. All rights reserved. 
+  See the copyright.txt in the distribution for a
+  full listing of individual contributors. 
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A 
+  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,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+  MA  02110-1301, USA.
+  
+  (C) 2005-2006,
+  @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+  These options are described in the JBossESB manual.
+  Defaults are provided here for convenience only.
+ 
+  Please read through this file prior to using the system, and consider
+  updating the specified entries.
+-->
+<esb
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+    <properties name="core">
+		<property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+		<property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+        <property name="jboss.esb.invm.scope.default" value="NONE"/>
+    </properties>
+    <properties name="registry">      
+    	<property name="org.jboss.soa.esb.registry.queryManagerURI"     		
+    		value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>    		
+    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"     		
+    		value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+    	<property name="org.jboss.soa.esb.registry.implementationClass" 
+    		value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.factoryClass" 
+    		value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.user" 
+    		value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.registry.password" 
+    	  value="password"/>
+    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" 
+    		value="org.apache.ws.scout.transport.RMITransport"/>
+    </properties>
+    <properties name="transports" depends="core">
+    	<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+    </properties>
+    <properties name="connection">
+    	<property name="min-pool-size" value="5"/>
+    	<property name="max-pool=size" value="10"/>
+    	<property name="blocking-timeout-millis" value="5000"/>
+    	<property name="abandoned-connection-timeout" value="10000"/>
+    	<property name="abandoned-connection-time-interval" value="30000"/>
+    </properties>
+    <properties name="dbstore">
+		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/"/>
+		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+		<!--table managed by pool to test for valid connections - created by pool automatically -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
+                <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+    </properties>
+    <properties name="messagerouting">
+    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+    </properties>
+</esb>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jndi.properties
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jndi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/jndi.properties	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/juddi.properties
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/juddi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/juddi.properties	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any 
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct 
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+ 
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+  

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/log4j.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/log4j.xml	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/log4j.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/readme.txt
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/readme.txt	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/readme.txt	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,18 @@
+Overview:
+=========
+  The purpose of the tomcat_gateway quickstart sample is to demonstarte how to 
+  configue a tomcat gateway to pass the http request into ESB service. 
+  
+
+Running this quickstart:
+========================
+  Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+  and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run '.esb' archive mode:
+===========================
+  1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+  2. Open the web brower and send http request to "http://localhost:8765/jbossesb/tomcatgateway/serviceA/" 
+     and "http://localhost:8765/jbossesb/tomcatgateway/serviceB/"
+  3. Switch back to Application Server console to see the output from the ESB
+  4. In this folder ("Window1"), type 'ant undeploy'.

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.tomcatgateway;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MyAction extends AbstractActionLifecycle {
+
+	protected ConfigTree _config;
+
+	public MyAction(ConfigTree config) {
+		_config = config;
+	}
+
+	public Message displayMessage(Message message) throws Exception {
+
+		System.out.println("&&&&&&&&&&&&&&&& MyAction &&&&&&&&&&&&&&&&&&&&&");
+		
+		System.out.println("------------Http Request Info-------------------"); 
+		Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
+		requestInfo.get("Method");
+		Iterator<String> infoIte = requestInfo.keySet().iterator();
+		while(infoIte.hasNext()) {
+			String key = infoIte.next();
+			System.out.println(key + " : " + requestInfo.get(key));
+		}
+		
+		
+		System.out.println("------------Http Prameter Map-------------------"); 
+		Object obj = message.getProperties().getProperty("RequestParameterMap");
+		
+		if (obj != null) {
+			Map<String, Object> paraMap = (Map<String, Object>)obj;
+			Iterator<String> paraIte = paraMap.keySet().iterator();
+			while(paraIte.hasNext()) {
+				String key = paraIte.next();
+				System.out.println(key + " : " + paraMap.get(key));
+			}
+		}
+		
+		
+		System.out.println("------------Http Request body -------------------");
+		System.out.println(new String((byte[])message.getBody().get()));
+		
+		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		message.getBody().add("This message is from ESB service 2");
+		return message;
+
+	}
+
+}

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction2.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction2.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_gateway/src/org/jboss/soa/esb/samples/quickstart/tomcatgateway/MyAction2.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.tomcatgateway;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MyAction2 extends AbstractActionLifecycle {
+
+	protected ConfigTree _config;
+
+	public MyAction2(ConfigTree config) {
+		_config = config;
+	}
+
+	public Message displayMessage(Message message) throws Exception {
+
+		
+		System.out.println("&&&&&&&&&&&&&&&& MyAction2 &&&&&&&&&&&&&&&&&&&&&");
+		
+		System.out.println("------------Http Request Info-------------------"); 
+		Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
+		requestInfo.get("Method");
+		Iterator<String> infoIte = requestInfo.keySet().iterator();
+		while(infoIte.hasNext()) {
+			String key = infoIte.next();
+			System.out.println(key + " : " + requestInfo.get(key));
+		}
+		
+		
+		System.out.println("------------Http Prameter Map-------------------"); 
+		Object obj = message.getProperties().getProperty("RequestParameterMap");
+		
+		if (obj != null) {
+			Map<String, Object> paraMap = (Map<String, Object>)obj;
+			Iterator<String> paraIte = paraMap.keySet().iterator();
+			while(paraIte.hasNext()) {
+				String key = paraIte.next();
+				System.out.println(key + " : " + paraMap.get(key));
+			}
+		}
+		
+		
+		System.out.println("------------Http Request body -------------------");
+		System.out.println(new String((byte[])message.getBody().get()));
+		
+		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		message.getBody().add("This message is from ESB service 2");
+		return message;
+
+	}
+
+}

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/build.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -6,5 +6,15 @@
 	</description>
 	
 	<!-- Import the base Ant build script... -->
-	<import file="../conf/base-build.xml"/> 	
+	<import file="../conf/base-build.xml"/>
+	<target name="sendesb" depends="compile"
+		description="Will send an esb Message">
+		<echo>Runs Test ESB Message Sender</echo>
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.tomcatlistener.test.SendEsbMessage" failonerror="true">
+			<arg value="tomcatListener"/> <!--  service category -->
+			<arg value="service"/>  <!--  service name -->
+			<arg value="Hello World - Straight to Tomcat ESB listener - no Gateway"/> <!--  Message text -->
+			<classpath refid="exec-classpath"/>
+		</java>
+	</target> 	
 </project>

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/deployment.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,6 +1,2 @@
 <jbossesb-deployment>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply</depends>
 </jbossesb-deployment>

Deleted: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbm-queue-service.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb"
-    xmbean-dd="xmdesc/Queue-xmbean.xml">
-	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-	<depends>jboss.messaging:service=PostOffice</depends>
-  </mbean>
-  
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply"
-    xmbean-dd="xmdesc/Queue-xmbean.xml">
-	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-	<depends>jboss.messaging:service=PostOffice</depends>
-  </mbean>
-
-
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1"
-    xmbean-dd="xmdesc/Queue-xmbean.xml">
-	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-	<depends>jboss.messaging:service=PostOffice</depends>
-  </mbean>
-  
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply"
-    xmbean-dd="xmdesc/Queue-xmbean.xml">
-	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-	<depends>jboss.messaging:service=PostOffice</depends>
-  </mbean>
-</server>

Deleted: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jbmq-queue-service.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-  <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb">
-    <depends optional-attribute-name="DestinationManager">
-      jboss.mq:service=DestinationManager
-    </depends>
-  </mbean>
-  
-  <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb_reply">
-    <depends optional-attribute-name="DestinationManager">
-      jboss.mq:service=DestinationManager
-    </depends>
-  </mbean>
-
-
-
-  <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1">
-    <depends optional-attribute-name="DestinationManager">
-      jboss.mq:service=DestinationManager
-    </depends>
-  </mbean>
-  
-  <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_tomcatlistener_Request_esb1_reply">
-    <depends optional-attribute-name="DestinationManager">
-      jboss.mq:service=DestinationManager
-    </depends>
-  </mbean>
-</server>

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/jboss-esb.xml	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,34 +1,9 @@
 <?xml version = "1.0" encoding = "UTF-8"?>
 <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
 
-    <providers>
-          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
-              <jms-bus busid="quickstartEsbChannel">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/quickstart_tomcatlistener_Request_esb"
-                  />
-              </jms-bus>
-              <jms-bus busid="quickstartEsbChannel1">
-                  <jms-message-filter
-                      dest-type="QUEUE"
-                      dest-name="queue/quickstart_tomcatlistener_Request_esb1"
-                  />
-              </jms-bus>
-          </jms-provider>   
-          
+    <providers>           
          <tomcat-provider name="HTTP" host="localhost" port="8765">
-            <!--property name="maxThreads" value="150"/>
-            <property name="scheme" value="https"/>
-            <property name="secure" value="true"/>
-            <property name="SSLEnabled" value="true"/>
-            <property name="Keystore" value="./key/.keystore"/>
-            <property name="Keystore" value="./key/.keystore"/>
-            <property name="Keypass" value="changeit"/>
-            <property name="allowTrace" value="true"/-->
-            <tomcat-bus busid="HTTP-1" context="/jbossesb/tomcatlistener/serviceA" />
-
-            <tomcat-bus busid="HTTP-2" context="/jbossesb/tomcatlistener/serviceB" />
+            <tomcat-bus busid="HTTP-1" context="/jbossesb/tomcatlistener" />
          </tomcat-provider>
       </providers>
                       
@@ -40,14 +15,8 @@
             <listeners>                
                 <tomcat-listener name="A1-HTTP"
                     busidref="HTTP-1"
-                    maxThreads="100"
-                    is-gateway="true">
-                <!--property name="synchronous" value="false"/>
-                <property name="asyncResponse" value="/response.txt"/-->
+                    maxThreads="5">
                </tomcat-listener>	
-                <jms-listener name="JMS-Gateway"
-                	busidref="quickstartEsbChannel" 
-                	/>    
             </listeners>
             <actions mep="RequestResponse">
                    <action name="action1" 
@@ -56,31 +25,5 @@
                    	/>                       
             </actions>
         </service>
-
-
-        <service 
-        	category="tomcatListener" 
-        	name="service2" 
-        	description="Hello World2">
-            <listeners>                
-                <tomcat-listener name="A2-HTTP"
-                    busidref="HTTP-2"
-                    maxThreads="10"
-                    is-gateway="true">
-                <!--property name="synchronous" value="false"/>
-                <property name="asyncResponse" value="/response.txt"/-->
-               </tomcat-listener>	
-                <jms-listener name="JMS-Gateway1"
-                	busidref="quickstartEsbChannel1" 
-                	/>    
-            </listeners>
-            <actions mep="RequestResponse">
-                   <action name="action1" 
-                   	class="org.jboss.soa.esb.samples.quickstart.tomcatlistener.MyAction2" 
-                   	process="displayMessage" 
-                   	/>                       
-            </actions>
-        </service>
-
       </services>
 </jbossesb>

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/readme.txt	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,7 +1,7 @@
 Overview:
 =========
   The purpose of the tomcat_listener quickstart sample is to demonstarte how to 
-  configue a tomcat listener to pass the http request into ESB service. 
+  configue a tomcat listener. 
   
 
 Running this quickstart:
@@ -12,7 +12,6 @@
 To Run '.esb' archive mode:
 ===========================
   1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
-  2. Open the web brower and send http request to "http://localhost:8765/jbossesb/tomcatlistener/serviceA/" 
-     and "http://localhost:8765/jbossesb/tomcatlistener/serviceB/"
+  2. type 'ant sendesb' to send ESB message to tomcat listener.
   3. Switch back to Application Server console to see the output from the ESB
   4. In this folder ("Window1"), type 'ant undeploy'.

Modified: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -39,35 +39,12 @@
 
 		
 		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-		
-		System.out.println("------------Http Request Info-------------------"); 
-		Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
-		requestInfo.get("Method");
-		Iterator<String> infoIte = requestInfo.keySet().iterator();
-		while(infoIte.hasNext()) {
-			String key = infoIte.next();
-			System.out.println(key + " : " + requestInfo.get(key));
-		}
-		
-		
-		System.out.println("------------Http Prameter Map-------------------"); 
-		Object obj = message.getProperties().getProperty("RequestParameterMap");
-		
-		if (obj != null) {
-			Map<String, Object> paraMap = (Map<String, Object>)obj;
-			Iterator<String> paraIte = paraMap.keySet().iterator();
-			while(paraIte.hasNext()) {
-				String key = paraIte.next();
-				System.out.println(key + " : " + paraMap.get(key));
-			}
-		}
-		
-		
+
 		System.out.println("------------Http Request body -------------------");
-		System.out.println(new String((byte[])message.getBody().get()));
+		System.out.println(message.getBody().get());
 		
 		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-		message.getBody().add("This message is from ESB service 1");
+		message.getBody().add("Reponse :" + message.getBody().get());
 		return message;
 
 	}

Deleted: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction2.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction2.java	2008-11-19 02:08:12 UTC (rev 23931)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/MyAction2.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.tomcatlistener;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jboss.soa.esb.actions.AbstractActionLifecycle;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-
-public class MyAction2 extends AbstractActionLifecycle {
-
-	protected ConfigTree _config;
-
-	public MyAction2(ConfigTree config) {
-		_config = config;
-	}
-
-	public Message displayMessage(Message message) throws Exception {
-
-		
-		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-		
-		System.out.println("------------Http Request Info-------------------"); 
-		Map requestInfo = (Map)message.getProperties().getProperty("RequestInfoMap");
-		requestInfo.get("Method");
-		Iterator<String> infoIte = requestInfo.keySet().iterator();
-		while(infoIte.hasNext()) {
-			String key = infoIte.next();
-			System.out.println(key + " : " + requestInfo.get(key));
-		}
-		
-		
-		System.out.println("------------Http Prameter Map-------------------"); 
-		Object obj = message.getProperties().getProperty("RequestParameterMap");
-		
-		if (obj != null) {
-			Map<String, Object> paraMap = (Map<String, Object>)obj;
-			Iterator<String> paraIte = paraMap.keySet().iterator();
-			while(paraIte.hasNext()) {
-				String key = paraIte.next();
-				System.out.println(key + " : " + paraMap.get(key));
-			}
-		}
-		
-		
-		System.out.println("------------Http Request body -------------------");
-		System.out.println(new String((byte[])message.getBody().get()));
-		
-		System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
-		message.getBody().add("This message is from ESB service 2");
-		return message;
-
-	}
-
-}
\ No newline at end of file

Added: labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/test/SendEsbMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/mlittle/legstar/product/samples/quickstarts/tomcat_listener/src/org/jboss/soa/esb/samples/quickstart/tomcatlistener/test/SendEsbMessage.java	2008-11-19 02:08:53 UTC (rev 23932)
@@ -0,0 +1,50 @@
+/*
+ * 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.samples.quickstart.tomcatlistener.test;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.client.ServiceInvoker;
+
+public class SendEsbMessage 
+{
+    public static void main(String args[]) throws Exception
+    {
+//      Setting the ConnectionFactory such that it will use scout
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+        
+    	if (args.length < 3)
+    	{
+    		System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
+    	}
+    	
+    	Message esbMessage = MessageFactory.getInstance().getMessage();
+
+    	esbMessage.getBody().add(args[2]);
+    	
+        Message msg = new ServiceInvoker(args[0], args[1]).deliverSync(esbMessage, 20000);
+        System.out.println("----" + msg.getBody().get());
+    	
+    }
+    
+}




More information about the jboss-svn-commits mailing list