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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ELEMENT  
      static java.lang.String NAMESPACE  
    • Constructor Summary

      Constructors 
      Constructor Description
      RosterExchangeManager​(org.jivesoftware.smack.XMPPConnection connection)
      Creates a new roster exchange manager.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRosterListener​(RosterExchangeListener rosterExchangeListener)
      Adds a listener to roster exchanges.
      static RosterExchangeManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)  
      void removeRosterListener​(RosterExchangeListener rosterExchangeListener)
      Removes a listener from roster exchanges.
      void send​(org.jivesoftware.smack.roster.RosterEntry rosterEntry, org.jxmpp.jid.Jid targetUserID)
      Sends a roster entry to userID.
      void send​(org.jivesoftware.smack.roster.RosterGroup rosterGroup, org.jxmpp.jid.Jid targetUserID)
      Sends a roster group to userID.
      void send​(org.jivesoftware.smack.roster.Roster roster, org.jxmpp.jid.Jid targetUserID)
      Sends a roster to userID.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RosterExchangeManager

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

      • getInstanceFor

        public static RosterExchangeManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • 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​(org.jivesoftware.smack.roster.Roster roster,
                         org.jxmpp.jid.Jid targetUserID)
                  throws org.jivesoftware.smack.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:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • send

        public void send​(org.jivesoftware.smack.roster.RosterEntry rosterEntry,
                         org.jxmpp.jid.Jid targetUserID)
                  throws org.jivesoftware.smack.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:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • send

        public void send​(org.jivesoftware.smack.roster.RosterGroup rosterGroup,
                         org.jxmpp.jid.Jid targetUserID)
                  throws org.jivesoftware.smack.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:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.