Package org.jivesoftware.openfire.user
Class HybridUserProvider
java.lang.Object
org.jivesoftware.openfire.user.UserMultiProvider
org.jivesoftware.openfire.user.HybridUserProvider
- All Implemented Interfaces:
UserProvider
Delegate UserProvider operations among up to three configurable provider implementation classes.
This class related to, but is distinct from
MappedUserProvider. The Hybrid variant of the provider iterates
over providers, operating on the first applicable instance. The Mapped variant, however, maps each user to exactly
one provider.- Author:
- Marc Seeger, Chris Neasbitt, Tom Evans, Guus der Kinderen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUser(String username, String password, String name, String email) Creates a new user in the first non-read-only provider.voiddeleteUser(String username) Removes a user from all non-read-only providers.getUserProvider(String username) Returns the first provider that contains the user, or the first provider that is not read-only when the user does not exist in any provider.protected List<UserProvider>Loads a user from the first provider that contains the user.voidsetCreationDate(String username, Date creationDate) Changes the creation date of a user in the first provider that contains the user.voidChanges the email address of a user in the first provider that contains the user.voidsetModificationDate(String username, Date modificationDate) Changes the modification date of a user in the first provider that contains the user.voidChanges the full name of a user in the first provider that contains the user.Methods inherited from class org.jivesoftware.openfire.user.UserMultiProvider
findUsers, findUsers, getSearchFields, getUserCount, getUsernames, getUsers, getUsers, instantiate, isEmailRequired, isNameRequired, isReadOnly
-
Constructor Details
-
HybridUserProvider
public HybridUserProvider()
-
-
Method Details
-
getUserProviders
-
createUser
public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException Creates a new user in the first non-read-only provider.- Parameters:
username- the username.password- the plain-text password.name- the user's name, which can benull, unless isNameRequired is set to true.email- the user's email address, which can benull, unless isEmailRequired is set to true.- Returns:
- The user that was created.
- Throws:
UserAlreadyExistsException- if the user already exists
-
deleteUser
Removes a user from all non-read-only providers.- Parameters:
username- the username to delete.
-
getUserProvider
Returns the first provider that contains the user, or the first provider that is not read-only when the user does not exist in any provider.- Parameters:
username- the username (cannot be null or empty).- Returns:
- The user provider (never null)
-
loadUser
Loads a user from the first provider that contains the user.- Parameters:
username- the username (cannot be null or empty).- Returns:
- The user (never null).
- Throws:
UserNotFoundException- When none of the providers contains the user.
-
setCreationDate
Changes the creation date of a user in the first provider that contains the user.- Parameters:
username- the username.creationDate- the date the user was created.- Throws:
UserNotFoundException- when the user was not found in any provider.UnsupportedOperationException- when the provider is read-only.
-
setModificationDate
public void setModificationDate(String username, Date modificationDate) throws UserNotFoundException Changes the modification date of a user in the first provider that contains the user.- Parameters:
username- the username.modificationDate- the date the user was (last) modified.- Throws:
UserNotFoundException- when the user was not found in any provider.UnsupportedOperationException- when the provider is read-only.
-
setName
Changes the full name of a user in the first provider that contains the user.- Parameters:
username- the username.name- the new full name a user.- Throws:
UserNotFoundException- when the user was not found in any provider.UnsupportedOperationException- when the provider is read-only.
-
setEmail
Changes the email address of a user in the first provider that contains the user.- Parameters:
username- the username.email- the new email address of a user.- Throws:
UserNotFoundException- when the user was not found in any provider.UnsupportedOperationException- when the provider is read-only.
-