org.mycore.common.events
Class MCREventManager

java.lang.Object
  extended by org.mycore.common.events.MCREventManager

public class MCREventManager
extends Object

Acts as a multiplexer to forward events that are created to all registered event handlers, in the order that is configured in mycore properties. For information how to configure, see MCREventHandler javadocs.

Author:
Frank Lützenkirchen
See Also:
MCREventHandler, MCREventHandlerBase

Field Summary
static boolean BACKWARD
          Call event handlers in backward direction (delete)
static boolean FORWARD
          Call event handlers in forward direction (create, update)
 
Method Summary
 void handleEvent(MCREvent evt)
          Same as handleEvent( evt, MCREventManager.FORWARD )
 void handleEvent(MCREvent evt, boolean direction)
          This method is called by the component that created the event and acts as a multiplexer that invokes all registered event handlers doHandleEvent methods.
static MCREventManager instance()
          The singleton manager instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORWARD

public static final boolean FORWARD
Call event handlers in forward direction (create, update)

See Also:
Constant Field Values

BACKWARD

public static final boolean BACKWARD
Call event handlers in backward direction (delete)

See Also:
Constant Field Values
Method Detail

instance

public static MCREventManager instance()
The singleton manager instance

Returns:
the single event manager

handleEvent

public void handleEvent(MCREvent evt,
                        boolean direction)
This method is called by the component that created the event and acts as a multiplexer that invokes all registered event handlers doHandleEvent methods. If something goes wrong and an exception is caught, the undoHandleEvent methods of all event handlers that are at a position BEFORE the failed one, will be called in reversed order. The parameter direction controls the order in which the event handlers are called.

Parameters:
evt - the event that happened
direction - the order in which the event handlers are called
See Also:
MCREventHandler.doHandleEvent(org.mycore.common.events.MCREvent), MCREventHandlerBase

handleEvent

public void handleEvent(MCREvent evt)
                 throws MCRException
Same as handleEvent( evt, MCREventManager.FORWARD )

Throws:
MCRException