org.apache.james.services
Interface UsersRepository

All Known Implementing Classes:
AbstractUsersRepository, UsersFileRepository, UsersLDAPRepository

public interface UsersRepository

Interface for a repository of users. A repository represents a logical grouping of users, typically by common purpose. E.g. the users served by an email server or the members of a mailing list.

Version:
$Revision: 1.9 $
Author:
Federico Barbieri , Charles Benett

Field Summary
static String ROLE
          The component role used by components implementing this service
static String USER
           
 
Method Summary
 void addUser(String name, 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.
 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.
 int countUsers()
          Returns a count of the users in the repository.
 Object getAttributes(String name)
          Deprecated. As of James 1.2.2 . Use the getUserByName method.
 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.
 Iterator list()
          List users in repository.
 void removeUser(String name)
          Removes a user from the repository
 boolean test(String name, Object attributes)
          Deprecated. As of James 1.2.2, use test(String name, String password)
 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.
 

Field Detail

ROLE

public static final String ROLE
The component role used by components implementing this service

See Also:
Constant Field Values

USER

public static final String USER
See Also:
Constant Field Values
Method Detail

addUser

public boolean addUser(User user)
Adds a user to the repository with the specified User object.

Parameters:
user - the user to be added
Returns:
true if succesful, false otherwise
Since:
James 1.2.2

addUser

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

Parameters:
name - the name of the user to be added
attributes - see decription

getAttributes

public Object getAttributes(String name)
Deprecated. As of James 1.2.2 . Use the getUserByName method.

Gets the attribute for a user. Not clear on behavior.


getUserByName

public User getUserByName(String name)
Get the user object with the specified user name. Return null if no such user.

Parameters:
name - the name of the user to retrieve
Returns:
the user being retrieved, null if the user doesn't exist
Since:
James 1.2.2

getUserByNameCaseInsensitive

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

Parameters:
name - the name of the user to retrieve
Returns:
the user being retrieved, null if the user doesn't exist
Since:
James 1.2.2

getRealName

public String getRealName(String name)
Returns the user name of the user matching name on an equalsIgnoreCase basis. Returns null if no match.

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)
Update the repository with the specified user object. A user object with this username must already exist.

Returns:
true if successful.

removeUser

public void removeUser(String name)
Removes a user from the repository

Parameters:
name - the user to remove from the repository

contains

public boolean contains(String name)
Returns whether or not this user is in the repository

Parameters:
name - the name to check in the repository
Returns:
whether the user is in the repository

containsCaseInsensitive

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

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)
Deprecated. As of James 1.2.2, use test(String name, String password)

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.


test

public boolean test(String name,
                    String password)
Test if user with name 'name' has password 'password'.

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
Since:
James 1.2.2

countUsers

public int countUsers()
Returns a count of the users in the repository.

Returns:
the number of users in the repository

list

public Iterator list()
List users in repository.

Returns:
Iterator over a collection of Strings, each being one user in the repository.


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