Class 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 Detail

      • DirWatcherTemplateFactory

        public DirWatcherTemplateFactory​(java.io.File templatesDirectory,
                                         TemplateFactory factory)
        Default ctor.
        Parameters:
        templatesDirectory - not null absolute path directory
        factory - 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 errors
        java.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 interface TemplateFactory
        Parameters:
        inputTemplateFile - raw template file of known type.
        options - template preparation options.
        Returns:
        preprocessed template file