Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.spi.user
Interface UserProvider

All Superinterfaces:
ServiceEventSource<UserNotificationEvent,User>, ServiceProvider

public interface UserProvider
extends ServiceProvider, ServiceEventSource<UserNotificationEvent,User>

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 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. To keep Clearspace in sync with the external user stores, it is recommended that provider implementation publish UserNotificationEvent. Inheriting from ServiceEventDispatcher will automatically provide support of registering listeners and event dispatch.

See Also:
ServiceProvider, User, UserTemplate, UserNotificationEvent

Method Summary
 User create(UserTemplate user)
          Creates a user based on the data passed in the UserTemplate
 void delete(User user)
          Deletes a user
 boolean exists(java.lang.String username)
          Returns true if a user exitst whose username matches.
 boolean exists(UserTemplate user)
          Returns true if the user that matches the template exists
 int getCount()
          Returns total number of users in the system.
 User getUser(java.lang.String username)
          returns the user associated to the username.
 User getUser(UserTemplate template)
          returns the specified user.
 java.lang.Iterable<java.lang.String> getUsernames()
          Returns an unmodifiable Collection of usernames of all users in the system.
 java.lang.Iterable<User> getUsers()
          Returns an unmodifiable Collections of all users in the system.
 java.lang.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 and delete operations.
 
Methods inherited from interface com.jivesoftware.spi.ServiceProvider
destroy, getConfigurationMap, initialize
 
Methods inherited from interface com.jivesoftware.spi.ServiceEventSource
addListener, removeListener
 

Method Detail

getUser

User getUser(java.lang.String username)
             throws NotFoundException,
                    java.lang.UnsupportedOperationException
returns the user associated to the username. It is possible for implementations to allow duplicate usernames. Use the get(UserTemplate) method.

Parameters:
username - the username
Returns:
the User.
Throws:
NotFoundException - if the User could not be found.
java.lang.UnsupportedOperationException - if the provider doesn't implement this method
See Also:
getUser(UserTemplate)

getUser

User getUser(UserTemplate template)
             throws NotFoundException
returns the specified user. The user template contains additional information about the user that can be used to narrow the search.

Parameters:
template - the template used to locate the user
Returns:
the User.
Throws:
NotFoundException - if the User could not be found.

getUsers

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

Returns:
an unmodifiable Collection of all users.

getUsernames

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

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

exists

boolean exists(java.lang.String username)
               throws java.lang.UnsupportedOperationException
Returns true if a user exitst whose username matches.

Parameters:
username - the username to match.
Returns:
exists true if the user exists, false otherwise
Throws:
java.lang.UnsupportedOperationException - if the provider doesn't implement this method

exists

boolean exists(UserTemplate user)
               throws java.lang.UnsupportedOperationException
Returns true if the user that matches the template exists

Parameters:
user - the template to use when searching.
Returns:
exists true if the user exists, false otherwise
Throws:
java.lang.UnsupportedOperationException - if the provider doesn't implement this method

supportsUpdate

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

Returns:
exists true if the user exists, false otherwise

create

User create(UserTemplate user)
            throws AlreadyExistsException
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

delete

void delete(User user)
Deletes a user

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()
Returns total number of users in the system.

Returns:
count total number of users

getUsers

java.lang.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.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.