You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/06/22 17:19:31 UTC

svn commit: r549840 - in /activemq/trunk/activemq-web-console/src/main: java/org/apache/activemq/web/RemoteJMXBrokerFacade.java webapp/WEB-INF/webconsole-properties.xml

Author: jstrachan
Date: Fri Jun 22 08:19:30 2007
New Revision: 549840

URL: http://svn.apache.org/viewvc?view=rev&rev=549840
Log:
patch from  Andrew Deason for AMQ-1260 - applied with thanks!

Modified:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
    activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=diff&rev=549840&r1=549839&r2=549840
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java (original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java Fri Jun 22 08:19:30 2007
@@ -34,6 +34,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
 
@@ -46,6 +47,8 @@
 public class RemoteJMXBrokerFacade extends BrokerFacadeSupport {
     private static final transient Log log = LogFactory.getLog(RemoteJMXBrokerFacade.class);
     private String jmxUrl;
+    private String jmxRole;
+    private String jmxPassword;
     private String brokerName;
     private JMXConnector connector;
 
@@ -57,6 +60,14 @@
         this.jmxUrl = url;
     }
 
+    public void setJmxRole(String role) {
+        this.jmxRole = role;
+    }
+
+    public void setJmxPassword(String password) {
+        this.jmxPassword = password;
+    }
+
     /**
      * Shutdown this facade aka close any open connection.
      */
@@ -110,6 +121,10 @@
 
     protected JMXConnector createConnection() {
         String[] urls = this.jmxUrl.split(",");
+	HashMap env = new HashMap();
+	env.put("jmx.remote.credentials",
+		new String[] {this.jmxRole, this.jmxPassword});
+
         if (urls == null || urls.length == 0) {
             urls = new String[]{this.jmxUrl};
         }
@@ -118,7 +133,7 @@
         for (int i = 0; i < urls.length; i++) {
             try {
                 JMXConnector connector = JMXConnectorFactory
-                        .connect(new JMXServiceURL(urls[i]));
+                        .connect(new JMXServiceURL(urls[i]), env);
                 connector.connect();
                 MBeanServerConnection connection = connector
                         .getMBeanServerConnection();

Modified: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml?view=diff&rev=549840&r1=549839&r2=549840
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml Fri Jun 22 08:19:30 2007
@@ -29,6 +29,8 @@
 
   <bean id="brokerQuery" class="org.apache.activemq.web.RemoteJMXBrokerFacade" autowire="constructor" destroy-method="shutdown">
   	<property name="jmxUrl" value="${webconsole.jmx.url}"/>
+	<property name="jmxRole" value="${webconsole.jmx.role}"/>
+	<property name="jmxPassword" value="${webconsole.jmx.password}"/>
   	<property name="brokerName"><null/></property>
   </bean>