public class TemplateWatcher
extends org.apache.commons.io.monitor.FileAlterationListenerAdaptor
| Constructor and Description |
|---|
TemplateWatcher(TemplatingManager manager,
File templateDir,
long pollInterval)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TemplateEntry |
compileTemplate(File templateFile)
Compiles the given template file and create the associated template entry.
|
Collection<TemplateEntry> |
findTemplatesForApplication(String appName)
Finds the templates that can apply to a given application.
|
void |
onFileChange(File file) |
void |
onFileCreate(File file) |
void |
onFileDelete(File file) |
void |
onStart(org.apache.commons.io.monitor.FileAlterationObserver observer) |
void |
start()
Starts this template watcher.
|
void |
stop()
Stops this template watcher.
|
public TemplateWatcher(TemplatingManager manager, File templateDir, long pollInterval)
manager - the templating manager, to which event handling is delegated.templateDir - the templates directory to watch.pollInterval - the poll interval.IOException - if there is a problem watching the template directory.public void start()
public void stop()
public Collection<TemplateEntry> findTemplatesForApplication(String appName)
The templates contained in the returned set may have been removed at the time they are accessed.
appName - the name of the application, or null to only get the global templatespublic void onStart(org.apache.commons.io.monitor.FileAlterationObserver observer)
onStart in interface org.apache.commons.io.monitor.FileAlterationListeneronStart in class org.apache.commons.io.monitor.FileAlterationListenerAdaptorpublic void onFileCreate(File file)
onFileCreate in interface org.apache.commons.io.monitor.FileAlterationListeneronFileCreate in class org.apache.commons.io.monitor.FileAlterationListenerAdaptorpublic void onFileChange(File file)
onFileChange in interface org.apache.commons.io.monitor.FileAlterationListeneronFileChange in class org.apache.commons.io.monitor.FileAlterationListenerAdaptorpublic void onFileDelete(File file)
onFileDelete in interface org.apache.commons.io.monitor.FileAlterationListeneronFileDelete in class org.apache.commons.io.monitor.FileAlterationListenerAdaptorpublic TemplateEntry compileTemplate(File templateFile)
IO and compile errors are logged but not rethrown.
templateFile - the template file to compilenull if any problem occurredCopyright © 2017. All rights reserved.