public class MappedUserProvider extends UserMultiProvider
UserProvider
that delegates to a user-specific UserProvider.
This class related to, but is distinct from HybridUserProvider
. 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:
UserProviderMapper
must be configured using the mappedUserProvider.mapper.className
system property. It is of importance to note that most UserProviderMapper implementations will require additional
configuration.MappedAuthProvider
Modifier and Type | Field and 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 and Description |
---|
MappedUserProvider() |
Modifier and Type | Method and 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)
Returns the 'backing' provider that serves the provided user.
|
Collection<UserProvider> |
getUserProviders()
Returns all UserProvider instances that serve as 'backing' providers.
|
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.
|
findUsers, findUsers, getSearchFields, getUserCount, getUsernames, getUsers, getUsers, instantiate, isEmailRequired, isNameRequired, isReadOnly
public static final String PROPERTY_MAPPER_CLASSNAME
protected final UserProviderMapper mapper
public Collection<UserProvider> getUserProviders()
UserMultiProvider
public UserProvider getUserProvider(String username)
UserMultiProvider
username
- A user identifier (cannot be null or empty).public User loadUser(String username) throws UserNotFoundException
UserProvider
username
- the usernameUserNotFoundException
- if the User could not be loaded.public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException
UserProvider
username
- the username.password
- the plain-text password.name
- the user's name, which can be null, unless isNameRequired is set to true.email
- the user's email address, which can be null, unless isEmailRequired is set to true.UserAlreadyExistsException
- if the username is already in use.public void deleteUser(String username)
UserProvider
username
- the username to delete.public void setName(String username, String name) throws UserNotFoundException
UserProvider
username
- the username.name
- the name.UserNotFoundException
- if the user could not be found.public void setEmail(String username, String email) throws UserNotFoundException
UserProvider
username
- the username.email
- the email address.UserNotFoundException
- if the user could not be found.public void setCreationDate(String username, Date creationDate) throws UserNotFoundException
UserProvider
username
- the username.creationDate
- the date the user was created.UserNotFoundException
- if the user could not be found.public void setModificationDate(String username, Date modificationDate) throws UserNotFoundException
UserProvider
username
- the username.modificationDate
- the date the user was last modified.UserNotFoundException
- if the user could not be found.Copyright © 2003-2008 Jive Software.