org.webmacro.resource
Class TemplateProvider

java.lang.Object
  |
  +--org.webmacro.resource.CachingProvider
        |
        +--org.webmacro.resource.TemplateProvider
All Implemented Interfaces:
Provider, ResourceLoader

public final class TemplateProvider
extends CachingProvider

The TemplateProvider is the WebMacro class responsible for loading templates. You could replace it with your own version in the configuration file. Templates are loaded from the filesystem, relative to the TemplatePath specified in teh configuration.

Ordinarily you would not accses this class directly, but instead you would call the Broker and it would look up and use the TemplateProvider for you.

See Also:
Provider

Fields inherited from class org.webmacro.resource.CachingProvider
_cacheSupportsReload
 
Constructor Summary
TemplateProvider()
           
 
Method Summary
 java.lang.String getType()
          Supports the "template" type
 void init(Broker b, Settings config)
          Create a new TemplateProvider that uses the specified directory as the source for Template objects that it will return
 java.lang.Object load(java.lang.String name, CacheElement ce)
          Grab a template based on its name.
 
Methods inherited from class org.webmacro.resource.CachingProvider
destroy, flush, get, load, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateProvider

public TemplateProvider()
Method Detail

init

public void init(Broker b,
                 Settings config)
          throws InitException
Create a new TemplateProvider that uses the specified directory as the source for Template objects that it will return
Overrides:
init in class CachingProvider
Throws:
ResourceInitException - provider failed to initialize

getType

public final java.lang.String getType()
Supports the "template" type

load

public final java.lang.Object load(java.lang.String name,
                                   CacheElement ce)
                            throws ResourceException
Grab a template based on its name.