Clearspace API (2.5.22) Core Javadocs

com.jivesoftware.spi.user
Interface UserProvider


public interface UserProvider

API for defining custom systems of record for user management. Implementations of user providers can optionally be chained into a UserManager that will consult the provider as the system of record and if supported, pass changes for a given user through to the underlying provider of record. Service for querying users and notifying listeners when operations that modify users occur. All implementations of this interface must support the basic query and listing methods. These are

There are additional facets of the API that can be enabled by returning true from supportsUpdate() and/or supportsPagination() methods. supportsUpdate() lets the application know that the Service allows creation, update and deletion of users. supportsPagination() lets the application know that service can efficiently load result set with large number of users and paginate through them. As of Clearspace 2.0, all changes to user data pass throught the Clearspace UserManager. The role of the user manager is to dispatch user updates to the underlying provider if the provider supports such updates.

See Also:
User, UserManager

Method Summary
 User create(User user)
          Creates a user based on the data passed in the UserTemplate
 void delete(User user)
          Deletes a user in the underlying provider store.
 int getCount()
          Returns total number of users in the system.
 String getName()
          Returns the name of the provider for system reporting and logging purposes.
 User getUser(User template)
          Template-driven search approach.
 Iterable<String> getUsernames()
          Returns an unmodifiable Collection of usernames of all users in the system.
 Iterable<User> getUsers()
          Returns an unmodifiable Collections of all users in the system.
 Iterable<User> getUsers(int startIndex, int size)
          Returns iterable result set of users, containing size or less users and starting at startIndex.
 boolean supportsPagination()
          Returns true if this provider supports pagination.
 boolean supportsUpdate()
          Returns true if this provider supports create, update and delete operations.
 void update(User user)
          Updates the user via the user provider, if the provider supports updates.
 

Method Detail

getUser

User getUser(User template)
Template-driven search approach. A provider implementation may choose to load a user given any information in the user object.

Parameters:
template - the template used to locate the user
Returns:
the User or null if no matching user is found.

getUsers

Iterable<User> getUsers()
Returns an unmodifiable Collections of all users in the system.

Returns:
an unmodifiable Collection of all users.

getUsernames

Iterable<String> getUsernames()
Returns an unmodifiable Collection of usernames of all users in the system.

Returns:
an unmodifiable Collection of all usernames in the system.

supportsUpdate

boolean supportsUpdate()
Returns true if this provider supports create, update and delete operations. This method will be called to check whether create/delete operations can be performed.

Returns:
true if the provider supports updates for user information

update

void update(User user)
            throws UnsupportedOperationException
Updates the user via the user provider, if the provider supports updates.

Parameters:
user -
Throws:
UnsupportedOperationException
Since:
2.0

create

User create(User user)
            throws AlreadyExistsException,
                   UnsupportedOperationException
Creates a user based on the data passed in the UserTemplate

Parameters:
user - template to base the new user of
Returns:
User created
Throws:
AlreadyExistsException - if the user is duplicate
UnsupportedOperationException - if new users cannot be created via the provider.

delete

void delete(User user)
Deletes a user in the underlying provider store.

Parameters:
user - user to delete

supportsPagination

boolean supportsPagination()
Returns true if this provider supports pagination. If the system contains a large number of users, it is more efficient to load a limited set of users at time. This method will be called to check whether count()/users(startIndex, size) operations can be performed.

Returns:
exists true if the provider supports pagination methods

getCount

int getCount()
             throws UnsupportedOperationException
Returns total number of users in the system.

Returns:
count total number of users
Throws:
UnsupportedOperationException

getUsers

Iterable<User> getUsers(int startIndex,
                        int size)
Returns iterable result set of users, containing size or less users and starting at startIndex.

Parameters:
startIndex - index to start the result set from
size - maximum size of the result set returned
Returns:
users A iterable collection of users less than or equal size starting at the given index.

getName

String getName()
Returns the name of the provider for system reporting and logging purposes.

Returns:

Clearspace Project Page

Copyright © 1999-2007 Jive Software.