org.apache.james.services
Interface UsersRepository

All Known Implementing Classes:
AbstractJdbcUsersRepository, AbstractUsersRepository, DefaultUsersJdbcRepository, JamesUsersJdbcRepository, ListUsersJdbcRepository, LocalUsersRepository, 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: 407988 $

Field Summary
static java.lang.String ROLE
          The component role used by components implementing this service
static java.lang.String USER
           
 
Method Summary
 void addUser(java.lang.String name, java.lang.Object attributes)
          Adds a user to the repository with the specified attributes.
 boolean addUser(java.lang.String username, java.lang.String password)
          Adds a user to the repository with the specified password
 boolean addUser(User user)
          Adds a user to the repository with the specified User object.
 boolean contains(java.lang.String name)
          Returns whether or not this user is in the repository
 boolean containsCaseInsensitive(java.lang.String name)
          Returns whether or not this user is in the repository.
 int countUsers()
          Returns a count of the users in the repository.
 java.lang.String getRealName(java.lang.String name)
          Returns the user name of the user matching name on an equalsIgnoreCase basis.
 User getUserByName(java.lang.String name)
          Get the user object with the specified user name.
 User getUserByNameCaseInsensitive(java.lang.String name)
          Get the user object with the specified user name.
 java.util.Iterator list()
          List users in repository.
 void removeUser(java.lang.String name)
          Removes a user from the repository
 boolean test(java.lang.String name, java.lang.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

static final java.lang.String ROLE
The component role used by components implementing this service

See Also:
Constant Field Values

USER

static final java.lang.String USER
See Also:
Constant Field Values
Method Detail

addUser

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

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.

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

addUser

boolean addUser(java.lang.String username,
                java.lang.String password)
Adds a user to the repository with the specified password

Parameters:
username - the username of the user to be added
password - the password of the user to add
Returns:
true if succesful, false otherwise
Since:
James 2.3.0

getUserByName

User getUserByName(java.lang.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

User getUserByNameCaseInsensitive(java.lang.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

java.lang.String getRealName(java.lang.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

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

void removeUser(java.lang.String name)
Removes a user from the repository

Parameters:
name - the user to remove from the repository

contains

boolean contains(java.lang.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

boolean containsCaseInsensitive(java.lang.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

boolean test(java.lang.String name,
             java.lang.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

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

Returns:
the number of users in the repository

list

java.util.Iterator list()
List users in repository.

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


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.