Package org.jivesoftware.openfire.roster
Class RosterEventDispatcher
- java.lang.Object
-
- org.jivesoftware.openfire.roster.RosterEventDispatcher
-
public class RosterEventDispatcher extends Object
Dispatches roster events. The following events are supported:- rosterLoaded --> A roster has just been loaded.
- contactAdded --> A contact has been added to a roster.
- contactUpdated --> A contact has been updated of a roster.
- contactDeleted --> A contact has been deleted from a roster.
addListener(RosterEventListener)andremoveListener(RosterEventListener)to add or removeRosterEventListener.- Author:
- Gaston Dombiak
-
-
Constructor Summary
Constructors Constructor Description RosterEventDispatcher()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddingContact(Roster roster, RosterItem item, boolean persistent)Notifies listeners that a contact is about to be added to a roster.static voidaddListener(RosterEventListener listener)Registers a listener to receive events.static voidcontactAdded(Roster roster, RosterItem item)Notifies the listeners that a contact has been added to a roster.static voidcontactDeleted(Roster roster, RosterItem item)Notifies the listeners that a contact has been deleted from a roster.static voidcontactUpdated(Roster roster, RosterItem item)Notifies the listeners that a contact has been updated.static voidremoveListener(RosterEventListener listener)Unregisters a listener to receive events.static voidrosterLoaded(Roster roster)Notifies the listeners that a roster has just been loaded.
-
-
-
Method Detail
-
addListener
public static void addListener(RosterEventListener listener)
Registers a listener to receive events.- Parameters:
listener- the listener.
-
removeListener
public static void removeListener(RosterEventListener listener)
Unregisters a listener to receive events.- Parameters:
listener- the listener.
-
rosterLoaded
public static void rosterLoaded(Roster roster)
Notifies the listeners that a roster has just been loaded.- Parameters:
roster- the loaded roster.
-
addingContact
public static boolean addingContact(Roster roster, RosterItem item, boolean persistent)
Notifies listeners that a contact is about to be added to a roster. New contacts may be persisted to the database or not. Listeners may indicate that contact about to be persisted should not be persisted. Only one listener is needed to returnfalseso that the contact is not persisted.- Parameters:
roster- the roster that was updated.item- the new roster item.persistent- true if the new contact is going to be saved to the database.- Returns:
- false if the contact should not be persisted to the database.
-
contactAdded
public static void contactAdded(Roster roster, RosterItem item)
Notifies the listeners that a contact has been added to a roster.- Parameters:
roster- the roster that was updated.item- the new roster item.
-
contactUpdated
public static void contactUpdated(Roster roster, RosterItem item)
Notifies the listeners that a contact has been updated.- Parameters:
roster- the roster that was updated.item- the updated roster item.
-
contactDeleted
public static void contactDeleted(Roster roster, RosterItem item)
Notifies the listeners that a contact has been deleted from a roster.- Parameters:
roster- the roster that was updated.item- the roster item that was deleted.
-
-