Package rocks.xmpp.extensions.disco
Class AbstractServiceDiscoveryManager
- java.lang.Object
-
- rocks.xmpp.extensions.disco.AbstractServiceDiscoveryManager
-
- All Implemented Interfaces:
ExtensionProtocol
,IQHandler
,DiscoverableInfo
,ServiceDiscoveryManager
- Direct Known Subclasses:
ClientServiceDiscoveryManager
public abstract class AbstractServiceDiscoveryManager extends Object implements ServiceDiscoveryManager
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addInfoProvider(InfoProvider infoProvider)
Adds an info provider.boolean
addItemProvider(ItemProvider itemProvider)
Adds an item provider.AsyncResult<DiscoverableInfo>
discoverInformation(Jid jid)
Discovers information about another XMPP entity.AsyncResult<ItemNode>
discoverItems(Jid jid)
Discovers item associated with another XMPP entity.AsyncResult<ItemNode>
discoverItems(Jid jid, String node)
Discovers item associated with another XMPP entity.AsyncResult<ItemNode>
discoverItems(Jid jid, ResultSetManagement resultSet)
Discovers item associated with another XMPP entity.AsyncResult<List<Item>>
discoverServices(Jid jid, String feature)
Discovers a service on the given entity by its feature namespace.AsyncResult<List<Item>>
discoverServices(Jid jid, Identity identity)
Discovers a service on the given entity by its identity.Set<String>
getFeatures()
Gets the features.String
getNamespace()
The protocol's main namespace.Class<?>
getPayloadClass()
Gets the IQ's payload class.IQ
handleRequest(IQ iq)
boolean
isEnabled()
Indicates whether this protocol is enabled.boolean
removeInfoProvider(InfoProvider infoNodeProvider)
Removes an info provider.boolean
removeItemProvider(ItemProvider itemProvider)
Removes an item provider.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface rocks.xmpp.extensions.disco.model.info.DiscoverableInfo
getExtensions, getIdentities
-
Methods inherited from interface rocks.xmpp.extensions.disco.ServiceDiscoveryManager
addFeature, addIdentity, discoverInformation, discoverItems, getDefaultInfo, removeFeature, removeIdentity
-
-
-
-
Method Detail
-
getNamespace
public final String getNamespace()
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- "http://jabber.org/protocol/disco#info"
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
getPayloadClass
public final Class<?> getPayloadClass()
Description copied from interface:IQHandler
Gets the IQ's payload class. Only payloads of this type are handled by this handler.- Specified by:
getPayloadClass
in interfaceIQHandler
- Returns:
- The IQ's payload class.
- See Also:
Stanza.getExtension(Class)
-
handleRequest
public final IQ handleRequest(IQ iq)
Description copied from interface:IQHandler
Handles an inbound IQ stanza of typeget
orset
.The returned IQ must be of type
result
orerror
. Ifnull
is returned, no response is returned to the requester and you must take responsibility of sending a response manually. However, this approach is not recommended.Use
IQ.createResult()
orIQ.createError(rocks.xmpp.core.stanza.model.StanzaError)
to generate the response IQ (i.e. an IQ with the same id).- Specified by:
handleRequest
in interfaceIQHandler
- Parameters:
iq
- The inbound IQ stanza.- Returns:
- The result or error IQ, which is the response to sending entity.
-
discoverInformation
public final AsyncResult<DiscoverableInfo> discoverInformation(Jid jid)
Description copied from interface:ServiceDiscoveryManager
Discovers information about another XMPP entity.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.
- Specified by:
discoverInformation
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The entity's JID.- Returns:
- The async service discovery result.
-
discoverItems
public final AsyncResult<ItemNode> discoverItems(Jid jid)
Description copied from interface:ServiceDiscoveryManager
Discovers item associated with another XMPP entity.- Specified by:
discoverItems
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The JID.- Returns:
- The async result with the discovered items.
-
discoverItems
public final AsyncResult<ItemNode> discoverItems(Jid jid, ResultSetManagement resultSet)
Description copied from interface:ServiceDiscoveryManager
Discovers item associated with another XMPP entity.- Specified by:
discoverItems
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The JID.resultSet
- The result set management.- Returns:
- The async result with the discovered items.
-
discoverItems
public final AsyncResult<ItemNode> discoverItems(Jid jid, String node)
Description copied from interface:ServiceDiscoveryManager
Discovers item associated with another XMPP entity.- Specified by:
discoverItems
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The JID.node
- The node.- Returns:
- The async result with the discovered items.
-
addInfoProvider
public final boolean addInfoProvider(InfoProvider infoProvider)
Description copied from interface:ServiceDiscoveryManager
Adds an info provider.- Specified by:
addInfoProvider
in interfaceServiceDiscoveryManager
- Parameters:
infoProvider
- The info provider.- Returns:
- true, if it has been successfully added.
- See Also:
ServiceDiscoveryManager.removeInfoProvider(InfoProvider)
-
removeInfoProvider
public final boolean removeInfoProvider(InfoProvider infoNodeProvider)
Description copied from interface:ServiceDiscoveryManager
Removes an info provider.- Specified by:
removeInfoProvider
in interfaceServiceDiscoveryManager
- Parameters:
infoNodeProvider
- The info provider.- Returns:
- true, if it has been successfully remove.
- See Also:
ServiceDiscoveryManager.addInfoProvider(InfoProvider)
-
addItemProvider
public final boolean addItemProvider(ItemProvider itemProvider)
Description copied from interface:ServiceDiscoveryManager
Adds an item provider. Requests to this handler will return items returned by the provider if appropriate.- Specified by:
addItemProvider
in interfaceServiceDiscoveryManager
- Parameters:
itemProvider
- The item provider.- Returns:
- If the provider could be added.
- See Also:
ServiceDiscoveryManager.removeItemProvider(ItemProvider)
-
removeItemProvider
public final boolean removeItemProvider(ItemProvider itemProvider)
Description copied from interface:ServiceDiscoveryManager
Removes an item provider.- Specified by:
removeItemProvider
in interfaceServiceDiscoveryManager
- Parameters:
itemProvider
- The item provider.- Returns:
- If the provider could be removed .
- See Also:
ServiceDiscoveryManager.addItemProvider(ItemProvider)
-
discoverServices
public final AsyncResult<List<Item>> discoverServices(Jid jid, Identity identity)
Description copied from interface:ServiceDiscoveryManager
Discovers a service on the given entity by its identity.E.g. to discover MUC services you could call this method with
Identity.conferenceText()
;This method is generally preferred over
ServiceDiscoveryManager.discoverServices(Jid, String)
.- Specified by:
discoverServices
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The XMPP entity, usually a server.identity
- The identity.- Returns:
- The services, that belong to the namespace.
-
discoverServices
public final AsyncResult<List<Item>> discoverServices(Jid jid, String feature)
Description copied from interface:ServiceDiscoveryManager
Discovers a service on the given entity by its feature namespace.- Specified by:
discoverServices
in interfaceServiceDiscoveryManager
- Parameters:
jid
- The XMPP entity, usually a server.feature
- The feature namespace.- Returns:
- The async result with the services, that belong to the namespace.
-
-