org.opencms.main
Class CmsEventManager

java.lang.Object
  extended by org.opencms.main.CmsEventManager

public class CmsEventManager
extends java.lang.Object

Manager that controls the OpenCms event system. There is only one instance of this event manager class used by the OpenCms runtime. This instance can be obtained by calling OpenCms.getEventManager().

Events can be used in OpenCms to notify custom event listeners that certain system events have happened. Event listeners have to implement the interface I_CmsEventListener.

Since:
7.0.0
Version:
$Revision: 1.7 $
Author:
Alexander Kandzior
See Also:
CmsEvent, I_CmsEventListener

Field Summary
protected static I_CmsEventListener[] EVENT_LIST
          Required as template for event list generation.
 
Constructor Summary
CmsEventManager()
          Create a new instance of an OpenCms event manager.
 
Method Summary
 void addCmsEventListener(I_CmsEventListener listener)
          Add a cms event listener that listens to all events.
 void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes)
          Add a cms event listener.
 void fireEvent(CmsEvent event)
          Notify all event listeners that a particular event has occurred.
 void fireEvent(int type)
          Notify all event listeners that a particular event has occurred without any additional event data.
 void fireEvent(int type, java.util.Map data)
          Notify all event listeners that a particular event has occurred.
protected  void fireEventHandler(java.util.List listeners, CmsEvent event)
          Fires the specified event to a list of event listeners.
protected  java.util.Map getEventListeners()
          Returns the map of all configured event listeners.
protected  void initialize(CmsEventManager base)
          Initialize this event manager with all events from the given base event manager.
 void removeCmsEventListener(I_CmsEventListener listener)
          Removes a cms event listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_LIST

protected static final I_CmsEventListener[] EVENT_LIST
Required as template for event list generation.

Constructor Detail

CmsEventManager

public CmsEventManager()
Create a new instance of an OpenCms event manager.

Method Detail

addCmsEventListener

public void addCmsEventListener(I_CmsEventListener listener)
Add a cms event listener that listens to all events.

Parameters:
listener - the listener to add

addCmsEventListener

public void addCmsEventListener(I_CmsEventListener listener,
                                int[] eventTypes)
Add a cms event listener.

Parameters:
listener - the listener to add
eventTypes - the events to listen for

fireEvent

public void fireEvent(CmsEvent event)
Notify all event listeners that a particular event has occurred.

Parameters:
event - the event that is forwarded to all listeners

fireEvent

public void fireEvent(int type)
Notify all event listeners that a particular event has occurred without any additional event data.

Parameters:
type - event type

fireEvent

public void fireEvent(int type,
                      java.util.Map data)
Notify all event listeners that a particular event has occurred.

Parameters:
type - event type
data - event data

removeCmsEventListener

public void removeCmsEventListener(I_CmsEventListener listener)
Removes a cms event listener.

Parameters:
listener - the listener to remove

getEventListeners

protected java.util.Map getEventListeners()
Returns the map of all configured event listeners.

Returns:
the map of all configured event listeners

initialize

protected void initialize(CmsEventManager base)
Initialize this event manager with all events from the given base event manager.

Parameters:
base - the base event manager to initialize this event manager with

fireEventHandler

protected void fireEventHandler(java.util.List listeners,
                                CmsEvent event)
Fires the specified event to a list of event listeners.

Parameters:
listeners - the listeners to fire
event - the event to fire