public final class PrivateDataManager extends Manager
<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 XEP-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.
|
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.
|
static PrivateDataManager |
getInstanceFor(XMPPConnection connection) |
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.
|
boolean |
isSupported()
Check if the service supports private data.
|
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.
|
connection, getAuthenticatedConnectionOrThrow, schedule
public static PrivateDataManager getInstanceFor(XMPPConnection connection)
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 SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
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.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
public void setPrivateData(PrivateData privateData) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
privateData
- the private data.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
public boolean isSupported() throws SmackException.NoResponseException, SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
XMPPException.XMPPErrorException