Class ClientServiceDiscoveryManager
- java.lang.Object
-
- rocks.xmpp.extensions.disco.AbstractServiceDiscoveryManager
-
- rocks.xmpp.extensions.disco.client.ClientServiceDiscoveryManager
-
- All Implemented Interfaces:
ExtensionProtocol
,IQHandler
,DiscoverableInfo
,ServiceDiscoveryManager
public final class ClientServiceDiscoveryManager extends AbstractServiceDiscoveryManager
Manages XEP-0030: Service Discovery.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).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCapabilitiesChangeListener(Consumer<EventObject> listener)
Adds a property change listener, which listens for changes in the identities, features and extensions collections.void
addExtension(DataForm extension)
Adds an extension.void
addFeature(String feature)
Adds a feature.void
addIdentity(Identity identity)
Adds an identity.void
addInfo(DiscoverableInfo discoverableInfo)
Adds discoverable information to the root node.AsyncResult<DiscoverableInfo>
discoverInformation(Jid jid, String node)
Discovers information about another XMPP entity targeted at a specific node.AsyncResult<ItemNode>
discoverItems(Jid jid, String node, ResultSetManagement resultSetManagement)
Discovers item associated with another XMPP entity.DiscoverableInfo
getDefaultInfo()
Gets the root node.List<DataForm>
getExtensions()
Gets an unmodifiable list of extensions.Set<Identity>
getIdentities()
Gets an unmodifiable set of identities.void
removeCapabilitiesChangeListener(Consumer<EventObject> listener)
Removes a property change listener.void
removeExtension(DataForm extension)
Removes an extension.void
removeFeature(String feature)
Removes a feature.void
removeIdentity(Identity identity)
Removes an identity.-
Methods inherited from class rocks.xmpp.extensions.disco.AbstractServiceDiscoveryManager
addInfoProvider, addItemProvider, discoverInformation, discoverItems, discoverItems, discoverItems, discoverServices, discoverServices, getFeatures, getNamespace, getPayloadClass, handleRequest, isEnabled, removeInfoProvider, removeItemProvider
-
-
-
-
Method Detail
-
addCapabilitiesChangeListener
public final void addCapabilitiesChangeListener(Consumer<EventObject> listener)
Adds a property change listener, which listens for changes in the identities, features and extensions collections.- Parameters:
listener
- The listener.- See Also:
removeCapabilitiesChangeListener(Consumer)
-
removeCapabilitiesChangeListener
public final void removeCapabilitiesChangeListener(Consumer<EventObject> listener)
Removes a property change listener.- Parameters:
listener
- The listener.- See Also:
addCapabilitiesChangeListener(Consumer)
-
getIdentities
public final Set<Identity> getIdentities()
Gets an unmodifiable set of identities.- Returns:
- The identities.
- See Also:
addIdentity(rocks.xmpp.extensions.disco.model.info.Identity)
,removeIdentity(rocks.xmpp.extensions.disco.model.info.Identity)
-
getExtensions
public final List<DataForm> getExtensions()
Gets an unmodifiable list of extensions.- Returns:
- The extensions.
- See Also:
addExtension(rocks.xmpp.extensions.data.model.DataForm)
,removeExtension(rocks.xmpp.extensions.data.model.DataForm)
, XEP-0128: Service Discovery Extensions
-
addIdentity
public final void addIdentity(Identity identity)
Adds an identity.- Parameters:
identity
- The identity.- See Also:
removeIdentity(rocks.xmpp.extensions.disco.model.info.Identity)
,getIdentities()
-
removeIdentity
public final void removeIdentity(Identity identity)
Removes an identity.- Parameters:
identity
- The identity.- See Also:
addIdentity(rocks.xmpp.extensions.disco.model.info.Identity)
,getIdentities()
-
addFeature
public final void addFeature(String feature)
Adds a feature. Features should not be added or removed directly. Instead enable or disable the respective extension manager, which will then add or remove the feature. That way, supported features are consistent with enabled extension managers and service discovery won't reveal features, that are in fact not supported.- Parameters:
feature
- The feature.- See Also:
removeFeature(String)
,AbstractServiceDiscoveryManager.getFeatures()
-
removeFeature
public final void removeFeature(String feature)
Removes a feature.- Parameters:
feature
- The feature.- See Also:
addFeature(String)
,AbstractServiceDiscoveryManager.getFeatures()
-
getDefaultInfo
public final DiscoverableInfo getDefaultInfo()
Description copied from interface:ServiceDiscoveryManager
Gets the root node.- Returns:
- The root node.
-
addExtension
public final void addExtension(DataForm extension)
Adds an extension.- Parameters:
extension
- The extension.- See Also:
removeExtension(rocks.xmpp.extensions.data.model.DataForm)
,getExtensions()
, XEP-0128: Service Discovery Extensions
-
removeExtension
public final void removeExtension(DataForm extension)
Removes an extension.- Parameters:
extension
- The extension.- See Also:
addExtension(rocks.xmpp.extensions.data.model.DataForm)
,getExtensions()
, XEP-0128: Service Discovery Extensions
-
addInfo
public final void addInfo(DiscoverableInfo discoverableInfo)
Adds discoverable information to the root node.- Parameters:
discoverableInfo
- The info.
-
discoverInformation
public final AsyncResult<DiscoverableInfo> discoverInformation(Jid jid, String node)
Discovers information about another XMPP entity targeted at a specific node.A disco#info query MAY also be directed to a specific node identifier associated with a JID.
- Parameters:
jid
- The entity's JID.node
- The node.- Returns:
- The async service discovery result.
- See Also:
AbstractServiceDiscoveryManager.discoverInformation(Jid)
-
discoverItems
public final AsyncResult<ItemNode> discoverItems(Jid jid, String node, ResultSetManagement resultSetManagement)
Discovers item associated with another XMPP entity.- Parameters:
jid
- The JID.node
- The node.resultSetManagement
- The result set management.- Returns:
- The async result with the discovered items.
-
-