[jboss-svn-commits] JBL Code SVN: r25032 - in labs/jbossesb/workspace/mlittle/legstar/product: rosetta/src/org/jboss/internal/soa/esb/couriers and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jan 31 12:08:51 EST 2009
Author: mark.little at jboss.com
Date: 2009-01-31 12:08:51 -0500 (Sat, 31 Jan 2009)
New Revision: 25032
Removed:
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/samples/quickstarts/http_listener/
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/client/ServiceInvoker.java
labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java
Log:
removed httpcourier
Deleted: 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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/DefaultHttpReplyToEpr.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.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);
- }
-
-
- }
-
-}
Deleted: 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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpCourier.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -1,128 +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, JBoss Inc.
- */
-package org.jboss.internal.soa.esb.couriers;
-
-import java.io.InputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.net.URISyntaxException;
-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.ContextObjectInputStream;
-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";
-
- protected static Logger logger = Logger.getLogger(InVMCourier.class);
-
- private HTTPEpr epr;
-
- private HttpClient httpClient = null;
-
- private PostMethod method = null;
-
- private Message repsonseMessage = 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;
- }
-
- try {
- if (epr.getURI().toString().endsWith("reply")) {
- // do nothing,reply message will be delivered by servlet response
- return true;
- }
- } catch (URISyntaxException e1) {
- logger.error("Failed to get uri from EPR " + epr);
- return false;
- }
-
- try {
- 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);
- if (method.getResponseBody().length > 0) {
- InputStream ins = method.getResponseBodyAsStream();
- Serializable serial = (Serializable) new ContextObjectInputStream(
- ins).readObject();
- repsonseMessage = Util.deserialize(serial);
- }
-
- } catch (final Exception e) {
- logger.error("HttpCourier.deliver caught exception.", e);
- logger.error("Failed to get response message :[ " + message + "]");
- return false;
- } finally {
- method.releaseConnection();
- }
-
- return true;
- }
-
- public Message pickup(long millis) {
- return repsonseMessage;
- }
-
- public void cleanup() {
- }
-
-}
Deleted: 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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HttpESBListenerServlet.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -1,143 +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, JBoss Inc.
- */
-package org.jboss.internal.soa.esb.couriers;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-
-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.EPR;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.ListenerUtil;
-import org.jboss.soa.esb.listeners.RegistryUtil;
-import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
-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 return message processed
- * by ActionprossingPipeline
- * @author <a href="mailto:ema at redhat.com">Jim Ma</a>
- */
-public class HttpESBListenerServlet extends HttpServlet {
- HttpCourier requestCourier = null;
- HttpCourier responseCourier = null;
- private boolean synchronous = false;
-
- private ActionProcessingPipeline pipeline ;
- private EPR epr;
- private ConfigTree config;
- public void init() throws ServletException {
- config = (ConfigTree) getServletContext().getAttribute("config");
- if (ListenerTagNames.MEP_REQUEST_RESPONSE.equals(config.getAttribute(ListenerTagNames.MEP_ATTRIBUTE_TAG))) {
- synchronous = true;
- }
-
- try
- {
- pipeline = new ActionProcessingPipeline(config) ;
- //pipeline.setTransactional(transactional);
- pipeline.initialise() ;
-
- }
- catch (final Exception ce)
- {
- throw new ServletException(ce);
- }
-
- ConfigTree eprElement = config.getFirstChild(ListenerTagNames.EPR_TAG);;
- try {
- epr = ListenerUtil.assembleEpr(eprElement);
- RegistryUtil.register(config, epr);
- } catch (Exception e) {
- throw new ServletException(e);
- }
-
-
- }
-
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- doService(req,resp);
- }
-
-
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- doService(req,resp);
- }
-
- protected void doService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String requestInfo = req.getServletPath();
- if ("/".equals(requestInfo)) {
- Serializable serial;
- try {
- serial = (Serializable) new ContextObjectInputStream(req.getInputStream()).readObject();
- } catch (Exception e1) {
- throw new ServletException(e1);
- }
- try {
- Message msg = Util.deserialize(serial);
- boolean result = pipeline.process(msg);
- if (result && synchronous) {
- OutputStream output = resp.getOutputStream();
- try {
- new ObjectOutputStream(output).writeObject(Util.serialize(msg));
- } catch (ParserConfigurationException e) {
- throw new ServletException(e);
- }
- output.flush();
- }
-
- if (!result) {
- //TODO: Modify the ActionProcessingPiple line to get Fault message from origianl message
- //Get default fault to message
- }
-
- } catch (Exception e) {
- throw new ServletException("Error when deserialize the request ESB message");
-
- }
-
- } else {
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
- }
-
-
- }
-
- public void destroy() {
- try {
- RegistryUtil.unregister(config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG), config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG), epr);
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/internal/soa/esb/couriers/TwoWayCourierImpl.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -26,7 +26,6 @@
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;
@@ -127,9 +126,7 @@
if (null == epr)
return null;
if (epr instanceof InVMEpr)
- return CourierFactory.getInstance().getInVMCourier((InVMEpr) epr);
- if (epr instanceof HTTPEpr)
- return new HttpCourier((HTTPEpr)epr);
+ return CourierFactory.getInstance().getInVMCourier((InVMEpr) epr);
if (epr instanceof JMSEpr)
return new JmsCourier((JMSEpr) epr, pickUpOnly);
if (epr instanceof FileEpr)
@@ -151,14 +148,6 @@
addr = epr.getAddr().getAddress();
if (addr.startsWith(InVMEpr.INVM_PROTOCOL))
return CourierFactory.getInstance().getInVMCourier(new InVMEpr(epr));
- if (addr.startsWith(HTTPEpr.HTTP_PROTOCOL))
- {
- if ("true".equals(epr.getAddr().getExtensionValue("is-gateway")))
- throw new MalformedEPRException("Courier for "
- + epr.getClass().getSimpleName() + " not supported: ESB-unaware EPR used!");
- else
- 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))
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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -30,7 +30,6 @@
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;
@@ -44,10 +43,6 @@
*/
public class HTTPEpr extends EPR
{
- public static final String HTTP_PROTOCOL = "http";
-
- protected String maxThreads = "50";
-
public HTTPEpr (EPR epr)
{
super(epr);
@@ -116,25 +111,6 @@
}
}
- 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/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -617,13 +617,6 @@
// do we need to do this for synchronous calls? Vagueries of Couriers?
- //It is a big hack for HTTP EPR. Look at if we can create another TwoWayCourierImpl to do that
- if (replyToEPR instanceof DefaultHttpReplyToEpr) {
- TwoWayCourierImpl twoWayCourier = (TwoWayCourierImpl)courier;
- HttpCourier httpCourier = (HttpCourier)twoWayCourier.getDeliverCourier();
- return httpCourier.pickup(timeout);
-
- }
courier.cleanup() ;
courier.setReplyToEpr(replyToEPR);
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 2009-01-31 15:17:05 UTC (rev 25031)
+++ labs/jbossesb/workspace/mlittle/legstar/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java 2009-01-31 17:08:51 UTC (rev 25032)
@@ -35,12 +35,10 @@
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;
@@ -66,17 +64,11 @@
LifecyclePriorities.COURIER_PRIORITY) ;
/**
- * InVM Couiers.
+ * InVM Couriers.
* <p/>
* 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.
@@ -147,12 +139,7 @@
TwoWayCourierImpl courier = new TwoWayCourierImpl(null, CourierFactory.getInstance().getInVMCourier((InVMEpr) replyToEPR));
courier.setReplyToEpr(replyToEPR);
return courier;
- } else if(replyToEPR instanceof HTTPEpr) {
- TwoWayCourierImpl courier = new TwoWayCourierImpl(null, CourierFactory.getInstance().getHttpCourier((HTTPEpr) replyToEPR));
- courier.setReplyToEpr(replyToEPR);
- return courier;
-
- } else {
+ } else {
return getCourier(null, replyToEPR);
}
}
@@ -170,25 +157,6 @@
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
More information about the jboss-svn-commits
mailing list