|
|||||||||
| 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>
P - the type of macro parameters bean.public abstract class AbstractScriptMacro<P extends ScriptMacroParameters>
Base Class for script evaluation macros.
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.
| Field Summary | |
|---|---|
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. |
| Fields inherited from class org.xwiki.rendering.macro.AbstractMacro |
|---|
beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_NAVIGATION |
| Constructor Summary | |
|---|---|
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)
|
|
| Method Summary | |
|---|---|
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. |
| 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 |
| Methods inherited from interface org.xwiki.rendering.macro.Macro |
|---|
supportsInlineMode |
| Field Detail |
|---|
protected static final String CONTENT_DESCRIPTION
@Inject @Deprecated protected DocumentAccessBridge documentAccessBridge
@Inject protected org.xwiki.context.Execution execution
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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.MacroExecutionExceptionMacro.execute(Object, String, MacroTransformationContext)
protected 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)
instead
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 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 content
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||