activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r812139 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jmx/ test/java/org/apache/activemq/broker/jmx/
Date Mon, 07 Sep 2009 13:52:45 GMT
Author: rajdavies
Date: Mon Sep  7 13:52:45 2009
New Revision: 812139

URL: http://svn.apache.org/viewvc?rev=812139&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-2378

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=812139&r1=812138&r2=812139&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Mon Sep  7 13:52:45 2009
@@ -904,6 +904,23 @@
         }
         return null;
     }
+    
+    public Map<String, String> getTransportConnectorURIsAsMap() {
+        Map<String, String> answer = new HashMap<String, String>();
+        for (TransportConnector connector : transportConnectors) {
+            try {
+                URI uri = connector.getConnectUri();
+                String scheme = uri.getScheme();
+                if (scheme != null) {
+                    answer.put(scheme.toLowerCase(), uri.toString());
+                    System.err.println(scheme + " = " + uri);
+                }
+            } catch (Exception e) {
+                LOG.debug("Failed to read URI to build transportURIsAsMap", e);
+            }
+        }
+        return answer;
+    }
 
     public String[] getTransportConnectorURIs() {
         return transportConnectorURIs;
@@ -1958,4 +1975,6 @@
     public CountDownLatch getSlaveStartSignal() {
         return slaveStartSignal;
     }
+    
+   
 }
\ No newline at end of file

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java?rev=812139&r1=812138&r2=812139&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
Mon Sep  7 13:52:45 2009
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.net.URI;
 import java.net.URL;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -319,4 +320,30 @@
             throw e.getTargetException();
         }
     }
+    
+
+    public String getOpenWireURL() {
+        String answer = brokerService.getTransportConnectorURIsAsMap().get("tcp");
+        return answer != null ? answer : "";
+    }
+
+    public String getStompURL() {
+        String answer = brokerService.getTransportConnectorURIsAsMap().get("stomp");
+        return answer != null ? answer : "";
+    }
+
+    public String getSslURL() {
+        String answer = brokerService.getTransportConnectorURIsAsMap().get("ssl");
+        return answer != null ? answer : "";
+    }
+
+    public String getStompSslURL() {
+        String answer = brokerService.getTransportConnectorURIsAsMap().get("stomp+ssl");
+        return answer != null ? answer : "";
+    }
+
+    public String getVMURL() {
+        URI answer = brokerService.getVmConnectorURI();
+        return answer != null ? answer.toString() : "";
+    }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java?rev=812139&r1=812138&r2=812139&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
Mon Sep  7 13:52:45 2009
@@ -223,4 +223,19 @@
     @MBeanInfo(value="Reloads log4j.properties from the classpath.")
     public void reloadLog4jProperties() throws Throwable;
     
+    @MBeanInfo("The url of the openwire connector")
+    String getOpenWireURL();
+    
+    @MBeanInfo("The url of the stomp connector")
+    String getStompURL();
+    
+    @MBeanInfo("The url of the SSL connector")
+    String getSslURL();
+    
+    @MBeanInfo("The url of the Stomp SSL connector")
+    String getStompSslURL();
+    
+    @MBeanInfo("The url of the VM connector")
+    String getVMURL();
+    
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java?rev=812139&r1=812138&r2=812139&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
Mon Sep  7 13:52:45 2009
@@ -71,6 +71,13 @@
         waitForKeyPress = true;
         TestRunner.run(MBeanTest.class);
     }
+    
+    public void testConnectors() throws Exception{
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
brokerName, BrokerViewMBean.class, true);
+        assertEquals("openwire URL doesn't equal bind Address",broker.getOpenWireURL(),this.bindAddress);
+
+    }
 
     public void testMBeans() throws Exception {
         connection = connectionFactory.createConnection();



Mime
View raw message