|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.engine.TemplateSourceImpl
public class TemplateSourceImpl
This class should be created using the TemplateSourceFactory
| Nested Class Summary | |
|---|---|
class |
TemplateSourceImpl.CompilerStatusLogger
|
protected class |
TemplateSourceImpl.ErrorRetriever
|
protected class |
TemplateSourceImpl.Results
|
protected class |
TemplateSourceImpl.TemplateSourceFileInfo
|
| Field Summary | |
|---|---|
protected File |
mCompiledDir
|
protected TemplateSourceConfig |
mConfig
|
protected Log |
mLog
|
protected boolean |
mLogCompileStatus
|
protected PropertyMap |
mProperties
|
protected TemplateSourceImpl.Results |
mResults
|
protected Map<String,TemplateSourceImpl.TemplateSourceFileInfo> |
mTemplateSourceFileInfo
|
| Constructor Summary | |
|---|---|
TemplateSourceImpl()
|
|
| Method Summary | |
|---|---|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
boolean all)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse,
StatusListener listener)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse,
TemplateErrorListener errorListener,
StatusListener listener)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
boolean all,
StatusListener listener)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
StatusListener listener,
String[] selectedTemplates)
|
protected TemplateSourceImpl.Results |
actuallyCompileTemplates(ClassInjector injector,
String[] selectedTemplates)
|
TemplateCompilationResults |
checkTemplates(ClassInjector injector,
boolean all,
String[] selectedTemplates)
|
static String[] |
chopString(String target,
String delimiters)
|
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 |
protected ClassInjector |
createClassInjector()
provides a default class injector using the contextType's ClassLoader as a parent. |
protected TemplateErrorListener |
createErrorListener()
|
static File |
createTemplateClassesDir(File tmpDir,
String dirPath,
Log log)
converts a path to a File for storing compiled template classes. |
ContextSource |
getContextSource()
|
String[] |
getImports()
|
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) |
protected Set<String> |
getKnownTemplateNameSet()
provides subclasses with access to modify the KnownTemplateNames |
Template[] |
getLoadedTemplates()
Returns the list of loaded templates |
Template |
getTemplate(String name)
Returns the template object of the given template name |
TemplateLoader |
getTemplateLoader()
|
protected File[] |
getTemplateRootDirs()
|
Date |
getTimeOfLastReload()
Returns the time the templates are last reloaded |
void |
init(TemplateSourceConfig config)
|
boolean |
isExceptionGuardianEnabled()
|
boolean |
isLogCompileStatus()
|
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. |
protected void |
setDestinationDirectory(File compiledDir)
allows a subclass to set directory to write the compiled templates this directory may be overridden if the ClassInjector passed into the compileTemplates() method points to a different location. |
void |
setImports(String[] imports)
|
void |
setLogCompileStatus(boolean logCompileStatus)
|
protected void |
setTemplateResources(String[] resourcePaths)
allows a subclass to set the resource paths directly rather than using init to parse the config. |
protected void |
setTemplateRootDirs(File[] rootDirs)
allows a subclass to directly specify the directories to be searched for template sources. |
protected void |
setTemplateStrings(String[] sourceData)
allows a subclass to set the source strings directly rather than using init to parse the config. |
protected boolean |
sourceSignatureChanged(String tName,
Compiler compiler)
parses the tea source file and compares the signature to the signature of the current class file in the TemplateRepository |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected TemplateSourceConfig mConfig
protected Log mLog
protected PropertyMap mProperties
protected File mCompiledDir
protected TemplateSourceImpl.Results mResults
protected Map<String,TemplateSourceImpl.TemplateSourceFileInfo> mTemplateSourceFileInfo
protected boolean mLogCompileStatus
| Constructor Detail |
|---|
public TemplateSourceImpl()
| Method Detail |
|---|
public static File createTemplateClassesDir(File tmpDir,
String dirPath,
Log log)
public static String[] chopString(String target,
String delimiters)
public void init(TemplateSourceConfig config)
init in interface TemplateSourcepublic String[] getImports()
public void setImports(String[] imports)
public TemplateCompilationResults compileTemplates(ClassInjector injector,
boolean all)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadingall - When true, compile all source, even if up-to-date
Exception
public TemplateCompilationResults compileTemplates(ClassInjector injector,
boolean all,
StatusListener listener)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadingall - When true, compile all source, even if up-to-datelistener - The status listener to callback
Exception
public TemplateCompilationResults compileTemplates(ClassInjector injector,
boolean all,
boolean recurse)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadingall - When true, compile all source, even if up-to-daterecurse - When true, recurse and compile through all
subdirectories
Exception
public TemplateCompilationResults compileTemplates(ClassInjector injector,
boolean all,
boolean recurse,
StatusListener listener)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadingall - When true, compile all source, even if up-to-daterecurse - When true, recurse and compile through all
subdirectorieslistener - The status listener to callback
Exception
public TemplateCompilationResults compileTemplates(ClassInjector injector,
String[] selectedTemplates)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadingselectedTemplates - an array of template names to compile
Exception
public TemplateCompilationResults compileTemplates(ClassInjector injector,
StatusListener listener,
String[] selectedTemplates)
throws Exception
TemplateSource
compileTemplates in interface TemplateSourceinjector - Class injector used for template compilation and
template loadinglistener - The status listener to callbackselectedTemplates - an array of template names to compile
Exception
public TemplateCompilationResults checkTemplates(ClassInjector injector,
boolean all,
String[] selectedTemplates)
throws Exception
Exceptionpublic ContextSource getContextSource()
getContextSource in interface TemplateSourcepublic int getKnownTemplateCount()
TemplateSource
getKnownTemplateCount in interface TemplateSourcepublic String[] getKnownTemplateNames()
TemplateSource
getKnownTemplateNames in interface TemplateSourcepublic Date getTimeOfLastReload()
TemplateSource
getTimeOfLastReload in interface TemplateSourcepublic boolean isExceptionGuardianEnabled()
isExceptionGuardianEnabled in interface TemplateSourcepublic TemplateLoader getTemplateLoader()
getTemplateLoader in interface TemplateSourcepublic Template[] getLoadedTemplates()
TemplateSource
getLoadedTemplates in interface TemplateSource
public Template getTemplate(String name)
throws ClassNotFoundException,
NoSuchMethodException
TemplateSource
getTemplate in interface TemplateSourceClassNotFoundException
NoSuchMethodException
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
boolean all)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
boolean all,
StatusListener listener)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse,
StatusListener listener)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
boolean all,
boolean recurse,
TemplateErrorListener errorListener,
StatusListener listener)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
String[] selectedTemplates)
throws Exception
Exception
protected TemplateSourceImpl.Results actuallyCompileTemplates(ClassInjector injector,
StatusListener listener,
String[] selectedTemplates)
throws Exception
Exceptionprotected Set<String> getKnownTemplateNameSet()
protected void setTemplateStrings(String[] sourceData)
protected void setTemplateResources(String[] resourcePaths)
protected void setTemplateRootDirs(File[] rootDirs)
protected File[] getTemplateRootDirs()
protected void setDestinationDirectory(File compiledDir)
protected ClassInjector createClassInjector()
throws Exception
Exceptionprotected TemplateErrorListener createErrorListener()
public Map<String,Boolean> listTouchedTemplates()
throws Exception
TemplateSource
listTouchedTemplates in interface TemplateSourceException
protected boolean sourceSignatureChanged(String tName,
Compiler compiler)
throws IOException
IOExceptionpublic boolean isLogCompileStatus()
public void setLogCompileStatus(boolean logCompileStatus)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||