org.liquidsite.app.template
Class TemplateManager

java.lang.Object
  extended byorg.liquidsite.app.template.TemplateManager

public class TemplateManager
extends java.lang.Object

A simple FreeMarker template manager. This class provides static methods that simplify the creation of templates.


Constructor Summary
TemplateManager()
           
 
Method Summary
static java.lang.String getBuildDate()
          Returns the application build date.
static java.lang.String getBuildVersion()
          Returns the application build version.
static Template getFileTemplate(java.lang.String path)
          Returns a template from the file system.
static Template getPageTemplate(User user, ContentPage page)
          Returns a template from a content page.
static void initialize(java.io.File baseDir, java.lang.String version, java.lang.String date)
          Initializes the template manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateManager

public TemplateManager()
Method Detail

initialize

public static void initialize(java.io.File baseDir,
                              java.lang.String version,
                              java.lang.String date)
                       throws TemplateException
Initializes the template manager.

Parameters:
baseDir - the application base directory
version - the application version number
date - the application version date
Throws:
TemplateException - if the template base directory couldn't be read properly

getBuildVersion

public static java.lang.String getBuildVersion()
Returns the application build version.

Returns:
the application build version

getBuildDate

public static java.lang.String getBuildDate()
Returns the application build date.

Returns:
the application build date

getFileTemplate

public static Template getFileTemplate(java.lang.String path)
                                throws TemplateException
Returns a template from the file system. The file name must be specified relative to the base directory used in the initialize() call.

Parameters:
path - the relative file name
Returns:
the template found
Throws:
TemplateException - if the template couldn't be read correctly

getPageTemplate

public static Template getPageTemplate(User user,
                                       ContentPage page)
                                throws TemplateException
Returns a template from a content page.

Parameters:
user - the user performing the operation
page - the content page
Returns:
the template found
Throws:
TemplateException - if the template couldn't be read correctly