public class HybridUserPropertyProvider extends Object implements UserPropertyProvider
UserNotFoundException
.
This class related to, but is distinct from MappedUserPropertyProvider
. 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.
To use this provider, use the following system property definition:
provider.userproperty.className = org.jivesoftware.openfire.user.HybridUserPropertyProvider
hybridUserPropertyProvider.primaryProvider.className = fully.qualified.ClassUserPropertyProvider
hybridUserPropertyProvider.secondaryProvider.className = fully.qualified.ClassUserPropertyProvider
hybridUserPropertyProvider.tertiaryProvider.className = fully.qualified.ClassUserPropertyProvider
Constructor and Description |
---|
HybridUserPropertyProvider() |
Modifier and Type | Method and Description |
---|---|
void |
deleteProperty(String username,
String propName)
Removes a property from all non-read-only providers.
|
void |
insertProperty(String username,
String propName,
String propValue)
Adds a new property, updating a previous property value if one already exists.
|
boolean |
isReadOnly()
Returns whether all backing providers are read-only.
|
Map<String,String> |
loadProperties(String username)
Returns the properties from the first provider that returns a non-empty collection.
|
String |
loadProperty(String username,
String propName)
Returns a property from the first provider that returns a non-null value.
|
void |
updateProperty(String username,
String propName,
String propValue)
Updates a property (or adds a new property when the property does not exist).
|
public Map<String,String> loadProperties(String username)
loadProperties
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).public String loadProperty(String username, String propName)
loadProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).public void insertProperty(String username, String propName, String propValue) throws UnsupportedOperationException
updateProperty(String, String, String)
.
First, tries to find a provider that has the property for the provided user. If that provider is read-only, an
UnsupportedOperationException is thrown. If the provider is not read-only, the existing property value will be
updated.
When the property is not defined in any provider, it will be added in the first non-read-only provider.
When all providers are read-only, an UnsupportedOperationException is thrown.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).UnsupportedOperationException
- if the property cannot be addedpublic void updateProperty(String username, String propName, String propValue) throws UnsupportedOperationException
insertProperty(String, String, String)
.
First, tries to find a provider that has the property for the provided user. If that provider is read-only, an
UnsupportedOperationException is thrown. If the provider is not read-only, the existing property value will be
updated.
When the property is not defined in any provider, it will be added in the first non-read-only provider.
When all providers are read-only, an UnsupportedOperationException is thrown.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).UnsupportedOperationException
- if the property cannot be updatedpublic void deleteProperty(String username, String propName) throws UnsupportedOperationException
deleteProperty
in interface UserPropertyProvider
username
- The identifier of the user (cannot be null or empty).propName
- The property name (cannot be null or empty).UnsupportedOperationException
- if the property cannot be deletedpublic boolean isReadOnly()
isReadOnly
in interface UserPropertyProvider
Copyright © 2003–2019 Ignite Realtime. All rights reserved.