public final class ServiceDiscoveryManager extends Manager
Modifier and Type | Method and Description |
---|---|
boolean |
accountSupportsFeatures(CharSequence... features)
Check if the given features are supported by the connection account.
|
boolean |
accountSupportsFeatures(Collection<? extends CharSequence> features)
Check if the given collection of features are supported by the connection account.
|
static void |
addDiscoInfoLookupShortcutMechanism(DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism) |
void |
addDiscoverInfoTo(DiscoverInfo response)
Add discover info response data.
|
boolean |
addEntityCapabilitiesChangedListener(EntityCapabilitiesChangedListener entityCapabilitiesChangedListener) |
void |
addFeature(String feature)
Registers that a new feature is supported by this XMPP entity.
|
void |
addIdentity(DiscoverInfo.Identity identity)
Add an further identity to the client.
|
static boolean |
canPublishItems(DiscoverInfo info)
Deprecated.
The disco-publish feature was removed from XEP-0030 in 2008 in favor of XEP-0060: Publish-Subscribe.
|
boolean |
canPublishItems(org.jxmpp.jid.Jid entityID)
Deprecated.
The disco-publish feature was removed from XEP-0030 in 2008 in favor of XEP-0060: Publish-Subscribe.
|
DiscoverInfo |
discoverInfo(org.jxmpp.jid.Jid entityID)
Returns the discovered information of a given XMPP entity addressed by its JID.
|
DiscoverInfo |
discoverInfo(org.jxmpp.jid.Jid entityID,
String node)
Returns the discovered information of a given XMPP entity addressed by its JID and
note attribute.
|
DiscoverItems |
discoverItems(org.jxmpp.jid.Jid entityID)
Returns the discovered items of a given XMPP entity addressed by its JID.
|
DiscoverItems |
discoverItems(org.jxmpp.jid.Jid entityID,
String node)
Returns the discovered items of a given XMPP entity addressed by its JID and
note attribute.
|
org.jxmpp.jid.DomainBareJid |
findService(String feature,
boolean useCache) |
org.jxmpp.jid.DomainBareJid |
findService(String feature,
boolean useCache,
String category,
String type) |
List<org.jxmpp.jid.DomainBareJid> |
findServices(String feature,
boolean stopOnFirst,
boolean useCache)
Find all services under the users service that provide a given feature.
|
List<DiscoverInfo> |
findServicesDiscoverInfo(org.jxmpp.jid.DomainBareJid serviceName,
String feature,
boolean stopOnFirst,
boolean useCache,
Map<? super org.jxmpp.jid.Jid,Exception> encounteredExceptions)
Find all services under a given service that provide a given feature.
|
List<DiscoverInfo> |
findServicesDiscoverInfo(String feature,
boolean stopOnFirst,
boolean useCache)
Find all services under the users service that provide a given feature.
|
List<DiscoverInfo> |
findServicesDiscoverInfo(String feature,
boolean stopOnFirst,
boolean useCache,
Map<? super org.jxmpp.jid.Jid,Exception> encounteredExceptions)
Find all services under the users service that provide a given feature.
|
DataForm |
getExtendedInfo()
Returns the data form that is set as extended information for this Service Discovery instance (XEP-0128).
|
List<ExtensionElement> |
getExtendedInfoAsList()
Returns the data form as List of PacketExtensions, or null if no data form is set.
|
List<String> |
getFeatures()
Returns the supported features by this XMPP entity.
|
Set<DiscoverInfo.Identity> |
getIdentities()
Returns all identities of this client as unmodifiable Collection.
|
DiscoverInfo.Identity |
getIdentity()
Return the default identity of the client.
|
String |
getIdentityName()
Returns the name of the client that will be returned when asked for the client identity
in a disco request.
|
String |
getIdentityType()
Returns the type of client that will be returned when asked for the client identity in a
disco request.
|
static ServiceDiscoveryManager |
getInstanceFor(XMPPConnection connection)
Returns the ServiceDiscoveryManager instance associated with a given XMPPConnection.
|
boolean |
includesFeature(String feature)
Returns true if the specified feature is registered in the ServiceDiscoveryManager.
|
void |
publishItems(org.jxmpp.jid.Jid entityID,
DiscoverItems discoverItems)
Deprecated.
The disco-publish feature was removed from XEP-0030 in 2008 in favor of XEP-0060: Publish-Subscribe.
|
void |
publishItems(org.jxmpp.jid.Jid entityID,
String node,
DiscoverItems discoverItems)
Deprecated.
The disco-publish feature was removed from XEP-0030 in 2008 in favor of XEP-0060: Publish-Subscribe.
|
static void |
removeDiscoInfoLookupShortcutMechanism(DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism) |
void |
removeExtendedInfo()
Removes the data form containing extended service discovery information
from the information returned by this XMPP entity.
|
void |
removeFeature(String feature)
Removes the specified feature from the supported features by this XMPP entity.
|
boolean |
removeIdentity(DiscoverInfo.Identity identity)
Remove an identity from the client.
|
void |
removeNodeInformationProvider(String node)
Removes the NodeInformationProvider responsible for providing information
(ie items) related to a given node.
|
boolean |
serverSupportsFeature(CharSequence feature)
Returns true if the server supports the given feature.
|
boolean |
serverSupportsFeatures(CharSequence... features) |
boolean |
serverSupportsFeatures(Collection<? extends CharSequence> features) |
static void |
setDefaultIdentity(DiscoverInfo.Identity identity)
Set the default identity all new connections will have.
|
void |
setExtendedInfo(DataForm info)
Registers extended discovery information of this XMPP entity.
|
void |
setIdentity(DiscoverInfo.Identity identity)
Sets the default identity the client will report.
|
void |
setNodeInformationProvider(String node,
NodeInformationProvider listener)
Sets the NodeInformationProvider responsible for providing information
(ie items) related to a given node.
|
boolean |
supportsFeature(org.jxmpp.jid.Jid jid,
CharSequence feature)
Queries the remote entity for it's features and returns true if the given feature is found.
|
boolean |
supportsFeatures(org.jxmpp.jid.Jid jid,
CharSequence... features) |
boolean |
supportsFeatures(org.jxmpp.jid.Jid jid,
Collection<? extends CharSequence> features) |
connection, getAuthenticatedConnectionOrThrow, schedule
public static void setDefaultIdentity(DiscoverInfo.Identity identity)
identity
- public String getIdentityName()
public void setIdentity(DiscoverInfo.Identity identity)
identity
- public DiscoverInfo.Identity getIdentity()
public String getIdentityType()
public void addIdentity(DiscoverInfo.Identity identity)
identity
- public boolean removeIdentity(DiscoverInfo.Identity identity)
identity
- public Set<DiscoverInfo.Identity> getIdentities()
public static ServiceDiscoveryManager getInstanceFor(XMPPConnection connection)
connection
- the connection used to look for the proper ServiceDiscoveryManager.public void addDiscoverInfoTo(DiscoverInfo response)
response
- the discover info response packetpublic void setNodeInformationProvider(String node, NodeInformationProvider listener)
In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined.
node
- the node whose items will be provided by the NodeInformationProvider.listener
- the NodeInformationProvider responsible for providing items related
to the node.public void removeNodeInformationProvider(String node)
node
- the node to remove the associated NodeInformationProvider.public List<String> getFeatures()
The result is a copied modifiable list of the original features.
public void addFeature(String feature)
Since no stanza is actually sent to the server it is safe to perform this operation before logging to the server. In fact, you may want to configure the supported features before logging to the server so that the information is already available if it is required upon login.
feature
- the feature to register as supported.public void removeFeature(String feature)
Since no stanza is actually sent to the server it is safe to perform this operation before logging to the server.
feature
- the feature to remove from the supported features.public boolean includesFeature(String feature)
feature
- the feature to look for.public void setExtendedInfo(DataForm info)
Since no stanza is actually sent to the server it is safe to perform this operation before logging to the server. In fact, you may want to configure the extended info before logging to the server so that the information is already available if it is required upon login.
info
- the data form that contains the extend service discovery
information.public DataForm getExtendedInfo()
public List<ExtensionElement> getExtendedInfoAsList()
public void removeExtendedInfo()
Since no stanza is actually sent to the server it is safe to perform this operation before logging to the server.
public DiscoverInfo discoverInfo(org.jxmpp.jid.Jid entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity or null.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
public DiscoverInfo discoverInfo(org.jxmpp.jid.Jid entityID, String node) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.node
- the optional attribute that supplements the 'jid' attribute.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
InterruptedException
public DiscoverItems discoverItems(org.jxmpp.jid.Jid entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
InterruptedException
public DiscoverItems discoverItems(org.jxmpp.jid.Jid entityID, String node) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.node
- the optional attribute that supplements the 'jid' attribute.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
InterruptedException
@Deprecated public boolean canPublishItems(org.jxmpp.jid.Jid entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
@Deprecated public static boolean canPublishItems(DiscoverInfo info)
info
- the discover info stanza to check.@Deprecated public void publishItems(org.jxmpp.jid.Jid entityID, DiscoverItems discoverItems) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.discoverItems
- the DiscoveryItems to publish.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
@Deprecated public void publishItems(org.jxmpp.jid.Jid entityID, String node, DiscoverItems discoverItems) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
entityID
- the address of the XMPP entity.node
- the attribute that supplements the 'jid' attribute.discoverItems
- the DiscoveryItems to publish.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
InterruptedException
public boolean serverSupportsFeature(CharSequence feature) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
feature
- SmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public boolean serverSupportsFeatures(CharSequence... features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public boolean serverSupportsFeatures(Collection<? extends CharSequence> features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public boolean accountSupportsFeatures(CharSequence... features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
features
- the features to checktrue
if all features are supported by the connection account, false
otherwiseSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public boolean accountSupportsFeatures(Collection<? extends CharSequence> features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
features
- a collection of featurestrue
if all features are supported by the connection account, false
otherwiseSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public boolean supportsFeature(org.jxmpp.jid.Jid jid, CharSequence feature) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
jid
- the JID of the remote entityfeature
- XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
InterruptedException
public boolean supportsFeatures(org.jxmpp.jid.Jid jid, CharSequence... features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public boolean supportsFeatures(org.jxmpp.jid.Jid jid, Collection<? extends CharSequence> features) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public List<DiscoverInfo> findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
feature
- the feature to search forstopOnFirst
- if true, stop searching after the first service was founduseCache
- if true, query a cache first to avoid network I/OSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public List<DiscoverInfo> findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache, Map<? super org.jxmpp.jid.Jid,Exception> encounteredExceptions) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
feature
- the feature to search forstopOnFirst
- if true, stop searching after the first service was founduseCache
- if true, query a cache first to avoid network I/OencounteredExceptions
- an optional map which will be filled with the exceptions encounteredSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public List<DiscoverInfo> findServicesDiscoverInfo(org.jxmpp.jid.DomainBareJid serviceName, String feature, boolean stopOnFirst, boolean useCache, Map<? super org.jxmpp.jid.Jid,Exception> encounteredExceptions) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
serviceName
- the service to queryfeature
- the feature to search forstopOnFirst
- if true, stop searching after the first service was founduseCache
- if true, query a cache first to avoid network I/OencounteredExceptions
- an optional map which will be filled with the exceptions encounteredSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public List<org.jxmpp.jid.DomainBareJid> findServices(String feature, boolean stopOnFirst, boolean useCache) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
feature
- the feature to search forstopOnFirst
- if true, stop searching after the first service was founduseCache
- if true, query a cache first to avoid network I/OSmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
InterruptedException
public org.jxmpp.jid.DomainBareJid findService(String feature, boolean useCache, String category, String type) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public org.jxmpp.jid.DomainBareJid findService(String feature, boolean useCache) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException
public boolean addEntityCapabilitiesChangedListener(EntityCapabilitiesChangedListener entityCapabilitiesChangedListener)
public static void addDiscoInfoLookupShortcutMechanism(DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism)
public static void removeDiscoInfoLookupShortcutMechanism(DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism)