P - the type of macro parameters bean.public abstract class AbstractScriptMacro<P extends ScriptMacroParameters> extends org.xwiki.rendering.macro.AbstractMacro<P> implements ScriptMacro
It is not obvious to see how macro execution works just from looking at the code. A lot of checking and
initialization is done in listeners to the ScriptEvaluatingEvent and
ScriptEvaluatedEvent. E.g. the check for programming rights for JSR223 scripts, check
for nested script macros and selecting the right class loader is done there.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CONTENT_DESCRIPTION
The default description of the script macro content.
|
protected DocumentAccessBridge |
documentAccessBridge
Deprecated.
since 2.5M1 (not used any more)
|
protected org.xwiki.context.Execution |
execution
Used by subclasses.
|
| Constructor and Description |
|---|
AbstractScriptMacro(String macroName) |
AbstractScriptMacro(String macroName,
String macroDescription) |
AbstractScriptMacro(String macroName,
String macroDescription,
Class<? extends ScriptMacroParameters> parametersBeanClass) |
AbstractScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor) |
AbstractScriptMacro(String macroName,
String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
Class<? extends ScriptMacroParameters> parametersBeanClass) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
evaluate(P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Deprecated.
since 2.4M2 use
evaluateString(ScriptMacroParameters, String, MacroTransformationContext)
instead |
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 String |
evaluateString(P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return
String based result. |
List<org.xwiki.rendering.block.Block> |
execute(P parameters,
String content,
org.xwiki.rendering.transformation.MacroTransformationContext context) |
protected org.xwiki.component.manager.ComponentManager |
getComponentManager() |
protected List<org.xwiki.rendering.block.Block> |
parseScriptResult(String content,
P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Convert script result as a
Block list. |
protected List<org.xwiki.rendering.block.Block> |
parseSourceSyntax(String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Parse provided content with the parser of the current wiki syntax.
|
compareTo, getDescriptor, getPriority, initialize, setDefaultCategory, setDescriptor, setPriorityprotected static final String CONTENT_DESCRIPTION
@Inject @Deprecated protected DocumentAccessBridge documentAccessBridge
@Inject protected org.xwiki.context.Execution execution
public AbstractScriptMacro(String macroName)
macroName - the name of the macro (eg "groovy")public AbstractScriptMacro(String macroName, String macroDescription)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.public AbstractScriptMacro(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 AbstractScriptMacro(String macroName, String macroDescription, Class<? extends ScriptMacroParameters> 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 AbstractScriptMacro(String macroName, String macroDescription, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor, Class<? extends ScriptMacroParameters> 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.protected org.xwiki.component.manager.ComponentManager getComponentManager()
public List<org.xwiki.rendering.block.Block> execute(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
execute in interface org.xwiki.rendering.macro.Macro<P extends ScriptMacroParameters>org.xwiki.rendering.macro.MacroExecutionExceptionprotected List<org.xwiki.rendering.block.Block> parseScriptResult(String content, P parameters, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
Block list.content - the script result to parse.parameters - the macro parameters.context - the context of the macro transformation.Blocks.org.xwiki.rendering.macro.MacroExecutionException - Failed to find source parser.@Deprecated protected String evaluate(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
evaluateString(ScriptMacroParameters, String, MacroTransformationContext)
insteadparameters - 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 String evaluateString(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
String based result.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(P parameters, String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
Block based result.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> parseSourceSyntax(String content, org.xwiki.rendering.transformation.MacroTransformationContext context) throws org.xwiki.rendering.macro.MacroExecutionException
content - the content to parse.context - the context of the macro transformation.org.xwiki.rendering.macro.MacroExecutionException - failed to parse contentCopyright © 2004–2014 XWiki. All rights reserved.