|
Dashboard Builder Commons 6.0.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.dashboard.commons.events.Publisher
public class Publisher
The publisher party int the publish/subscribe GoF design pattern.
WARNING: In order to solve the -lapsed listener- problem the reference to the subscriber stored by the Publisher is weak. This it means that if the Subscriber reference is lost then is also automatically removed from the subscribers list. To avoid this issue ensure that your Subscriber instance is referenced in your object model and exists as long as the Publisher is alive.
| Field Summary | |
|---|---|
static int |
EVENT_ALL
The event representing all events. |
protected Map |
subscribers
The registered subscribers grouped by eventId. |
| Constructor Summary | |
|---|---|
Publisher()
|
|
| Method Summary | |
|---|---|
Map |
getSubscribers()
Retrieve registered subscribers. |
List |
getSubscribers(int eventId)
Retrieve registered Subscribers for a specified event. |
void |
notifyEvent(int eventId,
Object eventInfo)
Interface used to fire events. |
void |
subscribe(Collection c,
int eventId)
Subscribe a collection subscribers for a concrete event. |
void |
subscribe(Subscriber subscriber)
Register a subscriber interested in ALL events. |
void |
subscribe(Subscriber subscriber,
int eventId)
Register a subscriber interested in a single event. |
void |
unsubscribe(Subscriber subscriber)
Removes a registered subscriber. |
void |
unsubscribe(Subscriber subscriber,
int eventId)
Removes a registered subscriber. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int EVENT_ALL
NOTE: EVENT_ALL=0 is a reserved identifier.
protected Map subscribers
| Constructor Detail |
|---|
public Publisher()
| Method Detail |
|---|
public void subscribe(Subscriber subscriber)
public void subscribe(Subscriber subscriber,
int eventId)
eventId - The event interested in.
NOTE: EVENT_ALL=0 is a reserved identifier.
public void subscribe(Collection c,
int eventId)
public void unsubscribe(Subscriber subscriber)
public void unsubscribe(Subscriber subscriber,
int eventId)
eventId - The event interested in.public Map getSubscribers()
public List getSubscribers(int eventId)
public void notifyEvent(int eventId,
Object eventInfo)
eventInfo - The object where event occurs.
|
Dashboard Builder Commons 6.0.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||