summaryrefslogtreecommitdiff
path: root/java/management/eclipse-plugin
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2011-10-21 14:42:12 +0000
committerStephen D. Huston <shuston@apache.org>2011-10-21 14:42:12 +0000
commitf83677056891e436bf5ba99e79240df2a44528cd (patch)
tree625bfd644b948e89105630759cf6decb0435354d /java/management/eclipse-plugin
parentebfd9ff053b04ab379acfc0fefedee5a31b6d8a5 (diff)
downloadqpid-python-QPID-2519.tar.gz
Merged out from trunkQPID-2519
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin')
-rw-r--r--java/management/eclipse-plugin/META-INF/MANIFEST.MF2
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java2
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXManagedObject.java29
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java25
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java2
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java132
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java199
7 files changed, 329 insertions, 62 deletions
diff --git a/java/management/eclipse-plugin/META-INF/MANIFEST.MF b/java/management/eclipse-plugin/META-INF/MANIFEST.MF
index 124fe1e767..0df308dff1 100644
--- a/java/management/eclipse-plugin/META-INF/MANIFEST.MF
+++ b/java/management/eclipse-plugin/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: Qpid JMX Management Console Plug-in
Bundle-SymbolicName: org.apache.qpid.management.ui; singleton:=true
-Bundle-Version: 0.9.0
+Bundle-Version: 0.13.0
Bundle-Activator: org.apache.qpid.management.ui.Activator
Bundle-Vendor: Apache Software Foundation
Bundle-Localization: plugin
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 20cfec3758..4a59176374 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
@@ -47,7 +47,7 @@ public abstract class ApplicationRegistry
//max supported broker management interface supported by this release of the management console
public static final int SUPPORTED_QPID_JMX_API_MAJOR_VERSION = 2;
- public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 0;
+ public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 3;
public static final String DATA_DIR = System.getProperty("user.home") + File.separator + ".qpidmc";
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXManagedObject.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXManagedObject.java
index 3561e16098..a8fb864cf6 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXManagedObject.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXManagedObject.java
@@ -21,6 +21,7 @@
package org.apache.qpid.management.ui.jmx;
import java.util.HashMap;
+import java.util.Map;
import javax.management.ObjectName;
@@ -31,14 +32,36 @@ public class JMXManagedObject extends ManagedBean
{
private ObjectName _objName;
- @SuppressWarnings("unchecked")
public JMXManagedObject(ObjectName objName)
{
super();
this._objName = objName;
setUniqueName(_objName.toString());
- setDomain(_objName.getDomain());
- super.setProperties(new HashMap(_objName.getKeyPropertyList()));
+ setDomain(_objName.getDomain());
+
+ HashMap<String,String> props = new HashMap<String,String>(_objName.getKeyPropertyList());
+
+ for(Map.Entry<String,String> entry : props.entrySet())
+ {
+ String value = entry.getValue();
+
+ if(value != null)
+ {
+ try
+ {
+ //if the name is quoted in the ObjectName, unquote it
+ value = ObjectName.unquote(value);
+ entry.setValue(value);
+ }
+ catch(IllegalArgumentException e)
+ {
+ //ignore, this just means the name is not quoted
+ //and can be left unchanged
+ }
+ }
+ }
+
+ super.setProperties(props);
}
public ObjectName getObjectName()
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java
index e42b3c53b6..35cc9f6e27 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationObject.java
@@ -61,7 +61,7 @@ public class NotificationObject
{
if (_source instanceof ObjectName)
{
- return ((ObjectName)_source).getKeyProperty("name");
+ return unquote(((ObjectName)_source).getKeyProperty("name"));
}
return null;
@@ -71,12 +71,31 @@ public class NotificationObject
{
if (_source instanceof ObjectName)
{
- return ((ObjectName)_source).getKeyProperty(VIRTUAL_HOST);
+ return unquote(((ObjectName)_source).getKeyProperty(VIRTUAL_HOST));
}
return null;
}
-
+
+ private String unquote(String value)
+ {
+ if(value != null)
+ {
+ try
+ {
+ //if the value is quoted in the ObjectName, unquote it
+ value = ObjectName.unquote(value);
+ }
+ catch(IllegalArgumentException e)
+ {
+ //ignore, this just means the value is not quoted
+ //and can be left unchanged
+ }
+ }
+
+ return value;
+ }
+
public String getMessage()
{
return _message;
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java
index 1fef89d6b5..527fc67be3 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java
@@ -131,6 +131,8 @@ public class MBeanTabFolderFactory
}
break;
case VHOST_MANAGER:
+ createAttributesTab(tabFolder, mbean);
+
tab = new TabItem(tabFolder, SWT.NONE);
tab.setText("Operations");
controller = new VHostTabControl(tabFolder, mbean, mbsc);
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java
new file mode 100644
index 0000000000..0fc94a5972
--- /dev/null
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * 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.views.users;
+
+import javax.management.MBeanOperationInfo;
+
+import org.apache.qpid.management.common.mbeans.UserManagement;
+import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation;
+import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter;
+
+/**
+ * UserManagement interface extension to provide the method signatures
+ * for old UserManagement methods no longer supported by the broker.
+ *
+ * This interface is used only for the creation of MBean proxy objects
+ * within the management console, for backwards compatibility with
+ * functionality in older broker versions.
+ */
+public interface LegacySupportingUserManagement extends UserManagement
+{
+ /**
+ * set password for user.
+ *
+ * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
+ *
+ * @deprecated since Qpid JMX API 1.7
+ *
+ * @param username The username for which the password is to be set
+ * @param password The password for the user
+ *
+ * @return The result of the operation
+ */
+ @Deprecated
+ @MBeanOperation(name = "setPassword", description = "Set password for user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
+ @MBeanOperationParameter(name = "passwd", description = "Password")char[] password);
+
+ /**
+ * Set rights for users with given details.
+ * Since Qpid JMX API 2.3 all invocations will cause an exception to be thrown
+ * as access rights can no longer be maintain via this interface.
+ *
+ * @deprecated since Qpid JMX API 2.3 / 1.12
+ *
+ * @param username The username to create
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return The result of the operation
+ */
+ @Deprecated
+ @MBeanOperation(name = "setRights", description = "Set access rights for user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean setRights(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+ /**
+ * Create users with given details.
+ * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
+ * exception will be thrown as access rights can no longer be maintain via this interface.
+ *
+ * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
+ *
+ * @deprecated since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return true if the user was created successfully, or false otherwise
+ */
+ @Deprecated
+ @MBeanOperation(name = "createUser", description = "Create new user from system.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
+ @MBeanOperationParameter(name = "passwd", description = "Password")char[] password,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+ /**
+ * Create users with given details.
+ * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
+ * exception will be thrown as access rights can no longer be maintain via this interface.
+ *
+ * @deprecated since Qpid JMX API 2.3 / 1.12
+ * @since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return true if the user was created successfully, or false otherwise
+ */
+ @Deprecated
+ @MBeanOperation(name = "createUser", description = "Create a new user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "password", description = "Password")String password,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
index fdcc25d337..2c540bf982 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
@@ -37,7 +37,6 @@ import javax.management.openmbean.TabularDataSupport;
import org.apache.qpid.management.ui.ApiVersion;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
-import org.apache.qpid.management.common.mbeans.UserManagement;
import org.apache.qpid.management.ui.jmx.JMXManagedObject;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
import org.apache.qpid.management.ui.views.TabControl;
@@ -83,7 +82,7 @@ public class UserManagementTabControl extends TabControl
private TableViewer _tableViewer = null;
private TabularDataSupport _userDetails = null;
- private UserManagement _ummb;
+ private LegacySupportingUserManagement _ummb;
private ApiVersion _ApiVersion;
public UserManagementTabControl(TabFolder tabFolder, JMXManagedObject mbean, MBeanServerConnection mbsc)
@@ -91,9 +90,9 @@ public class UserManagementTabControl extends TabControl
super(tabFolder);
_mbean = mbean;
_ApiVersion = ApplicationRegistry.getServerRegistry(mbean).getManagementApiVersion();
- _ummb = (UserManagement)
+ _ummb = (LegacySupportingUserManagement)
MBeanServerInvocationHandler.newProxyInstance(mbsc, mbean.getObjectName(),
- UserManagement.class, false);
+ LegacySupportingUserManagement.class, false);
_toolkit = new FormToolkit(_tabFolder.getDisplay());
_form = _toolkit.createScrolledForm(_tabFolder);
_form.getBody().setLayout(new GridLayout());
@@ -171,6 +170,13 @@ public class UserManagementTabControl extends TabControl
String[] titles = { "Username", "JMX Management Rights" };
int[] bounds = { 310, 200 };
+ if(!settingManagementRightsSupported())
+ {
+ //Since Qpid JMX API 2.3 / 1.12 only Username is used
+ titles = new String[]{ "Username"};
+ bounds = new int[]{ 310 };
+ }
+
for (int i = 0; i < titles.length; i++)
{
final int index = i;
@@ -214,7 +220,16 @@ public class UserManagementTabControl extends TabControl
Composite buttonsComposite = _toolkit.createComposite(tableComposite);
gridData = new GridData(SWT.FILL, SWT.TOP, false, false);
- gridData.heightHint = 165;
+ if(!settingManagementRightsSupported())
+ {
+ //The 'Set Rights' button is not shown from Qpid JMX API 2.3 / 1.12
+ //onward, provide less space
+ gridData.heightHint = 135;
+ }
+ else
+ {
+ gridData.heightHint = 165;
+ }
buttonsComposite.setLayoutData(gridData);
buttonsComposite.setLayout(new GridLayout());
@@ -292,14 +307,14 @@ public class UserManagementTabControl extends TabControl
if (returnValue == InputDialog.OK)
{
- char[] password = id.getValue().toCharArray();
+ char[] passwordArray = id.getValue().toCharArray();
// Qpid JMX API 1.1 and below expects the password to be sent as a hashed value.
if (_ApiVersion.lessThanOrEqualTo(1,1))
{
try
{
- password = ViewUtility.getHash(id.getValue());
+ passwordArray = ViewUtility.getHash(id.getValue());
}
catch (Exception hashException)
{
@@ -312,7 +327,18 @@ public class UserManagementTabControl extends TabControl
try
{
- boolean result = _ummb.setPassword(user, password);
+ boolean result;
+
+ //For Qpid JMX API >=1.7 use String based method instead of older char[] based method.
+ if(_ApiVersion.greaterThanOrEqualTo(1, 7))
+ {
+ result = _ummb.setPassword(user, id.getValue());
+ }
+ else
+ {
+ result = _ummb.setPassword(user, passwordArray);
+ }
+
ViewUtility.operationResultFeedback(result, "Updated user password", "Failed to update user password");
}
catch(Exception e2)
@@ -324,25 +350,34 @@ public class UserManagementTabControl extends TabControl
}
}
});
-
- final Button setRightsButton = _toolkit.createButton(buttonsComposite, "Set Rights ...", SWT.PUSH);
- gridData = new GridData(SWT.CENTER, SWT.BOTTOM, false, false);
- gridData.widthHint = 125;
- setRightsButton.setLayoutData(gridData);
- setRightsButton.setEnabled(false);
- setRightsButton.addSelectionListener(new SelectionAdapter()
+
+ final Button setRightsButton;
+ if(!settingManagementRightsSupported())
{
- public void widgetSelected(SelectionEvent e)
+ //The 'Set Rights' button is not used from Qpid JMX API 2.3 / 1.12 onward
+ setRightsButton = null;
+ }
+ else
+ {
+ setRightsButton = _toolkit.createButton(buttonsComposite, "Set Rights ...", SWT.PUSH);
+ gridData = new GridData(SWT.CENTER, SWT.BOTTOM, false, false);
+ gridData.widthHint = 125;
+ setRightsButton.setLayoutData(gridData);
+ setRightsButton.setEnabled(false);
+ setRightsButton.addSelectionListener(new SelectionAdapter()
{
- int selectionIndex = _table.getSelectionIndex();
-
- if (selectionIndex != -1)
+ public void widgetSelected(SelectionEvent e)
{
- setRights(setRightsButton.getShell());
+ int selectionIndex = _table.getSelectionIndex();
+
+ if (selectionIndex != -1)
+ {
+ setRights(setRightsButton.getShell());
+ }
}
- }
- });
-
+ });
+ }
+
_tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
public void selectionChanged(SelectionChangedEvent evt)
{
@@ -351,14 +386,20 @@ public class UserManagementTabControl extends TabControl
if (selectionIndex == -1)
{
deleteUsersButton.setEnabled(false);
- setRightsButton.setEnabled(false);
setPasswordButton.setEnabled(false);
+ if(setRightsButton != null)
+ {
+ setRightsButton.setEnabled(false);
+ }
return;
}
else
{
deleteUsersButton.setEnabled(true);
- setRightsButton.setEnabled(true);
+ if(setRightsButton != null)
+ {
+ setRightsButton.setEnabled(true);
+ }
}
if (_table.getSelectionCount() > 1)
@@ -386,11 +427,17 @@ public class UserManagementTabControl extends TabControl
//this only reloaded the JMX rights file before Qpid JMX API 1.2
_toolkit.createLabel(miscGroup, " Loads the current management rights file from disk");
}
- else
+ else if(settingManagementRightsSupported())
{
- //since Qpid JMX API 1.2 it also reloads the password file
+ //from Qpid JMX API 1.2 to 2.3 / 1.12 it also reloads the password file
_toolkit.createLabel(miscGroup, " Loads the current password and management rights files from disk");
}
+ else
+ {
+ //since Qpid JMX API 2.3 / 1.12 it only reloads the password file
+ _toolkit.createLabel(miscGroup, " Loads the current password data");
+ }
+
reloadUserDetails.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
@@ -453,7 +500,7 @@ public class UserManagementTabControl extends TabControl
{
case 0 : // username column
return (String) ((CompositeData) element).get(USERNAME);
- case 1 : // rights column
+ case 1 : // rights column (used for API < 2.3 / 1.12)
return classifyUserRights((CompositeData) element);
default :
return "-";
@@ -510,11 +557,11 @@ public class UserManagementTabControl extends TabControl
int comparison = 0;
switch(column)
{
- case 0:
+ case 0: //username column
comparison = String.valueOf(user1.get(USERNAME)).compareTo(
String.valueOf(user2.get(USERNAME)));
break;
- case 1:
+ case 1: // rights column (used for API < 2.3 / 1.12)
comparison = classifyUserRights(user1).compareTo(classifyUserRights(user2));
break;
default:
@@ -555,7 +602,12 @@ public class UserManagementTabControl extends TabControl
private void setRights(final Shell parent)
{
-
+ if(!settingManagementRightsSupported())
+ {
+ throw new UnsupportedOperationException("Setting management rights" +
+ " is not supported using this version of the broker management API: " + (_ApiVersion));
+ }
+
int selectionIndex = _table.getSelectionIndex();
if (selectionIndex == -1)
@@ -699,6 +751,13 @@ public class UserManagementTabControl extends TabControl
shell.open();
}
+
+ protected boolean settingManagementRightsSupported()
+ {
+ //setting management access rights was supported until Qpid JMX API 1.12 / 2.3
+ return _ApiVersion.lessThan(1,12) ||
+ (_ApiVersion.greaterThanOrEqualTo(2, 0) && _ApiVersion.lessThan(2,3));
+ }
private void addUser(final Shell parent)
{
@@ -706,7 +765,8 @@ public class UserManagementTabControl extends TabControl
Composite usernameComposite = _toolkit.createComposite(shell, SWT.NONE);
usernameComposite.setBackground(shell.getBackground());
- usernameComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ GridData usernameCompGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ usernameComposite.setLayoutData(usernameCompGridData);
usernameComposite.setLayout(new GridLayout(2,false));
_toolkit.createLabel(usernameComposite,"Username:").setBackground(shell.getBackground());
@@ -715,28 +775,45 @@ public class UserManagementTabControl extends TabControl
Composite passwordComposite = _toolkit.createComposite(shell, SWT.NONE);
passwordComposite.setBackground(shell.getBackground());
- passwordComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ GridData passwordCompGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ passwordComposite.setLayoutData(passwordCompGridData);
passwordComposite.setLayout(new GridLayout(2,false));
_toolkit.createLabel(passwordComposite,"Password:").setBackground(shell.getBackground());
final Text passwordText = new Text(passwordComposite, SWT.BORDER | SWT.PASSWORD);
passwordText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- Group buttonGroup = new Group(shell, SWT.NONE);
- buttonGroup.setText("JMX Management Rights");
- buttonGroup.setBackground(shell.getBackground());
- buttonGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- buttonGroup.setLayout(new GridLayout(4,false));
- final Button noneButton = new Button(buttonGroup, SWT.RADIO);
- noneButton.setText("No Access");
- noneButton.setSelection(true);
- final Button readButton = new Button(buttonGroup, SWT.RADIO);
- readButton.setText("Read Only");
- final Button writeButton = new Button(buttonGroup, SWT.RADIO);
- writeButton.setText("Read + Write");
- final Button adminButton = new Button(buttonGroup, SWT.RADIO);
- adminButton.setText("Admin");
+ final Button readButton;
+ final Button writeButton;
+ final Button adminButton;
+ if(settingManagementRightsSupported())
+ {
+ Group buttonGroup = new Group(shell, SWT.NONE);
+ buttonGroup.setText("JMX Management Rights");
+ buttonGroup.setBackground(shell.getBackground());
+ buttonGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ buttonGroup.setLayout(new GridLayout(4,false));
+
+ final Button noneButton = new Button(buttonGroup, SWT.RADIO);
+ noneButton.setText("No Access");
+ noneButton.setSelection(true);
+ readButton = new Button(buttonGroup, SWT.RADIO);
+ readButton.setText("Read Only");
+ writeButton = new Button(buttonGroup, SWT.RADIO);
+ writeButton.setText("Read + Write");
+ adminButton = new Button(buttonGroup, SWT.RADIO);
+ adminButton.setText("Admin");
+ }
+ else
+ {
+ readButton = null;
+ writeButton = null;
+ adminButton = null;
+ //The lack of rights settings will cause the dialog to,
+ //shrink so add width hints to the other components
+ passwordCompGridData.widthHint = 350;
+ usernameCompGridData.widthHint = 350;
+ }
Composite okCancelButtonsComp = _toolkit.createComposite(shell);
okCancelButtonsComp.setBackground(shell.getBackground());
@@ -784,22 +861,36 @@ public class UserManagementTabControl extends TabControl
return;
}
}
-
- boolean read = readButton.getSelection();
- boolean write = writeButton.getSelection();
- boolean admin = adminButton.getSelection();
+
+ //read the access rights selections if required
+ boolean read = false;
+ boolean write = false;
+ boolean admin = false;
+ if(settingManagementRightsSupported())
+ {
+ read = readButton.getSelection();
+ write = writeButton.getSelection();
+ admin = adminButton.getSelection();
+ }
shell.dispose();
try
{
boolean result = false;
- // If we have Qpid JMX API 1.7 or above, use newer createUser method with String based password.
- if (_ApiVersion.greaterThanOrEqualTo(1,7))
+
+ if (!settingManagementRightsSupported())
+ {
+ // If we have Qpid JMX API 2.3 / 1.12 or above, use newer createUser method without rights parameters.
+ result = _ummb.createUser(username, password);
+ }
+ else if (_ApiVersion.greaterThanOrEqualTo(1,7))
{
+ // If we have Qpid JMX API 1.7 or above, use newer createUser method with String based password.
result = _ummb.createUser(username, password, read, write, admin);
}
else
{
+ // Else we have Qpid JMX API 1.6 or below, use older createUser method with char[] based password.
result = _ummb.createUser(username, passwordChars, read, write, admin);
}