org.webmacro.resource
Class TemplateLoaderHelper
java.lang.Object
|
+--org.webmacro.resource.TemplateLoaderHelper
- public class TemplateLoaderHelper
- extends java.lang.Object
Helper class for template loaders to actuall load a Template.
This class should be used for loading templates from URLs
or files. Thus, the template loader only has to care for
locating the template.
This class will take care of loading the template and setting
up a correct reload context, depending on the protocol used.
- Author:
- Sebastian Kanthak (sebastian.kanthak@muehlheim.de)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TemplateLoaderHelper
public TemplateLoaderHelper()
- Construct a new TemplateLoaderHelper object
init
public void init(Broker b,
Settings config)
throws InitException
- Initialize this object
- Parameters:
b
- broker to useconfig
- configuration to initialize from
load
public Template load(java.io.File file,
CacheElement ce)
throws ResourceException
- Load a template from a file.
This will load the template from the specified file and
set up an appropriate reload context, if ce is not null.
It will use the check-for-reload delay specified for protocol
file.
- Parameters:
file
- file to load template fromce
- cache element for reload context or null, if no caching is used.- Returns:
- loaded template
- Throws:
ResourceException
- if template could not be loaded or parsed.
load
public Template load(java.net.URL url,
CacheElement ce)
throws ResourceException
- Load a template from an url.
This will load the template from the specified url and
set up an appropriate reload context, if ce is not null.
It will use the check-for-reload delay specified for the url's
protocol. If protocl is "file", the more efficient file operations
of java are used.
- Parameters:
url
- url to load template fromce
- cache element for reload context or null, if no caching is used.- Returns:
- loaded template
- Throws:
ResourceException
- if template could not be loaded or parsed.