synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u...@apache.org
Subject svn commit: r601985 - in /webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms: JMSConnectionFactory.java JMSSender.java
Date Fri, 07 Dec 2007 04:39:35 GMT
Author: upul
Date: Thu Dec  6 20:39:35 2007
New Revision: 601985

URL: http://svn.apache.org/viewvc?rev=601985&view=rev
Log:
SYNAPSE-183 allow axis2.xml JMSSender connection details used in JMS EPRs

Modified:
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSConnectionFactory.java
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSSender.java

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSConnectionFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSConnectionFactory.java?rev=601985&r1=601984&r2=601985&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSConnectionFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSConnectionFactory.java
Thu Dec  6 20:39:35 2007
@@ -276,7 +276,8 @@
 
         if (session == null) {
             try {                
-                Destination dest = (Destination) context.lookup(destinationJNDIname);
+                Destination dest = (Destination) getPhysicalDestination(destinationJNDIname);
+
                 if (dest instanceof Topic) {
                     session = ((TopicConnection) connection).
                         createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -287,8 +288,6 @@
 
                 jmsSessions.put(destinationJNDIname, session);
 
-            } catch (NamingException e) {
-                handleException("Error looking up destination : " + destinationJNDIname,
e);
             } catch (JMSException e) {
                 handleException("Unable to create a session using connection factory : "
+ name, e);
             }
@@ -386,6 +385,30 @@
      * @return the provider specific Destination name or null if cannot be found
      */
     private String getPhysicalDestinationName(String destinationJndi) {
+        Destination destination = getPhysicalDestination(destinationJndi);
+
+        if (destination != null) {
+            try {
+                if (destination instanceof Queue) {
+                    return ((Queue) destination).getQueueName();
+                } else if (destination instanceof Topic) {
+                    return ((Topic) destination).getTopicName();
+                }
+            } catch (JMSException e) {
+                log.warn("Error reading Destination name for JNDI destination : " + destinationJndi,
e);
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Return the provider specific [physical] Destination if any
+     * for the destination with the given JNDI name
+     *
+     * @param destinationJndi the JNDI name of the destination
+     * @return the provider specific Destination or null if cannot be found
+     */
+    private Destination getPhysicalDestination(String destinationJndi) {
         Destination destination = null;
 
         try {
@@ -409,18 +432,7 @@
             }
         }
 
-        if (destination != null) {
-            try {
-                if (destination instanceof Queue) {
-                    return ((Queue) destination).getQueueName();
-                } else if (destination instanceof Topic) {
-                    return ((Topic) destination).getTopicName();
-                }
-            } catch (JMSException e) {
-                log.warn("Error reading Destination name for JNDI destination : " + destinationJndi,
e);
-            }
-        }
-        return null;
+        return destination;
     }
 
     /**

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSSender.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSSender.java?rev=601985&r1=601984&r2=601985&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSSender.java
(original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSSender.java
Thu Dec  6 20:39:35 2007
@@ -80,6 +80,13 @@
      * @return the corresponding JMS connection factory, if any
      */
     private JMSConnectionFactory getJMSConnectionFactory(JMSOutTransportInfo trpInfo) {
+        if(trpInfo.getProperties() != null) {
+          String jmsConnectionFactoryName = (String) trpInfo.getProperties().get(JMSConstants.CONFAC_PARAM);
+          if(jmsConnectionFactoryName != null) {
+            return (JMSConnectionFactory) connectionFactories.get(jmsConnectionFactoryName);
+          }
+        }
+      
         Iterator cfNames = connectionFactories.keySet().iterator();
         while (cfNames.hasNext()) {
             String cfName = (String) cfNames.next();



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message