| 
 | Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.users.MemoryUserDatabase
public class MemoryUserDatabase
Concrete implementation of UserDatabase that loads all
 defined users, groups, and roles into an in-memory data structure,
 and uses a specified XML file for its persistent storage.
| Field Summary | |
|---|---|
| protected  java.util.HashMap | groupsThe set of Groups defined in this database, keyed by
 group name. | 
| protected  java.lang.String | idThe unique global identifier of this user database. | 
| protected  java.lang.String | pathnameThe relative (to catalina.base) or absolute pathname to
 the XML file in which we will save our persistent information. | 
| protected  java.lang.String | pathnameNewThe relative or absolute pathname ot the file in which we write our new information prior to renaming. | 
| protected  java.lang.String | pathnameOldThe relative or absolute pathname to the file in which our old information is stored while renaming is in progress. | 
| protected  boolean | readonlyA flag, indicating if the user database is read only. | 
| protected  java.util.HashMap | rolesThe set of Roles defined in this database, keyed by
 role name. | 
| protected  java.util.HashMap | usersThe set of Users defined in this database, keyed by
 user name. | 
| Constructor Summary | |
|---|---|
| MemoryUserDatabase()Create a new instance with default values. | |
| MemoryUserDatabase(java.lang.String id)Create a new instance with the specified values. | |
| Method Summary | |
|---|---|
|  void | close()Finalize access to this user database. | 
|  Group | createGroup(java.lang.String groupname,
            java.lang.String description)Create and return a new Groupdefined in this user database. | 
|  Role | createRole(java.lang.String rolename,
           java.lang.String description)Create and return a new Roledefined in this user database. | 
|  User | createUser(java.lang.String username,
           java.lang.String password,
           java.lang.String fullName)Create and return a new Userdefined in this user database. | 
|  Group | findGroup(java.lang.String groupname)Return the Groupwith the specified group name, if any;
 otherwise returnnull. | 
|  Role | findRole(java.lang.String rolename)Return the Rolewith the specified role name, if any;
 otherwise returnnull. | 
|  User | findUser(java.lang.String username)Return the Userwith the specified user name, if any;
 otherwise returnnull. | 
|  java.util.Iterator | getGroups()Return the set of Groups defined in this user database. | 
|  java.lang.String | getId()Return the unique global identifier of this user database. | 
|  java.lang.String | getPathname()Return the relative or absolute pathname to the persistent storage file. | 
|  boolean | getReadonly()Returning the readonly status of the user database | 
|  java.util.Iterator | getRoles()Return the set of Roles defined in this user database. | 
|  java.util.Iterator | getUsers()Return the set of Users defined in this user database. | 
|  boolean | isWriteable()Check for permissions to save this user database to persistent storage location | 
|  void | open()Initialize access to this user database. | 
|  void | removeGroup(Group group)Remove the specified Groupfrom this user database. | 
|  void | removeRole(Role role)Remove the specified Rolefrom this user database. | 
|  void | removeUser(User user)Remove the specified Userfrom this user database. | 
|  void | save()Save any updated information to the persistent storage location for this user database. | 
|  void | setPathname(java.lang.String pathname)Set the relative or absolute pathname to the persistent storage file. | 
|  void | setReadonly(boolean readonly)Setting the readonly status of the user database | 
|  java.lang.String | toString()Return a String representation of this UserDatabase. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected java.util.HashMap groups
Groups defined in this database, keyed by
 group name.
protected java.lang.String id
protected java.lang.String pathname
catalina.base) or absolute pathname to
 the XML file in which we will save our persistent information.
protected java.lang.String pathnameOld
protected java.lang.String pathnameNew
protected boolean readonly
protected java.util.HashMap roles
Roles defined in this database, keyed by
 role name.
protected java.util.HashMap users
Users defined in this database, keyed by
 user name.
| Constructor Detail | 
|---|
public MemoryUserDatabase()
public MemoryUserDatabase(java.lang.String id)
id - Unique global identifier of this user database| Method Detail | 
|---|
public java.util.Iterator getGroups()
Groups defined in this user database.
getGroups in interface UserDatabasepublic java.lang.String getId()
getId in interface UserDatabasepublic java.lang.String getPathname()
public void setPathname(java.lang.String pathname)
pathname - The new pathnamepublic boolean getReadonly()
public void setReadonly(boolean readonly)
readonly - the new statuspublic java.util.Iterator getRoles()
Roles defined in this user database.
getRoles in interface UserDatabasepublic java.util.Iterator getUsers()
Users defined in this user database.
getUsers in interface UserDatabase
public void close()
           throws java.lang.Exception
close in interface UserDatabasejava.lang.Exception - if any exception is thrown during closing
public Group createGroup(java.lang.String groupname,
                         java.lang.String description)
Group defined in this user database.
createGroup in interface UserDatabasegroupname - The group name of the new group (must be unique)description - The description of this group
public Role createRole(java.lang.String rolename,
                       java.lang.String description)
Role defined in this user database.
createRole in interface UserDatabaserolename - The role name of the new group (must be unique)description - The description of this group
public User createUser(java.lang.String username,
                       java.lang.String password,
                       java.lang.String fullName)
User defined in this user database.
createUser in interface UserDatabaseusername - The logon username of the new user (must be unique)password - The logon password of the new userfullName - The full name of the new userpublic Group findGroup(java.lang.String groupname)
Group with the specified group name, if any;
 otherwise return null.
findGroup in interface UserDatabasegroupname - Name of the group to returnpublic Role findRole(java.lang.String rolename)
Role with the specified role name, if any;
 otherwise return null.
findRole in interface UserDatabaserolename - Name of the role to returnpublic User findUser(java.lang.String username)
User with the specified user name, if any;
 otherwise return null.
findUser in interface UserDatabaseusername - Name of the user to return
public void open()
          throws java.lang.Exception
open in interface UserDatabasejava.lang.Exception - if any exception is thrown during openingpublic void removeGroup(Group group)
Group from this user database.
removeGroup in interface UserDatabasegroup - The group to be removedpublic void removeRole(Role role)
Role from this user database.
removeRole in interface UserDatabaserole - The role to be removedpublic void removeUser(User user)
User from this user database.
removeUser in interface UserDatabaseuser - The user to be removedpublic boolean isWriteable()
public void save()
          throws java.lang.Exception
save in interface UserDatabasejava.lang.Exception - if any exception is thrown during savingpublic java.lang.String toString()
toString in class java.lang.Object| 
 | Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||