org.apache.wiki.event
Class WikiEventUtils

java.lang.Object
  extended by org.apache.wiki.event.WikiEventUtils

public class WikiEventUtils
extends Object

A utility class that adds some JSPWiki-specific functionality to the WikiEventManager (which is really a general-purpose event manager).

Since:
2.4.20

Constructor Summary
WikiEventUtils()
           
 
Method Summary
static void addWikiEventListener(Object client, int type, WikiEventListener listener)
          This ungainly convenience method adds a WikiEventListener to the appropriate component of the provided client Object, to listen for events of the provided type (or related types, see the table below).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiEventUtils

public WikiEventUtils()
Method Detail

addWikiEventListener

public static void addWikiEventListener(Object client,
                                        int type,
                                        WikiEventListener listener)
This ungainly convenience method adds a WikiEventListener to the appropriate component of the provided client Object, to listen for events of the provided type (or related types, see the table 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.

Throws:
ClassCastException - if there is a type mismatch between certain event types and the client Object
See Also:
WikiEvent, WikiEngineEvent, WikiPageEvent, WikiSecurityEvent


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.