Package org.opencms.main
Class CmsEventManager
java.lang.Object
org.opencms.main.CmsEventManager
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 Summary
Modifier and TypeFieldDescriptionprotected static final I_CmsEventListener[]
Required as template for event list generation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCmsEventListener
(I_CmsEventListener listener) Add an OpenCms event listener that listens to all events.void
addCmsEventListener
(I_CmsEventListener listener, int[] eventTypes) Add an OpenCms event listener.void
fireEvent
(int type) Notify all event listeners that a particular event has occurred without any additional event data.void
Notify all event listeners that a particular event has occurred.void
Notify all event listeners that a particular event has occurred.protected void
fireEventHandler
(List<I_CmsEventListener> listeners, CmsEvent event) Fires the specified event to a list of event listeners.protected Map<Integer,
List<I_CmsEventListener>> 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.
-
Field Details
-
EVENT_LIST
Required as template for event list generation.
-
-
Constructor Details
-
CmsEventManager
public CmsEventManager()Create a new instance of an OpenCms event manager.
-
-
Method Details
-
addCmsEventListener
Add an OpenCms event listener that listens to all events.- Parameters:
listener
- the listener to add
-
addCmsEventListener
Add an OpenCms event listener.- Parameters:
listener
- the listener to addeventTypes
- the events to listen for
-
fireEvent
Notify all event listeners that a particular event has occurred.- Parameters:
event
- the event that is forwarded to all listeners
-
fireEvent
Notify all event listeners that a particular event has occurred without any additional event data.- Parameters:
type
- event type
-
fireEvent
Notify all event listeners that a particular event has occurred.- Parameters:
type
- event typedata
- event data
-
removeCmsEventListener
Removes a cms event listener.- Parameters:
listener
- the listener to remove
-
fireEventHandler
Fires the specified event to a list of event listeners.- Parameters:
listeners
- the listeners to fireevent
- the event to fire
-
getEventListeners
Returns the map of all configured event listeners.- Returns:
- the map of all configured event listeners
-
initialize
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
-