Class AbstractEntityCapabilitiesProtocol<T extends EntityCapabilities>

  • 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 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
      • 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.
      • 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 interface InfoProvider
        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.