## org.apache.catalina
Interface UserDatabase

All Known Implementing Classes:
  MemoryUserDatabase

public interface UserDatabase

Abstract representation of a database of `User`s and `Group`s that can be maintained by an application, along with definitions of corresponding `Role`s, and referenced by a `Realm` for authentication and access control.

Since:
  4.1
Version:
  $Revision: 466595 $ $Date: 2006-10-21 18:24:41 -0400 (Sat, 21 Oct 2006) $
Author:
  Craig R. McClanahan

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 `Group` defined in this user database.
`Role` `createRole(java.lang.String rolename, java.lang.String description)` Create and return a new `Role` defined in this user database.
`User` `createUser(java.lang.String username, java.lang.String password, java.lang.String fullName)` Create and return a new `User` defined in this user database.
`Group` `findGroup(java.lang.String groupname)` Return the `Group` with the specified group name, if any; otherwise return `null`.
`Role` `findRole(java.lang.String rolename)` Return the `Role` with the specified role name, if any; otherwise return `null`.
`User` `findUser(java.lang.String username)` Return the `User` with the specified user name, if any; otherwise return `null`.
`java.util.Iterator` `getGroups()` Return the set of `Group`s defined in this user database.
`java.lang.String` `getId()` Return the unique global identifier of this user database.
`java.util.Iterator` `getRoles()` Return the set of `Role`s defined in this user database.
`java.util.Iterator` `getUsers()` Return the set of `User`s defined in this user database.
`void` `open()` Initialize access to this user database.
`void` `removeGroup(Group group)` Remove the specified `Group` from this user database.
`void` `removeRole(Role role)` Remove the specified `Role` from this user database.
`void` `removeUser(User user)` Remove the specified `User` from this user database.
`void` `save()` Save any updated information to the persistent storage location for this user database.

Method Detail

### getGroups

    public java.util.Iterator getGroups()

  Return the set of `Group`s defined in this user database.

### getId

    public java.lang.String getId()

  Return the unique global identifier of this user database.

### getRoles

    public java.util.Iterator getRoles()

  Return the set of `Role`s defined in this user database.

### getUsers

    public java.util.Iterator getUsers()

  Return the set of `User`s defined in this user database.

### close

    public void close()
               throws java.lang.Exception

  Finalize access to this user database.

  Throws:
    `java.lang.Exception` - if any exception is thrown during closing

### createGroup

    public Group createGroup(java.lang.String groupname,
                             java.lang.String description)

  Create and return a new `Group` defined in this user database.

  Parameters:
    `groupname` - The group name of the new group (must be unique)
    `description` - The description of this group

### createRole

    public Role createRole(java.lang.String rolename,
                           java.lang.String description)

  Create and return a new `Role` defined in this user database.

  Parameters:
    `rolename` - The role name of the new role (must be unique)
    `description` - The description of this role

### createUser

    public User createUser(java.lang.String username,
                           java.lang.String password,
                           java.lang.String fullName)

  Create and return a new `User` defined in this user database.

  Parameters:
    `username` - The logon username of the new user (must be unique)
    `password` - The logon password of the new user
    `fullName` - The full name of the new user

### findGroup

    public Group findGroup(java.lang.String groupname)

  Return the `Group` with the specified group name, if any; otherwise return `null`.

  Parameters:
    `groupname` - Name of the group to return

### findRole

    public Role findRole(java.lang.String rolename)

  Return the `Role` with the specified role name, if any; otherwise return `null`.

  Parameters:
    `rolename` - Name of the role to return

### findUser

    public User findUser(java.lang.String username)

  Return the `User` with the specified user name, if any; otherwise return `null`.

  Parameters:
    `username` - Name of the user to return

### open

    public void open()
              throws java.lang.Exception

  Initialize access to this user database.

  Throws:
    `java.lang.Exception` - if any exception is thrown during opening

### removeGroup

    public void removeGroup(Group group)

  Remove the specified `Group` from this user database.

  Parameters:
    `group` - The group to be removed

### removeRole

    public void removeRole(Role role)

  Remove the specified `Role` from this user database.

  Parameters:
    `role` - The role to be removed

### removeUser

    public void removeUser(User user)

  Remove the specified `User` from this user database.

  Parameters:
    `user` - The user to be removed

### save

    public void save()
              throws java.lang.Exception

  Save any updated information to the persistent storage location for this user database.

  Throws:
    `java.lang.Exception` - if any exception is thrown during saving

Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.