org.apache.james.userrepository
Class UsersLDAPRepository

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

public class UsersLDAPRepository
extends AbstractLogEnabled
implements UsersRepository, Configurable, Contextualizable, Initializable

Implementation of a Repository to store users. This clas is a dummy for the proposal!

Version:
1.0.0, 24/04/1999
Author:
Charles Bennett

Field Summary
 
Fields inherited from interface org.apache.james.services.UsersRepository
ROLE, USER
 
Constructor Summary
UsersLDAPRepository()
           
 
Method Summary
 void addUser(String userName, Object attributes)
          Adds userName to the MemberAttribute (specified in conf.xml) of this node.
 boolean addUser(User user)
          Update the repository with the specified user object.
 void compose(ComponentManager compMgr)
           
 void configure(Configuration conf)
           
 boolean contains(String name)
          Returns whether or not this user is in the repository
 boolean containsCaseInsensitive(String name)
          Returns whether or not this user is in the repository.
 void contextualize(Context context)
           
 int countUsers()
          Returns a count of the users in the repository.
 void dispose()
          Disposes of all open directory contexts
 Object getAttributes(String name)
          Gets the attribute for a user.
 String getChildDestination(String childName)
           
 String getDomains()
           
 String getRealName(String name)
          Returns the user name of the user matching name on an equalsIgnoreCase basis.
 User getUserByName(String name)
          Get the user object with the specified user name.
 User getUserByNameCaseInsensitive(String name)
          Get the user object with the specified user name.
 void initialize()
           
 Iterator list()
          List users in repository.
 void removeGroupFromUser(String userName)
           
 void removeUser(String userName)
          Removes a user from the repository
 void setBase(String base)
           
 void setServerRoot()
           
 boolean test(String name, Object attributes)
          Tests a user with the appropriate attributes.
 boolean test(String name, String password)
          Test if user with name 'name' has password 'password'.
 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
 

Constructor Detail

UsersLDAPRepository

public UsersLDAPRepository()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
ContextException
See Also:
Contextualizable.contextualize(Context)

compose

public void compose(ComponentManager compMgr)
See Also:
Composable.compose(ComponentManager)

configure

public void configure(Configuration conf)
               throws ConfigurationException
Specified by:
configure in interface Configurable
ConfigurationException
See Also:
Configurable.configure(Configuration)

setServerRoot

public void setServerRoot()

setBase

public void setBase(String base)

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Exception
See Also:
Initializable.initialize()

getChildDestination

public String getChildDestination(String childName)

list

public Iterator list()
List users in repository.

Specified by:
list in interface UsersRepository
Returns:
Iterator over a collection of Strings, each being one user in the repository.

addUser

public boolean addUser(User user)
Update the repository with the specified user object. Unsupported for this user repository type.

Specified by:
addUser in interface UsersRepository
Parameters:
user - the user to be added
Returns:
false

getUserByName

public User getUserByName(String name)
Description copied from interface: UsersRepository
Get the user object with the specified user name. Return null if no such user.

Specified by:
getUserByName in interface UsersRepository
Parameters:
name - the name of the user to retrieve
Returns:
the user being retrieved, null if the user doesn't exist

getUserByNameCaseInsensitive

public User getUserByNameCaseInsensitive(String name)
Description copied from interface: UsersRepository
Get the user object with the specified user name. Match user naems on a case insensitive basis. Return null if no such user.

Specified by:
getUserByNameCaseInsensitive in interface UsersRepository
Parameters:
name - the name of the user to retrieve
Returns:
the user being retrieved, null if the user doesn't exist

containsCaseInsensitive

public boolean containsCaseInsensitive(String name)
Description copied from interface: UsersRepository
Returns whether or not this user is in the repository. Names are matched on a case insensitive basis.

Specified by:
containsCaseInsensitive in interface UsersRepository
Parameters:
name - the name to check in the repository
Returns:
whether the user is in the repository

getRealName

public String getRealName(String name)
Description copied from interface: UsersRepository
Returns the user name of the user matching name on an equalsIgnoreCase basis. Returns null if no match.

Specified by:
getRealName in interface UsersRepository
Parameters:
name - the name to case-correct
Returns:
the case-correct name of the user, null if the user doesn't exist

updateUser

public boolean updateUser(User user)
Description copied from interface: UsersRepository
Update the repository with the specified user object. A user object with this username must already exist.

Specified by:
updateUser in interface UsersRepository
Returns:
true if successful.

test

public boolean test(String name,
                    String password)
Description copied from interface: UsersRepository
Test if user with name 'name' has password 'password'.

Specified by:
test in interface UsersRepository
Parameters:
name - the name of the user to be tested
password - the password to be tested
Returns:
true if the test is successful, false if the user doesn't exist or if the password is incorrect

addUser

public void addUser(String userName,
                    Object attributes)
Adds userName to the MemberAttribute (specified in conf.xml) of this node. If ManageGroupAttribute (conf.xml) is TRUE then calls addGroupToUser.

Specified by:
addUser in interface UsersRepository
Parameters:
userName - the name of the user to be added
attributes - see decription

getAttributes

public Object getAttributes(String name)
Description copied from interface: UsersRepository
Gets the attribute for a user. Not clear on behavior.

Specified by:
getAttributes in interface UsersRepository

removeUser

public void removeUser(String userName)
Description copied from interface: UsersRepository
Removes a user from the repository

Specified by:
removeUser in interface UsersRepository
Parameters:
userName - the user to remove from the repository

removeGroupFromUser

public void removeGroupFromUser(String userName)

contains

public boolean contains(String name)
Description copied from interface: UsersRepository
Returns whether or not this user is in the repository

Specified by:
contains in interface UsersRepository
Parameters:
name - the name to check in the repository
Returns:
whether the user is in the repository

test

public boolean test(String name,
                    Object attributes)
Description copied from interface: UsersRepository
Tests a user with the appropriate attributes. In current implementations, this typically means "check the password" where a String password is passed as the Object attributes.

Specified by:
test in interface UsersRepository

countUsers

public int countUsers()
Description copied from interface: UsersRepository
Returns a count of the users in the repository.

Specified by:
countUsers in interface UsersRepository
Returns:
the number of users in the repository

getDomains

public String getDomains()

dispose

public void dispose()
             throws Exception
Disposes of all open directory contexts

Throws:
Exception - if an error is encountered during shutdown


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