Package org.apache.catalina.users
Class DataSourceUserDatabase
java.lang.Object
org.apache.catalina.users.SparseUserDatabase
org.apache.catalina.users.DataSourceUserDatabase
- All Implemented Interfaces:
- UserDatabase
UserDatabase backed by a data source.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final ConcurrentHashMap<String,Group> protected final ConcurrentHashMap<String,Role> protected final ConcurrentHashMap<String,User> protected final DataSourceDataSource to use.protected StringThe name of the JNDI JDBC DataSourceprotected StringThe column in the user group table that names a groupprotected StringThe table that holds the relation between groups and rolesprotected StringThe table that holds user data.protected final StringThe unique global identifier of this user database.protected final ConcurrentHashMap<String,Group> protected final ConcurrentHashMap<String,Role> protected final ConcurrentHashMap<String,User> protected booleanA flag, indicating if the user database is read only.protected final ConcurrentHashMap<String,Group> protected final ConcurrentHashMap<String,Role> protected final ConcurrentHashMap<String,User> protected StringThe column in the role and group tables for the descriptionprotected StringThe column in the user role table that names a roleprotected StringThe table that holds user data.protected StringThe column in the user table that holds the user's credentialsprotected StringThe column in the user table that holds the user's full nameprotected StringThe table that holds the relation between users and groupsprotected StringThe column in the user table that holds the user's nameprotected StringThe table that holds the relation between users and rolesprotected StringThe table that holds user data.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Finalize access to this user database.protected voidcloseConnection(Connection dbConnection) Close the specified database connection.createGroup(String groupname, String description) Create and return a newGroupdefined in this user database.createRole(String rolename, String description) Create and return a newRoledefined in this user database.createUser(String username, String password, String fullName) Create and return a newUserdefined in this user database.findGroupInternal(Connection dbConnection, String groupName) findRoleInternal(Connection dbConnection, String roleName) findUserInternal(Connection dbConnection, String userName) getId()booleangetRoles()getUsers()booleanIs the database available.protected booleanOnly use groups if the tables are fully defined.protected booleanOnly use roles if the tables are fully defined.voidmodifiedGroup(Group group) Signal the specifiedGroupfrom this user database has been modified.voidmodifiedRole(Role role) Signal the specifiedRolefrom this user database has been modified.voidmodifiedUser(User user) Signal the specifiedUserfrom this user database has been modified.voidopen()Initialize access to this user database.protected ConnectionOpen the specified database connection.voidremoveGroup(Group group) Remove the specifiedGroupfrom this user database.voidremoveRole(Role role) Remove the specifiedRolefrom this user database.voidremoveUser(User user) Remove the specifiedUserfrom this user database.voidsave()Save any updated information to the persistent storage location for this user database.protected voidsaveInternal(Connection dbConnection) voidsetDataSourceName(String dataSourceName) Set the name of the JNDI JDBC DataSource.voidsetGroupNameCol(String groupNameCol) voidsetGroupRoleTable(String groupRoleTable) voidsetGroupTable(String groupTable) voidsetReadonly(boolean readonly) voidsetRoleAndGroupDescriptionCol(String roleAndGroupDescriptionCol) voidsetRoleNameCol(String roleNameCol) Set the column in the user role table that names a role.voidsetRoleTable(String roleTable) voidsetUserCredCol(String userCredCol) Set the column in the user table that holds the user's credentials.voidsetUserFullNameCol(String userFullNameCol) voidsetUserGroupTable(String userGroupTable) voidsetUserNameCol(String userNameCol) Set the column in the user table that holds the user's name.voidsetUserRoleTable(String userRoleTable) Set the table that holds the relation between user's and roles.voidsetUserTable(String userTable) Set the table that holds user data.Methods inherited from class org.apache.catalina.users.SparseUserDatabaseisSparseMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.catalina.UserDatabasebackgroundProcess
- 
Field Details- 
dataSourceDataSource to use.
- 
idThe unique global identifier of this user database.
- 
createdUsers
- 
modifiedUsers
- 
removedUsers
- 
createdGroups
- 
modifiedGroups
- 
removedGroups
- 
createdRoles
- 
modifiedRoles
- 
removedRoles
- 
dataSourceNameThe name of the JNDI JDBC DataSource
- 
roleNameColThe column in the user role table that names a role
- 
roleAndGroupDescriptionColThe column in the role and group tables for the description
- 
groupNameColThe column in the user group table that names a group
- 
userCredColThe column in the user table that holds the user's credentials
- 
userFullNameColThe column in the user table that holds the user's full name
- 
userNameColThe column in the user table that holds the user's name
- 
userRoleTableThe table that holds the relation between users and roles
- 
userGroupTableThe table that holds the relation between users and groups
- 
groupRoleTableThe table that holds the relation between groups and roles
- 
userTableThe table that holds user data.
- 
groupTableThe table that holds user data.
- 
roleTableThe table that holds user data.
- 
readonlyprotected boolean readonlyA flag, indicating if the user database is read only.
 
- 
- 
Constructor Details- 
DataSourceUserDatabase
 
- 
- 
Method Details- 
getDataSourceName- Returns:
- the name of the JNDI JDBC DataSource.
 
- 
setDataSourceNameSet the name of the JNDI JDBC DataSource.- Parameters:
- dataSourceName- the name of the JNDI JDBC DataSource
 
- 
getRoleNameCol- Returns:
- the column in the user role table that names a role.
 
- 
setRoleNameColSet the column in the user role table that names a role.- Parameters:
- roleNameCol- The column name
 
- 
getUserCredCol- Returns:
- the column in the user table that holds the user's credentials.
 
- 
setUserCredColSet the column in the user table that holds the user's credentials.- Parameters:
- userCredCol- The column name
 
- 
getUserNameCol- Returns:
- the column in the user table that holds the user's name.
 
- 
setUserNameColSet the column in the user table that holds the user's name.- Parameters:
- userNameCol- The column name
 
- 
getUserRoleTable- Returns:
- the table that holds the relation between user's and roles.
 
- 
setUserRoleTableSet the table that holds the relation between user's and roles.- Parameters:
- userRoleTable- The table name
 
- 
getUserTable- Returns:
- the table that holds user data..
 
- 
setUserTableSet the table that holds user data.- Parameters:
- userTable- The table name
 
- 
getRoleAndGroupDescriptionCol- Returns:
- the roleAndGroupDescriptionCol
 
- 
setRoleAndGroupDescriptionCol- Parameters:
- roleAndGroupDescriptionCol- the roleAndGroupDescriptionCol to set
 
- 
getGroupNameCol- Returns:
- the groupNameCol
 
- 
setGroupNameCol- Parameters:
- groupNameCol- the groupNameCol to set
 
- 
getUserFullNameCol- Returns:
- the userFullNameCol
 
- 
setUserFullNameCol- Parameters:
- userFullNameCol- the userFullNameCol to set
 
- 
getUserGroupTable- Returns:
- the userGroupTable
 
- 
setUserGroupTable- Parameters:
- userGroupTable- the userGroupTable to set
 
- 
getGroupRoleTable- Returns:
- the groupRoleTable
 
- 
setGroupRoleTable- Parameters:
- groupRoleTable- the groupRoleTable to set
 
- 
getGroupTable- Returns:
- the groupTable
 
- 
setGroupTable- Parameters:
- groupTable- the groupTable to set
 
- 
getRoleTable- Returns:
- the roleTable
 
- 
setRoleTable- Parameters:
- roleTable- the roleTable to set
 
- 
getReadonlypublic boolean getReadonly()- Returns:
- the readonly
 
- 
setReadonlypublic void setReadonly(boolean readonly) - Parameters:
- readonly- the readonly to set
 
- 
getId- Returns:
- the unique global identifier of this user database.
 
- 
getGroups- Returns:
- the set of Groups defined in this user database.
 
- 
getRoles- Returns:
- the set of Roles defined in this user database.
 
- 
getUsers- Returns:
- the set of Users defined in this user database.
 
- 
closeDescription copied from interface:UserDatabaseFinalize access to this user database.- Throws:
- Exception- if any exception is thrown during closing
 
- 
createGroupDescription copied from interface:UserDatabaseCreate and return a newGroupdefined in this user database.- Parameters:
- groupname- The group name of the new group (must be unique)
- description- The description of this group
- Returns:
- The new group
 
- 
createRoleDescription copied from interface:UserDatabaseCreate and return a newRoledefined in this user database.- Parameters:
- rolename- The role name of the new role (must be unique)
- description- The description of this role
- Returns:
- The new role
 
- 
createUserDescription copied from interface:UserDatabaseCreate and return a newUserdefined 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
- Returns:
- The new user
 
- 
findGroup- Parameters:
- groupname- Name of the group to return
- Returns:
- the Groupwith the specified group name, if any; otherwise returnnull.
 
- 
findGroupInternal
- 
findRole- Parameters:
- rolename- Name of the role to return
- Returns:
- the Rolewith the specified role name, if any; otherwise returnnull.
 
- 
findRoleInternal
- 
findUser- Parameters:
- username- Name of the user to return
- Returns:
- the Userwith the specified user name, if any; otherwise returnnull.
 
- 
findUserInternal
- 
modifiedGroupDescription copied from interface:UserDatabaseSignal the specifiedGroupfrom this user database has been modified.- Parameters:
- group- The group that has been modified
 
- 
modifiedRoleDescription copied from interface:UserDatabaseSignal the specifiedRolefrom this user database has been modified.- Parameters:
- role- The role that has been modified
 
- 
modifiedUserDescription copied from interface:UserDatabaseSignal the specifiedUserfrom this user database has been modified.- Parameters:
- user- The user that has been modified
 
- 
openDescription copied from interface:UserDatabaseInitialize access to this user database.- Throws:
- Exception- if any exception is thrown during opening
 
- 
removeGroupDescription copied from interface:UserDatabaseRemove the specifiedGroupfrom this user database.- Parameters:
- group- The group to be removed
 
- 
removeRoleDescription copied from interface:UserDatabaseRemove the specifiedRolefrom this user database.- Parameters:
- role- The role to be removed
 
- 
removeUserDescription copied from interface:UserDatabaseRemove the specifiedUserfrom this user database.- Parameters:
- user- The user to be removed
 
- 
saveDescription copied from interface:UserDatabaseSave any updated information to the persistent storage location for this user database.- Throws:
- Exception- if any exception is thrown during saving
 
- 
saveInternal
- 
isAvailablepublic boolean isAvailable()Description copied from interface:UserDatabaseIs the database available.- Returns:
- true
 
- 
isGroupStoreDefinedprotected boolean isGroupStoreDefined()Only use groups if the tables are fully defined.- Returns:
- true when groups are used
 
- 
isRoleStoreDefinedprotected boolean isRoleStoreDefined()Only use roles if the tables are fully defined.- Returns:
- true when roles are used
 
- 
openConnectionOpen the specified database connection.- Returns:
- Connection to the database
 
- 
closeConnectionClose the specified database connection.- Parameters:
- dbConnection- The connection to be closed
 
 
-