public class DataSourceUserDatabase extends SparseUserDatabase
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> |
createdGroups |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> |
createdRoles |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,User> |
createdUsers |
protected javax.sql.DataSource |
dataSource
DataSource to use.
|
protected java.lang.String |
dataSourceName
The name of the JNDI JDBC DataSource
|
protected java.lang.String |
groupNameCol
The column in the user group table that names a group
|
protected java.lang.String |
groupRoleTable
The table that holds the relation between groups and roles
|
protected java.lang.String |
groupTable
The table that holds user data.
|
protected java.lang.String |
id
The unique global identifier of this user database.
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> |
modifiedGroups |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> |
modifiedRoles |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,User> |
modifiedUsers |
protected boolean |
readonly
A flag, indicating if the user database is read only.
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> |
removedGroups |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> |
removedRoles |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,User> |
removedUsers |
protected java.lang.String |
roleAndGroupDescriptionCol
The column in the role and group tables for the decription
|
protected java.lang.String |
roleNameCol
The column in the user role table that names a role
|
protected java.lang.String |
roleTable
The table that holds user data.
|
protected java.lang.String |
userCredCol
The column in the user table that holds the user's credentials
|
protected java.lang.String |
userFullNameCol
The column in the user table that holds the user's full name
|
protected java.lang.String |
userGroupTable
The table that holds the relation between users and groups
|
protected java.lang.String |
userNameCol
The column in the user table that holds the user's name
|
protected java.lang.String |
userRoleTable
The table that holds the relation between users and roles
|
protected java.lang.String |
userTable
The table that holds user data.
|
| Constructor and Description |
|---|
DataSourceUserDatabase(javax.sql.DataSource dataSource,
java.lang.String id) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Finalize access to this user database.
|
protected void |
closeConnection(java.sql.Connection dbConnection)
Close the specified database connection.
|
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) |
Group |
findGroupInternal(java.sql.Connection dbConnection,
java.lang.String groupName) |
Role |
findRole(java.lang.String rolename) |
Role |
findRoleInternal(java.sql.Connection dbConnection,
java.lang.String roleName) |
User |
findUser(java.lang.String username) |
User |
findUserInternal(java.sql.Connection dbConnection,
java.lang.String userName) |
java.lang.String |
getDataSourceName() |
java.lang.String |
getGroupNameCol() |
java.lang.String |
getGroupRoleTable() |
java.util.Iterator<Group> |
getGroups() |
java.lang.String |
getGroupTable() |
java.lang.String |
getId() |
boolean |
getReadonly() |
java.lang.String |
getRoleAndGroupDescriptionCol() |
java.lang.String |
getRoleNameCol() |
java.util.Iterator<Role> |
getRoles() |
java.lang.String |
getRoleTable() |
java.lang.String |
getUserCredCol() |
java.lang.String |
getUserFullNameCol() |
java.lang.String |
getUserGroupTable() |
java.lang.String |
getUserNameCol() |
java.lang.String |
getUserRoleTable() |
java.util.Iterator<User> |
getUsers() |
java.lang.String |
getUserTable() |
boolean |
isAvailable()
Is the database available.
|
protected boolean |
isGroupStoreDefined()
Only use groups if the tables are fully defined.
|
protected boolean |
isRoleStoreDefined()
Only use roles if the tables are fully defined.
|
void |
modifiedGroup(Group group)
Signal the specified
Group from this user database has been
modified. |
void |
modifiedRole(Role role)
Signal the specified
Role from this user database has been
modified. |
void |
modifiedUser(User user)
Signal the specified
User from this user database has been
modified. |
void |
open()
Initialize access to this user database.
|
protected java.sql.Connection |
openConnection()
Open the specified database connection.
|
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.
|
protected void |
saveInternal(java.sql.Connection dbConnection) |
void |
setDataSourceName(java.lang.String dataSourceName)
Set the name of the JNDI JDBC DataSource.
|
void |
setGroupNameCol(java.lang.String groupNameCol) |
void |
setGroupRoleTable(java.lang.String groupRoleTable) |
void |
setGroupTable(java.lang.String groupTable) |
void |
setReadonly(boolean readonly) |
void |
setRoleAndGroupDescriptionCol(java.lang.String roleAndGroupDescriptionCol) |
void |
setRoleNameCol(java.lang.String roleNameCol)
Set the column in the user role table that names a role.
|
void |
setRoleTable(java.lang.String roleTable) |
void |
setUserCredCol(java.lang.String userCredCol)
Set the column in the user table that holds the user's credentials.
|
void |
setUserFullNameCol(java.lang.String userFullNameCol) |
void |
setUserGroupTable(java.lang.String userGroupTable) |
void |
setUserNameCol(java.lang.String userNameCol)
Set the column in the user table that holds the user's name.
|
void |
setUserRoleTable(java.lang.String userRoleTable)
Set the table that holds the relation between user's and roles.
|
void |
setUserTable(java.lang.String userTable)
Set the table that holds user data.
|
isSparseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbackgroundProcessprotected final javax.sql.DataSource dataSource
protected final java.lang.String id
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,User> createdUsers
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,User> modifiedUsers
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,User> removedUsers
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> createdGroups
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> modifiedGroups
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Group> removedGroups
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> createdRoles
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> modifiedRoles
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,Role> removedRoles
protected java.lang.String dataSourceName
protected java.lang.String roleNameCol
protected java.lang.String roleAndGroupDescriptionCol
protected java.lang.String groupNameCol
protected java.lang.String userCredCol
protected java.lang.String userFullNameCol
protected java.lang.String userNameCol
protected java.lang.String userRoleTable
protected java.lang.String userGroupTable
protected java.lang.String groupRoleTable
protected java.lang.String userTable
protected java.lang.String groupTable
protected java.lang.String roleTable
protected boolean readonly
public DataSourceUserDatabase(javax.sql.DataSource dataSource,
java.lang.String id)
public java.lang.String getDataSourceName()
public void setDataSourceName(java.lang.String dataSourceName)
dataSourceName - the name of the JNDI JDBC DataSourcepublic java.lang.String getRoleNameCol()
public void setRoleNameCol(java.lang.String roleNameCol)
roleNameCol - The column namepublic java.lang.String getUserCredCol()
public void setUserCredCol(java.lang.String userCredCol)
userCredCol - The column namepublic java.lang.String getUserNameCol()
public void setUserNameCol(java.lang.String userNameCol)
userNameCol - The column namepublic java.lang.String getUserRoleTable()
public void setUserRoleTable(java.lang.String userRoleTable)
userRoleTable - The table namepublic java.lang.String getUserTable()
public void setUserTable(java.lang.String userTable)
userTable - The table namepublic java.lang.String getRoleAndGroupDescriptionCol()
public void setRoleAndGroupDescriptionCol(java.lang.String roleAndGroupDescriptionCol)
roleAndGroupDescriptionCol - the roleAndGroupDescriptionCol to setpublic java.lang.String getGroupNameCol()
public void setGroupNameCol(java.lang.String groupNameCol)
groupNameCol - the groupNameCol to setpublic java.lang.String getUserFullNameCol()
public void setUserFullNameCol(java.lang.String userFullNameCol)
userFullNameCol - the userFullNameCol to setpublic java.lang.String getUserGroupTable()
public void setUserGroupTable(java.lang.String userGroupTable)
userGroupTable - the userGroupTable to setpublic java.lang.String getGroupRoleTable()
public void setGroupRoleTable(java.lang.String groupRoleTable)
groupRoleTable - the groupRoleTable to setpublic java.lang.String getGroupTable()
public void setGroupTable(java.lang.String groupTable)
groupTable - the groupTable to setpublic java.lang.String getRoleTable()
public void setRoleTable(java.lang.String roleTable)
roleTable - the roleTable to setpublic boolean getReadonly()
public void setReadonly(boolean readonly)
readonly - the readonly to setpublic java.lang.String getId()
public java.util.Iterator<Group> getGroups()
Groups defined in this user database.public java.util.Iterator<Role> getRoles()
Roles defined in this user database.public java.util.Iterator<User> getUsers()
Users defined in this user database.public void close()
throws java.lang.Exception
UserDatabasejava.lang.Exception - if any exception is thrown during closingpublic Group createGroup(java.lang.String groupname, java.lang.String description)
UserDatabaseGroup defined in this user database.groupname - The group name of the new group (must be unique)description - The description of this grouppublic Role createRole(java.lang.String rolename, java.lang.String description)
UserDatabaseRole defined in this user database.rolename - The role name of the new role (must be unique)description - The description of this rolepublic User createUser(java.lang.String username, java.lang.String password, java.lang.String fullName)
UserDatabaseUser defined in this user database.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 userpublic Group findGroup(java.lang.String groupname)
groupname - Name of the group to returnGroup with the specified group name, if any;
otherwise return null.public Group findGroupInternal(java.sql.Connection dbConnection, java.lang.String groupName)
public Role findRole(java.lang.String rolename)
rolename - Name of the role to returnRole with the specified role name, if any; otherwise
return null.public Role findRoleInternal(java.sql.Connection dbConnection, java.lang.String roleName)
public User findUser(java.lang.String username)
username - Name of the user to returnUser with the specified user name, if any; otherwise
return null.public User findUserInternal(java.sql.Connection dbConnection, java.lang.String userName)
public void modifiedGroup(Group group)
UserDatabaseGroup from this user database has been
modified.group - The group that has been modifiedpublic void modifiedRole(Role role)
UserDatabaseRole from this user database has been
modified.role - The role that has been modifiedpublic void modifiedUser(User user)
UserDatabaseUser from this user database has been
modified.user - The user that has been modifiedpublic void open()
throws java.lang.Exception
UserDatabasejava.lang.Exception - if any exception is thrown during openingpublic void removeGroup(Group group)
UserDatabaseGroup from this user database.group - The group to be removedpublic void removeRole(Role role)
UserDatabaseRole from this user database.role - The role to be removedpublic void removeUser(User user)
UserDatabaseUser from this user database.user - The user to be removedpublic void save()
throws java.lang.Exception
UserDatabasejava.lang.Exception - if any exception is thrown during savingprotected void saveInternal(java.sql.Connection dbConnection)
public boolean isAvailable()
UserDatabaseprotected boolean isGroupStoreDefined()
protected boolean isRoleStoreDefined()
protected java.sql.Connection openConnection()
protected void closeConnection(java.sql.Connection dbConnection)
dbConnection - The connection to be closedCopyright © 2000-2023 Apache Software Foundation. All Rights Reserved.