Class FileChangeTriggerBuilder

java.lang.Object
com.inet.taskplanner.server.api.trigger.FileChangeTriggerBuilder

public class FileChangeTriggerBuilder extends 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 Details

    • FileChangeTriggerBuilder

      public FileChangeTriggerBuilder()
  • Method Details

    • createForFile

      public static TriggerDefinition createForFile(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:
      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(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:
      IllegalArgumentException - if given path is null, not absolute or denotes root component.
      Since:
      taskplanner 3.0
    • createForFolder

      public static TriggerDefinition createForFolder(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:
      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(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:
      IllegalArgumentException - if given path is null, not absolute or denotes root component.
      Since:
      taskplanner 3.0