Class designation: Class org.apache.wiki.event.WikiEventUtils

WikiEventUtils is a utility class that adds some JSPWiki-specific functionality to the WikiEventManager (which is really a general-purpose event manager). Knowing where to add a listener is a matter of figuring out where in the JSPWiki code certain events get fired. This class' addWikiEventListener() method takes some of that guesswork away — all you need to do is choose which type of event you want to listen for and the method will figure out the appropriate place to attach the provided listener (as according to the table shown below).

If the type value is valid but does not match any WikiEvent type known to this method, this will just attach the listener to the client Object. This may mean that the Object never fires events of the desired type; type-to-client matching is left to you to guarantee. Silence is golden, but not if you want those events.

Most event types expect a WikiEngine as the client, with the rest attaching the listener directly to the supplied source object, as described below:


WikiEvent Type(s) Required Source Object Actually Attached To
any WikiEngineEvent WikiEngine WikiEngine
WikiPageEvent.PAGE_LOCK, WikiPageEvent.PAGE_UNLOCK WikiEngine or PageManager PageManager
WikiPageEvent.PAGE_REQUESTED, WikiPageEvent.PAGE_DELIVERED WikiServletFilter WikiServletFilter
WikiPageEvent (phase boundary event) WikiEngine FilterManager
WikiPageEvent (in-phase event)
WikiPageEvent (in-phase event) any source object
WikiSecurityEvent any source object
any other valid type any source object
any invalid type any nothing


phase boundary event types
WikiPageEvent.PRE_TRANSLATE_BEGIN, WikiPageEvent.PRE_TRANSLATE_END, {WikiPageEvent.POST_TRANSLATE_BEGIN}, WikiPageEvent.POST_TRANSLATE_END, WikiPageEvent.PRE_SAVE_BEGIN, WikiPageEvent.PRE_SAVE_END, WikiPageEvent.POST_SAVE_BEGIN, and WikiPageEvent.POST_SAVE_END.
in-phase event types
WikiPageEvent.PRE_TRANSLATE, WikiPageEvent.POST_TRANSLATE, WikiPageEvent.PRE_SAVE, and WikiPageEvent.POST_SAVE.

Note: The Actually Attached To column may also be considered as the class(es) that fire events of the type(s) shown in the WikiEvent Type column.


See: WikiEvent, WikiEventManager


Category.Documentation