Package org.jivesoftware.openfire.user
Class MappedUserProvider
- java.lang.Object
-
- org.jivesoftware.openfire.user.UserMultiProvider
-
- org.jivesoftware.openfire.user.MappedUserProvider
-
- All Implemented Interfaces:
UserProvider
public class MappedUserProvider extends UserMultiProvider
AUserProviderthat delegates to a user-specific UserProvider. This class related to, but is distinct fromHybridUserProvider. The Hybrid variant of the provider iterates over providers, operating on the first applicable instance. This Mapped variant, however, maps each user to exactly one provider. To use this provider, use the following system property definition:provider.user.className = org.jivesoftware.openfire.user.MappedUserProvider
UserProviderMappermust be configured using themappedUserProvider.mapper.classNamesystem property. It is of importance to note that most UserProviderMapper implementations will require additional configuration.- Author:
- Guus der Kinderen, guus@goodbytes.nl
- See Also:
MappedAuthProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected UserProviderMappermapperUsed to determine what provider is to be used to operate on a particular user.static StringPROPERTY_MAPPER_CLASSNAMEName of the property of which the value is expected to be the classname of the UserProviderMapper instance to be used by instances of this class.
-
Constructor Summary
Constructors Constructor Description MappedUserProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UsercreateUser(String username, String password, String name, String email)Creates a new user.voiddeleteUser(String username)Delets a user.UserProvidergetUserProvider(String username)Collection<UserProvider>getUserProviders()UserloadUser(String username)Loads the specified user by username.voidsetCreationDate(String username, Date creationDate)Sets the date the user was created.voidsetEmail(String username, String email)Sets the user's email address.voidsetModificationDate(String username, Date modificationDate)Sets the date the user was last modified.voidsetName(String username, String name)Sets the user's name.-
Methods inherited from class org.jivesoftware.openfire.user.UserMultiProvider
findUsers, findUsers, getSearchFields, getUserCount, getUsernames, getUsers, getUsers, instantiate, isEmailRequired, isNameRequired, isReadOnly
-
-
-
-
Field Detail
-
PROPERTY_MAPPER_CLASSNAME
public static final String PROPERTY_MAPPER_CLASSNAME
Name of the property of which the value is expected to be the classname of the UserProviderMapper instance to be used by instances of this class.- See Also:
- Constant Field Values
-
mapper
protected final UserProviderMapper mapper
Used to determine what provider is to be used to operate on a particular user.
-
-
Method Detail
-
getUserProviders
public Collection<UserProvider> getUserProviders()
-
getUserProvider
public UserProvider getUserProvider(String username)
-
loadUser
public User loadUser(String username) throws UserNotFoundException
Description copied from interface:UserProviderLoads the specified user by username.- Parameters:
username- the username- Returns:
- the User.
- Throws:
UserNotFoundException- if the User could not be loaded.
-
createUser
public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException
Description copied from interface:UserProviderCreates a new user. This method should throw an UnsupportedOperationException if this operation is not supporte by the backend user store.- 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:
- a new User.
- Throws:
UserAlreadyExistsException- if the username is already in use.
-
deleteUser
public void deleteUser(String username)
Description copied from interface:UserProviderDelets a user. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Parameters:
username- the username to delete.
-
setName
public void setName(String username, String name) throws UserNotFoundException
Description copied from interface:UserProviderSets the user's name. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Parameters:
username- the username.name- the name.- Throws:
UserNotFoundException- if the user could not be found.
-
setEmail
public void setEmail(String username, String email) throws UserNotFoundException
Description copied from interface:UserProviderSets the user's email address. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Parameters:
username- the username.email- the email address.- Throws:
UserNotFoundException- if the user could not be found.
-
setCreationDate
public void setCreationDate(String username, Date creationDate) throws UserNotFoundException
Description copied from interface:UserProviderSets the date the user was created. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Parameters:
username- the username.creationDate- the date the user was created.- Throws:
UserNotFoundException- if the user could not be found.
-
setModificationDate
public void setModificationDate(String username, Date modificationDate) throws UserNotFoundException
Description copied from interface:UserProviderSets the date the user was last modified. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Parameters:
username- the username.modificationDate- the date the user was last modified.- Throws:
UserNotFoundException- if the user could not be found.
-
-