public class PrivateDataManager extends Object
<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.
| Modifier and Type | Class and Description |
|---|---|
static class |
PrivateDataManager.PrivateDataIQProvider
An IQ provider to parse IQ results containing private data.
|
| Constructor and Description |
|---|
PrivateDataManager(Connection connection)
Creates a new private data manager.
|
PrivateDataManager(Connection connection,
String user)
Creates a new private data manager for a specific user (special case).
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public PrivateDataManager(Connection connection)
connection - an XMPP connection which must have already undergone a
successful login.public PrivateDataManager(Connection 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.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.Copyright © 2003-2007 Jive Software.