This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. Event Management
Table of Contents [-]
Introduction #
The portal supports an event listening system for code to hook into the system. Event listening is configured in /portal-ejb/classes/portal.properties (and re-configured in portal-ext.properties) by configuring event handlers/listeners.
System level event handling #
Various events (e.g. application start-up, session creation and destruction, etc.) can have one or more handler classes listed. If a class is listed, it is called by the event management system. Key players in this mechanism are:
- com.liferay.portal.events.EventsProcessor (the dispatcher)
- com.liferay.portal.servlet.MainServlet (calls EventsProcessor for most events)
- com.liferay.portal.servlet.PortalSessionListener (calls EventsProcessor for session creation and destruction events)
- com.liferay.portal.action.LogoutAction (calls EventsProcessor when user logs out)
- com.liferay.portal.util.InitUtil (calls EventsProcessor during initialization)
Entity CRUD listening #
Code can be notified when most database "entities" are created, updated, deleted, etc. You can define "listeners" for the CRUD operations on users, layouts, organizations, locations, websites, etc. by defining a class that implements the interface com.liferay.portal.model.ModelListener, then making an entries in the portal-ext.properties file to "register" it. See portal.properties for more info and examples, but one an example is:
value.object.listener.com.liferay.portal.model.User=com.liferay.portal.model.UserListener
which defines a class that listens and responds to any additions, updates, and deletions from the registered user list.