Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.clearspace
Class ClearspaceUserProvider

    java.lang.Object
      org.jivesoftware.openfire.clearspace.ClearspaceUserProvider

All Implemented Interfaces:
  UserProvider

    public class ClearspaceUserProvider

extends Object
implements UserProvider

The ClearspaceUserProvider uses the UserService and ProfileSearchService web service inside of Clearspace to retrieve user information and to search for users from Clearspace.

Author:
  Gabriel Guardincerri

Field Summary
`protected static String` | `SEARCH_URL_PREFIX`
`protected static String` | `USER_URL_PREFIX`

Constructor Summary
`ClearspaceUserProvider()`

Method Summary
`User` | `createUser(String username, String password, String name, String email)` Creates user using the userService/users POST service.
`void` | `deleteUser(String username)` Deletes a user using the userService/users DELETE service.
`Collection<User>` | `findUsers(Set<String> fields, String query)` Search for the user using the userService/search POST method.
`Collection<User>` | `findUsers(Set<String> fields, String query, int startIndex, int numResults)` Search for the user using the userService/searchBounded POST method.
`Set<String>` | `getSearchFields()` Clearsapce can search using three fields: username, name and email.
`int` | `getUserCount()` Gets the user count using the userService/users/count GET service.
`Collection<String>` | `getUsernames()` Gets all usernames using the userService/userNames GET service.
`Collection<User>` | `getUsers()` Gets all users using the userService/userNames GET service.
`Collection<User>` | `getUsers(int startIndex, int numResults)` Gets a bounded list of users using the userService/userNames GET service.
`protected org.dom4j.Element` | `getUserUpdateParams(String username)` Creates the parameters to send in a update user request based on the information of `username`
`boolean` | `isEmailRequired()` In Clearspace email is required
`boolean` | `isNameRequired()` In Clearspace name is optional.
`boolean` | `isReadOnly()` Returns true if Clearspace is a read only user provider.
`User` | `loadUser(String username)` Loads the user using the userService/users GET service.
`void` | `setCreationDate(String username, Date creationDate)` Updates the creationDate of the user using the userService/update service.
`void` | `setEmail(String username, String email)` Updates the email of the user using the userService/update service.
`void` | `setModificationDate(String username, Date modificationDate)` Updates the modificationDate of the user using the userService/update service.
`void` | `setName(String username, String name)` Updates the name of the user using the userService/update service.
`protected void` | `updateUser(org.dom4j.Element userUpdateParams)` Updates the user using the userService/users PUT service.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### USER_URL_PREFIX

    protected static final String USER_URL_PREFIX

See Also:
  Constant Field Values

### SEARCH_URL_PREFIX

    protected static final String SEARCH_URL_PREFIX

See Also:
  Constant Field Values

Constructor Detail

### ClearspaceUserProvider

    public ClearspaceUserProvider()

Method Detail

### loadUser

    public User loadUser(String username)
                  throws UserNotFoundException

  Loads the user using the userService/users GET service. Only loads local users. Throws a UserNotFoundException exception if the user could not be found.

  Specified by:
    `loadUser` in interface `UserProvider`
  Parameters:
    `username` - the username of the user to load
  Returns:
    a user instance with the user information
  Throws:
    `UserNotFoundException` - if the user could not be found

### createUser

    public User createUser(String username,
                           String password,
                           String name,
                           String email)
                    throws UserAlreadyExistsException

  Creates user using the userService/users POST service. If Clearspace is a read only provider throws an UnsupportedOperationException. If there is already a user with the username throws a UserAlreadyExistsException.

  Specified by:
    `createUser` in interface `UserProvider`
  Parameters:
    `username` - the username of the user
    `password` - the password of the user
    `name` - the name of the user (optional)
    `email` - the email of the user
  Returns:
    an instance of the created user
  Throws:
    `UserAlreadyExistsException` - If there is already a user with the username
    `UnsupportedOperationException` - If Clearspace is a read only provider

### deleteUser

    public void deleteUser(String username)

  Deletes a user using the userService/users DELETE service. If the user is not found returns.

  Specified by:
    `deleteUser` in interface `UserProvider`
  Parameters:
    `username` - the username of the user to delete

### getUserCount

    public int getUserCount()

  Gets the user count using the userService/users/count GET service.

  Specified by:
    `getUserCount` in interface `UserProvider`
  Returns:
    the user count

### getUsers

    public Collection<User> getUsers()

  Gets all users using the userService/userNames GET service.

  Specified by:
    `getUsers` in interface `UserProvider`
  Returns:
    a list of all users

### getUsernames

    public Collection<String> getUsernames()

  Gets all usernames using the userService/userNames GET service.

  Specified by:
    `getUsernames` in interface `UserProvider`
  Returns:
    a list of all the usernames

### getUsers

    public Collection<User> getUsers(int startIndex,
                                     int numResults)

  Gets a bounded list of users using the userService/userNames GET service.

  Specified by:
    `getUsers` in interface `UserProvider`
  Parameters:
    `startIndex` - the start index
    `numResults` - the number of result
  Returns:
    a bounded list of users

### setName

    public void setName(String username,
                        String name)
                 throws UserNotFoundException

  Updates the name of the user using the userService/update service.

  Specified by:
    `setName` in interface `UserProvider`
  Parameters:
    `username` - the username of the user
    `name` - the new name of the user
  Throws:
    `UserNotFoundException` - if there is no user with that username

### setEmail

    public void setEmail(String username,
                         String email)
                  throws UserNotFoundException

  Updates the email of the user using the userService/update service.

  Specified by:
    `setEmail` in interface `UserProvider`
  Parameters:
    `username` - the username of the user
    `email` - the new email of the user
  Throws:
    `UserNotFoundException` - if the user could not be found

### setCreationDate

    public void setCreationDate(String username,
                                Date creationDate)
                         throws UserNotFoundException

  Updates the creationDate of the user using the userService/update service.

  Specified by:
    `setCreationDate` in interface `UserProvider`
  Parameters:
    `username` - the username of the user
    `creationDate` - the new email of the user
  Throws:
    `UserNotFoundException` - if the user could not be found

### setModificationDate

    public void setModificationDate(String username,
                                    Date modificationDate)
                             throws UserNotFoundException

  Updates the modificationDate of the user using the userService/update service.

  Specified by:
    `setModificationDate` in interface `UserProvider`
  Parameters:
    `username` - the username of the user
    `modificationDate` - the new modificationDate of the user
  Throws:
    `UserNotFoundException` - if the user could not be found

### getUserUpdateParams

    protected org.dom4j.Element getUserUpdateParams(String username)
                                             throws UserNotFoundException

  Creates the parameters to send in a update user request based on the information of `username`

  Parameters:
    `username` - the username of the user
  Returns:
    the parameters to send in a update user request
  Throws:
    `UserNotFoundException` - if the user could not be found

### updateUser

    protected void updateUser(org.dom4j.Element userUpdateParams)
                       throws UserNotFoundException

  Updates the user using the userService/users PUT service.

  Parameters:
    `userUpdateParams` - the request parameters
  Throws:
    `UserNotFoundException` - if the user could not be found

### getSearchFields

    public Set<String> getSearchFields()
                                throws UnsupportedOperationException

  Clearsapce can search using three fields: username, name and email.

  Specified by:
    `getSearchFields` in interface `UserProvider`
  Returns:
    a list of username, name and email
  Throws:
    `UnsupportedOperationException`

### findUsers

    public Collection<User> findUsers(Set<String> fields,
                                      String query)
                               throws UnsupportedOperationException

  Search for the user using the userService/search POST method.

  Specified by:
    `findUsers` in interface `UserProvider`
  Parameters:
    `fields` - the fields to search on.
    `query` - the query string.
  Returns:
    a Collection of users that match the search.
  Throws:
    `UnsupportedOperationException` - if the provider does not support the operation (this is an optional operation).

### findUsers

    public Collection<User> findUsers(Set<String> fields,
                                      String query,
                                      int startIndex,
                                      int numResults)
                               throws UnsupportedOperationException

  Search for the user using the userService/searchBounded POST method.

  Specified by:
    `findUsers` in interface `UserProvider`
  Parameters:
    `fields` - the fields to search on.
    `query` - the query string.
    `startIndex` - the starting index in the search result to return.
    `numResults` - the number of users to return in the search result.
  Returns:
    a Collection of users that match the search.
  Throws:
    `UnsupportedOperationException` - if the provider does not support the operation (this is an optional operation).

### isReadOnly

    public boolean isReadOnly()

  Returns true if Clearspace is a read only user provider.

  Specified by:
    `isReadOnly` in interface `UserProvider`
  Returns:
    true if Clearspace is a read only user provider

### isNameRequired

    public boolean isNameRequired()

  In Clearspace name is optional.

  Specified by:
    `isNameRequired` in interface `UserProvider`
  Returns:
    false

### isEmailRequired

    public boolean isEmailRequired()

  In Clearspace email is required

  Specified by:
    `isEmailRequired` in interface `UserProvider`
  Returns:
    true

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.