+1
Jerome.
----- Original Message -----
From: "Alex Busenius" <alex.busenius(a)xwiki.com>
To: "XWiki Developers" <devs(a)xwiki.org>
Sent: Monday, August 23, 2010 11:00:16 AM GMT +01:00 Amsterdam / Berlin / Bern / Rome /
Stockholm / Vienna
Subject: [xwiki-devs] [proposal] Cancelable events and refactoring script macros
Hello,
I'd like to refactor AbstractScriptMacro in order to be able to change
script behavior in the future without fanout violations. Here is the
plan emerged after several discussions with ThomasM:
Introduce a notion of cancelable events. Such events can be canceled by
the receiver (providing an optional reason), the actual canceling is
performed by the sender.
http://dev.xwiki.org/xwiki/bin/view/Design/CancelableEvents
Send a cancelable event ScriptEvaluationStartsEvent in
AbstractScriptMacro just before evaluating the script and a
ScriptEvaluationFinishedEvent right after evaluation has finished (in
finally block).
Add the following 3 listeners to those events (into
rendering.internal.macro.script) and move the corresponding code from
AbstractScriptMacro there:
ScriptClassLoaderHandlerListener
* does class loader manipulations currently performed by
AbstractScriptMacro#getClassLoader & Co
PermissionCheckerListener
* Aborts execution of scripts that need PR if the document is not saved
with PR
* To distinguish velocity and PR scripts, introduce a new interface
PrivilegedScriptMacro extends ScriptMacro and let
AbstractJSR223ScriptMacro implement it
NestedScriptMacroValidatorListener
* Replaces NestedScriptMacroValidator (ScriptMacroValidator component
is removed completely)
The refactoring will remove the following methods (breaks API):
AbstractJSR223ScriptMacro:
* protected boolean canExecuteScript()
* public List execute(JSR223ScriptMacroParameters, String,
MacroTransformationContext)
AbstractScriptMacro:
* protected boolean canHaveJarsParameters()
* protected ClassLoader getClassLoader(String, ClassLoader)
WDYT?
Alex
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs