Class DataSourceUserDatabase
java.lang.Object
org.apache.catalina.users.SparseUserDatabase
org.apache.catalina.users.DataSourceUserDatabase
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ConcurrentHashMap
<String, Group> protected final ConcurrentHashMap
<String, Role> protected final ConcurrentHashMap
<String, User> protected final DataSource
DataSource to use.protected String
The name of the JNDI JDBC DataSourceprotected String
The column in the user group table that names a groupprotected String
The table that holds the relation between groups and rolesprotected String
The table that holds user data.protected final String
The unique global identifier of this user database.protected final ConcurrentHashMap
<String, Group> protected final ConcurrentHashMap
<String, Role> protected final ConcurrentHashMap
<String, User> protected boolean
A 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 String
The column in the role and group tables for the descriptionprotected String
The column in the user role table that names a roleprotected String
The table that holds user data.protected String
The column in the user table that holds the user's credentialsprotected String
The column in the user table that holds the user's full nameprotected String
The table that holds the relation between users and groupsprotected String
The column in the user table that holds the user's nameprotected String
The table that holds the relation between users and rolesprotected String
The table that holds user data. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Finalize access to this user database.protected void
closeConnection
(Connection dbConnection) Close the specified database connection.createGroup
(String groupname, String description) Create and return a newGroup
defined in this user database.createRole
(String rolename, String description) Create and return a newRole
defined in this user database.createUser
(String username, String password, String fullName) Create and return a newUser
defined in this user database.findGroupInternal
(Connection dbConnection, String groupName) findRoleInternal
(Connection dbConnection, String roleName) findUserInternal
(Connection dbConnection, String userName) getId()
boolean
getRoles()
getUsers()
boolean
Is the database available.protected boolean
Only use groups if the tables are fully defined.protected boolean
Only use roles if the tables are fully defined.void
modifiedGroup
(Group group) Signal the specifiedGroup
from this user database has been modified.void
modifiedRole
(Role role) Signal the specifiedRole
from this user database has been modified.void
modifiedUser
(User user) Signal the specifiedUser
from this user database has been modified.void
open()
Initialize access to this user database.protected Connection
Open the specified database connection.void
removeGroup
(Group group) Remove the specifiedGroup
from this user database.void
removeRole
(Role role) Remove the specifiedRole
from this user database.void
removeUser
(User user) Remove the specifiedUser
from this user database.void
save()
Save any updated information to the persistent storage location for this user database.protected void
saveInternal
(Connection dbConnection) void
setDataSourceName
(String dataSourceName) Set the name of the JNDI JDBC DataSource.void
setGroupNameCol
(String groupNameCol) void
setGroupRoleTable
(String groupRoleTable) void
setGroupTable
(String groupTable) void
setReadonly
(boolean readonly) void
setRoleAndGroupDescriptionCol
(String roleAndGroupDescriptionCol) void
setRoleNameCol
(String roleNameCol) Set the column in the user role table that names a role.void
setRoleTable
(String roleTable) void
setUserCredCol
(String userCredCol) Set the column in the user table that holds the user's credentials.void
setUserFullNameCol
(String userFullNameCol) void
setUserGroupTable
(String userGroupTable) void
setUserNameCol
(String userNameCol) Set the column in the user table that holds the user's name.void
setUserRoleTable
(String userRoleTable) Set the table that holds the relation between user's and roles.void
setUserTable
(String userTable) Set the table that holds user data.Methods inherited from class org.apache.catalina.users.SparseUserDatabase
isSparse
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.catalina.UserDatabase
backgroundProcess
-
Field Details
-
dataSource
DataSource to use. -
id
The unique global identifier of this user database. -
createdUsers
-
modifiedUsers
-
removedUsers
-
createdGroups
-
modifiedGroups
-
removedGroups
-
createdRoles
-
modifiedRoles
-
removedRoles
-
dataSourceName
The name of the JNDI JDBC DataSource -
roleNameCol
The column in the user role table that names a role -
roleAndGroupDescriptionCol
The column in the role and group tables for the description -
groupNameCol
The column in the user group table that names a group -
userCredCol
The column in the user table that holds the user's credentials -
userFullNameCol
The column in the user table that holds the user's full name -
userNameCol
The column in the user table that holds the user's name -
userRoleTable
The table that holds the relation between users and roles -
userGroupTable
The table that holds the relation between users and groups -
groupRoleTable
The table that holds the relation between groups and roles -
userTable
The table that holds user data. -
groupTable
The table that holds user data. -
roleTable
The table that holds user data. -
readonly
protected 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.
-
setDataSourceName
Set 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.
-
setRoleNameCol
Set 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.
-
setUserCredCol
Set 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.
-
setUserNameCol
Set 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.
-
setUserRoleTable
Set the table that holds the relation between user's and roles.- Parameters:
userRoleTable
- The table name
-
getUserTable
- Returns:
- the table that holds user data..
-
setUserTable
Set 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
-
getReadonly
public boolean getReadonly()- Returns:
- the readonly
-
setReadonly
public void setReadonly(boolean readonly) - Parameters:
readonly
- the readonly to set
-
getId
- Returns:
- the unique global identifier of this user database.
-
getGroups
-
getRoles
-
getUsers
-
close
Description copied from interface:UserDatabase
Finalize access to this user database.- Throws:
Exception
- if any exception is thrown during closing
-
createGroup
Description copied from interface:UserDatabase
Create and return a newGroup
defined 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
-
createRole
Description copied from interface:UserDatabase
Create and return a newRole
defined 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
-
createUser
Description copied from interface:UserDatabase
Create and return a newUser
defined in this user database.- Parameters:
username
- The logon username of the new user (must be unique)password
- The logon password of the new userfullName
- The full name of the new user- Returns:
- The new user
-
findGroup
-
findGroupInternal
-
findRole
-
findRoleInternal
-
findUser
-
findUserInternal
-
modifiedGroup
Description copied from interface:UserDatabase
Signal the specifiedGroup
from this user database has been modified.- Parameters:
group
- The group that has been modified
-
modifiedRole
Description copied from interface:UserDatabase
Signal the specifiedRole
from this user database has been modified.- Parameters:
role
- The role that has been modified
-
modifiedUser
Description copied from interface:UserDatabase
Signal the specifiedUser
from this user database has been modified.- Parameters:
user
- The user that has been modified
-
open
Description copied from interface:UserDatabase
Initialize access to this user database.- Throws:
Exception
- if any exception is thrown during opening
-
removeGroup
Description copied from interface:UserDatabase
Remove the specifiedGroup
from this user database.- Parameters:
group
- The group to be removed
-
removeRole
Description copied from interface:UserDatabase
Remove the specifiedRole
from this user database.- Parameters:
role
- The role to be removed
-
removeUser
Description copied from interface:UserDatabase
Remove the specifiedUser
from this user database.- Parameters:
user
- The user to be removed
-
save
Description copied from interface:UserDatabase
Save any updated information to the persistent storage location for this user database.- Throws:
Exception
- if any exception is thrown during saving
-
saveInternal
-
isAvailable
public boolean isAvailable()Description copied from interface:UserDatabase
Is the database available.- Returns:
- true
-
isGroupStoreDefined
protected boolean isGroupStoreDefined()Only use groups if the tables are fully defined.- Returns:
- true when groups are used
-
isRoleStoreDefined
protected boolean isRoleStoreDefined()Only use roles if the tables are fully defined.- Returns:
- true when roles are used
-
openConnection
Open the specified database connection.- Returns:
- Connection to the database
-
closeConnection
Close the specified database connection.- Parameters:
dbConnection
- The connection to be closed
-