You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2011/02/14 13:28:51 UTC

svn commit: r1070469 - in /cxf/branches/2.3.x-fixes: ./ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ rt/transports/jms/src/main/resources/schemas/wsdl/ rt/transports/jms...

Author: ningjiang
Date: Mon Feb 14 12:28:51 2011
New Revision: 1070469

URL: http://svn.apache.org/viewvc?rev=1070469&view=rev
Log:
Merged revisions 1070430 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1070430 | ningjiang | 2011-02-14 18:32:46 +0800 (Mon, 14 Feb 2011) | 1 line
  
  CXF-3334 cxf-jms should support the topicReplyToName option of the JMS URI
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
    cxf/branches/2.3.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 14 12:28:51 2011
@@ -1 +1 @@
-/cxf/trunk:1068320,1068337,1068525,1068867,1068877,1069130,1069138,1069249,1069318,1069492,1069500,1069716,1069720,1069814,1070034
+/cxf/trunk:1068320,1068337,1068525,1068867,1068877,1069130,1069138,1069249,1069318,1069492,1069500,1069716,1069720,1069814,1070034,1070430

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java Mon Feb 14 12:28:51 2011
@@ -172,7 +172,7 @@ public class JMSConduit extends Abstract
             && replyTo != null) {
             if (exchange.isSynchronous() || exchange.isOneWay()) {
                 replyToDestination = JMSFactory.resolveOrCreateDestination(jmsTemplate, replyTo,
-                                                                           jmsConfig.isPubSubDomain());
+                                                                           jmsConfig.isReplyPubSubDomain());
             } else {
                 if (userCID == null || !jmsConfig.isUseConduitIdSelector()) { 
                     replyToDestination = getJMSListener().getDestination();

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java Mon Feb 14 12:28:51 2011
@@ -82,6 +82,7 @@ public class JMSConfiguration implements
     private String replyToDestination;
     private String messageType = JMSConstants.TEXT_MESSAGE_TYPE;
     private boolean pubSubDomain;
+    private boolean replyPubSubDomain;
     private Boolean useConduitIdSelector;
     private String conduitSelectorPrefix;
     private boolean autoResolveDestination;
@@ -299,6 +300,14 @@ public class JMSConfiguration implements
     public void setPubSubDomain(boolean pubSubDomain) {
         this.pubSubDomain = pubSubDomain;
     }
+    
+    public boolean isReplyPubSubDomain() {
+        return replyPubSubDomain;
+    }
+    
+    public void setReplyPubSubDomain(boolean replyPubSubDomain) {
+        this.replyPubSubDomain = replyPubSubDomain;
+    }
 
     public boolean isUseJms11() {
         return useJms11;

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java Mon Feb 14 12:28:51 2011
@@ -267,14 +267,14 @@ public class JMSOldConfigHolder {
                 jndiDestinationResolver.setJndiTemplate(jt);
                 jmsConfig.setDestinationResolver(jndiDestinationResolver);
                 jmsConfig.setTargetDestination(endpoint.getDestinationName());
-                jmsConfig.setReplyDestination(endpoint.getReplyToName());
+                setReplyDestination(jmsConfig, endpoint);
                 if (address != null) {
                     jmsConfig.setReplyToDestination(address.getJndiReplyToDestinationName());
                 }
             } else {
                 // Use the default dynamic destination resolver
                 jmsConfig.setTargetDestination(endpoint.getDestinationName());
-                jmsConfig.setReplyDestination(endpoint.getReplyToName());
+                setReplyDestination(jmsConfig, endpoint);
                 if (address != null) {
                     jmsConfig.setReplyToDestination(address.getJmsReplyToDestinationName());
                 }
@@ -288,6 +288,16 @@ public class JMSOldConfigHolder {
         jmsConfig.setTargetService(targetService);
         return jmsConfig;
     }
+    
+    private static void setReplyDestination(JMSConfiguration jmsConfig, JMSEndpoint endpoint) {
+        if (endpoint.getReplyToName() != null)  {
+            jmsConfig.setReplyDestination(endpoint.getReplyToName());
+            jmsConfig.setReplyPubSubDomain(false);
+        } else if (endpoint.getTopicReplyToName() != null) {
+            jmsConfig.setReplyDestination(endpoint.getTopicReplyToName());
+            jmsConfig.setReplyPubSubDomain(true);
+        }
+    }
 
     private static void mapAddressToEndpoint(AddressType address, JMSEndpoint endpoint) {
         boolean pubSubDomain = DestinationStyleType.TOPIC == address.getDestinationStyle();

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java Mon Feb 14 12:28:51 2011
@@ -79,6 +79,8 @@ public final class JMSEndpointParser {
         String priority = getAndRemoveParameter(parameters, JMSURIConstants.PRIORITY_PARAMETER_NAME);
         String replyToName = getAndRemoveParameter(parameters,
                                                    JMSURIConstants.REPLYTONAME_PARAMETER_NAME);
+        String topicReplyToName = getAndRemoveParameter(parameters,
+                                                   JMSURIConstants.TOPICREPLYTONAME_PARAMETER_NAME);
         String jndiConnectionFactoryName = getAndRemoveParameter(
                                                                  parameters,
                                                 JMSURIConstants.JNDICONNECTIONFACTORYNAME_PARAMETER_NAME);
@@ -96,9 +98,16 @@ public final class JMSEndpointParser {
         if (priority != null) {
             endpoint.setPriority(Integer.valueOf(priority));
         }
+        if (replyToName != null && topicReplyToName != null) {
+            throw new IllegalArgumentException(
+                "The replyToName and topicReplyToName should not be defined at the same time.");
+        }
         if (replyToName != null) {
             endpoint.setReplyToName(replyToName);
         }
+        if (topicReplyToName != null) {
+            endpoint.setTopicReplyToName(topicReplyToName);
+        }
         if (jndiConnectionFactoryName != null) {
             endpoint.setJndiConnectionFactoryName(jndiConnectionFactoryName);
         }

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd Mon Feb 14 12:28:51 2011
@@ -64,6 +64,7 @@
 		<xs:attribute name="timeToLive" type="xs:long" />
 		<xs:attribute name="priority" type="jms:priorityType" />
 		<xs:attribute name="replyToName" type="xs:string" />
+		<xs:attribute name="topicReplyToName" type="xs:string" />
 		<xs:attribute name="jndiConnectionFactoryName" type="xs:string" />
 		<xs:attribute name="jndiInitialContextFactory" type="xs:string" />
 		<xs:attribute name="jndiURL" type="xs:string" />

Modified: cxf/branches/2.3.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java?rev=1070469&r1=1070468&r2=1070469&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java (original)
+++ cxf/branches/2.3.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java Mon Feb 14 12:28:51 2011
@@ -39,7 +39,6 @@ public class JMSEndpointTest extends Ass
     public void testQueueParameters() throws Exception {
         JMSEndpoint endpoint = resolveEndpoint("jms:queue:Foo.Bar?foo=bar&foo2=bar2");
         assertTrue(endpoint instanceof JMSQueueEndpoint);
-        System.out.println("The Request URI is " + endpoint.getRequestURI());
         assertEquals(endpoint.getDestinationName(), "Foo.Bar");
         assertEquals(endpoint.getJmsVariant(), JMSURIConstants.QUEUE);
         assertEquals(endpoint.getParameters().size(), 2);
@@ -89,6 +88,26 @@ public class JMSEndpointTest extends Ass
     }
     
     @Test
+    public void testReplyToNameParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:queue:Foo.Bar?replyToName=FOO.Tar");
+        assertTrue(endpoint instanceof JMSQueueEndpoint);
+        assertEquals("Foo.Bar", endpoint.getDestinationName());
+        assertNull(endpoint.getTopicReplyToName());
+        assertEquals("FOO.Tar", endpoint.getReplyToName());
+        try {
+            resolveEndpoint("jms:queue:Foo.Bar?replyToName=FOO.Tar&topicReplyToName=FOO.Zar");
+            fail("Expecting exception here");
+        } catch (IllegalArgumentException ex) {
+            // expect the exception
+        }
+        
+        endpoint = resolveEndpoint("jms:queue:Foo.Bar?topicReplyToName=FOO.Zar");
+        assertEquals("Foo.Bar", endpoint.getDestinationName());
+        assertNull(endpoint.getReplyToName());
+        assertEquals("FOO.Zar", endpoint.getTopicReplyToName());
+    }
+    
+    @Test
     public void testJNDIWithAdditionalParameters() throws Exception {
         JMSEndpoint endpoint = resolveEndpoint("jms:jndi:Foo.Bar?" + "jndiInitialContextFactory"
                                                + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
@@ -143,13 +162,7 @@ public class JMSEndpointTest extends Ass
         assertFalse(requestUri.contains("priority=3"));
     }
     
-    private JMSEndpoint resolveEndpoint(String uri) {
-        JMSEndpoint endpoint = null;
-        try {
-            endpoint = JMSEndpointParser.createEndpoint(uri);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return endpoint;
+    private JMSEndpoint resolveEndpoint(String uri) throws Exception {
+        return JMSEndpointParser.createEndpoint(uri);
     }
 }