Class EntityCapabilitiesManager

    • Field Detail

      • OPENFIRE_IDENTIFIER_NODE

        public static final String OPENFIRE_IDENTIFIER_NODE
        A XEP-0115 described identifier for the Openfire server software, intended to be used as a value of 'node' attributes.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EntityCapabilitiesManager

        public EntityCapabilitiesManager()
    • Method Detail

      • initialize

        public void initialize​(XMPPServer server)
        Description copied from class: BasicModule

        Initializes the basic module.

        Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.

        Specified by:
        initialize in interface Module
        Overrides:
        initialize in class BasicModule
        Parameters:
        server - the server hosting this module.
      • destroy

        public void destroy()
        Description copied from class: BasicModule

        Destroys the module.

        Does nothing in the basic module.

        Specified by:
        destroy in interface Module
        Overrides:
        destroy in class BasicModule
      • process

        public void process​(org.xmpp.packet.Presence packet)
      • answerTimeout

        public void answerTimeout​(String packetId)
        Specified by:
        answerTimeout in interface org.xmpp.component.IQResultListener
      • receivedAnswer

        public void receivedAnswer​(org.xmpp.packet.IQ packet)
        Specified by:
        receivedAnswer in interface org.xmpp.component.IQResultListener
      • getEntityCapabilities

        public EntityCapabilities getEntityCapabilities​(org.xmpp.packet.JID jid)
        Returns the entity capabilities for a specific JID. The specified JID should be a full JID that identified the entity's connection.
        Parameters:
        jid - the full JID of entity
        Returns:
        the entity capabilities of jid, or null if these are unavailable.
      • registerCapabilities

        protected void registerCapabilities​(@Nonnull
                                            org.xmpp.packet.JID entity,
                                            @Nonnull
                                            EntityCapabilities newCapabilities)
        Registers that a particular entity has a particular set of capabilities, invoking event listeners when appropriate.
        Parameters:
        entity - The entity for which a set of capabilities is detected.
        newCapabilities - The capabilities that are detected.
      • addListener

        public void addListener​(@Nonnull
                                org.xmpp.packet.JID entity,
                                @Nonnull
                                EntityCapabilitiesListener listener)
        Registers an event listener that will be invoked when the detected entity capabilities for a particular entity have changed. This method supports multiple event listeners per JID. Registration of the same combination of entity and listener will be ignored.
        Parameters:
        entity - The entity for which to listen for events.
        listener - The event listener to be invoked when entity capabilities have changed.
      • removeListener

        public void removeListener​(@Nonnull
                                   org.xmpp.packet.JID entity,
                                   @Nonnull
                                   EntityCapabilitiesListener listener)
        Removes a previously registered event listener for a particular entity, if such a combination is currently registered.
        Parameters:
        entity - The entity for which the listener was registered.
        listener - The event listener to be removed.
      • removeListeners

        public void removeListeners​(@Nonnull
                                    org.xmpp.packet.JID entity)
        Removes all previously registered event listener for a particular entity, if any were registered.
        Parameters:
        entity - The entity for which listeners are to removed.
      • addListener

        public void addListener​(@Nonnull
                                EntityCapabilitiesListener listener)
        Registers an event listener that will be invoked when the detected entity capabilities for any entity have changed. If the listener already is registered, the invocation of this method will be a no-op.
        Parameters:
        listener - The event listener to be invoked when entity capabilities have changed.
      • removeListener

        public void removeListener​(@Nonnull
                                   EntityCapabilitiesListener listener)
        Removes a previously registered event listener, if such a listener is currently registered.
        Parameters:
        listener - The event listener to be removed.
      • dispatch

        protected void dispatch​(@Nonnull
                                org.xmpp.packet.JID entity,
                                @Nonnull
                                EntityCapabilities updatedEntityCapabilities,
                                @Nullable
                                EntityCapabilities previousEntityCapabilities)
        Invokes the entityCapabilitiesChanged method of all currently registered event listeners. It is assumed that this method is used to notify listeners of a change in capabilities for a particular entity.
        Parameters:
        entity - The entity for which an event is to be dispatched
        updatedEntityCapabilities - The most up-to-date capabilities.
        previousEntityCapabilities - The capabilities, if any, prior to the update.
      • checkObsolete

        protected void checkObsolete​(String verHash)
        Verifies if the provided 'ver' hash is used for any user. If not, the cache entry containing the entity capabilities are removed from the cache.
        Parameters:
        verHash - an 'ver' hash (cannot be null).
      • getLocalDomainVerHash

        public static String getLocalDomainVerHash()
        Returns the 'ver' hash for this server.
        Returns:
        A 'ver' hash, or null if none could be generated.