org.umber.catalan.process.workers.velocity
Class VelocityRunner

java.lang.Object
  extended byorg.umber.catalan.process.workers.velocity.VelocityRunner

public class VelocityRunner
extends java.lang.Object

Helper class to abstract calls to the Velocity API out of the VelocityProcessor class. This makes it possible to load the processor class when Velocity is not on the CLASSPATH, without triggering a ClassNotFoundException. VelocityRunner should be the only class in Catalan with any direct references to Velocity.

Author:
jsheets

Constructor Summary
VelocityRunner()
           
 
Method Summary
 java.lang.String processTemplate(java.lang.String template, java.util.Map props)
          Processes the given Velocity template against the supplied input nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityRunner

public VelocityRunner()
Method Detail

processTemplate

public java.lang.String processTemplate(java.lang.String template,
                                        java.util.Map props)
Processes the given Velocity template against the supplied input nodes. The nodes must be a collection of key/value pairs, which the runner will load into a VelocityContext object. The key names should correspond to references in the Velocity template. If the nodes List contains an odd number of nodes, the last node (lacking a corresponding value object) will be ignored.

Parameters:
template - the text of a Velocity template
props - map of properties to resolve in Velocity template
Returns:
the processed results