|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.bigbross.bossa.notify.NotificationBus
This class manages all event notifications inside Bossa. The events are notified to listeners registered in the bus. This registration can happen either at the bus creation or at a later time.
The listeners registered after the bus is created will not be preserved if this bus is serialized. Due to this behaviour, objects outside the Bossa core that are registered as listeners may lose notification of events if a failure crashes the system.
| Constructor Summary | |
NotificationBus(Bossa engine)
Creates a new empty notification bus. |
|
NotificationBus(Bossa engine,
List persistentListeners)
Creates a new notification bus with some persistent listeners. |
|
| Method Summary | |
void |
notifyEvent(Event event)
Informs the occurrence of an event to all registered listeners. |
boolean |
registerListener(Listener listener)
Registers a new listener of the notification bus. |
void |
removeListener(String id)
Removes the listener from the notification bus, if present. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NotificationBus(Bossa engine,
List persistentListeners)
engine - the bossa engine this notification bus is part.persistentListeners - a list of the persistent listeners.public NotificationBus(Bossa engine)
engine - the bossa engine this notification bus is part.| Method Detail |
public boolean registerListener(Listener listener)
listener - the object that will act as a listener of the
notification bus.
true if the listener is registered,
false if there is already a listener registered
with the same id.public void removeListener(String id)
id - the id of the listener.public void notifyEvent(Event event)
An event has an id and some attributes that are dependent on the event
type. See the constructor of the Event class for more
information.
event - the event.Event.Event(java.lang.String, int, java.util.Map, java.util.Date)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||