org.apache.james.impl.jamesuser
Class AbstractUsersRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.impl.jamesuser.AbstractUsersRepository
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, UsersRepository, VirtualUserTable, JamesUsersRepository
Direct Known Subclasses:
AbstractJdbcUsersRepository, UsersFileRepository, UsersLDAPRepository

public abstract class AbstractUsersRepository
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.framework.configuration.Configurable, JamesUsersRepository

A partial implementation of a Repository to store users.

This implements common functionality found in different UsersRespository implementations, and makes it easier to create new User repositories.


Field Summary
protected  boolean enableAliases
          Enable Aliases frmo JamesUser
protected  boolean enableForwarding
          Wether to enable forwarding for JamesUser or not
protected  boolean ignoreCase
          Ignore case in usernames
 
Fields inherited from interface org.apache.james.api.user.UsersRepository
ROLE, USER
 
Fields inherited from interface org.apache.james.api.vut.VirtualUserTable
ALIASDOMAIN_PREFIX, ERROR_PREFIX, REGEX_PREFIX, ROLE
 
Constructor Summary
AbstractUsersRepository()
           
 
Method Summary
 void addUser(java.lang.String name, java.lang.Object attributes)
          Adds a user to the repository with the specified attributes.
 boolean addUser(User user)
          Adds a user to the repository with the specified User object.
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected abstract  void doAddUser(User user)
          Adds a user to the underlying Repository.
protected abstract  void doUpdateUser(User user)
          Updates a user record to match the supplied User.
 java.util.Collection getMappings(java.lang.String username, java.lang.String domain)
          Return the mapped MailAddress for the given address.
 void setEnableAliases(boolean enableAliases)
          enable/disable aliases in case of JamesUsers
 void setEnableForwarding(boolean enableForwarding)
          enable/disable aliases in case of JamesUsers
 void setIgnoreCase(boolean ignoreCase)
          set case sensitive/insensitive operations
 boolean updateUser(User user)
          Update the repository with the specified user object.
 
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
 
Methods inherited from interface org.apache.james.api.user.UsersRepository
addUser, contains, containsCaseInsensitive, countUsers, getRealName, getUserByName, getUserByNameCaseInsensitive, list, removeUser, test
 

Field Detail

ignoreCase

protected boolean ignoreCase
Ignore case in usernames


enableAliases

protected boolean enableAliases
Enable Aliases frmo JamesUser


enableForwarding

protected boolean enableForwarding
Wether to enable forwarding for JamesUser or not

Constructor Detail

AbstractUsersRepository

public AbstractUsersRepository()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

doAddUser

protected abstract void doAddUser(User user)
Adds a user to the underlying Repository. The user name must not clash with an existing user.

Parameters:
user - the user to add

doUpdateUser

protected abstract void doUpdateUser(User user)
Updates a user record to match the supplied User.

Parameters:
user - the user to update

addUser

public void addUser(java.lang.String name,
                    java.lang.Object attributes)
Adds a user to the repository with the specified attributes. In current implementations, the Object attributes is generally a String password.

Specified by:
addUser in interface UsersRepository
Parameters:
name - the name of the user to be added
attributes - the password value as a String

addUser

public boolean addUser(User user)
Adds a user to the repository with the specified User object. Users names must be unique-case-insensitive in the repository.

Specified by:
addUser in interface UsersRepository
Parameters:
user - the user to be added
Returns:
true if succesful, false otherwise
Since:
James 1.2.2

updateUser

public boolean updateUser(User user)
Update the repository with the specified user object. A user object with this username must already exist.

Specified by:
updateUser in interface UsersRepository
Parameters:
user - the user to be updated
Returns:
true if successful.

getMappings

public java.util.Collection getMappings(java.lang.String username,
                                        java.lang.String domain)
                                 throws ErrorMappingException
Description copied from interface: VirtualUserTable
Return the mapped MailAddress for the given address. Return null if no matched mapping was found

Specified by:
getMappings in interface VirtualUserTable
Parameters:
username - the MailAddress
Returns:
the mapped mailAddress
Throws:
ErrorMappingException - get thrown if an error mapping was found
See Also:
VirtualUserTable.getMappings(java.lang.String, java.lang.String)

setEnableAliases

public void setEnableAliases(boolean enableAliases)
Description copied from interface: JamesUsersRepository
enable/disable aliases in case of JamesUsers

Specified by:
setEnableAliases in interface JamesUsersRepository
Parameters:
enableAliases - enable
See Also:
JamesUsersRepository.setEnableAliases(boolean)

setEnableForwarding

public void setEnableForwarding(boolean enableForwarding)
Description copied from interface: JamesUsersRepository
enable/disable aliases in case of JamesUsers

Specified by:
setEnableForwarding in interface JamesUsersRepository
Parameters:
enableForwarding - enable
See Also:
JamesUsersRepository.setEnableForwarding(boolean)

setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)
Description copied from interface: JamesUsersRepository
set case sensitive/insensitive operations

Specified by:
setIgnoreCase in interface JamesUsersRepository
Parameters:
ignoreCase - ignore
See Also:
JamesUsersRepository.setIgnoreCase(boolean)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.