summaryrefslogtreecommitdiff
path: root/qpid/java/management/eclipse-plugin/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2008-12-03 12:22:12 +0000
committerMartin Ritchie <ritchiem@apache.org>2008-12-03 12:22:12 +0000
commit435251360a7dfe116aedf94df7f4b9aa4a5b60cc (patch)
tree60595040911655a6a33dac1a80022023e8a4ae22 /qpid/java/management/eclipse-plugin/src
parente997fa8d551e46afad33777ee486464f9e4885e9 (diff)
downloadqpid-python-435251360a7dfe116aedf94df7f4b9aa4a5b60cc.tar.gz
QPID-794 : Patch provided by Robert Gemmell, removes the need for the specification of the System Property 'jmxconnector'. As commented in the JIRA, moving to a more friendly licensed JMX connector would be benefitial.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@722861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/eclipse-plugin/src')
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java7
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java38
2 files changed, 22 insertions, 23 deletions
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
index 0ad85dbf33..373ac24e0f 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
@@ -43,7 +43,6 @@ public abstract class ApplicationRegistry
private static FontRegistry fontRegistry = new FontRegistry();
public static final boolean debug = Boolean.getBoolean("eclipse.consoleLog");
public static final String securityMechanism = System.getProperty("security", null);
- public static final String connectorClass = System.getProperty("jmxconnector");
public static final long timeout = Long.parseLong(System.getProperty("timeout", "5000"));
static
@@ -139,9 +138,5 @@ public abstract class ApplicationRegistry
{
return securityMechanism;
}
-
- public static String getJMXConnectorClass()
- {
- return connectorClass;
- }
+
}
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
index f671a1dc9a..bc37521ded 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
@@ -22,7 +22,6 @@ package org.apache.qpid.management.ui.jmx;
import static org.apache.qpid.management.ui.Constants.*;
-import java.lang.reflect.Constructor;
import java.security.Security;
import java.util.ArrayList;
import java.util.Collections;
@@ -99,11 +98,10 @@ public class JMXServerRegistry extends ServerRegistry
{
super(server);
String securityMechanism = ApplicationRegistry.getSecurityMechanism();
- String connectorClassName = ApplicationRegistry.getJMXConnectorClass();
- if ((securityMechanism != null) && (connectorClassName != null))
+ if (securityMechanism != null)
{
- createSASLConnector(securityMechanism, connectorClassName);
+ createSASLConnector(securityMechanism);
}
else
{
@@ -126,15 +124,28 @@ public class JMXServerRegistry extends ServerRegistry
return _mbsc;
}
- private void createSASLConnector(String mech, String className) throws Exception
+ private void createSASLConnector(String mech) throws Exception
{
String text = "Security mechanism " + mech + " is not supported.";
- // Check if the given connector, which supports SASL is available
- Class connectorClass = Class.forName(className);
+ String jmxmpcClass="javax.management.remote.jmxmp.JMXMPConnector";
+ // Check if the JMXMPConnector is available to provide SASL support
+ try
+ {
+ Class connectorClass = Class.forName(jmxmpcClass, false, this.getClass().getClassLoader());
+ }
+ catch(ClassNotFoundException cnfe)
+ {
+ throw new Exception("JMXMPConnector class was not found, security unavailable.");
+ }
_jmxUrl = new JMXServiceURL("jmxmp", getManagedServer().getHost(), getManagedServer().getPort());
_env = new HashMap<String, Object>();
CallbackHandler handler;
+
+ /* set the package in which to find the JMXMP ClientProvider.class file
+ * loaded by the jmxremote.sasl plugin (from the jmxremote_optional.jar) */
+ _env.put("jmx.remote.protocol.provider.pkgs","com.sun.jmx.remote.protocol");
+
if (MECH_CRAMMD5.equals(mech))
{
// For SASL/CRAM-MD5
@@ -162,15 +173,7 @@ public class JMXServerRegistry extends ServerRegistry
MBeanUtility.printOutput(text);
throw new Exception(text);
}
- // Now create the instance of JMXMPConnector
- Class[] paramTypes = {JMXServiceURL.class, Map.class};
- Constructor cons = connectorClass.getConstructor(paramTypes);
-
- Object[] args = {_jmxUrl, _env};
- Object theObject = cons.newInstance(args);
- _jmxc = (JMXConnector)theObject;
-
Thread connectorThread = new Thread(new ConnectorThread());
connectorThread.start();
long timeNow = System.currentTimeMillis();
@@ -197,8 +200,9 @@ public class JMXServerRegistry extends ServerRegistry
{
_connected = false;
_connectionException = null;
-
- _jmxc.connect();
+
+ _jmxc = JMXConnectorFactory.connect(_jmxUrl, _env);
+
_connected = true;
}
catch (Exception ex)