|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xwiki.rendering.macro.AbstractMacro<P>
org.xwiki.rendering.macro.script.AbstractScriptMacro<P>
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro<P>
P - the type of macro parameters bean.public abstract class AbstractJSR223ScriptMacro<P extends JSR223ScriptMacroParameters>
Base Class for script evaluation macros based on JSR223.
| Field Summary | |
|---|---|
protected ScriptEngineManager |
scriptEngineManager
The JSR223 Script Engine Manager we use to evaluate JSR223 scripts. |
| Fields inherited from class org.xwiki.rendering.macro.script.AbstractScriptMacro |
|---|
CONTENT_DESCRIPTION, documentAccessBridge, execution |
| Fields inherited from class org.xwiki.rendering.macro.AbstractMacro |
|---|
beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_NAVIGATION |
| Constructor Summary | |
|---|---|
AbstractJSR223ScriptMacro(String macroName)
|
|
AbstractJSR223ScriptMacro(String macroName,
String macroDescription)
|
|
AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
|
|
AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
|
|
AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
|
|
| Method Summary | |
|---|---|
protected Object |
eval(String content,
ScriptEngine engine,
ScriptContext scriptContext)
Execute the script. |
protected List<org.xwiki.rendering.block.Block> |
evaluateBlock(P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return Block based result. |
protected List<org.xwiki.rendering.block.Block> |
evaluateBlock(ScriptEngine engine,
P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return Block based result. |
protected CompiledScript |
getCompiledScript(String content,
Compilable engine)
Return a compiled version of the provided script. |
protected ScriptContext |
getScriptContext()
Get the current ScriptContext and refresh it. |
protected String |
getScriptEngineName(P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Method to overwrite to indicate the script engine name. |
void |
initialize()
|
boolean |
supportsInlineMode()
|
| Methods inherited from class org.xwiki.rendering.macro.script.AbstractScriptMacro |
|---|
evaluate, evaluateString, execute, getComponentManager, parseScriptResult, parseSourceSyntax |
| Methods inherited from class org.xwiki.rendering.macro.AbstractMacro |
|---|
compareTo, getDescriptor, getPriority, setDefaultCategory, setDescriptor, setPriority |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ScriptEngineManager scriptEngineManager
| Constructor Detail |
|---|
public AbstractJSR223ScriptMacro(String macroName)
macroName - the name of the macro (eg "groovy")
public AbstractJSR223ScriptMacro(String macroName,
String macroDescription)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.
public AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.contentDescriptor - the description of the macro content.
public AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.parametersBeanClass - class of the parameters bean for this macro.
public AbstractJSR223ScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.contentDescriptor - the description of the macro content.parametersBeanClass - class of the parameters bean for this macro.| Method Detail |
|---|
public void initialize()
throws org.xwiki.component.phase.InitializationException
initialize in interface org.xwiki.component.phase.Initializableinitialize in class org.xwiki.rendering.macro.AbstractMacro<P extends JSR223ScriptMacroParameters>org.xwiki.component.phase.InitializationExceptionpublic boolean supportsInlineMode()
supportsInlineMode in interface org.xwiki.rendering.macro.Macro<P extends JSR223ScriptMacroParameters>
protected String getScriptEngineName(P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
parameters - the macro parameters.context - the context of the macro transformation.
protected ScriptContext getScriptContext()
protected List<org.xwiki.rendering.block.Block> evaluateBlock(P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
throws org.xwiki.rendering.macro.MacroExecutionException
AbstractScriptMacroBlock based result.
evaluateBlock in class AbstractScriptMacro<P extends JSR223ScriptMacroParameters>parameters - the macro parameters.content - the script to execute.context - the context of the macro transformation.
org.xwiki.rendering.macro.MacroExecutionException - failed to evaluate provided content.
protected List<org.xwiki.rendering.block.Block> evaluateBlock(ScriptEngine engine,
P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
throws ScriptException,
org.xwiki.rendering.macro.MacroExecutionException
Block based result.
engine - the script engine to use to evaluate the script.parameters - the macro parameters.content - the script to execute.context - the context of the macro transformation.
ScriptException - failed to evaluate script
org.xwiki.rendering.macro.MacroExecutionException - failed to evaluate provided content.
protected Object eval(String content,
ScriptEngine engine,
ScriptContext scriptContext)
throws ScriptException
content - the script to be executed by the script engineengine - the script enginescriptContext - the script context
ScriptException - if an error occurrs in script. ScriptEngines should create and throw
ScriptException wrappers for checked Exceptions thrown by underlying scripting
implementations.
protected CompiledScript getCompiledScript(String content,
Compilable engine)
throws ScriptException
content - the script to compile.engine - the script engine.
ScriptException - failed to compile the script.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||