Author: aidan
Date: Wed Jan  7 05:32:59 2009
New Revision: 732330

URL: http://svn.apache.org/viewvc?rev=732330&view=rev
Log:
QPID-1539: add management/common module. Move SASL and login code there.
 Make gui depend on management common and OSGify it a bit.

Added:
    qpid/trunk/qpid/java/management/common/build.xml
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java
    
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
      - copied, changed from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
Removed:
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
Modified:
    qpid/trunk/qpid/java/build.deps
    qpid/trunk/qpid/java/build.xml
    qpid/trunk/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF
    
qpid/trunk/qpid/java/management/eclipse-plugin/build-release-common.properties
    qpid/trunk/qpid/java/management/eclipse-plugin/build-release.xml
    qpid/trunk/qpid/java/management/eclipse-plugin/build.xml
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
    
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini

Modified: qpid/trunk/qpid/java/build.deps
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.deps?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- qpid/trunk/qpid/java/build.deps (original)
+++ qpid/trunk/qpid/java/build.deps Wed Jan  7 05:32:59 2009
@@ -102,3 +102,4 @@
 management-eclipse-plugin.test.libs=${systests.libs}
 broker-plugins.test.libs=${test.libs}
 management-tools-qpid-cli.test.libs=${junit4} ${slf4j-log4j} ${log4j} 
${client.libs}
+management-common.test.libs=${test.libs}

Modified: qpid/trunk/qpid/java/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.xml?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- qpid/trunk/qpid/java/build.xml (original)
+++ qpid/trunk/qpid/java/build.xml Wed Jan  7 05:32:59 2009
@@ -25,7 +25,7 @@
   <property name="modules.core"       value="junit-toolkit common broker 
client tools"/>
   <property name="modules.examples"   value="client/example"/>
   <property name="modules.tests"      value="systests perftests 
integrationtests testkit"/>
-  <property name="modules.management" value="management/client 
management/eclipse-plugin"/>
+  <property name="modules.management" value="management/common 
management/client management/eclipse-plugin"/>
   <property name="modules.plugin"     value="broker-plugins"/>
   <property name="modules.management.tools" value="management/tools/qpid-cli"/>
   <property name="modules"            value="${modules.core}

Added: qpid/trunk/qpid/java/management/common/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/build.xml?rev=732330&view=auto
==============================================================================
--- qpid/trunk/qpid/java/management/common/build.xml (added)
+++ qpid/trunk/qpid/java/management/common/build.xml Wed Jan  7 05:32:59 2009
@@ -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>

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/CRAMMD5HashedSaslClientFactory.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java
 Wed Jan  7 05:32:59 2009
@@ -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;
 

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/ClientSaslFactory.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java
 Wed Jan  7 05:32:59 2009
@@ -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;
 

Added: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java?rev=732330&view=auto
==============================================================================
--- 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
 (added)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java
 Wed Jan  7 05:32:59 2009
@@ -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";
+
+}
+

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/JCAProvider.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java
 Wed Jan  7 05:32:59 2009
@@ -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;

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/PlainSaslClient.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
 Wed Jan  7 05:32:59 2009
@@ -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.*;

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/SaslProvider.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java
 Wed Jan  7 05:32:59 2009
@@ -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;
 

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UserPasswordCallbackHandler.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
 Wed Jan  7 05:32:59 2009
@@ -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.*;

Copied: 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
 (from r732325, 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java)
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java?p2=qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java&p1=qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java&r1=732325&r2=732330&rev=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
 (original)
+++ 
qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
 Wed Jan  7 05:32:59 2009
@@ -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.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 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 @@
     {
         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;
+    }
 }

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF 
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/META-INF/MANIFEST.MF Wed Jan 
 7 05:32:59 2009
@@ -10,7 +10,8 @@
 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,

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/build-release-common.properties
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/build-release-common.properties?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/build-release-common.properties 
(original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/build-release-common.properties 
Wed Jan  7 05:32:59 2009
@@ -36,3 +36,5 @@
 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

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/build-release.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/build-release.xml?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/build-release.xml (original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/build-release.xml Wed Jan  7 
05:32:59 2009
@@ -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>

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/build.xml?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/build.xml (original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/build.xml Wed Jan  7 
05:32:59 2009
@@ -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"/>
 

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
 Wed Jan  7 05:32:59 2009
@@ -133,8 +133,4 @@
     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";
 }

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
 Wed Jan  7 05:32:59 2009
@@ -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.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.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 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 @@
         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

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/macosx/Configuration/config.ini
 Wed Jan  7 05:32:59 2009
@@ -24,7 +24,7 @@
 eclipse.product=org.apache.qpid.management.ui.product
 eclipse.application=org.apache.qpid.management.ui.application
 
-osgi.bundles=org.eclipse.equinox.com...@2:start,org.eclipse.core.runt...@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.com...@2:start,org.eclipse.core.runt...@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

Added: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF?rev=732330&view=auto
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
 (added)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/qpidmanagementcommon/MANIFEST.MF
 Wed Jan  7 05:32:59 2009
@@ -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

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/unix/configuration/config.ini
 Wed Jan  7 05:32:59 2009
@@ -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.com...@2:start,org.eclipse.core.runt...@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.com...@2:start,org.eclipse.core.runt...@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

Modified: 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini?rev=732330&r1=732329&r2=732330&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
 (original)
+++ 
qpid/trunk/qpid/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
 Wed Jan  7 05:32:59 2009
@@ -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.com...@2:start,org.eclipse.core.runt...@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.com...@2:start,org.eclipse.core.runt...@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


Reply via email to