Class CronTriggerBuilder

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

public class CronTriggerBuilder extends Object
Use this to construct a TriggerDefinition for a cron Trigger.

A cron trigger only needs one expression to be configured. The expression has the following syntax:
(minute) (hour) (dayOfMonth) (month) (dayOfWeek) (year)
Each value is separated by a space, the year value can be omitted. Only one of dayOfMonth and dayOfWeek can be specified, the other one must be '?'. It follows the QUARTZ syntax without the seconds value! See http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html for more detais on the syntax.

Example usage:

 
 
  TaskDefinition task = new TaskDefinition("mytask");
  TriggerDefinition cron = CronTriggerBuilder.create("0 18 1 * ?");
  task.addTrigger(cron);
  // ...add jobs and Actions...
  TaskPlanner.getInstance().addTask( task );
 
 
Since:
taskplanner 3.0
  • Constructor Details

    • CronTriggerBuilder

      public CronTriggerBuilder()
  • Method Details

    • create

      public static TriggerDefinition create(String expression)
      Create a new Definition for a CronTrigger using given cron expression.
      Parameters:
      expression - the expression to use
      Returns:
      the definition which can be added to the task
      Throws:
      IllegalArgumentException - if the given expression is null, empty or invalid.
      Since:
      taskplanner 3.0