public class MappedUserPropertyProvider extends Object implements UserPropertyProvider
UserPropertyProvider
that delegates to a user-specific UserPropertyProvider.
This implementation will explicitly verify if a user exists, when operating on its properties, but only if the
corresponding mapped provider does so. If that is the case, then the methods of this implementation will throw
UserNotFoundException
.
This class related to, but is distinct from HybridUserPropertyProvider
. 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:
UserPropertyProviderMapper
must be configured using the mappedUserPropertyProvider.mapper.className
system property. It is of importance to note that most UserPropertyProviderMapper implementations will require additional
configuration.Modifier and Type | Field and Description |
---|---|
protected UserPropertyProviderMapper |
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 UserPropertyProviderMapper
instance to be used by instances of this class.
|
Constructor and Description |
---|
MappedUserPropertyProvider() |
Modifier and Type | Method and Description |
---|---|
void |
deleteProperty(String username,
String propName)
Removes one particular property for a particular user.
|
void |
insertProperty(String username,
String propName,
String propValue)
Adds a property for an user.
|
static UserPropertyProvider |
instantiate(String propertyName)
Instantiates a UserPropertyProvider based on a property value (that is expected to be a class name).
|
boolean |
isReadOnly()
Returns whether all backing providers are read-only.
|
Map<String,String> |
loadProperties(String username)
Retrieves all properties for a particular user.
|
String |
loadProperty(String username,
String propName)
Retrieves a property value for a user.
|
void |
updateProperty(String username,
String propName,
String propValue)
Changes a property value for an user.
|
public static final String PROPERTY_MAPPER_CLASSNAME
protected final UserPropertyProviderMapper mapper
public static UserPropertyProvider instantiate(String propertyName)
propertyName
- A property name (cannot ben ull).public Map<String,String> loadProperties(String username) throws UserNotFoundException
UserPropertyProvider
loadProperties
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).UserNotFoundException
public String loadProperty(String username, String propName) throws UserNotFoundException
UserPropertyProvider
loadProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).UserNotFoundException
public void insertProperty(String username, String propName, String propValue) throws UserNotFoundException
UserPropertyProvider
insertProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).propValue
- The property value (cannot be null).UserNotFoundException
public void updateProperty(String username, String propName, String propValue) throws UserNotFoundException
UserPropertyProvider
updateProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).propValue
- The property value (cannot be null).UserNotFoundException
public void deleteProperty(String username, String propName) throws UserNotFoundException
UserPropertyProvider
deleteProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).UserNotFoundException
public boolean isReadOnly()
isReadOnly
in interface UserPropertyProvider
Copyright © 2003-2008 Jive Software.