net.customware.license.confluence
Class LicensedConfluenceMacro
java.lang.Object
com.atlassian.renderer.v2.macro.BaseMacro
org.randombits.confluence.support.ConfluenceMacro
net.customware.license.confluence.LicensedConfluenceMacro
- All Implemented Interfaces:
- com.atlassian.renderer.v2.macro.Macro
public abstract class LicensedConfluenceMacro
- extends org.randombits.confluence.support.ConfluenceMacro
This is an extension of the ConfluenceMacro 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(MacroInfo) method instead of the usual
execute(MacroInfo) 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 create the license manager. |
protected java.lang.String |
execute(org.randombits.confluence.support.MacroInfo info)
|
protected java.lang.String |
executeUnverified(org.randombits.confluence.support.MacroInfo info,
java.lang.Exception e)
This method is executed when verification fails. |
protected abstract java.lang.String |
executeVerified(org.randombits.confluence.support.MacroInfo info)
This method is called when the plugin has its license successfully
verified - that is, the macro can be used. |
protected de.schlichtherle.license.LicenseManager |
getLicenseManager()
Provides the license manager for this macro. |
| Methods inherited from class org.randombits.confluence.support.ConfluenceMacro |
createMacroInfo, execute |
| 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 |
LicensedConfluenceMacro
public LicensedConfluenceMacro()
execute
protected final java.lang.String execute(org.randombits.confluence.support.MacroInfo info)
throws com.atlassian.renderer.v2.macro.MacroException
- Specified by:
execute in class org.randombits.confluence.support.ConfluenceMacro
- Throws:
com.atlassian.renderer.v2.macro.MacroException
executeUnverified
protected java.lang.String executeUnverified(org.randombits.confluence.support.MacroInfo info,
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:
info - The macro info.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(org.randombits.confluence.support.MacroInfo info)
throws com.atlassian.renderer.v2.macro.MacroException
- This method is called when the plugin has its license successfully
verified - that is, the macro can be used.
- Parameters:
info - The macro info.
- Returns:
- The executed macro content.
- Throws:
com.atlassian.renderer.v2.macro.MacroException - if there is a problem while executing the macro.
getLicenseManager
protected de.schlichtherle.license.LicenseManager getLicenseManager()
- Provides the license manager for this macro. If the macro requires the
LicenseManager for some reason, this method should be called rather than
the
createLicenseManager() method, purely for performance
reasons.
- Returns:
- the current license manager.
createLicenseManager
protected abstract de.schlichtherle.license.LicenseManager createLicenseManager()
- This method is called to 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.