|
||||||||||
| 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 |
|---|
| 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(java.lang.String macroName)
|
|
AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.String macroDescription)
|
|
AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
java.lang.Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
|
|
AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
|
|
AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
java.lang.Class<? extends JSR223ScriptMacroParameters> parametersBeanClass)
|
|
| Method Summary | |
|---|---|
protected java.lang.Object |
eval(java.lang.String content,
javax.script.ScriptEngine engine,
javax.script.ScriptContext scriptContext)
Execute the script. |
protected java.util.List<org.xwiki.rendering.block.Block> |
evaluateBlock(P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return Block based result. |
protected java.util.List<org.xwiki.rendering.block.Block> |
evaluateBlock(javax.script.ScriptEngine engine,
P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return Block based result. |
protected javax.script.CompiledScript |
getCompiledScript(java.lang.String content,
javax.script.Compilable engine)
Return a compiled version of the provided script. |
protected javax.script.ScriptContext |
getScriptContext()
Get the current ScriptContext and refresh it. |
protected java.lang.String |
getScriptEngineName(P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Method to overwrite to indicate the script engine name. |
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, initialize, setDefaultCategory, setDescriptor, setPriority |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractJSR223ScriptMacro(java.lang.String macroName)
macroName - the name of the macro (eg "groovy")
public AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.String macroDescription)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.
public AbstractJSR223ScriptMacro(java.lang.String macroName,
java.lang.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(java.lang.String macroName,
java.lang.String macroDescription,
java.lang.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(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
java.lang.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 boolean supportsInlineMode()
supportsInlineMode in interface org.xwiki.rendering.macro.Macro<P extends JSR223ScriptMacroParameters>Macro.supportsInlineMode()
protected java.lang.String getScriptEngineName(P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
parameters - the macro parameters.context - the context of the macro transformation.
protected javax.script.ScriptContext getScriptContext()
protected java.util.List<org.xwiki.rendering.block.Block> evaluateBlock(P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
throws org.xwiki.rendering.macro.MacroExecutionException
Block 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.AbstractScriptMacro.evaluate(ScriptMacroParameters, String, MacroTransformationContext)
protected java.util.List<org.xwiki.rendering.block.Block> evaluateBlock(javax.script.ScriptEngine engine,
P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
throws javax.script.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.
javax.script.ScriptException - failed to evaluate script
org.xwiki.rendering.macro.MacroExecutionException - failed to evaluate provided content.
protected java.lang.Object eval(java.lang.String content,
javax.script.ScriptEngine engine,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
content - the script to be executed by the script engineengine - the script enginescriptContext - the script context
javax.script.ScriptException - if an error occurrs in script. ScriptEngines should create and throw
ScriptException wrappers for checked Exceptions thrown by underlying scripting
implementations.
protected javax.script.CompiledScript getCompiledScript(java.lang.String content,
javax.script.Compilable engine)
throws javax.script.ScriptException
content - the script to compile.engine - the script engine.
javax.script.ScriptException - failed to compile the script.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||