Methods Summary |
---|
public void | addRole(java.lang.String rolename)Add a new {@link Role} to those this group belongs to.
Group group = (Group) this.resource;
if (group == null) {
return;
}
Role role = group.getUserDatabase().findRole(rolename);
if (role == null) {
throw new IllegalArgumentException
("Invalid role name '" + rolename + "'");
}
group.addRole(role);
|
public java.lang.String[] | getRoles()Return the MBean Names of all authorized roles for this group.
// ------------------------------------------------------------- Attributes
Group group = (Group) this.resource;
ArrayList results = new ArrayList();
Iterator roles = group.getRoles();
while (roles.hasNext()) {
Role role = null;
try {
role = (Role) roles.next();
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), role);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for role " + role);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getUsers()Return the MBean Names of all users that are members of this group.
Group group = (Group) this.resource;
ArrayList results = new ArrayList();
Iterator users = group.getUsers();
while (users.hasNext()) {
User user = null;
try {
user = (User) users.next();
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), user);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for user " + user);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
|
public void | removeRole(java.lang.String rolename)Remove a {@link Role} from those this group belongs to.
Group group = (Group) this.resource;
if (group == null) {
return;
}
Role role = group.getUserDatabase().findRole(rolename);
if (role == null) {
throw new IllegalArgumentException
("Invalid role name '" + rolename + "'");
}
group.removeRole(role);
|