org.xwiki.rendering.internal.macro.script
Class AbstractScriptCheckerListener

java.lang.Object
  extended by org.xwiki.rendering.internal.macro.script.AbstractScriptCheckerListener
All Implemented Interfaces:
org.xwiki.observation.EventListener
Direct Known Subclasses:
NestedScriptMacroValidatorListener, PermissionCheckerListener

public abstract class AbstractScriptCheckerListener
extends java.lang.Object
implements org.xwiki.observation.EventListener

Abstract base class for listeners that need to perform some checks just before a script macro is executed. Subclasses must implement check(CancelableEvent, MacroTransformationContext, ScriptMacroParameters) that allows them to avoid casting and checking for the right event type.

Since:
2.5M1
Version:
$Id$

Constructor Summary
AbstractScriptCheckerListener()
           
 
Method Summary
protected abstract  void check(org.xwiki.observation.event.CancelableEvent event, org.xwiki.rendering.transformation.MacroTransformationContext context, ScriptMacroParameters parameters)
          This method is called when an ScriptEvaluatingEvent is received.
 java.util.List<org.xwiki.observation.event.Event> getEvents()
           This implementation returns a singleton list with a ScriptEvaluatingEvent.
 void onEvent(org.xwiki.observation.event.Event event, java.lang.Object source, java.lang.Object data)
           This implementation casts the arguments to the correct type and calls check(CancelableEvent, MacroTransformationContext, ScriptMacroParameters).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.observation.EventListener
getName
 

Constructor Detail

AbstractScriptCheckerListener

public AbstractScriptCheckerListener()
Method Detail

getEvents

public java.util.List<org.xwiki.observation.event.Event> getEvents()
This implementation returns a singleton list with a ScriptEvaluatingEvent.

Specified by:
getEvents in interface org.xwiki.observation.EventListener
See Also:
EventListener.getEvents()

onEvent

public void onEvent(org.xwiki.observation.event.Event event,
                    java.lang.Object source,
                    java.lang.Object data)
This implementation casts the arguments to the correct type and calls check(CancelableEvent, MacroTransformationContext, ScriptMacroParameters).

Specified by:
onEvent in interface org.xwiki.observation.EventListener
See Also:
EventListener.onEvent(Event, java.lang.Object, java.lang.Object)

check

protected abstract void check(org.xwiki.observation.event.CancelableEvent event,
                              org.xwiki.rendering.transformation.MacroTransformationContext context,
                              ScriptMacroParameters parameters)
This method is called when an ScriptEvaluatingEvent is received.

Parameters:
event - the received event
context - current transformation context
parameters - parameters of the script macro about to be executed


Copyright © 2004-2011 XWiki. All Rights Reserved.