org.apache.james.userrepository
Class ListUsersJdbcRepository
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.james.impl.jamesuser.AbstractUsersRepository
org.apache.james.userrepository.AbstractJdbcUsersRepository
org.apache.james.userrepository.ListUsersJdbcRepository
- All Implemented Interfaces:
- org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, UsersRepository, VirtualUserTable, JamesUsersRepository
public class ListUsersJdbcRepository
- extends AbstractJdbcUsersRepository
A very lightweight UserRepository, which persists a list
of user names in a database. Password information is not
persisted.
Method Summary |
boolean |
addUser(java.lang.String username,
java.lang.String password)
Adds a user to the repository with the specified password |
protected User |
readUserFromResultSet(java.sql.ResultSet rsUsers)
Reads properties for a User from an open ResultSet. |
protected void |
setUserForInsertStatement(User user,
java.sql.PreparedStatement userInsert)
Set parameters of a PreparedStatement object with property values from a
User instance. |
protected void |
setUserForUpdateStatement(User user,
java.sql.PreparedStatement userUpdate)
Set parameters of a PreparedStatement object with
property values from a User instance. |
boolean |
test(java.lang.String name,
java.lang.String password)
Test if user with name 'name' has password 'password'. |
Methods inherited from class org.apache.james.userrepository.AbstractJdbcUsersRepository |
configure, contains, containsCaseInsensitive, countUsers, doAddUser, doRemoveUser, doUpdateUser, getRealName, getUserByName, getUserByName, getUserByNameCaseInsensitive, getUserByNameIterating, initialize, list, listAllUsers, listUserNames, removeUser, service |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListUsersJdbcRepository
public ListUsersJdbcRepository()
test
public boolean test(java.lang.String name,
java.lang.String password)
- Description copied from class:
AbstractJdbcUsersRepository
- Test if user with name 'name' has password 'password'.
- Specified by:
test
in interface UsersRepository
- Overrides:
test
in class AbstractJdbcUsersRepository
- Parameters:
name
- the name of the user to be testedpassword
- the password to be tested
- Returns:
- true if the test is successful, false if the password is
incorrect or the user doesn't exist
- See Also:
UsersRepository.test(java.lang.String, java.lang.String)
readUserFromResultSet
protected User readUserFromResultSet(java.sql.ResultSet rsUsers)
throws java.sql.SQLException
- Description copied from class:
AbstractJdbcUsersRepository
- Reads properties for a User from an open ResultSet. Subclass
implementations of this method must have knowledge of the fields
presented by the "select" and "selectByLowercaseName" SQL statements.
These implemenations may generate a subclass-specific User instance.
- Specified by:
readUserFromResultSet
in class AbstractJdbcUsersRepository
- Parameters:
rsUsers
- A ResultSet with a User record in the current row.
- Returns:
- A User instance
- Throws:
java.sql.SQLException
- if an exception occurs reading from the ResultSet- See Also:
AbstractJdbcUsersRepository.readUserFromResultSet(java.sql.ResultSet)
setUserForInsertStatement
protected void setUserForInsertStatement(User user,
java.sql.PreparedStatement userInsert)
throws java.sql.SQLException
- Description copied from class:
AbstractJdbcUsersRepository
- Set parameters of a PreparedStatement object with property values from a
User instance. Implementations of this method have knowledge of the
parameter ordering of the "insert" SQL statement definition.
- Specified by:
setUserForInsertStatement
in class AbstractJdbcUsersRepository
- Parameters:
user
- a User instance, which should be an implementation class which
is handled by this Repostory implementation.userInsert
- a PreparedStatement initialised with SQL taken from the
"insert" SQL definition.
- Throws:
java.sql.SQLException
- if an exception occurs while setting parameter values.- See Also:
AbstractJdbcUsersRepository.setUserForInsertStatement(org.apache.james.api.user.User, java.sql.PreparedStatement)
setUserForUpdateStatement
protected void setUserForUpdateStatement(User user,
java.sql.PreparedStatement userUpdate)
throws java.sql.SQLException
- Set parameters of a PreparedStatement object with
property values from a User instance.
- Specified by:
setUserForUpdateStatement
in class AbstractJdbcUsersRepository
- Parameters:
user
- a User instance, which should be an implementation class which
is handled by this Repostory implementation.userUpdate
- a PreparedStatement initialised with SQL taken from the "update" SQL definition.
- Throws:
java.sql.SQLException
- if an exception occurs while setting parameter values.
addUser
public boolean addUser(java.lang.String username,
java.lang.String password)
- Description copied from interface:
UsersRepository
- Adds a user to the repository with the specified password
- Parameters:
username
- the username of the user to be addedpassword
- the password of the user to add
- Returns:
- true if succesful, false otherwise
- See Also:
UsersRepository.addUser(java.lang.String, java.lang.String)
Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.