Updated Branches:
  refs/heads/trunk ccc85af30 -> 40af36e93

add ability to do port mapping when publishing connector uris; important in 
restricting environments


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/40af36e9
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/40af36e9
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/40af36e9

Branch: refs/heads/trunk
Commit: 40af36e93443e4ae1a302530f52ca662f9ef79ab
Parents: ccc85af
Author: Dejan Bosanac <[email protected]>
Authored: Tue Sep 3 17:06:41 2013 +0200
Committer: Dejan Bosanac <[email protected]>
Committed: Tue Sep 3 17:07:13 2013 +0200

----------------------------------------------------------------------
 .../apache/activemq/broker/PublishedAddressPolicy.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/40af36e9/activemq-broker/src/main/java/org/apache/activemq/broker/PublishedAddressPolicy.java
----------------------------------------------------------------------
diff --git 
a/activemq-broker/src/main/java/org/apache/activemq/broker/PublishedAddressPolicy.java
 
b/activemq-broker/src/main/java/org/apache/activemq/broker/PublishedAddressPolicy.java
index 01f22d3..0814a41 100644
--- 
a/activemq-broker/src/main/java/org/apache/activemq/broker/PublishedAddressPolicy.java
+++ 
b/activemq-broker/src/main/java/org/apache/activemq/broker/PublishedAddressPolicy.java
@@ -19,6 +19,7 @@ package org.apache.activemq.broker;
 import java.net.InetAddress;
 import java.net.URI;
 import java.net.UnknownHostException;
+import java.util.HashMap;
 import java.util.Locale;
 
 import org.apache.activemq.util.InetAddressUtil;
@@ -34,6 +35,7 @@ public class PublishedAddressPolicy {
 
     private String clusterClientUriQuery;
     private PublishedHostStrategy publishedHostStrategy = 
PublishedHostStrategy.DEFAULT;
+    private HashMap<Integer, Integer> portMapping = new HashMap<Integer, 
Integer>();
 
     /**
      * Defines the value of the published host value.
@@ -70,6 +72,9 @@ public class PublishedAddressPolicy {
         String userInfo = 
getPublishedUserInfoValue(connectorURI.getUserInfo());
         String host = getPublishedHostValue(connectorURI.getHost());
         int port = connectorURI.getPort();
+        if (portMapping.containsKey(port)) {
+            port = portMapping.get(port);
+        }
         String path = getPublishedPathValue(connectorURI.getPath());
         String fragment = 
getPublishedFragmentValue(connectorURI.getFragment());
 
@@ -197,4 +202,11 @@ public class PublishedAddressPolicy {
     public void setPublishedHostStrategy(String strategy) {
         this.publishedHostStrategy = PublishedHostStrategy.getValue(strategy);
     }
+
+    /**
+     * @param portMapping map the ports in restrictive environments
+     */
+    public void setPortMapping(HashMap<Integer, Integer> portMapping) {
+        this.portMapping = portMapping;
+    }
 }

Reply via email to