Class DefaultUserPropertyProvider
java.lang.Object
org.jivesoftware.openfire.user.property.DefaultUserPropertyProvider
- All Implemented Interfaces:
UserPropertyProvider
Default implementation of the UserPropertyProvider interface, which reads and writes data from the
ofUserProp database table.
This implementation will not explicitly verify if a user exists, when operating on its properties. The methods of
this implementation will not throw UserNotFoundException.
Warning: in virtually all cases a user property provider should not be used directly. Instead, use the
Map returned by User.getProperties() to create, read, update or delete user properties. Failure to do so
is likely to result in inconsistent data behavior and race conditions. Direct access to the user property
provider is only provided for special-case logic.- Author:
- Guus der Kinderen, guus@goodbytes.nl
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteProperty(String username, String propName) Removes one particular property for a particular user.voidinsertProperty(String username, String propName, String propValue) Adds a property for an user.booleanReturns true if this UserPropertyProvider is read-only.loadProperties(String username) Retrieves all properties for a particular user.loadProperty(String username, String propertyName) Retrieves a property value for a user.voidupdateProperty(String username, String propName, String propValue) Changes a property value for an user.
-
Constructor Details
-
DefaultUserPropertyProvider
public DefaultUserPropertyProvider()
-
-
Method Details
-
loadProperties
Description copied from interface:UserPropertyProviderRetrieves all properties for a particular user.- Specified by:
loadPropertiesin interfaceUserPropertyProvider- Parameters:
username- The identifier of the user (cannot be null or empty).- Returns:
- A collection, possibly empty, but never null.
-
loadProperty
Description copied from interface:UserPropertyProviderRetrieves a property value for a user. This method will return null when the desired property was not defined for the user (null values are not supported).- Specified by:
loadPropertyin interfaceUserPropertyProvider- Parameters:
username- The identifier of the user (cannot be null or empty).propertyName- The property name (cannot be null or empty).- Returns:
- The property value (possibly null).
-
insertProperty
Description copied from interface:UserPropertyProviderAdds a property for an user. The behavior of inserting a duplicate property name is not defined by this interface.- Specified by:
insertPropertyin interfaceUserPropertyProvider- Parameters:
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).
-
updateProperty
Description copied from interface:UserPropertyProviderChanges a property value for an user. The behavior of updating a non-existing property is not defined by this interface.- Specified by:
updatePropertyin interfaceUserPropertyProvider- Parameters:
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).
-
deleteProperty
Description copied from interface:UserPropertyProviderRemoves one particular property for a particular user. The behavior of deleting a non-existing property is not defined by this interface.- Specified by:
deletePropertyin interfaceUserPropertyProvider- Parameters:
username- The identifier of the user (cannot be null or empty).propName- The property name (cannot be null or empty).
-
isReadOnly
public boolean isReadOnly()Description copied from interface:UserPropertyProviderReturns true if this UserPropertyProvider is read-only. When read-only, properties can not be created, deleted or modified. Invocation of the corresponding methods should result in anUnsupportedOperationException.- Specified by:
isReadOnlyin interfaceUserPropertyProvider- Returns:
- true if the user provider is read-only.
-