Author: alessio.soldano(a)jboss.com
Date: 2010-03-19 06:56:27 -0400 (Fri, 19 Mar 2010)
New Revision: 11817
Modified:
stack/native/trunk/modules/core/pom.xml
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/transport/jms/AbstractJMSTransportSupport.java
stack/native/trunk/modules/testsuite/pom.xml
stack/native/trunk/pom.xml
Log:
[JBWS-2969] Using new JMSEndpointResolver to remove dependency on HornetQ (moved it to
tests on AS trunt (jboss601) only)
Modified: stack/native/trunk/modules/core/pom.xml
===================================================================
--- stack/native/trunk/modules/core/pom.xml 2010-03-19 10:49:42 UTC (rev 11816)
+++ stack/native/trunk/modules/core/pom.xml 2010-03-19 10:56:27 UTC (rev 11817)
@@ -138,14 +138,6 @@
<artifactId>mail</artifactId>
</dependency>
<dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-transports</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-jms-client</artifactId>
- </dependency>
- <dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
</dependency>
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/transport/jms/AbstractJMSTransportSupport.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/transport/jms/AbstractJMSTransportSupport.java 2010-03-19
10:49:42 UTC (rev 11816)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/transport/jms/AbstractJMSTransportSupport.java 2010-03-19
10:56:27 UTC (rev 11817)
@@ -41,12 +41,10 @@
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.jms.Topic;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.xml.soap.SOAPException;
-import org.hornetq.jms.client.HornetQDestination;
import org.jboss.logging.Logger;
import org.jboss.util.NestedRuntimeException;
import org.jboss.wsf.spi.SPIProvider;
@@ -58,12 +56,14 @@
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.management.JMSEndpointResolver;
/**
* 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(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
*/
public abstract class AbstractJMSTransportSupport implements MessageListener
{
@@ -97,18 +97,9 @@
if (log.isDebugEnabled())
log.debug("Incomming SOAP message: " + msgStr);
- String fromName = null;
- Destination destination = message.getJMSDestination();
- if (destination instanceof HornetQDestination)
- fromName = getFromName(destination,
((HornetQDestination)destination).isQueue());
- else if (destination instanceof Queue)
- fromName = getFromName(destination, true);
- else if (destination instanceof Topic)
- fromName = getFromName(destination, false);
-
InputStream inputStream = new ByteArrayInputStream(msgStr.getBytes());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024);
- processSOAPMessage(fromName, inputStream, outputStream);
+ processSOAPMessage(message.getJMSDestination(), inputStream, outputStream);
msgStr = new String(outputStream.toByteArray());
if (log.isDebugEnabled())
@@ -141,20 +132,17 @@
}
}
- private static String getFromName(Destination destination, boolean queue) throws
JMSException
+ protected void processSOAPMessage(Destination destination, InputStream inputStream,
OutputStream outStream) throws SOAPException, IOException, RemoteException
{
- return queue ? "queue/" + ((Queue)destination).getQueueName() :
"topic/" + ((Topic)destination).getTopicName();
- }
-
- protected void processSOAPMessage(String fromName, InputStream inputStream,
OutputStream outStream) throws SOAPException, IOException, RemoteException
- {
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
EndpointRegistry epRegistry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
- Endpoint endpoint = getEndpointForDestination(epRegistry, fromName);
+ JMSEndpointResolver resolver = spiProvider.getSPI(JMSEndpointResolver.class);
+ resolver.setDestination(destination);
+ Endpoint endpoint = epRegistry.resolve(resolver);
if (endpoint == null)
- throw new IllegalStateException("Cannot find endpoint for: " +
fromName);
+ throw new IllegalStateException("Cannot find endpoint for destination:
" + destination);
EndpointAssociation.setEndpoint(endpoint);
try
@@ -204,23 +192,6 @@
}
}
- // The destination jndiName is encoded in the service object name under key
'jms'
- private Endpoint getEndpointForDestination(EndpointRegistry epRegistry, String
fromName)
- {
- Endpoint endpoint = null;
- for (ObjectName oname : epRegistry.getEndpoints())
- {
- Endpoint aux = epRegistry.getEndpoint(oname);
- String jmsProp = aux.getName().getKeyProperty("jms");
- if (jmsProp != null && jmsProp.equals(fromName))
- {
- endpoint = aux;
- break;
- }
- }
- return endpoint;
- }
-
private String getMessageStr(BytesMessage message) throws Exception
{
byte[] buffer = new byte[8 * 1024];
Modified: stack/native/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/pom.xml 2010-03-19 10:49:42 UTC (rev 11816)
+++ stack/native/trunk/modules/testsuite/pom.xml 2010-03-19 10:56:27 UTC (rev 11817)
@@ -26,6 +26,7 @@
<wsdl.publish.location>${project.build.directory}/wsdl-publish</wsdl.publish.location>
<hibernate.version>3.2.4.sp1</hibernate.version>
<jboss.javaee.version>5.0.0.GA</jboss.javaee.version>
+ <hornetq.version>2.1.0.r8931</hornetq.version>
</properties>
<!-- Modules -->
@@ -544,6 +545,16 @@
<artifactId>jboss-as-system</artifactId>
<version>${jboss.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-transports</artifactId>
+ <version>${hornetq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jms-client</artifactId>
+ <version>${hornetq.version}</version>
+ </dependency>
</dependencies>
<build>
<plugins>
Modified: stack/native/trunk/pom.xml
===================================================================
--- stack/native/trunk/pom.xml 2010-03-19 10:49:42 UTC (rev 11816)
+++ stack/native/trunk/pom.xml 2010-03-19 10:56:27 UTC (rev 11817)
@@ -69,7 +69,6 @@
<jboss.logging.version>2.2.0.CR1</jboss.logging.version>
<jboss.jaxr.version>2.0.1</jboss.jaxr.version>
<apache.scout.version>1.1.1</apache.scout.version>
- <hornetq.version>2.1.0.r8931</hornetq.version>
<juddi.version>0.9RC4</juddi.version>
<netty.version>3.1.5.GA</netty.version>
<sun.fastinfoset.version>1.2.2</sun.fastinfoset.version>
@@ -413,21 +412,6 @@
<artifactId>netty</artifactId>
<version>${netty.version}</version>
</dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-transports</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-transports</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-jms-client</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
Show replies by date