Package rocks.xmpp.extensions.caps
Class AbstractEntityCapabilitiesProtocol<T extends EntityCapabilities>
- java.lang.Object
-
- rocks.xmpp.extensions.caps.AbstractEntityCapabilitiesProtocol<T>
-
- Type Parameters:
T
- The Entity Capabilities implementation.
- All Implemented Interfaces:
ExtensionProtocol
,InboundPresenceHandler
,DiscoverableInfo
,InfoProvider
- Direct Known Subclasses:
AbstractEntityCapabilities1Protocol
,AbstractEntityCapabilities2Protocol
public abstract class AbstractEntityCapabilitiesProtocol<T extends EntityCapabilities> extends Object implements InboundPresenceHandler, InfoProvider, ExtensionProtocol, DiscoverableInfo
Base class for the Entity Capabilities protocols.As of today, there are two versions of Entity Capabilities:
- XEP-0115: Entity Capabilities
- XEP-0390: Entity Capabilities 2.0
This class provides the common aspects of both protocols, both from a client and a server point of view. It handles inbound presence and processes any entity capabilities extension (caching, associating capabilities to the sending entity, discovering capabilities if necessary). It also provides the Service Discovery node, so that other entities can discover our capabilities.
Subclasses for the client should deal with outbound presence and attach Entity Capabilities to the presence, while server implementations should include them as stream feature.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<T>
getEntityCapabilitiesClass()
Gets the Entity Capabilities class, which represent different versions of caps.DiscoverableInfo
getInfo(Jid to, Jid from, String node, Locale locale)
Gets the info appropriate to the given parameters.Map<Collection<InfoDiscovery>,EntityCapabilities>
getPublishedNodes()
Gets the published nodes.void
handleEntityCapabilities(EntityCapabilities entityCapabilities, Jid entity)
Handles entity capabilities by associating them to the entity or discovering the entity's capabilities if they are not cached.void
handleInboundPresence(PresenceEvent e)
Handles an inbound presence.InfoDiscovery
publishCapsNode()
Publishes this entity's capabilities as Service Discovery node.-
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, getFeatures, getIdentities
-
Methods inherited from interface rocks.xmpp.core.ExtensionProtocol
getNamespace, isEnabled
-
-
-
-
Method Detail
-
getEntityCapabilitiesClass
public final Class<T> getEntityCapabilitiesClass()
Gets the Entity Capabilities class, which represent different versions of caps.- Returns:
- The class.
- See Also:
EntityCapabilities1
,EntityCapabilities2
-
getPublishedNodes
public final Map<Collection<InfoDiscovery>,EntityCapabilities> getPublishedNodes()
Gets the published nodes.- Returns:
- The published nodes.
-
publishCapsNode
public final InfoDiscovery publishCapsNode()
Publishes this entity's capabilities as Service Discovery node. On the client side this can used, when sending presence. On the server side this is used when advertising stream features and include the server's capabilities.The published node can be discovered by another entity.
- Returns:
- The published information.
-
handleEntityCapabilities
public void handleEntityCapabilities(EntityCapabilities entityCapabilities, Jid entity)
Handles entity capabilities by associating them to the entity or discovering the entity's capabilities if they are not cached.Entity Capabilities can either be announced in presence or in stream features.
- Parameters:
entityCapabilities
- The entity capabilities.entity
- The entity which generated the capabilities.
-
handleInboundPresence
public final void handleInboundPresence(PresenceEvent e)
Description copied from interface:InboundPresenceHandler
Handles an inbound presence.- Specified by:
handleInboundPresence
in interfaceInboundPresenceHandler
- Parameters:
e
- The presence event.
-
getInfo
public final DiscoverableInfo getInfo(Jid to, Jid from, String node, Locale locale)
Description copied from interface:InfoProvider
Gets the info appropriate to the given parameters.- Specified by:
getInfo
in interfaceInfoProvider
- Parameters:
to
- The receiving entity.from
- The requesting entity.node
- The requested node, if any. May be null.locale
- The locale of the requesting entity's stream or stanza.- Returns:
- The info or null, if no information could be found.
-
-