Package io.github.erdos.stencil.impl
Class DirWatcherTemplateFactory
- java.lang.Object
-
- io.github.erdos.stencil.impl.DirWatcherTemplateFactory
-
- All Implemented Interfaces:
TemplateFactory
public final class DirWatcherTemplateFactory extends java.lang.Object implements TemplateFactory
Watches file system and automatically loads template files on file changes.
-
-
Constructor Summary
Constructors Constructor Description DirWatcherTemplateFactory(java.io.File templatesDirectory, TemplateFactory factory)
Default ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.File
getTemplatesDirectory()
PreparedTemplate
prepareTemplateFile(java.io.File inputTemplateFile, PrepareOptions options)
Preprocesses a raw template file.void
start()
Starts directory watcher and tries to load all files.void
stop()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.erdos.stencil.TemplateFactory
prepareTemplateFile
-
-
-
-
Constructor Detail
-
DirWatcherTemplateFactory
public DirWatcherTemplateFactory(java.io.File templatesDirectory, TemplateFactory factory)
Default ctor.- Parameters:
templatesDirectory
- not null absolute path directoryfactory
- wrapped factory
-
-
Method Detail
-
getTemplatesDirectory
public java.io.File getTemplatesDirectory()
-
start
public void start() throws java.io.IOException, java.lang.IllegalStateException
Starts directory watcher and tries to load all files.- Throws:
java.io.IOException
- on file system errorsjava.lang.IllegalStateException
- if already started
-
stop
public void stop()
-
prepareTemplateFile
public PreparedTemplate prepareTemplateFile(java.io.File inputTemplateFile, PrepareOptions options)
Description copied from interface:TemplateFactory
Preprocesses a raw template file.- Specified by:
prepareTemplateFile
in interfaceTemplateFactory
- Parameters:
inputTemplateFile
- raw template file of known type.options
- template preparation options.- Returns:
- preprocessed template file
-
-