org.mmbase.core.event
Class EventManager

Package class diagram package EventManager
java.lang.Object
  extended by org.mmbase.core.event.EventManager
All Implemented Interfaces:
EventListener, SystemEventListener, WeightEventListener

public class EventManager
extends Object
implements SystemEventListener

This class manages all event related stuff. it is the place to register event brokers, and it will propagate all events. The class is set up as a singleton. When the manager is instantiated, event brokers are added for Event, NodeEvent and RelationEvent

Since:
MMBase-1.8
Version:
$Id: EventManager.java 46071 2011-11-23 13:22:23Z michiel $
Author:
Ernst Bunders

Nested Class Summary
static class EventManager.Ready
           
 
Field Summary
protected static String CONFIG
           
static String DTD_EVENTMANAGER
           
static String PUBLIC_ID_EVENTMANAGER
           
protected  ResourceWatcher watcher
           
 
Method Summary
 void addEventBroker(EventBroker broker)
          add an event broker for a specific type of event
 void addEventListener(EventListener listener)
           
protected  void addEventListener(EventListener listener, boolean propagateToCollected)
           
protected  void configure(String resource)
           
 Collection<EventBroker> getBrokers()
           
static EventManager getInstance()
          use this method to get an instance of the event manager
static String getMachineName()
           
 long getNumberOfPropagatedEvents()
           
 long getPropagationCost()
           
 long getPropagationCostNs()
           
static UUID getUUID()
           
 int getWeight()
          The weight of an event listener determines the order in which they are called.
 void notify(SystemEvent se)
           
 void propagateEvent(Event event)
          This method will propagate the given event to all the aproprate listeners.
 void propagateEvent(Event event, boolean asynchronous)
          Like propagateEvent(org.mmbase.core.event.Event) but with an extra argument 'asynchronous'.
 void removeEventBroker(EventBroker broker)
          remove a broker for a specific type of event
 void removeEventListener(EventListener listener)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_ID_EVENTMANAGER

public static final String PUBLIC_ID_EVENTMANAGER
See Also:
Constant Field Values

DTD_EVENTMANAGER

public static final String DTD_EVENTMANAGER
See Also:
Constant Field Values

CONFIG

protected static final String CONFIG
See Also:
Constant Field Values

watcher

protected ResourceWatcher watcher
Method Detail

getInstance

public static EventManager getInstance()
use this method to get an instance of the event manager


getUUID

public static UUID getUUID()
Since:
MMBase-2.0

getMachineName

public static String getMachineName()
Since:
MMBase-2.0

notify

public void notify(SystemEvent se)
Specified by:
notify in interface SystemEventListener

getWeight

public int getWeight()
Description copied from interface: WeightEventListener
The weight of an event listener determines the order in which they are called. The bigger, the earlier.

Specified by:
getWeight in interface WeightEventListener

configure

protected final void configure(String resource)

getBrokers

public Collection<EventBroker> getBrokers()
Since:
MMBase-1.8.5

addEventBroker

public void addEventBroker(EventBroker broker)
add an event broker for a specific type of event

Parameters:
broker -

removeEventBroker

public void removeEventBroker(EventBroker broker)
remove a broker for a specific type of event

Parameters:
broker -

addEventListener

public final void addEventListener(EventListener listener)

addEventListener

protected void addEventListener(EventListener listener,
                                boolean propagateToCollected)
Parameters:
listener -

removeEventListener

public void removeEventListener(EventListener listener)
Parameters:
listener -

propagateEvent

public void propagateEvent(Event event)
This method will propagate the given event to all the aproprate listeners. what makes a listener apropriate is determined by it's type (class) and by possible constraint properties (if the handling broker supports those

Parameters:
event -
See Also:
AbstractEventBroker

propagateEvent

public void propagateEvent(Event event,
                           boolean asynchronous)
Like propagateEvent(org.mmbase.core.event.Event) but with an extra argument 'asynchronous'.

Parameters:
asynchronous - If true, execute the propagation in a different thread, and don't let this thread wait for the result.
Since:
MMBase-1.9.3

getNumberOfPropagatedEvents

public long getNumberOfPropagatedEvents()
Since:
MMBase-1.8.1

getPropagationCost

public long getPropagationCost()
Since:
MMBase-1.8.1

getPropagationCostNs

public long getPropagationCostNs()
Since:
MMBase-1.9

shutdown

public void shutdown()
Since:
MMBase-1.9


MMBase2 Utils 2.0-SNAPSHOT - 2013-03-30T06:24