org.ogf.graap.wsag.server.actions.impl
Class VelocityAgreementTemplateAction

java.lang.Object
  extended by org.ogf.graap.wsag.server.actions.AbstractGetTemplateAction
      extended by org.ogf.graap.wsag.server.actions.impl.VelocityAgreementTemplateAction
All Implemented Interfaces:
IActionHandler, IGetTemplateAction

public class VelocityAgreementTemplateAction
extends AbstractGetTemplateAction

Implementation of an IGetTemplateAction that dynamically creates an agreement template using Velocity Template engine. Agreement templates are generated based on the specified template file when the action is initialized (initialize()). Subsequent calls to the getTemplate() method return the agreement template that was created during the action initialization process.

Author:
Oliver Waeldrich

Constructor Summary
VelocityAgreementTemplateAction()
           
 
Method Summary
 AgreementTemplateType getTemplate()
          Returns the processed template.
 String getTemplateFilename()
          Returns the file name of the template to process.
protected  Map<String,?> getTemplateParameter()
          Hook for custom implementations for providing a set of parameters that are can be accessed by the Velocity template.
 void initialize()
          Initializes this action.
 void setTemplateFilename(String templateFilename)
          Sets the file name of the template to process.
 
Methods inherited from class org.ogf.graap.wsag.server.actions.AbstractGetTemplateAction
getHandlerContext, setHandlerContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityAgreementTemplateAction

public VelocityAgreementTemplateAction()
Method Detail

initialize

public void initialize()
                throws ActionInitializationException
Initializes this action. During the action initialization process the specified template file is loaded via the application ClassLoader and processed as Velocity template. The resulting agreement template is stored and retrieved via the getTemplate() method. Default implementation of action initialization. Subclasses may overwrite this method in order to provide a custom initialization of a handler. Initializes an action handler. This method is called when a agreement factory action initializes its action handlers. It is called once during the the engine initialization.

Specified by:
initialize in interface IActionHandler
Overrides:
initialize in class AbstractGetTemplateAction
Throws:
ActionInitializationException - Indicates an error during handler initialization.

getTemplateParameter

protected Map<String,?> getTemplateParameter()
Hook for custom implementations for providing a set of parameters that are can be accessed by the Velocity template. Implementations return a map with parameters in order to dynamically include them in the template.

Returns:
the template parameters used for creating the template
See Also:
AbstractGetTemplateAction.getHandlerContext(), IActionHandlerContext.getFactoryContext()

getTemplate

public AgreementTemplateType getTemplate()
Returns the processed template. the agreement templates offered by a factory

Returns:
the agreement template

getTemplateFilename

public String getTemplateFilename()
Returns the file name of the template to process.

Returns:
the templateFilename

setTemplateFilename

public void setTemplateFilename(String templateFilename)
Sets the file name of the template to process.

Parameters:
templateFilename - the templateFilename to set


Copyright © 2008-2012. All Rights Reserved.