[jboss-svn-commits] JBossWS SVN: r899 - in branches/tdiesler/trunk: . src/main/java/org/jboss/ws/integration/jboss src/main/java/org/jboss/ws/integration/jboss/jms src/main/java/org/jboss/ws/transport src/test/java/org/jboss/test/ws/samples/jmstransport src/test/resources/samples/jmstransport/META-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 5 08:33:13 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-09-05 08:33:03 -0400 (Tue, 05 Sep 2006)
New Revision: 899
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/transport/jms/
Modified:
branches/tdiesler/trunk/build.xml
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/jmstransport/OrganizationJMSEndpoint.java
branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss-service.xml
branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss.xml
Log:
merge trunk -r 898
Modified: branches/tdiesler/trunk/build.xml
===================================================================
--- branches/tdiesler/trunk/build.xml 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/build.xml 2006-09-05 12:33:03 UTC (rev 899)
@@ -139,8 +139,6 @@
<include name="javax/jws/**"/>
<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.java"/>
<classpath path="${build.classes14.dir}"/>
<classpath refid="core.classpath"/>
</javac>
@@ -153,7 +151,6 @@
deprecation="${javac.deprecation}" failonerror="${javac.fail.onerror}">
<include name="org/jboss/ws/integration/**"/>
<include name="org/jboss/ws/transport/jms/**"/>
- <include name="org/jboss/ws/server/ServiceEndpointInterceptor.java"/>
<classpath path="${build.classes14.dir}"/>
<classpath refid="integration.classpath"/>
</javac>
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms (from rev 898, trunk/src/main/java/org/jboss/ws/integration/jboss/jms)
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java 2006-09-05 12:33:03 UTC (rev 899)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.integration.jboss.jms;
-
-// $Id$
-
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.management.ObjectName;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointInvoker;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/**
- * A dispatcher for SOAPMessages
- *
- * @author Thomas.Diesler at jboss.org
- */
-public class JMSMessageDispatcher implements MessageDispatcher
-{
- // logging support
- protected Logger log = Logger.getLogger(JMSMessageDispatcher.class);
-
- /** Dispatch the message to the underlying SOAP engine
- */
- 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);
-
- if (sepID == null)
- throw new WSException("Cannot find serviceID for: " + fromName);
-
- log.debug("dipatchMessage: " + sepID);
-
- // 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);
- }
-
- // Associate a message context with the current thread
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- msgContext.setEndpointMetaData(sepMetaData);
-
- return sep.handleRequest(null, null, reqMessage);
- }
- catch (BindingException ex)
- {
- throw new WSException("Cannot bind incomming soap message", ex);
- }
- }
-
- /** Dispatch the message to the underlying SOAP engine
- */
- public SOAPMessage delegateMessage(String serviceID, InputStream soapMessage) throws RemoteException
- {
- throw new NotImplementedException();
- }
-
- // The destination jndiName is encoded in the service object name under key 'jms'
- private ObjectName getServiceEndpointForDestination(ServiceEndpointManager epManager, String fromName)
- {
- ObjectName sepID = null;
- for (ObjectName aux : epManager.getServiceEndpoints())
- {
- String jmsProp = aux.getKeyProperty("jms");
- if (jmsProp != null && jmsProp.equals(fromName))
- {
- sepID = aux;
- break;
- }
- }
- return sepID;
- }
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java (from rev 898, trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSMessageDispatcher.java)
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java 2006-09-05 12:33:03 UTC (rev 899)
@@ -1,255 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.integration.jboss.jms;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.ejb.EJBException;
-import javax.ejb.MessageDrivenBean;
-import javax.ejb.MessageDrivenContext;
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NestedRuntimeException;
-import org.jboss.ws.common.SOAPMessageContextBase;
-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.
- * A subclass should only need to implement the service endpoint interface.
- *
- * @author Thomas.Diesler at jboss.org
- */
-public abstract class JMSTransportSupport implements MessageDrivenBean, MessageListener
-{
- // logging support
- protected Logger log = Logger.getLogger(JMSTransportSupport.class);
-
- //private MessageDrivenContext mdbCtx;
- private QueueConnectionFactory queueFactory;
-
- /**
- * All messages come in here, if it is a BytesMessage we pass it on for further processing.
- */
- public void onMessage(Message message)
- {
- try
- {
- String msgStr = null;
- if (message instanceof BytesMessage)
- {
- msgStr = getMessageStr((BytesMessage)message);
- }
- else if (message instanceof TextMessage)
- {
- msgStr = ((TextMessage)message).getText();
- }
- else
- {
- log.warn("Invalid message type: " + message);
- return;
- }
-
- log.debug("Incomming SOAP message: " + msgStr);
-
- String fromName = null;
- Destination destination = message.getJMSDestination();
- if (destination instanceof Queue)
- fromName = "queue/" + ((Queue)destination).getQueueName();
- if (destination instanceof Topic)
- fromName = "topic/" + ((Topic)destination).getTopicName();
-
- // Associate a message context with the current thread
- SOAPMessageContextBase 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);
-
- 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");
- }
- }
- else
- {
- log.debug("SOAP response message is null");
- }
- }
- finally
- {
- MessageContextAssociation.popMessageContext();
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new EJBException(e);
- }
- }
-
- protected SOAPMessage processSOAPMessage(String fromName, InputStream reqMessage) throws SOAPException, IOException, RemoteException
- {
- MessageDispatcher msgDispatcher = new JMSMessageDispatcher();
- SOAPMessage resMessage = msgDispatcher.dipatchMessage(fromName, this, reqMessage);
- return resMessage;
- }
-
- private String getMessageStr(BytesMessage message) throws Exception
- {
- byte[] buffer = new byte[8 * 1024];
- ByteArrayOutputStream out = new ByteArrayOutputStream(buffer.length);
- int read = message.readBytes(buffer);
- while (read != -1)
- {
- out.write(buffer, 0, read);
- read = message.readBytes(buffer);
- }
-
- byte[] msgBytes = out.toByteArray();
- return new String(msgBytes);
- }
-
- /**
- * Get the reply queue.
- */
- protected Queue getReplyQueue(Message message) throws JMSException
- {
- Queue replyQueue = (Queue)message.getJMSReplyTo();
- return replyQueue;
- }
-
- /**
- * Respond to the call by sending a message to the reply queue
- */
- protected void sendResponse(Queue replyQueue, String msgStr) throws SOAPException, IOException, JMSException
- {
- QueueConnection qc = queueFactory.createQueueConnection();
- QueueSession session = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- QueueSender sender = null;
- try
- {
- sender = session.createSender(replyQueue);
- TextMessage responseMessage = session.createTextMessage(msgStr);
- sender.send(responseMessage);
- log.info("Sent response");
- }
- finally
- {
- try
- {
- sender.close();
- }
- catch (JMSException ignored)
- {
- }
- try
- {
- session.close();
- }
- catch (JMSException ignored)
- {
- }
- try
- {
- qc.close();
- }
- catch (JMSException ignored)
- {
- }
- }
- }
-
- // MDB lifecycle methods ********************************************************************************************
-
- public void ejbCreate()
- {
- try
- {
- InitialContext ctx = new InitialContext();
- queueFactory = (QueueConnectionFactory)ctx.lookup("java:/ConnectionFactory");
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new NestedRuntimeException(e);
- }
- }
-
- /**
- * A container invokes this method before it ends the life of the message-driven object.
- */
- public void ejbRemove() throws EJBException
- {
- }
-
- /**
- * Set the associated message-driven context.
- */
- public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
- {
- //this.mdbCtx = ctx;
- }
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java (from rev 898, trunk/src/main/java/org/jboss/ws/integration/jboss/jms/JMSTransportSupport.java)
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java 2006-09-05 12:33:03 UTC (rev 899)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.integration.jboss.jms;
-
-// $Id$
-
-import java.io.InputStream;
-import java.rmi.RemoteException;
-
-import javax.xml.soap.SOAPMessage;
-
-/**
- * A dispatcher for SOAPMessages
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Feb-2006
- */
-public interface MessageDispatcher
-{
- /** Dispatch the message to the underlying SOAP engine
- */
- SOAPMessage dipatchMessage(String fromName, Object targetImplBean, InputStream reqMessage) throws RemoteException;
-
- /** Dispatch the message to the underlying SOAP engine
- */
- SOAPMessage delegateMessage(String serviceID, InputStream reqMessage) throws RemoteException;
-}
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java (from rev 898, trunk/src/main/java/org/jboss/ws/integration/jboss/jms/MessageDispatcher.java)
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/jmstransport/OrganizationJMSEndpoint.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/jmstransport/OrganizationJMSEndpoint.java 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/jmstransport/OrganizationJMSEndpoint.java 2006-09-05 12:33:03 UTC (rev 899)
@@ -11,7 +11,7 @@
import java.rmi.RemoteException;
import org.jboss.logging.Logger;
-import org.jboss.ws.transport.jms.JMSTransportSupport;
+import org.jboss.ws.integration.jboss.jms.JMSTransportSupport;
/**
* An example of a MDB acting as a web service endpoint.
Modified: branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss-service.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss-service.xml 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss-service.xml 2006-09-05 12:33:03 UTC (rev 899)
@@ -3,12 +3,12 @@
<!-- $Id$ -->
<server>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.mq.destination:service=Queue,name=RequestQueue">
- <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ <mbean code="org.jboss.jms.server.destination.Queue" name="jboss.messaging.destination:service=Queue,name=RequestQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer"> jboss.messaging:service=ServerPeer</depends>
</mbean>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.mq.destination:service=Queue,name=ResponseQueue">
- <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ <mbean code="org.jboss.jms.server.destination.Queue" name="jboss.messaging.destination:service=Queue,name=ResponseQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer"> jboss.messaging:service=ServerPeer</depends>
</mbean>
-</server>
+</server>
\ No newline at end of file
Modified: branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss.xml 2006-09-05 08:23:03 UTC (rev 898)
+++ branches/tdiesler/trunk/src/test/resources/samples/jmstransport/META-INF/jboss.xml 2006-09-05 12:33:03 UTC (rev 899)
@@ -8,7 +8,7 @@
<message-driven>
<ejb-name>OrganizationMDB</ejb-name>
<destination-jndi-name>queue/RequestQueue</destination-jndi-name>
- <depends>jboss.mq.destination:service=Queue,name=RequestQueue</depends>
+ <depends>jboss.messaging.destination:service=Queue,name=RequestQueue</depends>
</message-driven>
</enterprise-beans>
</jboss>
More information about the jboss-svn-commits
mailing list