From fccb3cc2b075eff4b540f26adaf4f86c28579846 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 22 Jun 2007 15:19:30 +0000 Subject: [PATCH] patch from Andrew Deason for AMQ-1260 - applied with thanks! git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@549840 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/web/RemoteJMXBrokerFacade.java | 17 ++++++++++++++++- .../webapp/WEB-INF/webconsole-properties.xml | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java b/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java index 52c4590e23..0afa708fab 100644 --- a/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java +++ b/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java @@ -34,6 +34,7 @@ import javax.management.remote.JMXServiceURL; 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 @@ import java.util.Set; 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 @@ public class RemoteJMXBrokerFacade extends BrokerFacadeSupport { 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 @@ public class RemoteJMXBrokerFacade extends BrokerFacadeSupport { 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 @@ public class RemoteJMXBrokerFacade extends BrokerFacadeSupport { 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(); diff --git a/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml b/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml index ad1f48231c..33fb5ff314 100644 --- a/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml +++ b/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml @@ -29,6 +29,8 @@ + +