org.apache.james.userrepository
Class DefaultUsersJdbcRepository

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.james.userrepository.AbstractUsersRepository
              |
              +--org.apache.james.userrepository.AbstractJdbcUsersRepository
                    |
                    +--org.apache.james.userrepository.DefaultUsersJdbcRepository
All Implemented Interfaces:
Component, Composable, Configurable, Contextualizable, Initializable, LogEnabled, UsersRepository

public class DefaultUsersJdbcRepository
extends AbstractJdbcUsersRepository

A Jdbc-backed UserRepository which handles User instances of the DefaultUser class. Although this repository can handle subclasses of DefaultUser, like DefaultJamesUser, only properties from the DefaultUser class are persisted.

Author:
Darrell DeBoer

Field Summary
 
Fields inherited from class org.apache.james.userrepository.AbstractJdbcUsersRepository
context, m_sqlParameters
 
Fields inherited from interface org.apache.james.services.UsersRepository
ROLE, USER
 
Constructor Summary
DefaultUsersJdbcRepository()
           
 
Method Summary
protected  User readUserFromResultSet(ResultSet rsUsers)
          Reads properties for a User from an open ResultSet.
protected  void setUserForInsertStatement(User user, PreparedStatement userInsert)
          Set parameters of a PreparedStatement object with property values from a User instance.
protected  void setUserForUpdateStatement(User user, PreparedStatement userUpdate)
          Set parameters of a PreparedStatement object with property values from a User instance.
 
Methods inherited from class org.apache.james.userrepository.AbstractJdbcUsersRepository
compose, configure, contextualize, doAddUser, doRemoveUser, doUpdateUser, getUserByName, initialize, listAllUsers
 
Methods inherited from class org.apache.james.userrepository.AbstractUsersRepository
addUser, addUser, contains, containsCaseInsensitive, countUsers, getAttributes, getRealName, getUserByName, getUserByNameCaseInsensitive, list, listUserNames, removeUser, test, test, updateUser
 
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
 

Constructor Detail

DefaultUsersJdbcRepository

public DefaultUsersJdbcRepository()
Method Detail

readUserFromResultSet

protected User readUserFromResultSet(ResultSet rsUsers)
                              throws SQLException
Reads properties for a User from an open ResultSet.

Specified by:
readUserFromResultSet in class AbstractJdbcUsersRepository
Parameters:
rsUsers - A ResultSet with a User record in the current row.
Returns:
A User instance
Throws:
SQLException - if an exception occurs reading from the ResultSet

setUserForInsertStatement

protected void setUserForInsertStatement(User user,
                                         PreparedStatement userInsert)
                                  throws SQLException
Set parameters of a PreparedStatement object with property values from a User instance.

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:
SQLException - if an exception occurs while setting parameter values.

setUserForUpdateStatement

protected void setUserForUpdateStatement(User user,
                                         PreparedStatement userUpdate)
                                  throws 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:
SQLException - if an exception occurs while setting parameter values.


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."