it.geosolutions.tools.freemarker.filter
Class FreeMarkerFilter

java.lang.Object
  extended by it.geosolutions.tools.freemarker.filter.FreeMarkerFilter

public class FreeMarkerFilter
extends Object

A file filter processor used to filter a file obtaining a filtered document

Author:
Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Constructor Summary
FreeMarkerFilter(String workingDir, Reader reader)
          Constructor
FreeMarkerFilter(String wd, String ifn)
          Constructor
 
Method Summary
 boolean process(freemarker.template.TemplateModel root, Writer out)
          This method is used to process the file using this configuration
 freemarker.template.TemplateModel wrapRoot(Object tm)
          Try to wrap the passed object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeMarkerFilter

public FreeMarkerFilter(String wd,
                        String ifn)
Constructor

Parameters:
wd - workingDir (Set the explicit directory from which to load templates)
ifn - input file name (the template)
data - data structure (containing variable to substitute)
See Also:
documentation for detailed accepted data types.

FreeMarkerFilter

public FreeMarkerFilter(String workingDir,
                        Reader reader)
Constructor

Parameters:
wd - workingDir (Set the explicit directory from which to load templates)
r - the reader of a FreeMarker template
See Also:
documentation for detailed accepted data types.
Method Detail

wrapRoot

public freemarker.template.TemplateModel wrapRoot(Object tm)
                                           throws NullPointerException,
                                                  freemarker.template.TemplateModelException
Try to wrap the passed object

Parameters:
tm - the Object containing the TemplateModel to use as root data model TemplateHashModel TemplateSequenceModel TemplateCollectionModel TemplateScalarModel TemplateNumberModel TemplateTransformModel
Throws:
NullPointerException - if tm is null
freemarker.template.TemplateModelException - if defined objectWrapper can't wrap the passed object

process

public final boolean process(freemarker.template.TemplateModel root,
                             Writer out)
                      throws freemarker.template.TemplateException,
                             IOException
This method is used to process the file using this configuration

Parameters:
out - the Writer
Returns:
true if success
Throws:
freemarker.template.TemplateException - if an exception occurs during template processing
IOException - if an I/O exception occurs during writing to the writer.


Copyright © 2011-2012 GeoSolutions. All Rights Reserved.