Package org.apache.fulcrum.security.spi
Class AbstractUserManager
- 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
 
 
 
 
- 
- 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:
- MemoryUserManagerImpl,- TorqueAbstractUserManager
 
 public abstract class AbstractUserManager extends AbstractEntityManager implements UserManager This implementation keeps all objects in memory. This is mostly meant to help with testing and prototyping of ideas.- Version:
- $Id$
- Author:
- Eric Pugh
- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from class org.apache.fulcrum.security.spi.AbstractManagermanager
 - 
Fields inherited from interface org.apache.fulcrum.security.UserManagerROLE
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractUserManager()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends User>
 TaddUser(T user, String password)Creates new user account with specified attributes.voidauthenticate(User user, String password)Authenticate an User with the specified password.voidchangePassword(User user, String oldPassword, String newPassword)Change the password for an User.booleancheckExists(User user)Check whether a specified user's account exists.voidforcePassword(User user, String password)Forcibly sets new password for an User.<T extends AccessControlList>
 TgetACL(User user)Return a Class object representing the system's chosen implementation of of ACL interface.ACLFactorygetACLFactory()<T extends User>
 TgetUser(String name)Retrieve a user from persistent storage using username as the key.<T extends User>
 TgetUser(String userName, String password)Retrieve a user from persistent storage using username as the key, and authenticate the user.<T extends User>
 TgetUserById(Object id)Retrieve a User object with specified Id.<T extends User>
 TgetUserInstance()Construct a blank User object.<T extends User>
 TgetUserInstance(String userName)Construct a blank User object.protected abstract <T extends User>
 TpersistNewUser(T user)- 
Methods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManagerconfigure, getClassName, setClassName
 - 
Methods inherited from class org.apache.fulcrum.security.spi.AbstractManagerdispose, getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
 - 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabledenableLogging, getLogger, setupLogger, setupLogger, setupLogger
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.fulcrum.security.UserManagercheckExists, getAllUsers, removeUser, saveUser
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractUserManagerpublic AbstractUserManager() 
 
- 
 - 
Method Detail- 
persistNewUserprotected abstract <T extends User> T persistNewUser(T user) throws DataBackendException - Type Parameters:
- T- User type
- Parameters:
- user- user to persist
- Returns:
- a User object
- Throws:
- DataBackendException- if fail to connect
 
 - 
getACLpublic <T extends AccessControlList> T getACL(User user) throws UnknownEntityException Description copied from interface:UserManagerReturn a Class object representing the system's chosen implementation of of ACL interface.- Specified by:
- getACLin interface- UserManager
- Type Parameters:
- T- AccessControlList
- Parameters:
- user- the user
- Returns:
- systems's chosen implementation of ACL interface.
- Throws:
- UnknownEntityException- if the implementation of ACL interface could not be determined, or does not exist.
 
 - 
checkExistspublic boolean checkExists(User user) throws DataBackendException Check whether a specified user's account exists. The login name is used for looking up the account.- Specified by:
- checkExistsin interface- UserManager
- Parameters:
- user- The user to be checked.
- Returns:
- true if the specified account exists
- Throws:
- DataBackendException- if there was an error accessing the data backend.
 
 - 
getUserpublic <T extends User> T getUser(String userName, String password) throws PasswordMismatchException, UnknownEntityException, DataBackendException Retrieve a user from persistent storage using username as the key, and authenticate the user. The implementation may chose to authenticate to the server as the user whose data is being retrieved.- Specified by:
- getUserin interface- UserManager
- Type Parameters:
- T- User
- Parameters:
- userName- the name of the user.
- password- the user supplied password.
- Returns:
- an User object.
- Throws:
- PasswordMismatchException- if the supplied password was incorrect.
- UnknownEntityException- if the user's account does not exist in the database.
- DataBackendException- if there is a problem accessing the storage.
 
 - 
getUserpublic <T extends User> T getUser(String name) throws DataBackendException, UnknownEntityException Description copied from interface:UserManagerRetrieve a user from persistent storage using username as the key.- Specified by:
- getUserin interface- UserManager
- Type Parameters:
- T- User
- Parameters:
- name- the name of the user.
- Returns:
- an User object.
- Throws:
- DataBackendException- if there is a problem accessing the storage.
- UnknownEntityException- if the user's record does not exist in the database.
 
 - 
getUserByIdpublic <T extends User> T getUserById(Object id) throws DataBackendException, UnknownEntityException Retrieve a User object with specified Id.- Specified by:
- getUserByIdin interface- UserManager
- Type Parameters:
- T- User
- Parameters:
- id- the id of the User.
- Returns:
- an object representing the User with specified id.
- Throws:
- UnknownEntityException- if the user does not exist in the database.
- DataBackendException- if there is a problem accessing the storage.
 
 - 
authenticatepublic void authenticate(User user, String password) throws PasswordMismatchException, UnknownEntityException, DataBackendException Authenticate an User with the specified password. If authentication is successful the method returns nothing. If there are any problems, exception was thrown.- Specified by:
- authenticatein interface- UserManager
- Parameters:
- user- an User object to authenticate.
- password- the user supplied password.
- Throws:
- PasswordMismatchException- if the supplied password was incorrect.
- UnknownEntityException- if the user's account does not exist in the database.
- DataBackendException- if there is a problem accessing the storage.
 
 - 
changePasswordpublic void changePassword(User user, String oldPassword, String newPassword) throws PasswordMismatchException, UnknownEntityException, DataBackendException Change the password for an User. The user must have supplied the old password to allow the change.- Specified by:
- changePasswordin interface- UserManager
- Parameters:
- user- an User to change password for.
- oldPassword- The old password to verify
- newPassword- The new password to set
- Throws:
- PasswordMismatchException- if the supplied password was incorrect.
- UnknownEntityException- if the user's account does not exist in the database.
- DataBackendException- if there is a problem accessing the storage.
 
 - 
forcePasswordpublic void forcePassword(User user, String password) throws UnknownEntityException, DataBackendException Forcibly sets new password for an User. This is supposed by the administrator to change the forgotten or compromised passwords. Certain implementatations of this feature would require administrative level access to the authenticating server / program.- Specified by:
- forcePasswordin interface- UserManager
- Parameters:
- user- an User to change password for.
- password- the new password.
- Throws:
- UnknownEntityException- if the user's record does not exist in the database.
- DataBackendException- if there is a problem accessing the storage.
 
 - 
getUserInstancepublic <T extends User> T getUserInstance() throws DataBackendException Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Specified by:
- getUserInstancein interface- UserManager
- Type Parameters:
- T- User type
- Returns:
- an object implementing User interface.
- Throws:
- DataBackendException- if the object could not be instantiated.
 
 - 
getUserInstancepublic <T extends User> T getUserInstance(String userName) throws DataBackendException Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Specified by:
- getUserInstancein interface- UserManager
- Type Parameters:
- T- User
- Parameters:
- userName- The name of the user.
- Returns:
- an object implementing User interface.
- Throws:
- DataBackendException- if the object could not be instantiated.
 
 - 
addUserpublic <T extends User> T addUser(T user, String password) throws DataBackendException, EntityExistsException Creates new user account with specified attributes.- Specified by:
- addUserin interface- UserManager
- Parameters:
- user- the object describing account to be created.
- password- The password to use for the account.
- Returns:
- User the user added
- Throws:
- DataBackendException- if there was an error accessing the data backend.
- EntityExistsException- if the user account already exists.
 
 - 
getACLFactorypublic ACLFactory getACLFactory() - Returns:
- Returns the ACLFactory.
 
 
- 
 
-