Package org.apache.catalina.mbeans
Class SparseUserDatabaseMBean
- java.lang.Object
-
- org.apache.tomcat.util.modeler.BaseModelMBean
-
- org.apache.catalina.mbeans.SparseUserDatabaseMBean
-
- All Implemented Interfaces:
javax.management.DynamicMBean
,javax.management.MBeanRegistration
,javax.management.modelmbean.ModelMBeanNotificationBroadcaster
,javax.management.NotificationBroadcaster
- Direct Known Subclasses:
MemoryUserDatabaseMBean
public class SparseUserDatabaseMBean extends BaseModelMBean
A ModelMBean implementation for the
org.apache.catalina.users.SparseUserDatabase
component. The main difference is that the MBeans are created on demand (for example, the findUser method would register the corresponding user and make it available for management. All the MBeans created for users, groups and roles are then discarded when save is invoked.- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description protected ManagedBean
managed
TheManagedBean
information describing this MBean.protected ManagedBean
managedGroup
TheManagedBean
information describing Group MBeans.protected ManagedBean
managedRole
TheManagedBean
information describing Group MBeans.protected ManagedBean
managedUser
TheManagedBean
information describing User MBeans.protected javax.management.MBeanServer
mserver
TheMBeanServer
for this application.protected Registry
registry
The configuration information registry for our managed beans.-
Fields inherited from class org.apache.tomcat.util.modeler.BaseModelMBean
attributeBroadcaster, generalBroadcaster, managedBean, oname, resource, resourceType
-
-
Constructor Summary
Constructors Constructor Description SparseUserDatabaseMBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
createGroup(java.lang.String groupname, java.lang.String description)
Create a new Group and return the corresponding MBean Name.java.lang.String
createRole(java.lang.String rolename, java.lang.String description)
Create a new Role and return the corresponding MBean Name.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.java.lang.String
findGroup(java.lang.String groupname)
Return the MBean Name for the specified group name (if any); otherwise returnnull
.java.lang.String
findRole(java.lang.String rolename)
Return the MBean Name for the specified role name (if any); otherwise returnnull
.java.lang.String
findUser(java.lang.String username)
Return the MBean Name for the specified user name (if any); otherwise returnnull
.java.lang.String[]
getGroups()
java.lang.String[]
getRoles()
java.lang.String[]
getUsers()
void
removeGroup(java.lang.String groupname)
Remove an existing group and destroy the corresponding MBean.void
removeRole(java.lang.String rolename)
Remove an existing role and destroy the corresponding MBean.void
removeUser(java.lang.String username)
Remove an existing user and destroy the corresponding MBean.void
save()
Call actual save and unregister all obsolete beans.-
Methods inherited from class org.apache.tomcat.util.modeler.BaseModelMBean
addAttributeChangeNotificationListener, addNotificationListener, getAttribute, getAttributes, getClassName, getJmxName, getManagedResource, getMBeanInfo, getModelerType, getNotificationInfo, getObjectName, invoke, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedBean, setManagedResource, toString
-
-
-
-
Field Detail
-
registry
protected final Registry registry
The configuration information registry for our managed beans.
-
mserver
protected final javax.management.MBeanServer mserver
TheMBeanServer
for this application.
-
managed
protected final ManagedBean managed
TheManagedBean
information describing this MBean.
-
managedGroup
protected final ManagedBean managedGroup
TheManagedBean
information describing Group MBeans.
-
managedRole
protected final ManagedBean managedRole
TheManagedBean
information describing Group MBeans.
-
managedUser
protected final ManagedBean managedUser
TheManagedBean
information describing User MBeans.
-
-
Method Detail
-
getGroups
public java.lang.String[] getGroups()
- Returns:
- the MBean Names of all groups defined in this database.
-
getRoles
public java.lang.String[] getRoles()
- Returns:
- the MBean Names of all roles defined in this database.
-
getUsers
public java.lang.String[] getUsers()
- Returns:
- the MBean Names of all users defined in this database.
-
createGroup
public java.lang.String createGroup(java.lang.String groupname, java.lang.String description)
Create a new Group and return the corresponding MBean Name.- Parameters:
groupname
- Group name of the new groupdescription
- Description of the new group- Returns:
- the new group object name
-
createRole
public java.lang.String createRole(java.lang.String rolename, java.lang.String description)
Create a new Role and return the corresponding MBean Name.- Parameters:
rolename
- Group name of the new groupdescription
- Description of the new group- Returns:
- the new role object name
-
createUser
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.- Parameters:
username
- User name of the new userpassword
- Password for the new userfullName
- Full name for the new user- Returns:
- the new user object name
-
findGroup
public java.lang.String findGroup(java.lang.String groupname)
Return the MBean Name for the specified group name (if any); otherwise returnnull
.- Parameters:
groupname
- Group name to look up- Returns:
- the group object name
-
findRole
public java.lang.String findRole(java.lang.String rolename)
Return the MBean Name for the specified role name (if any); otherwise returnnull
.- Parameters:
rolename
- Role name to look up- Returns:
- the role object name
-
findUser
public java.lang.String findUser(java.lang.String username)
Return the MBean Name for the specified user name (if any); otherwise returnnull
.- Parameters:
username
- User name to look up- Returns:
- the user object name
-
removeGroup
public void removeGroup(java.lang.String groupname)
Remove an existing group and destroy the corresponding MBean.- Parameters:
groupname
- Group name to remove
-
removeRole
public void removeRole(java.lang.String rolename)
Remove an existing role and destroy the corresponding MBean.- Parameters:
rolename
- Role name to remove
-
removeUser
public void removeUser(java.lang.String username)
Remove an existing user and destroy the corresponding MBean.- Parameters:
username
- User name to remove
-
save
public void save()
Call actual save and unregister all obsolete beans.
-
-