diff options
| author | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2007-05-02 14:19:52 +0000 |
|---|---|---|
| committer | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2007-05-02 14:19:52 +0000 |
| commit | 42a5d17829488ac72117e763d9f2d1b83a577cc2 (patch) | |
| tree | 197514040c84561e9337c4ea1654b3a7ea3b9844 /java/management/eclipse-plugin | |
| parent | 3739a1e857f826d6530ca234a9ac22fe13ca04e8 (diff) | |
| download | qpid-python-42a5d17829488ac72117e763d9f2d1b83a577cc2.tar.gz | |
Exchange MBeans updated - init method moved to super class.
Exception handling of management console updated for SecurityException.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@534473 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin')
5 files changed, 82 insertions, 76 deletions
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 f6eace3101..0ad85dbf33 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 @@ -106,7 +106,7 @@ public abstract class ApplicationRegistry public static ServerRegistry getServerRegistry(ManagedBean mbean) { ManagedServer server = mbean.getServer(); - return _serverRegistryMap.get(server); + return getServerRegistry(server); } public static boolean isServerConnected(ManagedServer server) @@ -118,7 +118,7 @@ public abstract class ApplicationRegistry public static void serverConnectionClosed(ManagedServer server) { _closedServerList.add(server); - _serverRegistryMap.remove(server); + removeServer(server); } /* 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 f70452dd42..53aa927299 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 @@ -22,6 +22,8 @@ package org.apache.qpid.management.ui.actions; import static org.apache.qpid.management.ui.Constants.ERROR_SERVER_CONNECTION; +import java.io.IOException; + import org.apache.qpid.management.ui.ApplicationRegistry; import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor; import org.apache.qpid.management.ui.Constants; @@ -75,8 +77,27 @@ public class AbstractAction MBeanUtility.printStackTrace(ex); if (msg == null) { - msg = ex.getMessage(); + if (ex instanceof IOException) + { + if ((ex.getMessage() != null) && (ex.getMessage().indexOf(RMI_SASL_ERROR) != -1)) + { + msg = SECURITY_FAILURE; + } + else + { + msg = SERVER_UNAVAILABLE; + } + } + else if (ex instanceof SecurityException) + { + msg = SECURITY_FAILURE; + } + else + { + msg = ex.getMessage(); + } } + if ((msg == null) && (ex.getCause() != null)) { msg = ex.getCause().getMessage(); 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 c13f54929d..7a36ca6160 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,8 +22,6 @@ 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.NumberVerifyListener; @@ -63,37 +61,26 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD public void run(IAction action) { - if(_window != null) - { - reset(); - createAddServerPopup(); - try - { - if (_addServer) - { - getNavigationView().addNewServer(_transport, _host, Integer.parseInt(_port), _domain, _user, _password); - } - } - catch(InfoRequiredException ex) - { - 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) + if(_window == null) + return; + + reset(); + createAddServerPopup(); + try + { + if (_addServer) { - handleException(ex, null, null); + getNavigationView().addNewServer(_transport, _host, Integer.parseInt(_port), _domain, _user, _password); } } + catch(InfoRequiredException ex) + { + ViewUtility.popupInfoMessage(ACTION_ADDSERVER, ex.getMessage()); + } + catch (Exception ex) + { + handleException(ex, null, null); + } } private void reset() 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 609484a557..dd9e792912 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,8 +27,6 @@ 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; @@ -58,45 +56,34 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA public void run(IAction action) { - if(_window != null) - { - try - { - reset(); - // Check if a server node is selected to be reconnected. - TreeObject serverNode = getNavigationView().getSelectedServerNode(); - _serverName = serverNode.getName(); - _title = ACTION_LOGIN + " (" + _serverName + ")"; - - // Get the login details(username/password) - createLoginPopup(); - - if (_connect) - { - // Connect the server - getNavigationView().reconnect(_user, _password); - } - } - catch(InfoRequiredException ex) - { - 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) + if(_window == null) + return; + + try + { + reset(); + // Check if a server node is selected to be reconnected. + TreeObject serverNode = getNavigationView().getSelectedServerNode(); + _serverName = serverNode.getName(); + _title = ACTION_LOGIN + " (" + _serverName + ")"; + + // Get the login details(username/password) + createLoginPopup(); + + if (_connect) { - handleException(ex, null, null); + // Connect the server + getNavigationView().reconnect(_user, _password); } } + catch(InfoRequiredException ex) + { + ViewUtility.popupInfoMessage("Reconnect Qpid server", ex.getMessage()); + } + catch (Exception ex) + { + handleException(ex, null, null); + } } private void reset() 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 f97568e275..f671a1dc9a 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 @@ -65,6 +65,7 @@ public class JMXServerRegistry extends ServerRegistry private JMXServiceURL _jmxUrl = null; private JMXConnector _jmxc = null; private MBeanServerConnection _mbsc = null; + private Exception _connectionException = null; private List<String> _usersList; // When an mbean gets removed from mbean server, then the notification listener @@ -175,9 +176,16 @@ public class JMXServerRegistry extends ServerRegistry long timeNow = System.currentTimeMillis(); connectorThread.join(ApplicationRegistry.timeout); - if (!_connected && (System.currentTimeMillis() - timeNow >= ApplicationRegistry.timeout)) + if (_connectionException != null) { - throw new Exception("Qpid server connection timed out"); + throw _connectionException; + } + if (!_connected) + { + if (System.currentTimeMillis() - timeNow >= ApplicationRegistry.timeout) + throw new Exception("Qpid server connection timed out"); + else + throw new Exception("Qpid server connection failed"); } } @@ -188,11 +196,14 @@ public class JMXServerRegistry extends ServerRegistry try { _connected = false; + _connectionException = null; + _jmxc.connect(); _connected = true; } catch (Exception ex) { + _connectionException = ex; MBeanUtility.printStackTrace(ex); } } @@ -205,10 +216,10 @@ public class JMXServerRegistry extends ServerRegistry { try { - if (_jmxc != null) + if (_jmxc != null && _clientListener != null) _jmxc.removeConnectionNotificationListener(_clientListener); - if (_mbsc != null) + if (_mbsc != null && _clientListener != null) _mbsc.removeNotificationListener(_serverObjectName, _clientListener); // remove mbean notification listeners @@ -219,7 +230,7 @@ public class JMXServerRegistry extends ServerRegistry } catch (ListenerNotFoundException ex) { - System.out.println(ex.toString()); + MBeanUtility.printOutput(ex.toString()); } } |
