|
||||||||||
| 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 java.lang.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(java.lang.String macroName)
|
|
AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription)
|
|
AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
java.lang.Class<? extends ScriptMacroParameters> parametersBeanClass)
|
|
AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
|
|
AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
java.lang.Class<? extends ScriptMacroParameters> parametersBeanClass)
|
|
| Method Summary | |
|---|---|
protected java.lang.String |
evaluate(P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Deprecated. since 2.4M2 use evaluateString(ScriptMacroParameters, String, MacroTransformationContext)
instead |
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.lang.String |
evaluateString(P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Execute provided script and return String based result. |
java.util.List<org.xwiki.rendering.block.Block> |
execute(P parameters,
java.lang.String content,
org.xwiki.rendering.transformation.MacroTransformationContext context)
|
protected org.xwiki.component.manager.ComponentManager |
getComponentManager()
|
protected java.util.List<org.xwiki.rendering.block.Block> |
parseScriptResult(java.lang.String content,
P parameters,
org.xwiki.rendering.transformation.MacroTransformationContext context)
Convert script result as a Block list. |
protected java.util.List<org.xwiki.rendering.block.Block> |
parseSourceSyntax(java.lang.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 java.lang.String CONTENT_DESCRIPTION
@Inject @Deprecated protected DocumentAccessBridge documentAccessBridge
@Inject protected org.xwiki.context.Execution execution
| Constructor Detail |
|---|
public AbstractScriptMacro(java.lang.String macroName)
macroName - the name of the macro (eg "groovy")
public AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription)
macroName - the name of the macro (eg "groovy")macroDescription - the text description of the macro.
public AbstractScriptMacro(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 AbstractScriptMacro(java.lang.String macroName,
java.lang.String macroDescription,
java.lang.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(java.lang.String macroName,
java.lang.String macroDescription,
org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor,
java.lang.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 java.util.List<org.xwiki.rendering.block.Block> execute(P parameters,
java.lang.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 java.util.List<org.xwiki.rendering.block.Block> parseScriptResult(java.lang.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 java.lang.String evaluate(P parameters,
java.lang.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 java.lang.String evaluateString(P parameters,
java.lang.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 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.
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 java.util.List<org.xwiki.rendering.block.Block> parseSourceSyntax(java.lang.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 | |||||||||