Package org.jivesoftware.openfire
Class PrivateStorage
- java.lang.Object
-
- org.jivesoftware.openfire.container.BasicModule
-
- org.jivesoftware.openfire.PrivateStorage
-
- All Implemented Interfaces:
Module
public class PrivateStorage extends BasicModule
Private storage for user accounts (XEP-0049). It is used by some XMPP systems for saving client settings on the server. This implementation uses the Personal Eventing Protocol implementation to store and retrieve data. This ensures that XEP-0049 operates on the same data as XEP-0223.- Author:
- Iain Shigeoka, Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Constructor Summary
Constructors Constructor Description PrivateStorage()
Constructs a new PrivateStore instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String username, org.dom4j.Element data)
Stores private data.org.dom4j.Element
get(String username, org.dom4j.Element data)
Returns the data stored under a key corresponding to the name and namespace of the given element.boolean
isEnabled()
Returns true if private storage is enabled.void
setEnabled(boolean enabled)
Sets whether private storage is enabled.-
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName, initialize, start, stop
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Returns true if private storage is enabled.- Returns:
- true if private storage is enabled.
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether private storage is enabled.- Parameters:
enabled
- true if this private store is enabled.
-
add
public void add(String username, org.dom4j.Element data)
Stores private data. If the name and namespace of the element matches another stored private data XML document, then replace it with the new one.- Parameters:
data
- the data to store (XML element)username
- the username of the account where private data is being stored
-
get
public org.dom4j.Element get(String username, org.dom4j.Element data)
Returns the data stored under a key corresponding to the name and namespace of the given element. The Element must be in the form:<name xmlns='namespace'/>
If no data is currently stored under the given key, an empty element will be returned.
- Parameters:
data
- an XML document who's element name and namespace is used to match previously stored private data.username
- the username of the account where private data is being stored.- Returns:
- the data stored under the given key or the data element.
-
-