Class TorqueAbstractUserManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.fulcrum.security.spi.AbstractManager
-
- org.apache.fulcrum.security.spi.AbstractEntityManager
-
- org.apache.fulcrum.security.spi.AbstractUserManager
-
- org.apache.fulcrum.security.torque.TorqueAbstractUserManager
-
- All Implemented Interfaces:
Serializable
,org.apache.avalon.framework.activity.Disposable
,org.apache.avalon.framework.configuration.Configurable
,org.apache.avalon.framework.logger.LogEnabled
,org.apache.avalon.framework.service.Serviceable
,org.apache.avalon.framework.thread.ThreadSafe
,UserManager
- Direct Known Subclasses:
PeerUserManager
,TorqueBasicUserManagerImpl
,TorqueDynamicUserManagerImpl
public abstract class TorqueAbstractUserManager extends AbstractUserManager
This implementation persists to a database via Torque.- Version:
- $Id:$
- Author:
- Thomas Vandahl
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.fulcrum.security.spi.AbstractManager
manager
-
Fields inherited from interface org.apache.fulcrum.security.UserManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description TorqueAbstractUserManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
checkExists(String userName)
Check whether a specified user's account exists.void
configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon Service lifecycle methodprotected abstract <T extends User>
List<T>doSelectAllUsers(Connection con)
Get all specialized Usersprotected abstract <T extends User>
TdoSelectById(Integer id, Connection con)
Get a specialized User by idprotected abstract <T extends User>
TdoSelectByName(String name, Connection con)
Get a specialized User by name<T extends User>
UserSet<T>getAllUsers()
Retrieves all users defined in the system.<T extends User>
TgetUser(String userName)
Retrieve a user from persistent storage using username as the key.<T extends User>
TgetUserById(Object id)
Retrieve a User object with specified id.protected <T extends User>
TpersistNewUser(T user)
Creates new user account with specified attributes.void
removeUser(User user)
Removes an user account from the system.void
saveUser(User user)
Stores User attributes.-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractUserManager
addUser, authenticate, changePassword, checkExists, forcePassword, getACL, getACLFactory, getUser, getUserInstance, getUserInstance
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManager
getClassName, setClassName
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractManager
dispose, getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
-
-
-
-
Constructor Detail
-
TorqueAbstractUserManager
public TorqueAbstractUserManager()
-
-
Method Detail
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
Avalon Service lifecycle method- Specified by:
configure
in interfaceorg.apache.avalon.framework.configuration.Configurable
- Overrides:
configure
in classAbstractEntityManager
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
-
doSelectAllUsers
protected abstract <T extends User> List<T> doSelectAllUsers(Connection con) throws org.apache.torque.TorqueException
Get all specialized Users- Parameters:
con
- a database connection- Returns:
- a List of User instances
- Throws:
org.apache.torque.TorqueException
- if any database error occurs
-
doSelectByName
protected abstract <T extends User> T doSelectByName(String name, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException
Get a specialized User by name- Parameters:
name
- the name of the groupcon
- a database connection- Returns:
- a User instance
- Throws:
org.apache.torque.NoRowsException
- if no such group existsorg.apache.torque.TooManyRowsException
- if multiple groups with the given name existorg.apache.torque.TorqueException
- if any database error occurs if any other database error occurs
-
doSelectById
protected abstract <T extends User> T doSelectById(Integer id, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException
Get a specialized User by id- Parameters:
id
- the id of the groupcon
- a database connection- Returns:
- a User instance
- Throws:
org.apache.torque.NoRowsException
- if no such group existsorg.apache.torque.TooManyRowsException
- if multiple groups with the given id existorg.apache.torque.TorqueException
- if any database error occurs if any other database error occurs
-
removeUser
public void removeUser(User user) throws DataBackendException, UnknownEntityException
Removes an user account from the system.- Parameters:
user
- the object describing the account to be removed.- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the user account is not present.
-
persistNewUser
protected <T extends User> T persistNewUser(T user) throws DataBackendException
Creates new user account with specified attributes.- Specified by:
persistNewUser
in classAbstractUserManager
- Type Parameters:
T
- User type- Parameters:
user
- the object describing account to be created.- Returns:
- a User object
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
saveUser
public void saveUser(User user) throws DataBackendException, UnknownEntityException
Stores User attributes. The User is required to exist in the system.- Parameters:
user
- The User to be stored.- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the role does not exist.
-
checkExists
public boolean checkExists(String userName) throws DataBackendException
Check whether a specified user's account exists. The login name is used for looking up the account.- Parameters:
userName
- The name of the user to be checked.- Returns:
- true if the specified account exists
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
getUser
public <T extends User> T getUser(String userName) throws UnknownEntityException, DataBackendException
Retrieve a user from persistent storage using username as the key. Additionally retrieves all attached objects fromTorqueAbstractSecurityEntity.retrieveAttachedObjects(Connection, Boolean)
- Specified by:
getUser
in interfaceUserManager
- Overrides:
getUser
in classAbstractUserManager
- Type Parameters:
T
- User- Parameters:
userName
- the name of the user.- Returns:
- an User object.
- Throws:
UnknownEntityException
- if the user's account does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
getAllUsers
public <T extends User> UserSet<T> getAllUsers() throws DataBackendException
Retrieves all users defined in the system.- Type Parameters:
T
- User type- Returns:
- the names of all users defined in the system.
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
getUserById
public <T extends User> T getUserById(Object id) throws DataBackendException, UnknownEntityException
Retrieve a User object with specified id.- Specified by:
getUserById
in interfaceUserManager
- Overrides:
getUserById
in classAbstractUserManager
- Type Parameters:
T
- User- Parameters:
id
- the id of the User.- Returns:
- an object representing the User with specified id.
- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the user does not exist.
-
-