net.customware.license.confluence
Class LicensedBaseMacro
java.lang.Object
com.atlassian.renderer.v2.macro.BaseMacro
net.customware.license.confluence.LicensedBaseMacro
- All Implemented Interfaces:
- com.atlassian.renderer.v2.macro.Macro
public abstract class LicensedBaseMacro
- extends com.atlassian.renderer.v2.macro.BaseMacro
This is an extension of the BaseMacro which checks for a valid
license being installed before continuing with normal execution of the macro.
Implementors of this class should put their usual macro code in the
executeVerified(Map, String, RenderContext) method instead of the
usual execute(Map, String, RenderContext) method. This is called if
the license is verified to be valid.
- Author:
- David Peterson
| Fields inherited from interface com.atlassian.renderer.v2.macro.Macro |
RAW_PARAMS_KEY |
|
Method Summary |
protected abstract de.schlichtherle.license.LicenseManager |
createLicenseManager()
This method is called to initially create the license manager. |
java.lang.String |
execute(java.util.Map params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx)
|
protected java.lang.String |
executeUnverified(java.util.Map<java.lang.String,java.lang.String> params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx,
java.lang.Exception e)
This method is executed when verification fails. |
protected abstract java.lang.String |
executeVerified(java.util.Map<java.lang.String,java.lang.String> params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx)
Executed if the current license is verified - that is, the macro can
execute successfully. |
protected de.schlichtherle.license.LicenseManager |
getLicenseManager()
|
| Methods inherited from class com.atlassian.renderer.v2.macro.BaseMacro |
suppressMacroRenderingDuringWysiwyg, suppressSurroundingTagDuringWysiwygRendering |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.atlassian.renderer.v2.macro.Macro |
getBodyRenderMode, hasBody, isInline |
LicensedBaseMacro
public LicensedBaseMacro()
execute
public final java.lang.String execute(java.util.Map params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx)
throws com.atlassian.renderer.v2.macro.MacroException
- Throws:
com.atlassian.renderer.v2.macro.MacroException
executeUnverified
protected java.lang.String executeUnverified(java.util.Map<java.lang.String,java.lang.String> params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx,
java.lang.Exception e)
throws com.atlassian.renderer.v2.macro.MacroException
- This method is executed when verification fails. It can be overridden if
macro subclasses wish to change the default error handling behaviour.
The default behaviour is to simply display the exception error message in
a highlighted box.
- Parameters:
params - The macro parameters.body - The macro body text.ctx - The render context.e - The exception thrown when verifying.
- Returns:
- The XHTML code for the error message.
- Throws:
com.atlassian.renderer.v2.macro.MacroException - if there is a problem while rendering the macro.
executeVerified
protected abstract java.lang.String executeVerified(java.util.Map<java.lang.String,java.lang.String> params,
java.lang.String body,
com.atlassian.renderer.RenderContext ctx)
throws com.atlassian.renderer.v2.macro.MacroException
- Executed if the current license is verified - that is, the macro can
execute successfully.
- Parameters:
params - The macro parameters.body - The macro body.ctx - The render context.
- Returns:
- The rendered macro.
- Throws:
com.atlassian.renderer.v2.macro.MacroException - if there is a problem while executing the macro.
getLicenseManager
protected de.schlichtherle.license.LicenseManager getLicenseManager()
createLicenseManager
protected abstract de.schlichtherle.license.LicenseManager createLicenseManager()
- This method is called to initially create the license manager. If the
macro needs access to the license manager for any reason it should call
getLicenseManager() instead of this method, for performance
reasons.
- Returns:
- the new license manager.
Copyright © 2011 CustomWare Asia Pacific. All Rights Reserved.