org.teatrove.tea.engine
Interface TemplateSource

All Known Implementing Classes:
TemplateSourceImpl

public interface TemplateSource

Implementations are responsible for providing compiled templates to an ApplicationDepot. The context to compile against must be provided by the TemplateSourceConfig and a subset of available template sources may be provided to reduce the number of compilation issues. Template classes from either a precompiled library or earlier dynamic compilations may also be provided.

Author:
Jonathan Colwell

Method Summary
 TemplateCompilationResults compileTemplates(ClassInjector injector, boolean all)
          Compile templates recursively
 TemplateCompilationResults compileTemplates(ClassInjector injector, boolean all, boolean recurse)
          Compile templates
 TemplateCompilationResults compileTemplates(ClassInjector injector, boolean all, boolean recurse, StatusListener listener)
          Compile templates
 TemplateCompilationResults compileTemplates(ClassInjector injector, boolean all, StatusListener listener)
          Compile templates recursively using the specified status listener.
 TemplateCompilationResults compileTemplates(ClassInjector injector, StatusListener listener, String[] selectedTemplates)
          Compile selected templates
 TemplateCompilationResults compileTemplates(ClassInjector injector, String[] selectedTemplates)
          Compile selected templates
 ContextSource getContextSource()
           
 int getKnownTemplateCount()
          Returns number of all templates that are compiled (failed or succeed)
 String[] getKnownTemplateNames()
          Returns names of all templates that are compiled (failed or succeed)
 Template[] getLoadedTemplates()
          Returns the list of loaded templates
 Template getTemplate(String name)
          Returns the template object of the given template name
 TemplateLoader getTemplateLoader()
           
 Date getTimeOfLastReload()
          Returns the time the templates are last reloaded
 void init(TemplateSourceConfig config)
           
 boolean isExceptionGuardianEnabled()
           
 Map<String,Boolean> listTouchedTemplates()
          Returns a Map of templates that need reloading - the entry key is the String name of the template - the entry value is a Boolean indicating if the template signature has changed.
 

Method Detail

init

void init(TemplateSourceConfig config)
          throws Exception
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            boolean all)
                                            throws Exception
Compile templates recursively

Parameters:
injector - Class injector used for template compilation and template loading
all - When true, compile all source, even if up-to-date
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            boolean all,
                                            StatusListener listener)
                                            throws Exception
Compile templates recursively using the specified status listener.

Parameters:
injector - Class injector used for template compilation and template loading
all - When true, compile all source, even if up-to-date
listener - The status listener to callback
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            boolean all,
                                            boolean recurse)
                                            throws Exception
Compile templates

Parameters:
injector - Class injector used for template compilation and template loading
all - When true, compile all source, even if up-to-date
recurse - When true, recurse and compile through all subdirectories
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            boolean all,
                                            boolean recurse,
                                            StatusListener listener)
                                            throws Exception
Compile templates

Parameters:
injector - Class injector used for template compilation and template loading
all - When true, compile all source, even if up-to-date
recurse - When true, recurse and compile through all subdirectories
listener - The status listener to callback
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            String[] selectedTemplates)
                                            throws Exception
Compile selected templates

Parameters:
injector - Class injector used for template compilation and template loading
selectedTemplates - an array of template names to compile
Throws:
Exception

compileTemplates

TemplateCompilationResults compileTemplates(ClassInjector injector,
                                            StatusListener listener,
                                            String[] selectedTemplates)
                                            throws Exception
Compile selected templates

Parameters:
injector - Class injector used for template compilation and template loading
listener - The status listener to callback
selectedTemplates - an array of template names to compile
Throws:
Exception

listTouchedTemplates

Map<String,Boolean> listTouchedTemplates()
                                         throws Exception
Returns a Map of templates that need reloading - the entry key is the String name of the template - the entry value is a Boolean indicating if the template signature has changed. TRUE indicates the signature has changed. FALSE indicates the signature has not changed.

Throws:
Exception

getKnownTemplateCount

int getKnownTemplateCount()
Returns number of all templates that are compiled (failed or succeed)


getKnownTemplateNames

String[] getKnownTemplateNames()
Returns names of all templates that are compiled (failed or succeed)


getTimeOfLastReload

Date getTimeOfLastReload()
Returns the time the templates are last reloaded


isExceptionGuardianEnabled

boolean isExceptionGuardianEnabled()

getLoadedTemplates

Template[] getLoadedTemplates()
Returns the list of loaded templates


getTemplate

Template getTemplate(String name)
                     throws ClassNotFoundException,
                            NoSuchMethodException
Returns the template object of the given template name

Throws:
ClassNotFoundException
NoSuchMethodException

getContextSource

ContextSource getContextSource()
Returns:
the context source used internally for template compilation.

getTemplateLoader

TemplateLoader getTemplateLoader()


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.