diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-05-03 13:47:43 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-05-03 13:47:43 +0000 |
| commit | a5ac90d02dbaebe2a7ec76841f4541f34912581a (patch) | |
| tree | 710c2a0e32452eb22353ee64f23fe8617d5271ae /java/management | |
| parent | 49c6109ef7370409c93bc35b6a9ddf58e6fca465 (diff) | |
| download | qpid-python-a5ac90d02dbaebe2a7ec76841f4541f34912581a.tar.gz | |
Merged revisions 534473-534477,534479-534763 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r534473 | bhupendrab | 2007-05-02 15:19:52 +0100 (Wed, 02 May 2007) | 2 lines
Exchange MBeans updated - init method moved to super class.
Exception handling of management console updated for SecurityException.
........
r534763 | bhupendrab | 2007-05-03 10:35:11 +0100 (Thu, 03 May 2007) | 1 line
Management console users list display is updated.
........
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@534859 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management')
7 files changed, 94 insertions, 81 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()); } } diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java index bd168ed24e..f5b4a22e03 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java @@ -749,7 +749,10 @@ public class OperationTabControl extends TabControl List<String> list = new ArrayList<String>(); for (CompositeData data : records) { - list.add(data.get(USERNAME).toString()); + if (data.containsKey(USERNAME)) + { + list.add(data.get(USERNAME).toString()); + } } return list; diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java index 89ab360937..4f2b70f869 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java @@ -335,11 +335,15 @@ public class ViewUtility if (data.containsKey("MimeType")) { mimeType = (String)data.get("MimeType"); + } + if (data.containsKey("Encoding")) + { encoding = (String)data.get("Encoding"); - if (encoding == null || encoding.length() == 0) - { - encoding = Charset.defaultCharset().name(); - } + } + + if (encoding == null || encoding.length() == 0) + { + encoding = Charset.defaultCharset().name(); } if ("text/plain".equals(mimeType)) |
