org.milyn.templating.stringtemplate
Class StringTemplateContentHandlerFactory

java.lang.Object
  extended by org.milyn.templating.stringtemplate.StringTemplateContentHandlerFactory
All Implemented Interfaces:
ContentHandler, ContentHandlerFactory

@Resource(type="st")
public class StringTemplateContentHandlerFactory
extends Object
implements ContentHandlerFactory

StringTemplate DOMElementVisitor Creator class.

Creates DOMElementVisitor instances for applying StringTemplate transformations (i.e. ".st" files).

This templating solution relies on the Smooks JavaBean Cartridge to perform the JavaBean population that's required by StringTemplate.

Targeting ".st" Files for Transformation

 <resource-config selector="target-element">
     <!-- See URIResourceLocator -->
     <resource>/com/acme/AcmeStringTemplate.st</resource>

     <!-- (Optional) The action to be applied on the template content. Should the content
          generated by the template:
          1. replace ("replace") the target element, or
          2. be added to ("addto") the target element, or
          3. be inserted before ("insertbefore") the target element, or
          4. be inserted after ("insertafter") the target element.
          5. be bound to ("bindto") a BeanContext variable named by the "bindId" param.
          Default "replace".-->
     <param name="action">replace/addto/insertbefore/insertafter</param>

     <!-- (Optional) Should the template be applied before (true) or
             after (false) Smooks visits the child elements of the target element.
             Default "false".-->
     <param name="applyTemplateBefore">true/false</param>

     <!-- (Optional) The name of the OutputStreamResource
             to which the result should be written. If set, the "action" param is ignored. -->
     <param name="outputStreamResource">xyzResource</param>

     <!-- (Optional) Template encoding.
          Default "UTF-8".-->
     <param name="encoding">encoding</param>

     <!-- (Optional) bindId when "action" is "bindto".
     <param name="bindId">xxxx</param>

 </resource-config>
 

Author:
tfennelly

Field Summary
 
Fields inherited from interface org.milyn.delivery.ContentHandlerFactory
PARAM_RESTYPE
 
Constructor Summary
StringTemplateContentHandlerFactory()
           
 
Method Summary
 ContentHandler create(SmooksResourceConfiguration resourceConfig)
          Create a StringTemplate based ContentHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTemplateContentHandlerFactory

public StringTemplateContentHandlerFactory()
Method Detail

create

public ContentHandler create(SmooksResourceConfiguration resourceConfig)
                      throws SmooksConfigurationException,
                             InstantiationException
Create a StringTemplate based ContentHandler.

Specified by:
create in interface ContentHandlerFactory
Parameters:
resourceConfig - The SmooksResourceConfiguration for the StringTemplate.
Returns:
The StringTemplate ContentHandler instance.
Throws:
SmooksConfigurationException
InstantiationException


Copyright © 2014. All Rights Reserved.