org.milyn.templating
Class AbstractTemplateProcessor

java.lang.Object
  extended by org.milyn.templating.AbstractTemplateProcessor
All Implemented Interfaces:
ContentHandler, DOMElementVisitor, DOMVisitAfter, DOMVisitBefore, DOMVisitor, Producer, Visitor
Direct Known Subclasses:
FreeMarkerTemplateProcessor, XslTemplateProcessor

public abstract class AbstractTemplateProcessor
extends Object
implements DOMElementVisitor, Producer

Abstract template processing unit.

Defines abstract methods for loading the template in question, as well as convienience methods for processing the template action against the templating result (replace, addto, insertbefore and insertafter).

See implementations.

Author:
tfennelly

Nested Class Summary
protected static class AbstractTemplateProcessor.Action
           
static class AbstractTemplateProcessor.ActionDecoder
           
 
Field Summary
static String TEMPLATE_SPLIT_PI
          Template split point processing instruction.
 
Constructor Summary
AbstractTemplateProcessor()
           
 
Method Summary
 boolean applyTemplateBefore()
           
protected  AbstractTemplateProcessor.Action getAction()
           
 BeanId getBindBeanId()
           
 String getBindId()
           
 Charset getEncoding()
           
 String getOutputStreamResource()
           
 Set<String> getProducts()
           
 void initialize()
           
protected abstract  void loadTemplate(SmooksResourceConfiguration config)
           
protected  void processTemplateAction(Element element, Node templatingResult, ExecutionContext executionContext)
           
protected  void processTemplateAction(Element element, NodeList templatingResultNodeList, ExecutionContext executionContext)
           
protected  void setTemplatingConfiguration(TemplatingConfiguration templatingConfiguration)
           
protected abstract  void visit(Element element, ExecutionContext executionContext)
           
 void visitAfter(Element element, ExecutionContext executionContext)
           
 void visitBefore(Element element, ExecutionContext executionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE_SPLIT_PI

public static final String TEMPLATE_SPLIT_PI
Template split point processing instruction.

See Also:
Constant Field Values
Constructor Detail

AbstractTemplateProcessor

public AbstractTemplateProcessor()
Method Detail

initialize

@Initialize
public void initialize()

setTemplatingConfiguration

protected void setTemplatingConfiguration(TemplatingConfiguration templatingConfiguration)

loadTemplate

protected abstract void loadTemplate(SmooksResourceConfiguration config)
                              throws IOException,
                                     TransformerConfigurationException
Throws:
IOException
TransformerConfigurationException

applyTemplateBefore

public boolean applyTemplateBefore()

getProducts

public Set<String> getProducts()
Specified by:
getProducts in interface Producer

getAction

protected AbstractTemplateProcessor.Action getAction()

getEncoding

public Charset getEncoding()

getBindId

public String getBindId()

getOutputStreamResource

public String getOutputStreamResource()

processTemplateAction

protected void processTemplateAction(Element element,
                                     Node templatingResult,
                                     ExecutionContext executionContext)

processTemplateAction

protected void processTemplateAction(Element element,
                                     NodeList templatingResultNodeList,
                                     ExecutionContext executionContext)

visitBefore

public void visitBefore(Element element,
                        ExecutionContext executionContext)
                 throws SmooksException
Specified by:
visitBefore in interface DOMVisitBefore
Throws:
SmooksException

visitAfter

public void visitAfter(Element element,
                       ExecutionContext executionContext)
                throws SmooksException
Specified by:
visitAfter in interface DOMVisitAfter
Throws:
SmooksException

visit

protected abstract void visit(Element element,
                              ExecutionContext executionContext)
                       throws SmooksException
Throws:
SmooksException

getBindBeanId

public BeanId getBindBeanId()
Returns:
the bindBeanId


Copyright © 2014. All Rights Reserved.