Class CmsEventManager

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

public class CmsEventManager extends 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
See Also:
  • Field Details

  • Constructor Details

    • CmsEventManager

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

  • Method Details

    • addCmsEventListener

      public void addCmsEventListener(I_CmsEventListener listener)
      Add an OpenCms event listener that listens to all events.

      Parameters:
      listener - the listener to add
    • addCmsEventListener

      public void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes)
      Add an OpenCms 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, Map<String,Object> data)
      Notify all event listeners that a particular event has occurred.

      Parameters:
      type - event type
      data - event data
    • removeCmsEventListener

      Removes a cms event listener.

      Parameters:
      listener - the listener to remove
    • fireEventHandler

      protected void fireEventHandler(List<I_CmsEventListener> listeners, CmsEvent event)
      Fires the specified event to a list of event listeners.

      Parameters:
      listeners - the listeners to fire
      event - the event to fire
    • 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