org.webmacro.resource
Class FileTemplateLoader

java.lang.Object
  extended byorg.webmacro.resource.AbstractTemplateLoader
      extended byorg.webmacro.resource.FileTemplateLoader
All Implemented Interfaces:
TemplateLoader

public class FileTemplateLoader
extends AbstractTemplateLoader

Implementation of TemplateLoader that loads templates from a given directory. Objects of this class are responsible for searching exactly one directory for templates. If it handles a request, it takes path as the base path to find the template.

Author:
Sebastian Kanthak (sebastian.kanthak@muehlheim.de)

Field Summary
 
Fields inherited from class org.webmacro.resource.AbstractTemplateLoader
broker, helper, log
 
Constructor Summary
FileTemplateLoader()
           
 
Method Summary
 Template load(java.lang.String query, CacheElement ce)
          Tries to load a template by interpreting query as a path relative to the path set by setPath.
 void setConfig(java.lang.String config)
          Set the config options for this template loader.
 
Methods inherited from class org.webmacro.resource.AbstractTemplateLoader
init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTemplateLoader

public FileTemplateLoader()
Method Detail

setConfig

public void setConfig(java.lang.String config)
Description copied from interface: TemplateLoader
Set the config options for this template loader. The config option is the path after the colon (":") in the TemplatePath setting for this loader.
This can be an path as well as JDBC settings or something completely different.

Parameters:
config - config options for this template loader

load

public final Template load(java.lang.String query,
                           CacheElement ce)
                    throws ResourceException
Tries to load a template by interpreting query as a path relative to the path set by setPath.

Parameters:
query - location to load template from
ce - cache element that will be used for this template or null if no cache is used.
Throws:
ResourceException - if an error occured while loading the template