|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.core.event.EventBroker
public abstract class EventBroker
This is the base class for all event brokers in mmbase. the function of an
event broker is to know about a specific kind of event, as well as a specific
kind of event listener. All events should be derived from the
org.mmbase.core.event.Event class, and all listeners from the
org.mmbase.core.event.EventListener interface.
Allthough event
listeners have to implement the EventListener interface, the actual method
that will be called to pass on the event is not part of this interface, as it
is specific for the kind of event you want to listen for. This is a contract
between the broker implementation and the event listerer interface.
This class does most of the work of keeping references to all the listeners
and allowing for adding/removing them. Only a fiew type specific actions are
delegated to the super class.
The EventListener also provides a method
for passing on constraint properties to a event broker. If you want to create
your own event type you can use this feature to accomplish that not all
events of your type are propagated to the listener.
| Constructor Summary | |
|---|---|
EventBroker()
|
|
| Method Summary | |
|---|---|
abstract boolean |
addListener(EventListener listener)
|
protected abstract Collection<EventListener> |
backing()
|
abstract boolean |
canBrokerForEvent(Event event)
this method should return true if this event broker can broker for events of this type. |
abstract boolean |
canBrokerForListener(EventListener listener)
this method should return true if this broker can accept and propagate events to the listener of this type. |
boolean |
equals(Object o)
|
Collection<EventListener> |
getListeners()
|
int |
hashCode()
|
protected abstract void |
notifyEventListener(Event event,
EventListener listener)
This method has two functions. |
void |
notifyForEvent(Event event)
|
abstract void |
removeListener(EventListener listener)
|
abstract String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EventBroker()
| Method Detail |
|---|
public abstract boolean canBrokerForListener(EventListener listener)
event instanceof <EventListener associated with this broker>
listener - public abstract boolean canBrokerForEvent(Event event)
event instanceof <EvenType associated with this broker>
event -
protected abstract void notifyEventListener(Event event,
EventListener listener)
throws ClassCastException
event - listener -
ClassCastExceptionpublic abstract boolean addListener(EventListener listener)
public abstract void removeListener(EventListener listener)
protected abstract Collection<EventListener> backing()
public Collection<EventListener> getListeners()
public void notifyForEvent(Event event)
public abstract String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||