From 887db9e2f2736b8869df8f987d7a6918b65d01c9 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Fri, 27 Jul 2018 07:25:35 -0400 Subject: [PATCH] AMQ-6970 - Adding SSL params for RAR Fixing missing ssl parameters when configuring rar. Also fixing configuration logic of inproper null checks inside ActiveMQManagedConnectionFactory Thank you to Flavia Rainone for the patch (cherry picked from commit e39db5693496d48f0d704f9f14f8e2c9b6a153cf) --- .../ra/ActiveMQConnectionFactory.java | 1 + .../ra/ActiveMQConnectionSupport.java | 20 +++++++++++++++++ .../ra/ActiveMQManagedConnectionFactory.java | 22 ++++++++++++++----- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java index 234fc309d8..4e30a374cd 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionFactory.java @@ -91,6 +91,7 @@ public class ActiveMQConnectionFactory implements ConnectionFactory, QueueConnec if (manager == null) { throw new JMSException("No JCA ConnectionManager configured! Either enable UseInboundSessionEnabled or get your JCA container to configure one."); } + return (Connection)manager.allocateConnection(factory, connectionRequestInfo); } catch (ResourceException e) { // Throw the root cause if it was a JMSException.. diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionSupport.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionSupport.java index c3e0e9b681..86d788f999 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionSupport.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionSupport.java @@ -193,6 +193,10 @@ public class ActiveMQConnectionSupport { info.setServerUrl(url); } + public String getTrustStore() { + return info.getTrustStore(); + } + public void setTrustStore(String trustStore) { if (log.isDebugEnabled()) { log.debug(this + ", setting [trustStore] to: " + trustStore); @@ -200,6 +204,10 @@ public class ActiveMQConnectionSupport { info.setTrustStore(trustStore); } + public String getTrustStorePassword() { + return info.getTrustStorePassword(); + } + public void setTrustStorePassword(String trustStorePassword) { if (log.isDebugEnabled()) { log.debug(this + ", setting [trustStorePassword] to: " + trustStorePassword); @@ -207,6 +215,10 @@ public class ActiveMQConnectionSupport { info.setTrustStorePassword(trustStorePassword); } + public String getKeyStore() { + return info.getKeyStore(); + } + public void setKeyStore(String keyStore) { if (log.isDebugEnabled()) { log.debug(this + ", setting [keyStore] to: " + keyStore); @@ -214,6 +226,10 @@ public class ActiveMQConnectionSupport { info.setKeyStore(keyStore); } + public String getKeyStorePassword() { + return info.getKeyStorePassword(); + } + public void setKeyStorePassword(String keyStorePassword) { if (log.isDebugEnabled()) { log.debug(this + ", setting [keyStorePassword] to: " + keyStorePassword); @@ -221,6 +237,10 @@ public class ActiveMQConnectionSupport { info.setKeyStorePassword(keyStorePassword); } + public String getKeyStoreKeyPassword() { + return info.getKeyStoreKeyPassword(); + } + public void setKeyStoreKeyPassword(String keyStoreKeyPassword) { if (log.isDebugEnabled()) { log.debug(this + ", setting [keyStoreKeyPassword] to: " + keyStoreKeyPassword); diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java index a7344e4892..b9b452b802 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java @@ -76,21 +76,33 @@ public class ActiveMQManagedConnectionFactory extends ActiveMQConnectionSupport if (getUserName() == null) { setUserName(baseInfo.getUserName()); } - if (getDurableTopicPrefetch() != null) { + if (getDurableTopicPrefetch() == null) { setDurableTopicPrefetch(baseInfo.getDurableTopicPrefetch()); } - if (getOptimizeDurableTopicPrefetch() != null) { + if (getOptimizeDurableTopicPrefetch() == null) { setOptimizeDurableTopicPrefetch(baseInfo.getOptimizeDurableTopicPrefetch()); } - if (getQueuePrefetch() != null) { + if (getQueuePrefetch() == null) { setQueuePrefetch(baseInfo.getQueuePrefetch()); } - if (getQueueBrowserPrefetch() != null) { + if (getQueueBrowserPrefetch() == null) { setQueueBrowserPrefetch(baseInfo.getQueueBrowserPrefetch()); } - if (getTopicPrefetch() != null) { + if (getTopicPrefetch() == null) { setTopicPrefetch(baseInfo.getTopicPrefetch()); } + if (getKeyStore() == null) { + setKeyStore(baseInfo.getKeyStore()); + } + if (getKeyStorePassword() == null) { + setKeyStorePassword(baseInfo.getKeyStorePassword()); + } + if (getTrustStore() == null) { + setTrustStore(baseInfo.getTrustStore()); + } + if (getTrustStorePassword() == null) { + setTrustStorePassword(baseInfo.getTrustStorePassword()); + } } }