Class FileChangeTriggerBuilder


  • public class FileChangeTriggerBuilder
    extends java.lang.Object
    Use this to construct a TriggerDefinition for a file change Trigger.

    A file change trigger needs one file path to be configured. The file path has to be absolute and can not denote root directory (like C:\ or /).

    Example usage:

     
      TaskDefinition task = new TaskDefinition( "mytask" );
      TriggerDefinition definition = FileChangeTriggerBuilder.createForFolder( "D:\\Documents\\Reports" );
      task.addTrigger( definition );
      // add jobs and actions
      TaskPlanner.getInstance().addTask( task );
     
     
    Since:
    taskplanner 3.0
    • Constructor Detail

      • FileChangeTriggerBuilder

        public FileChangeTriggerBuilder()
    • Method Detail

      • createForFile

        public static TriggerDefinition createForFile​(java.lang.String path)
        Create a new Definition for a file change Trigger using given path string.
        Parameters:
        path - absolute path that denotes file.
        Returns:
        the definition which can be added to the task.
        Throws:
        java.lang.IllegalArgumentException - if given path string is null, path string cannot be converted to a Path, path is not absolute or denotes root component.
        Since:
        taskplanner 3.0
      • createForFile

        public static TriggerDefinition createForFile​(java.nio.file.Path path)
        Create a new Definition for a file change Trigger using given path.
        Parameters:
        path - absolute path that denotes file.
        Returns:
        the definition which can be added to the task.
        Throws:
        java.lang.IllegalArgumentException - if given path is null, not absolute or denotes root component.
        Since:
        taskplanner 3.0
      • createForFolder

        public static TriggerDefinition createForFolder​(java.lang.String path)
        Create a new Definition for a file change Trigger using given path string.
        Parameters:
        path - absolute path that denotes folder.
        Returns:
        the definition which can be added to the task.
        Throws:
        java.lang.IllegalArgumentException - if given path string is null, path string cannot be converted to a Path, path is not absolute or denotes root component.
        Since:
        taskplanner 3.0
      • createForFolder

        public static TriggerDefinition createForFolder​(java.nio.file.Path path)
        Create a new Definition for a file change Trigger using given path.
        Parameters:
        path - absolute path that denotes folder.
        Returns:
        the definition which can be added to the task.
        Throws:
        java.lang.IllegalArgumentException - if given path is null, not absolute or denotes root component.
        Since:
        taskplanner 3.0