summaryrefslogtreecommitdiff
path: root/java/management/eclipse-plugin/src/main
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2009-02-27 20:14:07 +0000
committerRobert Gemmell <robbie@apache.org>2009-02-27 20:14:07 +0000
commit2ef0ad78f223d70b651a8409db462f3e64e074d8 (patch)
tree88db350f1e8bf29bd86d070d4dd738901985e4af /java/management/eclipse-plugin/src/main
parent7c79adf16acfeb31cd2b90699c456698237a2e82 (diff)
downloadqpid-python-2ef0ad78f223d70b651a8409db462f3e64e074d8.tar.gz
QPID-1536: modify the B64MD5 PD to take plain text input and perform the required hashing itself in order to present a consistent interface for user management. Alter management console to use mbean versioning to detect this and send plaintext to v2+ user management mbeans. Update RMIPasswordAuthenticator to make use of the new PD input consistency
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@748680 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin/src/main')
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java1
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java63
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java32
3 files changed, 72 insertions, 24 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
index 5e05375e28..be0284c047 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
@@ -32,6 +32,7 @@ public class Constants
public final static String ACTION_REMOVE_MBEANNODE = "Remove from list";
public final static String VALUE = "value";
public final static String TYPE = "type";
+ public final static String VERSION = "version";
public final static String NODE_TYPE_SERVER = "server";
public final static String NODE_TYPE_DOMAIN = "domain";
public final static String NODE_TYPE_MBEANTYPE = "mbeantype";
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java
index 31825e925d..ae01f30f32 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ManagedBean.java
@@ -20,13 +20,17 @@
*/
package org.apache.qpid.management.ui;
-import static org.apache.qpid.management.ui.Constants.*;
+import static org.apache.qpid.management.ui.Constants.ADMIN_MBEAN_TYPE;
+import static org.apache.qpid.management.ui.Constants.CONNECTION;
+import static org.apache.qpid.management.ui.Constants.DEFAULT_VH;
+import static org.apache.qpid.management.ui.Constants.EXCHANGE;
+import static org.apache.qpid.management.ui.Constants.QUEUE;
+import static org.apache.qpid.management.ui.Constants.VIRTUAL_HOST;
+
import java.util.HashMap;
/**
* Class representing a managed bean on the managed server
- * @author Bhupendra Bhardwaj
- *
*/
public abstract class ManagedBean extends ManagedObject
{
@@ -36,27 +40,50 @@ public abstract class ManagedBean extends ManagedObject
private String _virtualHostName = null;
private ManagedServer _server = null;
private HashMap _properties = null;
-
+ private int _version;
+
public String getProperty(String key)
{
- return (String)_properties.get(key);
+ return (String) _properties.get(key);
}
-
+
public HashMap getProperties()
{
return _properties;
}
+
public void setProperties(HashMap properties)
{
this._properties = properties;
setName(getProperty("name"));
setType(getProperty("type"));
+ setVersion(getProperty("version"));
_virtualHostName = getProperty(VIRTUAL_HOST);
}
+
+ public void setVersion(String version)
+ {
+ try
+ {
+ _version = Integer.parseInt(version);
+ }
+ catch (NumberFormatException nfe)
+ {
+ _version = 1;
+ }
+
+ }
+
+ public int getVersion()
+ {
+ return _version;
+ }
+
public String getDomain()
{
return _domain;
}
+
public void setDomain(String domain)
{
this._domain = domain;
@@ -66,65 +93,75 @@ public abstract class ManagedBean extends ManagedObject
{
return _server;
}
+
public void setServer(ManagedServer server)
{
this._server = server;
}
+
public String getType()
{
return _type;
}
+
public void setType(String type)
{
this._type = type;
}
+
public String getUniqueName()
{
return _uniqueName;
}
+
public void setUniqueName(String uniqueName)
{
this._uniqueName = uniqueName;
}
-
+
public String getVirtualHostName()
{
// To make it work with the broker with no virtual host implementation
return _virtualHostName == null ? DEFAULT_VH : _virtualHostName;
}
-
+
/**
* Returns mbean instance name. MBeans which have only one instance, the type attribute will be returned
+ *
* @return
*/
public String getInstanceName()
{
if (getName() != null)
+ {
return getName();
+ }
else
+ {
return getType();
+ }
}
-
+
public boolean isQueue()
{
return _type.endsWith(QUEUE);
}
-
+
public boolean isConnection()
{
return _type.endsWith(CONNECTION);
}
-
+
public boolean isExchange()
{
return _type.endsWith(EXCHANGE);
}
-
+
public boolean isTempQueue()
{
return (isQueue() && getName().startsWith("tmp_"));
}
-
+
public boolean isAdmin()
{
return _type.endsWith(ADMIN_MBEAN_TYPE);
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 eba8d9caa5..11df1b6f00 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
@@ -33,8 +33,6 @@ import static org.apache.qpid.management.ui.Constants.*;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
-import org.apache.qpid.management.ui.ServerRegistry;
-import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
import org.apache.qpid.management.ui.model.OperationData;
import org.apache.qpid.management.ui.model.ParameterData;
@@ -69,8 +67,6 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* Control class for the MBean operations tab. It creates the required widgets
* for the selected MBean.
- * @author Bhupendra Bhardwaj
- * @author Robert Gemmell
*/
public class OperationTabControl extends TabControl
{
@@ -605,23 +601,37 @@ public class OperationTabControl extends TabControl
return;
}
- // customized for passwords
- if (PASSWORD.equalsIgnoreCase(param.getName()))
+ //Custom handling for the PASSWORD field
+ if (param.getName().equalsIgnoreCase(PASSWORD))
{
+ //Convert the String value to a character array if that is what is required.
if (param.getType().equals("[C"))
{
- try
+ // Retreive the mBean type and version.
+ // If we have a version 1 UserManagement class mbean then it expects the password
+ // to be sent as the hashed version.
+ if (_mbean.getType().equals("UserManagement") && _mbean.getVersion() == 1)
{
- param.setValue(ViewUtility.getHash((String)param.getValue()));
+ try
+ {
+ param.setValue(ViewUtility.getHash((String) param.getValue()));
+ }
+ catch (Exception hashException)
+ {
+ ViewUtility.popupErrorMessage(_form.getText(),
+ "Unable to calculate hash for Password:"
+ + hashException.getMessage());
+ return;
+ }
}
- catch (Exception ex)
+ else
{
- MBeanUtility.handleException(_mbean, ex);
- return;
+ param.setValue(((String) param.getValue()).toCharArray());
}
}
}
// end of customization
+
}
}