|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.smackx.PrivateDataManager
public class PrivateDataManager
Manages private data, which is a mechanism to allow users to store arbitrary XML data on an XMPP server. Each private data chunk is defined by a element name and XML namespace. Example private data:
<color xmlns="http://example.com/xmpp/color"> <favorite>blue</blue> <leastFavorite>puce</leastFavorite> </color>
PrivateDataProvider
instances are responsible for translating the XML into objects.
If no PrivateDataProvider is registered for a given element name and namespace, then
a DefaultPrivateData
instance will be returned.Warning: this is an non-standard protocol documented by JEP-49. Because this is a non-standard protocol, it is subject to change.
Nested Class Summary | |
---|---|
static class |
PrivateDataManager.PrivateDataIQProvider
An IQ provider to parse IQ results containing private data. |
Constructor Summary | |
---|---|
PrivateDataManager(XMPPConnection connection)
Creates a new private data manager. |
|
PrivateDataManager(XMPPConnection connection,
String user)
Creates a new private data manager for a specific user (special case). |
Method Summary | |
---|---|
static void |
addPrivateDataProvider(String elementName,
String namespace,
PrivateDataProvider provider)
Adds a private data provider with the specified element name and name space. |
PrivateData |
getPrivateData(String elementName,
String namespace)
Returns the private data specified by the given element name and namespace. |
static PrivateDataProvider |
getPrivateDataProvider(String elementName,
String namespace)
Returns the private data provider registered to the specified XML element name and namespace. |
static void |
removePrivateDataProvider(String elementName,
String namespace)
Removes a private data provider with the specified element name and namespace. |
void |
setPrivateData(PrivateData privateData)
Sets a private data value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrivateDataManager(XMPPConnection connection)
connection
- an XMPP connection which must have already undergone a
successful login.public PrivateDataManager(XMPPConnection connection, String user)
connection
- an XMPP connection which must have already undergone a
successful login.user
- the XMPP address of the user to get and set private data for.Method Detail |
---|
public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace)
<iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'> <query xmlns='jabber:iq:private'> <prefs xmlns='http://www.xmppclient.com/prefs'> <value1>ABC</value1> <value2>XYZ</value2> </prefs> </query> </iq>
Note: this method is generally only called by the internal Smack classes.
elementName
- the XML element name.namespace
- the XML namespace.
public static void addPrivateDataProvider(String elementName, String namespace, PrivateDataProvider provider)
elementName
- the XML element name.namespace
- the XML namespace.provider
- the private data provider.public static void removePrivateDataProvider(String elementName, String namespace)
elementName
- The XML element name.namespace
- The XML namespace.public PrivateData getPrivateData(String elementName, String namespace) throws XMPPException
If a PrivateDataProvider is registered for the specified element name/namespace pair then
that provider will determine the specific object type that is returned. If no provider
is registered, a DefaultPrivateData
instance will be returned.
elementName
- the element name.namespace
- the namespace.
XMPPException
- if an error occurs getting the private data.public void setPrivateData(PrivateData privateData) throws XMPPException
privateData
- the private data.
XMPPException
- if setting the private data fails.
|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |