Class ThemeFilesSynchronizer

java.lang.Object
io.jmix.flowui.devserver.ThemeFilesSynchronizer
All Implemented Interfaces:
Serializable

public class ThemeFilesSynchronizer extends Object implements Serializable
Watches for the file or sub-directory changes in the given directory.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory)
    Creates an instance of the file watcher for the given directory taking into account the given file filter.
    ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, File... watchDirectory)
    Creates an instance of the file watcher for the given directory.
    ThemeFilesSynchronizer(org.apache.commons.io.monitor.FileAlterationListener listener, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory)
    Creates an instance of the file watcher for the given directory taking into account the given file filter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setTimeout(long timeout)
    Sets the time interval between file/directory checks.
    void
    Starts the file watching.
    void
    Stops the file watching.
    void
    stop(long stopInterval)
    Stops the file watching and waits for a given stop interval for watching thread to finish.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ThemeFilesSynchronizer

      public ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, File... watchDirectory)
      Creates an instance of the file watcher for the given directory.

      Reports the changed file or directory as a File instance to the provided consumer.

      Watches the files create/delete and directory create/delete events.

      Parameters:
      onChangeConsumer - to be called when any change detected
      watchDirectory - the directory to watch for the changes, cannot be empty
    • ThemeFilesSynchronizer

      public ThemeFilesSynchronizer(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory)
      Creates an instance of the file watcher for the given directory taking into account the given file filter.

      Reports the changed file or directory as a File instance to the provided consumer.

      Watches the files create/delete and directory create/delete events.

      Parameters:
      fileFilter - defined if the given file or directory should be watched
      onChangeConsumer - to be called when any change detected
      watchDirectory - the directory to watch for the changes, cannot be empty
    • ThemeFilesSynchronizer

      public ThemeFilesSynchronizer(org.apache.commons.io.monitor.FileAlterationListener listener, com.vaadin.flow.function.SerializablePredicate<File> fileFilter, File... watchDirectory)
      Creates an instance of the file watcher for the given directory taking into account the given file filter.

      Reports the changed file or directory as a File instance to the provided consumer.

      Reports file and directory changes to the given listener.

      Parameters:
      fileFilter - defined if the given file or directory should be watched
      listener - to be invoked once any changes detected
      watchDirectory - the directory to watch for the changes, cannot be empty
  • Method Details

    • start

      public void start() throws Exception
      Starts the file watching.
      Throws:
      Exception - if an error occurs during startup
    • stop

      public void stop() throws Exception
      Stops the file watching.
      Throws:
      Exception - if an error occurs during stop
    • stop

      public void stop(long stopInterval) throws Exception
      Stops the file watching and waits for a given stop interval for watching thread to finish.
      Parameters:
      stopInterval - time interval to wait for the watching thread
      Throws:
      Exception - if an error occurs during stop
    • setTimeout

      public void setTimeout(long timeout)
      Sets the time interval between file/directory checks.
      Parameters:
      timeout - time interval between file/directory checks