Interface EntityCapabilitiesManager

  • All Known Implementing Classes:
    ClientEntityCapabilitiesManager

    public interface EntityCapabilitiesManager
    A manager for Entity Capabilities whose primary task is to cache capabilities.

    Capabilities are the identities, features and extensions discovered by Service Discovery request and consolidated as "capability set" in DiscoverableInfo. Each capability set is hashed using a protocol specific algorithm and then cached.

    Capabilities can be shared among multiple entities, e.g. if they use the same client software. To avoid multiple service discovery requests to each entity, entities provide a hash value and capabilities can be read from a cache instead.

    • Method Detail

      • writeCapabilities

        void writeCapabilities​(Hash hash,
                               DiscoverableInfo discoverableInfo)
        Writes capabilities to the cache.

        A capability is identified by a hash value and can be shared among multiple entities, e.g. if multiple entities use the same client software with the same features.

        Capabilities should be cached permanently, so that they can be reused.

        Parameters:
        hash - The hash which identifies the capabilities.
        discoverableInfo - The discovered info (capabilities) to cache.
        See Also:
        readCapabilities(Hash)
      • writeEntityCapabilities

        void writeEntityCapabilities​(Jid entity,
                                     DiscoverableInfo discoverableInfo)
        Writes entity capabilities for an XMPP entity (JID).

        Usually it is sufficient to cache capabilities associated with an entity (JID) in-memory.

        Parameters:
        entity - The XMPP entity.
        discoverableInfo - The entity capabilities.
        See Also:
        readEntityCapabilities(Jid)
      • discoverCapabilities

        AsyncResult<DiscoverableInfo> discoverCapabilities​(Jid jid)
        Discovers capabilities for the given entity. If there are cached capabilities for the given entity, they should be returned. Otherwise a service discovery request must be made, which should then be cached.
        Parameters:
        jid - The entity.
        Returns:
        The result containing the capabilities.
      • isSupported

        default AsyncResult<Boolean> isSupported​(String feature,
                                                 Jid jid)
        Checks whether a feature is supported by checking the capabilities set of the entity. If the capabilities are unknown a service discovery request is made.
        Parameters:
        feature - The feature.
        jid - The entity, which should usually be a full JID.
        Returns:
        The result indicating, if the entity supports the feature.
        See Also:
        DiscoverableInfo.getFeatures(), discoverCapabilities(Jid)