Fields Summary |
---|
protected org.apache.tomcat.util.modeler.Registry | registryThe configuration information registry for our managed beans. |
protected MBeanServer | mserverThe MBeanServer in which we are registered. |
protected org.apache.tomcat.util.modeler.ManagedBean | managedThe ManagedBean information describing this MBean. |
protected org.apache.tomcat.util.modeler.ManagedBean | managedGroupThe ManagedBean information describing Group MBeans. |
protected org.apache.tomcat.util.modeler.ManagedBean | managedRoleThe ManagedBean information describing Group MBeans. |
protected org.apache.tomcat.util.modeler.ManagedBean | managedUserThe ManagedBean information describing User MBeans. |
Methods Summary |
---|
public java.lang.String | createGroup(java.lang.String groupname, java.lang.String description)Create a new Group and return the corresponding MBean Name.
UserDatabase database = (UserDatabase) this.resource;
Group group = database.createGroup(groupname, description);
try {
MBeanUtils.createMBean(group);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception creating group " + group + " MBean");
iae.initCause(e);
throw iae;
}
return (findGroup(groupname));
|
public java.lang.String | createRole(java.lang.String rolename, java.lang.String description)Create a new Role and return the corresponding MBean Name.
UserDatabase database = (UserDatabase) this.resource;
Role role = database.createRole(rolename, description);
try {
MBeanUtils.createMBean(role);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception creating role " + role + " MBean");
iae.initCause(e);
throw iae;
}
return (findRole(rolename));
|
public java.lang.String | createUser(java.lang.String username, java.lang.String password, java.lang.String fullName)Create a new User and return the corresponding MBean Name.
UserDatabase database = (UserDatabase) this.resource;
User user = database.createUser(username, password, fullName);
try {
MBeanUtils.createMBean(user);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception creating user " + user + " MBean");
iae.initCause(e);
throw iae;
}
return (findUser(username));
|
public java.lang.String | findGroup(java.lang.String groupname)Return the MBean Name for the specified group name (if any);
otherwise return null .
UserDatabase database = (UserDatabase) this.resource;
Group group = database.findGroup(groupname);
if (group == null) {
return (null);
}
try {
ObjectName oname =
MBeanUtils.createObjectName(managedGroup.getDomain(), group);
return (oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for group " + group);
iae.initCause(e);
throw iae;
}
|
public java.lang.String | findRole(java.lang.String rolename)Return the MBean Name for the specified role name (if any);
otherwise return null .
UserDatabase database = (UserDatabase) this.resource;
Role role = database.findRole(rolename);
if (role == null) {
return (null);
}
try {
ObjectName oname =
MBeanUtils.createObjectName(managedRole.getDomain(), role);
return (oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for role " + role);
iae.initCause(e);
throw iae;
}
|
public java.lang.String | findUser(java.lang.String username)Return the MBean Name for the specified user name (if any);
otherwise return null .
UserDatabase database = (UserDatabase) this.resource;
User user = database.findUser(username);
if (user == null) {
return (null);
}
try {
ObjectName oname =
MBeanUtils.createObjectName(managedUser.getDomain(), user);
return (oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for user " + user);
iae.initCause(e);
throw iae;
}
|
public java.lang.String[] | getGroups()Return the MBean Names of all groups defined in this database.
// ------------------------------------------------------------- Attributes
UserDatabase database = (UserDatabase) this.resource;
ArrayList results = new ArrayList();
Iterator groups = database.getGroups();
while (groups.hasNext()) {
Group group = (Group) groups.next();
results.add(findGroup(group.getGroupname()));
}
return ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getRoles()Return the MBean Names of all roles defined in this database.
UserDatabase database = (UserDatabase) this.resource;
ArrayList results = new ArrayList();
Iterator roles = database.getRoles();
while (roles.hasNext()) {
Role role = (Role) roles.next();
results.add(findRole(role.getRolename()));
}
return ((String[]) results.toArray(new String[results.size()]));
|
public java.lang.String[] | getUsers()Return the MBean Names of all users defined in this database.
UserDatabase database = (UserDatabase) this.resource;
ArrayList results = new ArrayList();
Iterator users = database.getUsers();
while (users.hasNext()) {
User user = (User) users.next();
results.add(findUser(user.getUsername()));
}
return ((String[]) results.toArray(new String[results.size()]));
|
public void | removeGroup(java.lang.String groupname)Remove an existing group and destroy the corresponding MBean.
UserDatabase database = (UserDatabase) this.resource;
Group group = database.findGroup(groupname);
if (group == null) {
return;
}
try {
MBeanUtils.destroyMBean(group);
database.removeGroup(group);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception destroying group " + group + " MBean");
iae.initCause(e);
throw iae;
}
|
public void | removeRole(java.lang.String rolename)Remove an existing role and destroy the corresponding MBean.
UserDatabase database = (UserDatabase) this.resource;
Role role = database.findRole(rolename);
if (role == null) {
return;
}
try {
MBeanUtils.destroyMBean(role);
database.removeRole(role);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception destroying role " + role + " MBean");
iae.initCause(e);
throw iae;
}
|
public void | removeUser(java.lang.String username)Remove an existing user and destroy the corresponding MBean.
UserDatabase database = (UserDatabase) this.resource;
User user = database.findUser(username);
if (user == null) {
return;
}
try {
MBeanUtils.destroyMBean(user);
database.removeUser(user);
} catch (Exception e) {
IllegalArgumentException iae = new IllegalArgumentException
("Exception destroying user " + user + " MBean");
iae.initCause(e);
throw iae;
}
|