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
AUserProvider
that 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
UserProviderMapper
must be configured using themappedUserProvider.mapper.className
system 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 UserProviderMapper
mapper
Used to determine what provider is to be used to operate on a particular user.static 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.
-
Constructor Summary
Constructors Constructor Description MappedUserProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
createUser(String username, String password, String name, String email)
Creates a new user.void
deleteUser(String username)
Delets a user.UserProvider
getUserProvider(String username)
Collection<UserProvider>
getUserProviders()
User
loadUser(String username)
Loads the specified user by username.void
setCreationDate(String username, Date creationDate)
Sets the date the user was created.void
setEmail(String username, String email)
Sets the user's email address.void
setModificationDate(String username, Date modificationDate)
Sets the date the user was last modified.void
setName(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:UserProvider
Loads 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:UserProvider
Creates 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:UserProvider
Delets 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:UserProvider
Sets 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:UserProvider
Sets 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:UserProvider
Sets 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:UserProvider
Sets 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.
-
-