Author: thomas.diesler(a)jboss.com
Date: 2006-11-05 18:01:19 -0500 (Sun, 05 Nov 2006)
New Revision: 1395
Added:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcherMBean.java
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java
Modified:
branches/jbossws-1.0/build.xml
branches/jbossws-1.0/src/main/java/org/jboss/ws/WSException.java
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
branches/jbossws-1.0/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
Log:
Retain JMSTransport backward compatiblility
Modified: branches/jbossws-1.0/build.xml
===================================================================
--- branches/jbossws-1.0/build.xml 2006-11-05 21:04:29 UTC (rev 1394)
+++ branches/jbossws-1.0/build.xml 2006-11-05 23:01:19 UTC (rev 1395)
@@ -146,6 +146,7 @@
<include name="javax/jws/**"/>
<include name="org/jboss/ws/**"/>
<exclude name="org/jboss/ws/integration/**"/>
+ <exclude name="org/jboss/ws/transport/jms/**"/>
<classpath path="${build.classes14.dir}"/>
<classpath refid="core.classpath"/>
</javac>
@@ -157,6 +158,7 @@
<javac srcdir="${src.java.dir}" sourcepath=""
destdir="${build.classes.dir}" debug="${javac.debug}"
verbose="${javac.verbose}"
deprecation="${javac.deprecation}"
failonerror="${javac.fail.onerror}">
<include name="org/jboss/ws/integration/**"/>
+ <include name="org/jboss/ws/transport/jms/**"/>
<classpath path="${build.classes14.dir}"/>
<classpath refid="integration.classpath"/>
</javac>
@@ -244,6 +246,7 @@
<fileset dir="${build.classes.dir}">
<include name="org/jboss/ws/integration/*.class"/>
<include name="org/jboss/ws/integration/jboss/**"/>
+ <include name="org/jboss/ws/transport/jms/**"/>
<include
name="org/jboss/ws/server/ServiceEndpointInterceptor.class"/>
</fileset>
</jar>
@@ -355,6 +358,7 @@
<fileset dir="${build.classes14.dir}">
<include name="org/jboss/ws/**"/>
<exclude name="org/jboss/ws/integration/**"/>
+ <exclude name="org/jboss/ws/transport/jms/**"/>
<exclude
name="org/jboss/ws/server/ServiceEndpointInterceptor.class"/>
</fileset>
<fileset dir="${build.resources.dir}">
@@ -368,6 +372,7 @@
<fileset dir="${build.classes14.dir}">
<include name="org/jboss/ws/integration/*.class"/>
<include name="org/jboss/ws/integration/jboss/**"/>
+ <include name="org/jboss/ws/transport/jms/**"/>
<include
name="org/jboss/ws/server/ServiceEndpointInterceptor.class"/>
</fileset>
</jar>
Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/WSException.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/WSException.java 2006-11-05 21:04:29
UTC (rev 1394)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/WSException.java 2006-11-05 23:01:19
UTC (rev 1395)
@@ -51,4 +51,12 @@
{
super(cause);
}
+
+ public static void rethrowException(String msg, Exception ex)
+ {
+ if (ex instanceof WSException)
+ throw (WSException)ex;
+
+ throw new WSException(msg, ex);
+ }
}
Modified:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
===================================================================
---
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-11-05
23:01:19 UTC (rev 1395)
@@ -21,20 +21,23 @@
*/
package org.jboss.ws.integration.jboss.jms;
-// $Id$
+// $Id:JMSMessageDispatcher.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.rmi.RemoteException;
+import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.xml.soap.SOAPMessage;
import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
import org.jboss.ws.common.CommonMessageContext;
import org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB;
+import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.server.ServiceEndpoint;
import org.jboss.ws.server.ServiceEndpointInvoker;
@@ -47,7 +50,7 @@
*
* @author Thomas.Diesler(a)jboss.org
*/
-public class JMSMessageDispatcher implements MessageDispatcher
+public class JMSMessageDispatcher implements JMSMessageDispatcherMBean
{
// logging support
protected Logger log = Logger.getLogger(JMSMessageDispatcher.class);
@@ -56,38 +59,51 @@
*/
public SOAPMessage dipatchMessage(String fromName, Object targetBean, InputStream
reqMessage) throws RemoteException
{
- try
- {
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- ObjectName sepID = getServiceEndpointForDestination(epManager, fromName);
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ ObjectName sepID = getServiceEndpointForDestination(epManager, fromName);
- if (sepID == null)
- throw new WSException("Cannot find serviceID for: " + fromName);
+ if (sepID == null)
+ throw new WSException("Cannot find serviceID for: " + fromName);
- log.debug("dipatchMessage: " + sepID);
+ log.debug("dipatchMessage: " + sepID);
- // Setup the MDB invoker
- ServiceEndpoint sep = epManager.getServiceEndpointByID(sepID);
- ServerEndpointMetaData sepMetaData =
sep.getServiceEndpointInfo().getServerEndpointMetaData();
+ // Setup the MDB invoker
+ ServiceEndpoint sep = epManager.getServiceEndpointByID(sepID);
+ ServerEndpointMetaData sepMetaData =
sep.getServiceEndpointInfo().getServerEndpointMetaData();
- ServiceEndpointInvoker invoker = sep.getServiceEndpointInfo().getInvoker();
- if (invoker instanceof ServiceEndpointInvokerMDB)
- {
- ServiceEndpointInvokerMDB mdbInvoker = (ServiceEndpointInvokerMDB)invoker;
- mdbInvoker.setTargetBeanObject(targetBean);
- }
+ ServiceEndpointInvoker invoker = sep.getServiceEndpointInfo().getInvoker();
+ if (invoker instanceof ServiceEndpointInvokerMDB)
+ {
+ ServiceEndpointInvokerMDB mdbInvoker = (ServiceEndpointInvokerMDB)invoker;
+ mdbInvoker.setTargetBeanObject(targetBean);
+ }
- // Associate a message context with the current thread
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- msgContext.setEndpointMetaData(sepMetaData);
-
- return sep.handleRequest(null, null, reqMessage);
+ // Associate a message context with the current thread
+ CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
+ MessageContextAssociation.pushMessageContext(msgContext);
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ SOAPMessage resMessage = null;
+ try
+ {
+ // Process the request message and return the already serialized response
+ // Legacy implementations of the JMSTransportSupport dont provide a msg
+ // context which is needed for serialization.
+ resMessage = sep.handleRequest(null, null, reqMessage);
+ resMessage.writeTo(new ByteArrayOutputStream());
+ return resMessage;
}
- catch (BindingException ex)
+ catch (Exception ex)
{
- throw new WSException("Cannot bind incomming soap message", ex);
+ WSException.rethrowException("Cannot process SOAP request", ex);
}
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
+
+ return resMessage;
}
/** Dispatch the message to the underlying SOAP engine
@@ -112,4 +128,22 @@
}
return sepID;
}
+
+ public void create() throws Exception
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ if (server != null)
+ {
+ server.registerMBean(this, OBJECT_NAME);
+ }
+ }
+
+ public void destroy() throws Exception
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ if (server != null)
+ {
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
}
Added:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcherMBean.java
===================================================================
---
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcherMBean.java 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcherMBean.java 2006-11-05
23:01:19 UTC (rev 1395)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss.jms;
+
+// $Id:JMSMessageDispatcher.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
+
+public interface JMSMessageDispatcherMBean extends MessageDispatcher
+{
+}
Property changes on:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcherMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
===================================================================
---
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-11-05
23:01:19 UTC (rev 1395)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.integration.jboss.jms;
-// $Id$
+// $Id:JMSTransportSupport.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -51,9 +51,6 @@
import org.jboss.logging.Logger;
import org.jboss.util.NestedRuntimeException;
-import org.jboss.ws.common.CommonMessageContext;
-import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.soap.MessageContextAssociation;
/**
* The abstract base class for MDBs that want to act as web service endpoints.
@@ -100,41 +97,30 @@
if (destination instanceof Topic)
fromName = "topic/" + ((Topic)destination).getTopicName();
- // Associate a message context with the current thread
- CommonMessageContext msgContext = new SOAPMessageContextJAXRPC();
- MessageContextAssociation.pushMessageContext(msgContext);
- try
+ InputStream reqMessage = new ByteArrayInputStream(msgStr.getBytes());
+ SOAPMessage resMessage = processSOAPMessage(fromName, reqMessage);
+
+ if (resMessage != null)
{
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ resMessage.writeTo(baos);
- InputStream reqMessage = new ByteArrayInputStream(msgStr.getBytes());
- SOAPMessage resMessage = processSOAPMessage(fromName, reqMessage);
+ msgStr = new String(baos.toByteArray());
+ log.debug("Outgoing SOAP message: " + msgStr);
- if (resMessage != null)
+ Queue replyQueue = getReplyQueue(message);
+ if (replyQueue != null)
{
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- resMessage.writeTo(baos);
-
- msgStr = new String(baos.toByteArray());
- log.debug("Outgoing SOAP message: " + msgStr);
-
- Queue replyQueue = getReplyQueue(message);
- if (replyQueue != null)
- {
- sendResponse(replyQueue, msgStr);
- }
- else
- {
- log.warn("No reply queue, ignore response message");
- }
+ sendResponse(replyQueue, msgStr);
}
else
{
- log.debug("SOAP response message is null");
+ log.warn("No reply queue, ignore response message");
}
}
- finally
+ else
{
- MessageContextAssociation.popMessageContext();
+ log.debug("SOAP response message is null");
}
}
catch (RuntimeException rte)
Modified:
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
===================================================================
---
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-11-05
23:01:19 UTC (rev 1395)
@@ -26,8 +26,11 @@
import java.io.InputStream;
import java.rmi.RemoteException;
+import javax.management.ObjectName;
import javax.xml.soap.SOAPMessage;
+import org.jboss.ws.utils.ObjectNameFactory;
+
/**
* A dispatcher for SOAPMessages
*
@@ -36,6 +39,8 @@
*/
public interface MessageDispatcher
{
+ public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=JMSTransportSupport");
+
/** Dispatch the message to the underlying SOAP engine
*/
SOAPMessage dipatchMessage(String fromName, Object targetImplBean, InputStream
reqMessage) throws RemoteException;
Added:
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java
===================================================================
---
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java 2006-11-05
23:01:19 UTC (rev 1395)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.transport.jms;
+
+// $Id:JMSMessageDispatcher.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
+
+
+/**
+ * Retained for backward compatibility with JBossAS-4.0.5.GA and less
+ * @deprecated
+ */
+public class JMSMessageDispatcher extends
org.jboss.ws.integration.jboss.jms.JMSMessageDispatcher
+{
+}
Property changes on:
branches/jbossws-1.0/src/main/java/org/jboss/ws/transport/jms/JMSMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/jbossws-1.0/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/jbossws-1.0/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-05
21:04:29 UTC (rev 1394)
+++
branches/jbossws-1.0/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-05
23:01:19 UTC (rev 1395)
@@ -39,6 +39,8 @@
<property
name="serviceEndpointServlet">org.jboss.ws.integration.jboss.JBossServiceEndpointServlet</property>
</bean>
+ <bean name="JMSMessageDispatcher"
class="org.jboss.ws.integration.jboss.jms.JMSMessageDispatcher"/>
+
<!-- A subscription manager for WS-Eventing -->
<bean name="SubscriptionManager"
class="org.jboss.ws.eventing.mgmt.SubscriptionManager">
<property name="maxLeaseTimeMins">10</property>