summaryrefslogtreecommitdiff
path: root/qpid/java/management
diff options
context:
space:
mode:
authorAidan Skinner <aidan@apache.org>2009-01-07 13:32:59 +0000
committerAidan Skinner <aidan@apache.org>2009-01-07 13:32:59 +0000
commit400cf393e1a7758d7e08093fcb62bfbd1e8881a3 (patch)
treef52957f2f9ffc306c2d41b59a0edaec675168f1d /qpid/java/management
parentde26a37fe587e9ddd8814c0fb9193617daf5dbc5 (diff)
downloadqpid-python-400cf393e1a7758d7e08093fcb62bfbd1e8881a3.tar.gz
QPID-1539: add management/common module. Move SASL and login code there.
Make gui depend on management common and OSGify it a bit. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@732330 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management')
-rw-r--r--qpid/java/management/common/build.xml25
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java33
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java)2
-rw-r--r--qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java (renamed from qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java)32
-rw-r--r--qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF3
-rw-r--r--qpid/java/management/eclipse-plugin/build-release-common.properties2
-rw-r--r--qpid/java/management/eclipse-plugin/build-release.xml13
-rw-r--r--qpid/java/management/eclipse-plugin/build.xml2
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java4
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java208
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini2
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF11
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini2
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini2
19 files changed, 137 insertions, 214 deletions
diff --git a/qpid/java/management/common/build.xml b/qpid/java/management/common/build.xml
new file mode 100644
index 0000000000..a30aa36578
--- /dev/null
+++ b/qpid/java/management/common/build.xml
@@ -0,0 +1,25 @@
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+ -->
+<project name="Management Common" default="build">
+
+ <import file="../../module.xml"/>
+
+</project>
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java
index 32a0c12344..be4897d6c4 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.util.Map;
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java
index ce9a273eaa..ee5803a220 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.util.Map;
diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
new file mode 100644
index 0000000000..31010baf8b
--- /dev/null
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.management.common.sasl;
+
+public class Constants
+{
+
+ public final static String MECH_CRAMMD5 = "CRAM-MD5";
+ public final static String MECH_PLAIN = "PLAIN";
+ public final static String SASL_CRAMMD5 = "SASL/CRAM-MD5";
+ public final static String SASL_PLAIN = "SASL/PLAIN";
+
+}
+
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java
index d8189f3ac3..f5a3ca8ccc 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.security.Provider;
import java.util.Map;
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
index 22190f29eb..806975c32f 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.io.*;
import javax.security.auth.callback.*;
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java
index 2917de8740..1eb44e35df 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.security.Provider;
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
index 1602229c85..a1634f86d9 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.io.*;
import javax.security.auth.callback.*;
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
index f4e3d2661e..09aba1f3e1 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
+++ b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
@@ -18,9 +18,12 @@
* under the License.
*
*/
-package org.apache.qpid.management.ui.sasl;
+package org.apache.qpid.management.common.sasl;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -28,7 +31,6 @@ import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.qpid.management.ui.views.ViewUtility;
public class UsernameHashedPasswordCallbackHandler implements CallbackHandler
{
@@ -38,7 +40,7 @@ public class UsernameHashedPasswordCallbackHandler implements CallbackHandler
public UsernameHashedPasswordCallbackHandler(String user, String password) throws Exception
{
this.user = user;
- this.pwchars = ViewUtility.getHash(password);
+ this.pwchars = getHash(password);
}
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
@@ -79,4 +81,28 @@ public class UsernameHashedPasswordCallbackHandler implements CallbackHandler
{
clearPassword();
}
+
+ public static char[] getHash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
+ {
+ byte[] data = text.getBytes("utf-8");
+
+ MessageDigest md = MessageDigest.getInstance("MD5");
+
+ for (byte b : data)
+ {
+ md.update(b);
+ }
+
+ byte[] digest = md.digest();
+
+ char[] hash = new char[digest.length ];
+
+ int index = 0;
+ for (byte b : digest)
+ {
+ hash[index++] = (char) b;
+ }
+
+ return hash;
+ }
}
diff --git a/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF b/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF
index 15fcd8d59a..32d1b7a1b2 100644
--- a/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF
+++ b/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.forms,
- jmxremote.sasl;resolution:=optional
+ jmxremote.sasl;resolution:=optional,
+ qpid-management-common
Eclipse-LazyStart: true
Export-Package: org.apache.qpid.management.ui,
org.apache.qpid.management.ui.actions,
diff --git a/qpid/java/management/eclipse-plugin/build-release-common.properties b/qpid/java/management/eclipse-plugin/build-release-common.properties
index 65ef9be092..29f582bec5 100644
--- a/qpid/java/management/eclipse-plugin/build-release-common.properties
+++ b/qpid/java/management/eclipse-plugin/build-release-common.properties
@@ -36,3 +36,5 @@ eclipse.ini=src/main/resources/eclipse.ini
license.eclipse.txt=src/main/resources/license.eclipse.txt
jmxremote.sasl.manifest=src/main/resources/sasl/MANIFEST.MF
+
+qpidmanagementcommon.manifest=src/main/resources/qpidmanagementcommon/MANIFEST.MF
diff --git a/qpid/java/management/eclipse-plugin/build-release.xml b/qpid/java/management/eclipse-plugin/build-release.xml
index b116fcb55c..46eca58424 100644
--- a/qpid/java/management/eclipse-plugin/build-release.xml
+++ b/qpid/java/management/eclipse-plugin/build-release.xml
@@ -33,6 +33,7 @@
<isset property ="eclipse.ini"/>
<isset property ="license.eclipse.txt"/>
<isset property ="jmxremote.sasl.manifest"/>
+ <isset property ="qpidmanagementcommon.manifest"/>
<!-- platform specific properties -->
<isset property ="bin.includes"/>
<isset property ="release.name"/>
@@ -66,6 +67,16 @@
</copy>
</target>
+ <target name="release-bin-qpidmanagementcommon-plugin">
+ <!-- Copy the management common plugin's manifest, creating its plugin directory -->
+ <copy todir="${release.subdir}/eclipse/plugins/qpid-management-common_1.0.0/META-INF" flatten="true" failonerror="true">
+ <fileset file="${qpidmanagementcommon.manifest}"/>
+ </copy>
+ <copy todir="${release.subdir}/eclipse/plugins/qpid-management-common_1.0.0/" flatten="true" failonerror="true">
+ <fileset file="${build.lib}/qpid-management-common-${project.version}.jar"/>
+ </copy>
+ </target>
+
<target name="copy-executable" description="Copy eclipse-rcp execuitable" if="eclipse.executable">
<!-- Copy the eclipse rcp executable files -->
@@ -147,6 +158,6 @@
<target name="release-bin" depends="check,release-bin-prepare,release-bin-rcp-deps,
- release-bin-mcplugin-jar,release-bin-jmxremote-plugin,release-bin-zip,release-bin-gzip"/>
+ release-bin-mcplugin-jar,release-bin-qpidmanagementcommon-plugin,release-bin-jmxremote-plugin,release-bin-zip,release-bin-gzip"/>
</project>
diff --git a/qpid/java/management/eclipse-plugin/build.xml b/qpid/java/management/eclipse-plugin/build.xml
index 2c36e79823..1d6144116d 100644
--- a/qpid/java/management/eclipse-plugin/build.xml
+++ b/qpid/java/management/eclipse-plugin/build.xml
@@ -20,7 +20,7 @@
-->
<project name="Eclipse Plugin" default="build">
- <property name="module.depends" value="broker common"/>
+ <property name="module.depends" value="broker common management/common"/>
<import file="../../module.xml"/>
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
index d6f895b64a..5e05375e28 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
@@ -133,8 +133,4 @@ public class Constants
public final static String INFO_USERNAME = "Please enter the " + USERNAME;
public final static String INFO_PASSWORD = "Please enter the " + PASSWORD;
- public final static String MECH_CRAMMD5 = "CRAM-MD5";
- public final static String MECH_PLAIN = "PLAIN";
- public final static String SASL_CRAMMD5 = "SASL/CRAM-MD5";
- public final static String SASL_PLAIN = "SASL/PLAIN";
}
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 b27661e56c..945c63f19a 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
@@ -20,16 +20,13 @@
*/
package org.apache.qpid.management.ui.jmx;
-import static org.apache.qpid.management.ui.Constants.*;
+import static org.apache.qpid.management.ui.Constants.ALL;
-import java.io.IOException;
-import java.security.Security;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.management.ListenerNotFoundException;
@@ -38,11 +35,8 @@ import javax.management.MBeanServerConnection;
import javax.management.Notification;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.sasl.SaslClientFactory;
+import org.apache.qpid.management.common.JMXConnnectionFactory;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
import org.apache.qpid.management.ui.ManagedServer;
@@ -51,21 +45,13 @@ import org.apache.qpid.management.ui.model.ManagedAttributeModel;
import org.apache.qpid.management.ui.model.NotificationInfoModel;
import org.apache.qpid.management.ui.model.NotificationObject;
import org.apache.qpid.management.ui.model.OperationDataModel;
-import org.apache.qpid.management.ui.sasl.JCAProvider;
-import org.apache.qpid.management.ui.sasl.SaslProvider;
-import org.apache.qpid.management.ui.sasl.UserPasswordCallbackHandler;
-import org.apache.qpid.management.ui.sasl.UsernameHashedPasswordCallbackHandler;
public class JMXServerRegistry extends ServerRegistry
{
- private boolean _connected = false;
private ObjectName _serverObjectName = null;
- private Map<String, Object> _env = null;
- private JMXServiceURL _jmxUrl = null;
private JMXConnector _jmxc = null;
private MBeanServerConnection _mbsc = null;
- private Exception _connectionException = null;
private String _securityMechanism = null;
private List<String> _usersList;
@@ -99,94 +85,20 @@ public class JMXServerRegistry extends ServerRegistry
public JMXServerRegistry(ManagedServer server) throws Exception
{
super(server);
+
+ _jmxc = JMXConnnectionFactory.getJMXConnection(
+ ApplicationRegistry.timeout, server.getHost(),
+ server.getPort(), server.getUser(), server.getPassword());
+
+ _mbsc = _jmxc.getMBeanServerConnection();
- long timeNow;
-
- //auto-negotiate an RMI or JMXMP (SASL/CRAM-MD5 or SASL/PLAIN) JMX connection to broker
- try
- {
- timeNow = System.currentTimeMillis();
- createJMXconnector("RMI");
- }
- catch (IOException rmiIOE)
- {
- // check if the ioe was raised because we tried connecting to a non RMI-JRMP based JMX server
- boolean jrmpServer = !rmiIOE.getMessage().contains("non-JRMP server at remote endpoint");
-
- if (jrmpServer)
- {
- IOException nioe = new IOException();
- nioe.initCause(rmiIOE);
- throw nioe;
- }
- else
- {
- try
- {
- //It wasnt an RMI ConnectorServer at the broker end. Try to establish a JMXMP SASL/CRAM-MD5 connection instead.
- timeNow = System.currentTimeMillis();
- createJMXconnector("JMXMP_CRAM-MD5");
- }
- catch (IOException cramIOE)
- {
- // check if the IOE was raised because we tried connecting to a SASL/PLAIN server using SASL/CRAM-MD5
- boolean plainProfileServer = cramIOE.getMessage().contains("The server supported profiles [SASL/PLAIN]" +
- " do not match the client required profiles [SASL/CRAM-MD5]");
-
- if (!plainProfileServer)
- {
- IOException nioe = new IOException();
- nioe.initCause(cramIOE);
- throw nioe;
- }
- else
- {
- try
- {
- // Try to establish a JMXMP SASL/PLAIN connection instead.
- timeNow = System.currentTimeMillis();
- createJMXconnector("JMXMP_PLAIN");
- }
- catch (IOException plainIOE)
- {
- /* Out of options now. Check that the IOE was raised because we tried connecting to a server
- * which didnt support SASL/PLAIN. If so, signal an unknown profile type. If not, raise the exception. */
- boolean unknownProfile = cramIOE.getMessage().contains("do not match the client required profiles [SASL/PLAIN]");
-
- if (unknownProfile)
- {
- throw new Exception("Unknown JMXMP authentication mechanism, unable to connect.");
- }
- else
- {
- IOException nioe = new IOException();
- nioe.initCause(plainIOE);
- throw nioe;
- }
- }
- }
- }
- }
- }
-
- if (_connected)
- {
- _mbsc = _jmxc.getMBeanServerConnection();
+ _clientListener = new ClientListener(server);
+ _notificationListener = new ClientNotificationListener(server);
- _clientListener = new ClientListener(server);
- _notificationListener = new ClientNotificationListener(server);
+ _jmxc.addConnectionNotificationListener(_clientListener, null, null);
+ _serverObjectName = new ObjectName("JMImplementation:type=MBeanServerDelegate");
+ _mbsc.addNotificationListener(_serverObjectName, _clientListener, null, null);
- _jmxc.addConnectionNotificationListener(_clientListener, null, null);
- _serverObjectName = new ObjectName("JMImplementation:type=MBeanServerDelegate");
- _mbsc.addNotificationListener(_serverObjectName, _clientListener, null, null);
- }
- else
- {
- if (System.currentTimeMillis() - timeNow >= ApplicationRegistry.timeout)
- throw new Exception("Qpid server connection timed out");
- else
- throw new Exception("Qpid server connection failed");
- }
}
public MBeanServerConnection getServerConnection()
@@ -194,106 +106,12 @@ public class JMXServerRegistry extends ServerRegistry
return _mbsc;
}
- private void createJMXconnector(String connectionType) throws IOException, Exception
- {
- if (connectionType == "RMI")
- {
- _securityMechanism = MECH_PLAIN;
-
- _jmxUrl = new JMXServiceURL(getManagedServer().getUrl());
- _env = null;
- }
- else if (connectionType.contains("JMXMP"))
- {
- // Check that the JMXMPConnector is available to provide SASL support
- final String jmxmpcClass = "javax.management.remote.jmxmp.JMXMPConnector";
-
- try
- {
- Class.forName(jmxmpcClass, false, this.getClass().getClassLoader());
- }
- catch (ClassNotFoundException cnfe)
- {
- throw new Exception("JMXMPConnector class not found, unable to connect to specified server.\n\n"
- + "Please add the jmxremote_optional.jar to the jmxremote.sasl plugin folder, or the classpath.");
- }
-
- _jmxUrl = new JMXServiceURL("jmxmp", getManagedServer().getHost(), getManagedServer().getPort());
- _env = new HashMap<String, Object>();
-
- /* 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 (connectionType == "JMXMP_CRAM-MD5")
- {
- _securityMechanism = MECH_CRAMMD5;
-
- Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>();
- Class<?> clazz = Class.forName("org.apache.qpid.management.ui.sasl.CRAMMD5HashedSaslClientFactory");
- map.put("CRAM-MD5-HASHED", (Class<? extends SaslClientFactory>) clazz);
- Security.addProvider(new JCAProvider(map));
-
- CallbackHandler handler = new UsernameHashedPasswordCallbackHandler(
- getManagedServer().getUser(),
- getManagedServer().getPassword());
- _env.put("jmx.remote.profiles", SASL_CRAMMD5);
- _env.put("jmx.remote.sasl.callback.handler", handler);
- }
- else if (connectionType == "JMXMP_PLAIN")
- {
- _securityMechanism = MECH_PLAIN;
-
- Security.addProvider(new SaslProvider());
- CallbackHandler handler = new UserPasswordCallbackHandler(getManagedServer().getUser(), getManagedServer().getPassword());
- _env.put("jmx.remote.profiles", SASL_PLAIN);
- _env.put("jmx.remote.sasl.callback.handler", handler);
- }
- else
- {
- throw new Exception("Unknown authentication mechanism");
- }
- }
- else
- {
- throw new Exception("Unknown connection type");
- }
-
- Thread connectorThread = new Thread(new ConnectorThread());
- connectorThread.start();
- connectorThread.join(ApplicationRegistry.timeout);
-
- if (_connectionException != null)
- {
- throw _connectionException;
- }
- }
public String getSecurityMechanism()
{
return _securityMechanism;
}
- private class ConnectorThread implements Runnable
- {
- public void run()
- {
- try
- {
- _connected = false;
- _connectionException = null;
-
- _jmxc = JMXConnectorFactory.connect(_jmxUrl, _env);
-
- _connected = true;
- }
- catch (Exception ex)
- {
- _connectionException = ex;
- }
- }
- }
-
/**
* removes all listeners from the mbean server. This is required when user
* disconnects the Qpid server connection
diff --git a/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini b/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
index fe1a9fe2c2..de55f949a4 100644
--- a/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
+++ b/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
@@ -24,7 +24,7 @@ osgi.splashPath=platform\:/base/plugins/org.eclipse.platform
eclipse.product=org.apache.qpid.management.ui.product
eclipse.application=org.apache.qpid.management.ui.application
-osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.carbon.macosx,org.eclipse.ui,org.eclipse.ui.forms,org.eclipse.ui.workbench,org.eclipse.equinox.app,org.eclipse.core.databinding,org.eclipse.jface.databinding,jmxremote.sasl
+osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.carbon.macosx,org.eclipse.ui,org.eclipse.ui.forms,org.eclipse.ui.workbench,org.eclipse.equinox.app,org.eclipse.core.databinding,org.eclipse.jface.databinding,jmxremote.sasl,qpid-management-common
osgi.bundles.defaultStartLevel=4
eof=eof
diff --git a/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF b/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
new file mode 100644
index 0000000000..496dec6129
--- /dev/null
+++ b/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 1
+Bundle-Name: Qpid management commonPlug-in
+Bundle-SymbolicName: qpid-management-common
+Bundle-Version: 1.0.0
+Bundle-ClassPath: qpid-management-common-M4.jar
+Export-Package: org.apache.qpid.management.common,
+ org.apache.qpid.management.common.sasl
+Bundle-Vendor:
+Bundle-Localization: plugin
+Require-Bundle: jmxremote.sasl
diff --git a/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini b/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
index 5bbf344c17..3c70d9aa0d 100644
--- a/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
+++ b/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
@@ -22,6 +22,6 @@
osgi.splashPath=platform:/base/plugins/org.apache.qpid.management.ui
eclipse.product=org.apache.qpid.management.ui.product
eclipse.application=org.apache.qpid.management.ui.application
-osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.gtk.linux.x86,org.eclipse.ui,org.eclipse.ui.forms,org.eclipse.ui.workbench,jmxremote.sasl
+osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.gtk.linux.x86,org.eclipse.ui,org.eclipse.ui.forms,org.eclipse.ui.workbench,jmxremote.sasl,qpid-management-common
osgi.bundles.defaultStartLevel=4
eof=eof
diff --git a/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini b/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
index e83321e650..aa68db3e4e 100644
--- a/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
+++ b/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
@@ -22,5 +22,5 @@
osgi.splashPath=platform:/base/plugins/org.apache.qpid.management.ui
eclipse.product=org.apache.qpid.management.ui.product
eclipse.application=org.apache.qpid.management.ui.application
-osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.forms,jmxremote.sasl,org.eclipse.ui.workbench
+osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.forms,jmxremote.sasl,org.eclipse.ui.workbench,qpid-management-common
osgi.bundles.defaultStartLevel=4