Class RosterExchangeManager


  • public class RosterExchangeManager
    extends java.lang.Object
    Manages Roster exchanges. A RosterExchangeManager provides a high level access to send rosters, roster groups and roster entries to XMPP clients. It also provides an easy way to hook up custom logic when entries are received from another XMPP client through RosterExchangeListeners.
    • Constructor Detail

      • RosterExchangeManager

        public RosterExchangeManager​(XMPPConnection connection)
        Creates a new roster exchange manager.
        Parameters:
        connection - an XMPPConnection which is used to send and receive messages.
    • Method Detail

      • addRosterListener

        public void addRosterListener​(RosterExchangeListener rosterExchangeListener)
        Adds a listener to roster exchanges. The listener will be fired anytime roster entries are received from remote XMPP clients.
        Parameters:
        rosterExchangeListener - a roster exchange listener.
      • removeRosterListener

        public void removeRosterListener​(RosterExchangeListener rosterExchangeListener)
        Removes a listener from roster exchanges. The listener will be fired anytime roster entries are received from remote XMPP clients.
        Parameters:
        rosterExchangeListener - a roster exchange listener..
      • send

        public void send​(Roster roster,
                         Jid targetUserID)
                  throws SmackException.NotConnectedException,
                         java.lang.InterruptedException
        Sends a roster to userID. All the entries of the roster will be sent to the target user.
        Parameters:
        roster - the roster to send
        targetUserID - the user that will receive the roster entries
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • send

        public void send​(RosterEntry rosterEntry,
                         Jid targetUserID)
                  throws SmackException.NotConnectedException,
                         java.lang.InterruptedException
        Sends a roster entry to userID.
        Parameters:
        rosterEntry - the roster entry to send
        targetUserID - the user that will receive the roster entries
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • send

        public void send​(RosterGroup rosterGroup,
                         Jid targetUserID)
                  throws SmackException.NotConnectedException,
                         java.lang.InterruptedException
        Sends a roster group to userID. All the entries of the group will be sent to the target user.
        Parameters:
        rosterGroup - the roster group to send
        targetUserID - the user that will receive the roster entries
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.