org.webmacro.resource
Interface TemplateLoader

All Known Implementing Classes:
AbstractTemplateLoader

public interface TemplateLoader

Interface for template loaders. Template loaders are responsible to search for and load templates from a single location. They are used by DelegatingTemplateProvider to do the actual work.

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

Method Summary
 void init(Broker b, Settings settings)
          Init this template loader*
 Template load(java.lang.String query, CacheElement ce)
          Try to load a template.
 void setConfig(java.lang.String config)
          Set the config options for this template loader.
 

Method Detail

init

public void init(Broker b,
                 Settings settings)
          throws InitException
Init this template loader*

Throws:
InitException

setConfig

public void setConfig(java.lang.String config)
               throws InitException
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
Throws:
InitException

load

public Template load(java.lang.String query,
                     CacheElement ce)
              throws ResourceException
Try to load a template. This method will create and return a template found in the location described by query or return null, if no such template exists. If a resource is found at the location, but no template could be created for some reason, a ResourceException is thrown.
If the cache element ce is not null, this method should set a reload context on the cache element to enable reload-on-demand for this template. If ce is null, caching is disabled.

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


Copyright © 1999-2006 WebMacro. All Rights Reserved.