summaryrefslogtreecommitdiff
path: root/java/management/eclipse-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/management/eclipse-plugin/src')
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java12
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java10
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java36
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java59
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java68
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java22
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java20
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java48
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java25
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java25
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java89
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java114
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java13
-rw-r--r--java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF27
-rw-r--r--java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini2
15 files changed, 264 insertions, 306 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java
index 9015b74f3f..b5c1b5074a 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.management.ui;
+import org.apache.qpid.management.ui.actions.VersionAction;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.IMenuManager;
@@ -44,8 +46,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor
// in the fill methods. This ensures that the actions aren't recreated
// when fillActionBars is called with FILL_PROXY.
private IWorkbenchAction exitAction;
- private IWorkbenchAction aboutAction;
-
+ private Action _aboutAction;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer)
{
@@ -63,8 +64,8 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
- aboutAction = ActionFactory.ABOUT.create(window);
- register(aboutAction);
+ _aboutAction = new VersionAction(window);
+ register(_aboutAction);
}
@@ -85,8 +86,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor
fileMenu.add(exitAction);
// Help
- //aboutAction.setText("about Qpid Management Console");
- helpMenu.add(aboutAction);
+ helpMenu.add(_aboutAction);
}
protected void fillCoolBar(ICoolBarManager coolBar)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
index 714f84ea49..0693a4fc93 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java
@@ -41,8 +41,9 @@ public abstract class ApplicationRegistry
{
private static ImageRegistry imageRegistry = new ImageRegistry();
private static FontRegistry fontRegistry = new FontRegistry();
- public static final boolean debug = Boolean.getBoolean("debug");
- public static final String securityMechanism = System.getProperty("security", null);
+ 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");
static
{
@@ -137,4 +138,9 @@ public abstract class ApplicationRegistry
{
return securityMechanism;
}
+
+ public static String getJMXConnectorClass()
+ {
+ return connectorClass;
+ }
}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java
deleted file mode 100644
index 12dea649c6..0000000000
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * 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.ui;
-
-/**
- * Interface defining the application's command IDs.
- * Key bindings can be defined for specific commands.
- * To associate an action with a command, use IAction.setActionDefinitionId(commandId).
- *
- * @see org.eclipse.jface.action.IAction#setActionDefinitionId(String)
- */
-public interface ICommandIds
-{
- //public static final String CMD_ADD_SERVER = "org.apache.qpid.management.ui.add";
- //public static final String CMD_RECONNECT_SERVER = "org.apache.qpid.management.ui.reconnect";
- //public static final String CMD_DISCONNECT_SERVER = "org.apache.qpid.management.ui.disconnect";
- //public static final String CMD_REFRESH = "org.apache.qpid.management.ui.actions.refresh";
-}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
index 0101905bbf..f70452dd42 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.ui.actions;
import static org.apache.qpid.management.ui.Constants.ERROR_SERVER_CONNECTION;
@@ -6,15 +26,24 @@ import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
import org.apache.qpid.management.ui.Constants;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
+import org.apache.qpid.management.ui.views.NavigationView;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class AbstractAction
{
+ private NavigationView _navigationView;
+
protected IWorkbenchWindow _window;
+
+ public static final String RMI_SASL_ERROR = "non-JRMP server";
+ public static final String SECURITY_FAILURE = "User authentication has failed";
+ public static final String SERVER_UNAVAILABLE = "Qpid server is not running";
/**
* We will cache window object in order to
@@ -28,9 +57,20 @@ public class AbstractAction
{
_window.getShell().setImage(ApplicationRegistry.getImage(Constants.CONSOLE_IMAGE));
}
+ }
+
+ protected NavigationView getNavigationView()
+ {
+ if (_navigationView == null)
+ {
+ _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID);
+ }
+
+ return _navigationView;
}
- protected void handleException(Exception ex, String title, String msg)
+
+ protected void handleException(Throwable ex, String title, String msg)
{
MBeanUtility.printStackTrace(ex);
if (msg == null)
@@ -55,4 +95,21 @@ public class AbstractAction
IStatus.OK, msg, null);
ErrorDialog.openError(_window.getShell(), "Error", title, status);
}
+
+
+ /**
+ * Selection in the workbench has been changed. We can change the state of the 'real' action here
+ * if we want, but this can only happen after the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+
+ }
}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
index ff0f42b49e..c13f54929d 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
@@ -22,13 +22,13 @@ package org.apache.qpid.management.ui.actions;
import static org.apache.qpid.management.ui.Constants.*;
+import java.io.IOException;
+
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
-import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.NumberVerifyListener;
import org.apache.qpid.management.ui.views.ViewUtility;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -47,7 +47,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
{
private static final String[] _domains ={"org.apache.qpid"};
- private NavigationView _navigationView;
private String _transport = DEFAULT_PROTOCOL;
private String _host;
private String _port;
@@ -62,19 +61,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
}
- /*
- public AddServer(IWorkbenchWindow window)//, String label)
- {
- _window = window;
- //setText(label);
- // The id is used to refer to the action in a menu or toolbar
- setId(ICommandIds.CMD_ADD_SERVER);
- // Associate the action with a pre-defined command, to allow key bindings.
- setActionDefinitionId(ICommandIds.CMD_ADD_SERVER);
- //setImageDescriptor(org.apache.qpid.management.ui.Activator.getImageDescriptor("/icons/add.gif"));
- }
- */
-
public void run(IAction action)
{
if(_window != null)
@@ -92,6 +78,17 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
{
ViewUtility.popupInfoMessage(ACTION_ADDSERVER, ex.getMessage());
}
+ catch (IOException ex)
+ {
+ if ((ex.getMessage() != null) && (ex.getMessage().indexOf(RMI_SASL_ERROR) != -1))
+ {
+ handleException(ex, null, SECURITY_FAILURE);
+ }
+ else
+ {
+ handleException(ex, null, SERVER_UNAVAILABLE);
+ }
+ }
catch (Exception ex)
{
handleException(ex, null, null);
@@ -110,45 +107,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
}
/**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
-
- }
-
- private NavigationView getNavigationView()
- {
- if (_navigationView == null)
- {
- _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID);
- }
-
- return _navigationView;
- }
-
- /*
- public void run()
- {
- if(_window != null)
- {
- createWidgets();
- }
- }
- */
-
- /**
* Creates the shell and then opens the popup where user can enter new connection details.
* Connects to the new server and adds the server in the navigation page.
* Pops up any error occured in connecting to the new server
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
index 3907424748..a3e52149df 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
@@ -25,7 +25,6 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.ViewUtility;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class CloseConnection extends AbstractAction implements IWorkbenchWindowActionDelegate
@@ -53,24 +52,5 @@ public class CloseConnection extends AbstractAction implements IWorkbenchWindowA
handleException(ex, null, null);
}
}
- }
-
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
-
- }
+ }
}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
index 69e74898ab..d3af3661b0 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
@@ -25,7 +25,6 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.MBeanView;
import org.apache.qpid.management.ui.views.ViewUtility;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class EditAttribute extends AbstractAction implements IWorkbenchWindowActionDelegate
@@ -49,23 +48,4 @@ public class EditAttribute extends AbstractAction implements IWorkbenchWindowAct
}
}
}
-
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
-
- }
}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
index 3c0dea586e..609484a557 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
@@ -27,14 +27,14 @@ import static org.apache.qpid.management.ui.Constants.INFO_USERNAME;
import static org.apache.qpid.management.ui.Constants.PASSWORD;
import static org.apache.qpid.management.ui.Constants.USERNAME;
+import java.io.IOException;
+
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.Constants;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
-import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.TreeObject;
import org.apache.qpid.management.ui.views.ViewUtility;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -50,45 +50,12 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class ReconnectServer extends AbstractAction implements IWorkbenchWindowActionDelegate
{
- private NavigationView _navigationView;
private String _title;
private String _serverName;
private String _user;
private String _password;
private boolean _connect;
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection)
- {
-
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose()
- {
-
- }
-
- private NavigationView getNavigationView()
- {
- if (_navigationView == null)
- {
- _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID);
- }
-
- return _navigationView;
- }
-
public void run(IAction action)
{
if(_window != null)
@@ -114,6 +81,17 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
{
ViewUtility.popupInfoMessage("Reconnect Qpid server", ex.getMessage());
}
+ catch (IOException ex)
+ {
+ if ((ex.getMessage() != null) && (ex.getMessage().indexOf(RMI_SASL_ERROR) != -1))
+ {
+ handleException(ex, null, SECURITY_FAILURE);
+ }
+ else
+ {
+ handleException(ex, null, SERVER_UNAVAILABLE);
+ }
+ }
catch (Exception ex)
{
handleException(ex, null, null);
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
index b76c36c649..34251c12d7 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
@@ -24,7 +24,6 @@ import org.apache.qpid.management.ui.jmx.MBeanUtility;
import org.apache.qpid.management.ui.views.MBeanView;
import org.apache.qpid.management.ui.views.NavigationView;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
@@ -32,29 +31,7 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
* @author Bhupendra Bhardwaj
*/
public class Refresh extends AbstractAction implements IWorkbenchWindowActionDelegate
-{
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection)
- {
-
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose()
- {
-
- }
-
+{
public void run(IAction action)
{
if(_window != null)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
index f8878c44a1..e329255414 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
@@ -24,33 +24,10 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.ViewUtility;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class RemoveServer extends AbstractAction implements IWorkbenchWindowActionDelegate
-{
- /**
- * Selection in the workbench has been changed. We
- * can change the state of the 'real' action here
- * if we want, but this can only happen after
- * the delegate has been created.
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection)
- {
-
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose()
- {
-
- }
-
+{
public void run(IAction action)
{
if(_window != null)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java
new file mode 100644
index 0000000000..11db02f5a2
--- /dev/null
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * 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.ui.actions;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.qpid.management.ui.Constants;
+import org.apache.qpid.management.ui.jmx.MBeanUtility;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+
+public class VersionAction extends Action
+{
+ private IWorkbenchWindow _window;
+ public static final String VERSION_RESOURCE = "qpidversion.properties";
+
+ public static final String PRODUCT_NAME_PROPERTY = "qpid.name";
+ public static final String RELEASE_VERSION_PROPERTY = "qpid.version";
+ public static final String BUILD_VERSION_PROPERTY = "qpid.svnversion";
+
+ private static final String DEFAULT = "unknown";
+ private static String _releaseVersion;
+ private static String _buildVersion;
+ private static String _text;
+
+ static
+ {
+ Properties props = new Properties();
+ try
+ {
+ InputStream propertyStream = VersionAction.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE);
+ if (propertyStream != null)
+ {
+ props.load(propertyStream);
+ _releaseVersion = readPropertyValue(props, RELEASE_VERSION_PROPERTY);
+ _buildVersion = readPropertyValue(props, BUILD_VERSION_PROPERTY);
+ _text = "Build Version : " + _buildVersion + "\n" +
+ "Release Version : " + _releaseVersion;
+ }
+ }
+ catch (Exception ex)
+ {
+ MBeanUtility.printStackTrace(ex);
+ }
+ }
+
+ public VersionAction(IWorkbenchWindow window)
+ {
+ _window = window;
+ setText("About " + Constants.APPLICATION_NAME);
+ setId("qpidmc.about");
+ setActionDefinitionId("qpidmc.about");
+ }
+
+ private static String readPropertyValue(Properties props, String propertyName)
+ {
+ String retVal = (String) props.get(propertyName);
+ if (retVal == null)
+ {
+ retVal = DEFAULT;
+ }
+ return retVal;
+ }
+
+ public void run()
+ {
+ MessageDialog.openInformation(_window.getShell(), Constants.APPLICATION_NAME, _text);
+ }
+}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
index 816c479cf9..988b22b4cf 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
@@ -39,6 +39,7 @@ 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.ui.ApplicationRegistry;
@@ -58,6 +59,8 @@ import org.apache.qpid.management.ui.sasl.UsernameHashedPasswordCallbackHandler;
public class JMXServerRegistry extends ServerRegistry
{
private ObjectName _serverObjectName = null;
+ private Map<String, Object> _env = null;
+ private JMXServiceURL _jmxUrl = null;
private JMXConnector _jmxc = null;
private MBeanServerConnection _mbsc = null;
@@ -92,68 +95,28 @@ public class JMXServerRegistry extends ServerRegistry
public JMXServerRegistry(ManagedServer server) throws Exception
{
super(server);
- JMXServiceURL jmxUrl = new JMXServiceURL(server.getUrl());
- Map<String, Object> env = null;
String securityMechanism = ApplicationRegistry.getSecurityMechanism();
+ String connectorClassName = ApplicationRegistry.getJMXConnectorClass();
+
+ boolean saslPluginAvailable = false;
- if (securityMechanism != null)
- {
+ if ((securityMechanism != null) && (connectorClassName != null))
+ {
try
{
- // Check if the JMXMP connector is available
- Class klass = Class.forName("javax.management.remote.jmxmp.JMXMPConnector");
-
- jmxUrl = new JMXServiceURL("jmxmp", server.getHost(), server.getPort());
- env = new HashMap<String, Object>();
-
- if (MECH_CRAMMD5.equals(securityMechanism))
- {
- // For SASL/CRAM-MD5
- 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));
- env.put("jmx.remote.profiles", SASL_CRAMMD5);
- env.put("jmx.remote.sasl.callback.handler",
- new UsernameHashedPasswordCallbackHandler(server.getUser(), server.getPassword()));
- }
- else if (MECH_PLAIN.equals(securityMechanism))
- {
- // For SASL/PLAIN
- Security.addProvider(new SaslProvider());
- env.put("jmx.remote.profiles", SASL_PLAIN);
- env.put("jmx.remote.sasl.callback.handler",
- new UserPasswordCallbackHandler(server.getUser(), server.getPassword()));
- }
- else
- {
- MBeanUtility.printOutput("Security mechanism " + securityMechanism + " is not supported.");
- }
-
- // Now create the instance of JMXMPConnector
- Class[] paramTypes = {JMXServiceURL.class, Map.class};
- Constructor cons = klass.getConstructor(paramTypes);
-
- Object[] args = {jmxUrl, env};
- Object theObject = cons.newInstance(args);
-
- _jmxc = (JMXConnector)theObject;
- _jmxc.connect();
- MBeanUtility.printOutput("Starting JMXConnector with SASL. Server=" + server.getName());
+ createSASLConnector(securityMechanism, connectorClassName);
+ saslPluginAvailable = true;
}
catch (Exception ex)
{
- // When JMXMPConnector is not available
- MBeanUtility.printOutput("Starting JMXConnector. Server=" + server.getName());
- jmxUrl = new JMXServiceURL(server.getUrl());
- _jmxc = JMXConnectorFactory.connect(jmxUrl, null);
+ MBeanUtility.printStackTrace(ex);
}
}
- else
+
+ if (!saslPluginAvailable)
{
- jmxUrl = new JMXServiceURL(server.getUrl());
- _jmxc = JMXConnectorFactory.connect(jmxUrl, null);
+ _jmxUrl = new JMXServiceURL(server.getUrl());
+ _jmxc = JMXConnectorFactory.connect(_jmxUrl, null);
}
_mbsc = _jmxc.getMBeanServerConnection();
@@ -171,6 +134,53 @@ public class JMXServerRegistry extends ServerRegistry
return _mbsc;
}
+ private void createSASLConnector(String mech, String className) 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);
+
+ _jmxUrl = new JMXServiceURL("jmxmp", getManagedServer().getHost(), getManagedServer().getPort());
+ _env = new HashMap<String, Object>();
+ CallbackHandler handler;
+ if (MECH_CRAMMD5.equals(mech))
+ {
+ // For SASL/CRAM-MD5
+ 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));
+ handler = new UsernameHashedPasswordCallbackHandler(getManagedServer().getUser(),
+ getManagedServer().getPassword());
+ _env.put("jmx.remote.profiles", SASL_CRAMMD5);
+ _env.put("jmx.remote.sasl.callback.handler", handler);
+
+ }
+ else if (MECH_PLAIN.equals(mech))
+ {
+ // For SASL/PLAIN
+ Security.addProvider(new SaslProvider());
+ handler = new UserPasswordCallbackHandler(getManagedServer().getUser(), getManagedServer().getPassword());
+ _env.put("jmx.remote.profiles", SASL_PLAIN);
+ _env.put("jmx.remote.sasl.callback.handler", handler);
+ }
+ else
+ {
+ 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;
+ _jmxc.connect();
+ }
+
/**
* removes all listeners from the mbean server. This is required when user
* disconnects the Qpid server connection
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
index e5f99c2f7b..1da13a9b56 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
@@ -208,16 +208,9 @@ public class NavigationView extends ViewPart
*/
private void createRMIServerConnection(ManagedServer server) throws Exception
{
- try
- {
- // Currently Qpid Management Console only supports JMX MBeanServer
- ServerRegistry serverRegistry = new JMXServerRegistry(server);
- ApplicationRegistry.addServer(server, serverRegistry);
- }
- catch (IOException ex)
- {
- throw (Exception)ex.getCause();
- }
+ // Currently Qpid Management Console only supports JMX MBeanServer
+ ServerRegistry serverRegistry = new JMXServerRegistry(server);
+ ApplicationRegistry.addServer(server, serverRegistry);
}
/**
diff --git a/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF b/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF
index 7a9e5caaaf..ad274a8f89 100644
--- a/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF
+++ b/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF
@@ -1,19 +1,8 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Jmxmp Plug-in
-Bundle-SymbolicName: jmxremote.optional
-Bundle-Version: 1.0.1
-Bundle-ClassPath: .
-Bundle-Vendor:
-Bundle-Localization: plugin
-Export-Package: com.sun.jmx.remote.generic,
- com.sun.jmx.remote.opt.internal,
- com.sun.jmx.remote.opt.security,
- com.sun.jmx.remote.opt.util,
- com.sun.jmx.remote.profile.sasl,
- com.sun.jmx.remote.profile.tls,
- com.sun.jmx.remote.protocol.jmxmp,
- com.sun.jmx.remote.socket,
- javax.management.remote.generic,
- javax.management.remote.jmxmp,
- javax.management.remote.message
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: jmx sasl Plug-in
+Bundle-SymbolicName: jmxremote.sasl
+Bundle-Version: 1.0.1
+Bundle-ClassPath: .
+Bundle-Vendor:
+Bundle-Localization: plugin
diff --git a/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini b/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
index 1762840aff..e83321e650 100644
--- a/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini
+++ b/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.optional,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
osgi.bundles.defaultStartLevel=4