public final class ServiceDiscoveryManager extends Manager
The ability to discover information about entities on the Jabber network is extremely valuable. Such information might include features offered or protocols supported by the entity, the entity's type or identity, and additional entities that are associated with the original entity in some way (often thought of as "children" of the "parent" entity).
Enabled extensions are automatically added to the list of features by their respective manager class. Disabled extensions are removed.
This class automatically manages inbound service discovery requests by responding with a list of enabled extensions (features).
| Modifier and Type | Method and Description |
|---|---|
void |
addCapabilitiesChangeListener(Consumer<EventObject> listener)
Adds a property change listener, which listens for changes in the identities, features, extensions and items collections.
|
void |
addExtension(DataForm extension)
Adds an extension.
|
void |
addFeature(Class<? extends Manager> managerClass)
Adds a feature by its manager class.
|
void |
addFeature(String feature)
Adds a feature.
|
void |
addIdentity(Identity identity)
Adds an identity.
|
void |
addInfoNode(InfoNode infoNode)
Adds an info node.
|
InfoNode |
discoverInformation(Jid jid)
Discovers information about another XMPP entity.
|
InfoNode |
discoverInformation(Jid jid,
String node)
Discovers information about another XMPP entity targeted at a specific node.
|
ItemNode |
discoverItems(Jid jid)
Discovers item associated with another XMPP entity.
|
ItemNode |
discoverItems(Jid jid,
ResultSetManagement resultSet)
Discovers item associated with another XMPP entity.
|
ItemNode |
discoverItems(Jid jid,
String node)
Discovers item associated with another XMPP entity.
|
ItemNode |
discoverItems(Jid jid,
String node,
ResultSetManagement resultSetManagement)
Discovers item associated with another XMPP entity.
|
Collection<Item> |
discoverServices(Identity identity)
Discovers a service on the connected server by its identity.
|
Collection<Item> |
discoverServices(String feature)
Discovers a service on the connected server by its feature namespace.
|
List<DataForm> |
getExtensions()
Gets an unmodifiable list of extensions.
|
Set<String> |
getFeatures()
Gets an unmodifiable set of features.
|
Set<Identity> |
getIdentities()
Gets an unmodifiable set of identities.
|
List<Item> |
getItems()
Gets an unmodifiable list of items.
|
void |
registerFeature(Extension extension)
Registers a feature / extension.
|
void |
removeCapabilitiesChangeListener(Consumer<EventObject> listener)
Removes a property change listener.
|
void |
removeExtension(DataForm extension)
Removes an extension.
|
void |
removeFeature(Class<? extends Manager> managerClass)
Removes a feature by its manager class.
|
void |
removeFeature(String feature)
Removes a feature.
|
void |
removeIdentity(Identity identity)
Removes an identity.
|
void |
removeInfoNode(String node)
Removes an info node.
|
void |
setItemProvider(ResultSetProvider<Item> itemProvider)
Sets an item provider for the root node.
|
void |
setItemProvider(String node,
ResultSetProvider<Item> itemProvider)
Sets an item provider for a node.
|
isEnabled, setEnabledpublic final void addCapabilitiesChangeListener(Consumer<EventObject> listener)
listener - The listener.removeCapabilitiesChangeListener(Consumer)public final void removeCapabilitiesChangeListener(Consumer<EventObject> listener)
listener - The listener.addCapabilitiesChangeListener(Consumer)public final Set<Identity> getIdentities()
addIdentity(rocks.xmpp.extensions.disco.model.info.Identity),
removeIdentity(rocks.xmpp.extensions.disco.model.info.Identity)public final Set<String> getFeatures()
addFeature(String),
removeFeature(String)public List<DataForm> getExtensions()
addExtension(rocks.xmpp.extensions.data.model.DataForm),
removeExtension(rocks.xmpp.extensions.data.model.DataForm),
XEP-0128: Service Discovery Extensionspublic final void addIdentity(Identity identity)
identity - The identity.removeIdentity(rocks.xmpp.extensions.disco.model.info.Identity),
getIdentities()public final void removeIdentity(Identity identity)
identity - The identity.addIdentity(rocks.xmpp.extensions.disco.model.info.Identity),
getIdentities()public final void addFeature(String feature)
feature - The feature.removeFeature(String),
getFeatures()public final void removeFeature(String feature)
feature - The feature.addFeature(String),
getFeatures()public final void addFeature(Class<? extends Manager> managerClass)
managerClass - The manager class.addFeature(String),
getFeatures()public final void removeFeature(Class<? extends Manager> managerClass)
managerClass - The feature.addFeature(String),
getFeatures()public final void addExtension(DataForm extension)
extension - The extension.removeExtension(rocks.xmpp.extensions.data.model.DataForm),
getExtensions(),
XEP-0128: Service Discovery Extensionspublic final void removeExtension(DataForm extension)
extension - The extension.addExtension(rocks.xmpp.extensions.data.model.DataForm),
getExtensions(),
XEP-0128: Service Discovery Extensionspublic final InfoNode discoverInformation(Jid jid) throws XmppException
3. Discovering Information About a Jabber Entity
A requesting entity may want to discover information about another entity on the network. The information desired generally is of two kinds:
- The target entity's identity.
- The features offered and protocols supported by the target entity.
jid - The entity's JID.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final InfoNode discoverInformation(Jid jid, String node) throws XmppException
A disco#info query MAY also be directed to a specific node identifier associated with a JID.
jid - The entity's JID.node - The node.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptiondiscoverInformation(Jid)public final ItemNode discoverItems(Jid jid) throws XmppException
jid - The JID.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final ItemNode discoverItems(Jid jid, ResultSetManagement resultSet) throws XmppException
jid - The JID.resultSet - The result set management.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final ItemNode discoverItems(Jid jid, String node) throws XmppException
jid - The JID.node - The node.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final ItemNode discoverItems(Jid jid, String node, ResultSetManagement resultSetManagement) throws XmppException
jid - The JID.node - The node.resultSetManagement - The result set management.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic final Collection<Item> discoverServices(Identity identity) throws XmppException
E.g. to discover MUC services you could call this method with Identity.conferenceText();
This method is generally preferred over discoverServices(String).
identity - The identity.StanzaException - If the server returned a stanza error.NoResponseException - If the server did not respond.XmppExceptionpublic final Collection<Item> discoverServices(String feature) throws XmppException
feature - The feature namespace.StanzaException - If the server returned a stanza error.NoResponseException - If the server did not respond.XmppExceptionpublic final void addInfoNode(InfoNode infoNode)
infoNode - The info node.public final void removeInfoNode(String node)
node - The node name.public final void setItemProvider(ResultSetProvider<Item> itemProvider)
If you want to manage items in memory, you can use DefaultItemProvider.
itemProvider - The item provider.public final void setItemProvider(String node, ResultSetProvider<Item> itemProvider)
If you want to manage items in memory, you can use DefaultItemProvider.
node - The node name.itemProvider - The item provider.public final void registerFeature(Extension extension)
extension - The extension.Copyright © 2014–2015 XMPP.rocks. All rights reserved.