[hornetq-commits] JBoss hornetq SVN: r9252 - in trunk: src/main/org/hornetq/ra and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri May 21 11:47:21 EDT 2010


Author: ataylor
Date: 2010-05-21 11:47:20 -0400 (Fri, 21 May 2010)
New Revision: 9252

Modified:
   trunk/examples/javaee/jca-config/server2/ra.xml
   trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
Log:
https://jira.jboss.org/browse/HORNETQ-391 - fixed using the correcxt transport params

Modified: trunk/examples/javaee/jca-config/server2/ra.xml
===================================================================
--- trunk/examples/javaee/jca-config/server2/ra.xml	2010-05-21 14:37:48 UTC (rev 9251)
+++ trunk/examples/javaee/jca-config/server2/ra.xml	2010-05-21 15:47:20 UTC (rev 9252)
@@ -45,14 +45,8 @@
          <description>The transport configuration. These values must be in the form of key=val;key=val;</description>
          <config-property-name>ConnectionParameters</config-property-name>
          <config-property-type>java.lang.String</config-property-type>
-         <config-property-value>port=5445</config-property-value>
+         <config-property-value>host=127.0.0.1;port=5445</config-property-value>
       </config-property>
-      <config-property>
-        <description>Use XA?</description>
-        <config-property-name>UseXA</config-property-name>
-        <config-property-type>java.lang.Boolean</config-property-type>
-        <config-property-value>true</config-property-value>
-      </config-property>
       
       <outbound-resourceadapter>
          <connection-definition>

Modified: trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java	2010-05-21 14:37:48 UTC (rev 9251)
+++ trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java	2010-05-21 15:47:20 UTC (rev 9252)
@@ -13,6 +13,7 @@
 package org.hornetq.ra;
 
 import java.io.Serializable;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -1358,25 +1359,26 @@
                                                                                 : getDiscoveryAddress();
       if (connectorClassName != null)
       {
-         Map<String, Object> connectionParams = overrideProperties.getParsedConnectionParameters() != null ? overrideProperties.getParsedConnectionParameters()
-                                                                                                          : raProperties.getParsedConnectionParameters();
+         Map<String, Object> connectionParams =
+               overrideConnectionParameters(overrideProperties.getParsedConnectionParameters(),raProperties.getParsedConnectionParameters());
          TransportConfiguration transportConf = new TransportConfiguration(connectorClassName, connectionParams);
 
          String backUpCOnnectorClassname = overrideProperties.getBackupConnectorClassName() != null ? overrideProperties.getBackupConnectorClassName()
                                                                                                    : getBackupConnectorClassName();
-         Map<String, Object> backupConnectionParams = overrideProperties.getParsedBackupConnectionParameters() != null ? overrideProperties.getParsedBackupConnectionParameters()
-                                                                                                                      : getBackupConnectionParameters();
+         Map<String, Object> backupConnectionParams =
+               overrideConnectionParameters(overrideProperties.getParsedBackupConnectionParameters(),
+                     getBackupConnectionParameters());
          TransportConfiguration backup = backUpCOnnectorClassname == null ? null
                                                                          : new TransportConfiguration(backUpCOnnectorClassname,
                                                                                                       backupConnectionParams);
 
-         cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(transportConf, backup);
+         cf = HornetQJMSClient.createConnectionFactory(transportConf, backup);
       }
       else if (discoveryAddress != null)
       {
          Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort()
                                                                               : getDiscoveryPort();
-         cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+         cf = HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
       }
       else
       {
@@ -1386,6 +1388,24 @@
       return cf;
    }
 
+   public Map<String, Object> overrideConnectionParameters(final Map<String, Object> connectionParams,
+                                                           final Map<String, Object> overrideConnectionParams)
+   {
+      Map<String, Object> map = new HashMap<String, Object>();
+      if(connectionParams != null)
+      {
+         map.putAll(connectionParams);
+      }
+      if(overrideConnectionParams != null)
+      {
+         for (Map.Entry<String, Object> stringObjectEntry : overrideConnectionParams.entrySet())
+         {
+            map.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
+         }
+      }
+      return map;
+   }
+
    private void setParams(final HornetQConnectionFactory cf,
                           final ConnectionFactoryProperties overrideProperties)
    {



More information about the hornetq-commits mailing list