Package org.jivesoftware.smackx.xroster
Class RosterExchangeManager
- java.lang.Object
-
- org.jivesoftware.smackx.xroster.RosterExchangeManager
-
public class RosterExchangeManager extends 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 Summary
Constructors Constructor Description RosterExchangeManager(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(XMPPConnection connection)
void
removeRosterListener(RosterExchangeListener rosterExchangeListener)
Removes a listener from roster exchanges.void
send(RosterEntry rosterEntry, Jid targetUserID)
Sends a roster entry to userID.void
send(RosterGroup rosterGroup, Jid targetUserID)
Sends a roster group to userID.void
send(Roster roster, Jid targetUserID)
Sends a roster to userID.
-
-
-
Field Detail
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
-
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
-
getInstanceFor
public static RosterExchangeManager getInstanceFor(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(Roster roster, Jid targetUserID) throws SmackException.NotConnectedException, InterruptedException
Sends a roster to userID. All the entries of the roster will be sent to the target user.- Parameters:
roster
- the roster to sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
send
public void send(RosterEntry rosterEntry, Jid targetUserID) throws SmackException.NotConnectedException, InterruptedException
Sends a roster entry to userID.- Parameters:
rosterEntry
- the roster entry to sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
send
public void send(RosterGroup rosterGroup, Jid targetUserID) throws SmackException.NotConnectedException, 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 sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
-