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 must be absolute and cannot denote a root directory (such as 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, userID );

Since:
taskplanner 3.0
  • Constructor Details

    • FileChangeTriggerBuilder

      public FileChangeTriggerBuilder()
  • Method Details

    • createForFile

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

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

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

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