CalendarIntervalScheduleBuilder (Quartz Parent POM 2.0.1 API)

Quartz Java



org.quartz Class CalendarIntervalScheduleBuilder

java.lang.Object
  extended by org.quartz.ScheduleBuilder<CalendarIntervalTrigger>
      extended by org.quartz.CalendarIntervalScheduleBuilder

public class CalendarIntervalScheduleBuilder
extends ScheduleBuilder<CalendarIntervalTrigger>

CalendarIntervalScheduleBuilder is a ScheduleBuilder that defines calendar time (day, week, month, year) interval-based schedules for Triggers.

Quartz provides a builder-style API for constructing scheduling-related entities via a Domain-Specific Language (DSL). The DSL can best be utilized through the usage of static imports of the methods on the classes TriggerBuilder, JobBuilder, DateBuilder, JobKey, TriggerKey and the various ScheduleBuilder implementations.

Client code can then use the DSL to write code such as this:

         JobDetail job = newJob(MyJob.class)
             .withIdentity("myJob")
             .build();
             
         Trigger trigger = newTrigger() 
             .withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
             .withSchedule(simpleSchedule()
                 .withIntervalInHours(1)
                 .repeatForever())
             .startAt(futureDate(10, MINUTES))
             .build();
         
         scheduler.scheduleJob(job, trigger);
 

See Also:
CalenderIntervalTrigger, CronScheduleBuilder, ScheduleBuilder, SimpleScheduleBuilder, TriggerBuilder

Method Summary
 org.quartz.spi.MutableTrigger build()
          Build the actual Trigger -- NOT intended to be invoked by end users, but will rather be invoked by a TriggerBuilder which this ScheduleBuilder is given to.
static CalendarIntervalScheduleBuilder calendarIntervalSchedule()
          Create a CalendarIntervalScheduleBuilder.
 CalendarIntervalScheduleBuilder withInterval(int interval, DateBuilder.IntervalUnit unit)
          Specify the time unit and interval for the Trigger to be produced.
 CalendarIntervalScheduleBuilder withIntervalInDays(int intervalInDays)
          Specify an interval in the IntervalUnit.DAY that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInHours(int intervalInHours)
          Specify an interval in the IntervalUnit.HOUR that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes)
          Specify an interval in the IntervalUnit.MINUTE that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInMonths(int intervalInMonths)
          Specify an interval in the IntervalUnit.MONTH that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds)
          Specify an interval in the IntervalUnit.SECOND that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInWeeks(int intervalInWeeks)
          Specify an interval in the IntervalUnit.WEEK that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withIntervalInYears(int intervalInYears)
          Specify an interval in the IntervalUnit.YEAR that the produced Trigger will repeat at.
 CalendarIntervalScheduleBuilder withMisfireHandlingInstructionDoNothing()
          If the Trigger misfires, use the CalendarIntervalTrigger.MISFIRE_INSTRUCTION_DO_NOTHING instruction.
 CalendarIntervalScheduleBuilder withMisfireHandlingInstructionFireAndProceed()
          If the Trigger misfires, use the CalendarIntervalTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction.
 CalendarIntervalScheduleBuilder withMisfireHandlingInstructionIgnoreMisfires()
          If the Trigger misfires, use the Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calendarIntervalSchedule

public static CalendarIntervalScheduleBuilder calendarIntervalSchedule()
Create a CalendarIntervalScheduleBuilder.

Returns:
the new CalendarIntervalScheduleBuilder

build

public org.quartz.spi.MutableTrigger build()
Build the actual Trigger -- NOT intended to be invoked by end users, but will rather be invoked by a TriggerBuilder which this ScheduleBuilder is given to.

Specified by:
build in class ScheduleBuilder<CalendarIntervalTrigger>
See Also:
TriggerBuilder.withSchedule(ScheduleBuilder)

withInterval

public CalendarIntervalScheduleBuilder withInterval(int interval,
                                                    DateBuilder.IntervalUnit unit)
Specify the time unit and interval for the Trigger to be produced.

Parameters:
interval - the interval at which the trigger should repeat.
unit - the time unit (IntervalUnit) of the interval.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInSeconds

public CalendarIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds)
Specify an interval in the IntervalUnit.SECOND that the produced Trigger will repeat at.

Parameters:
intervalInSeconds - the number of seconds at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInMinutes

public CalendarIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes)
Specify an interval in the IntervalUnit.MINUTE that the produced Trigger will repeat at.

Parameters:
intervalInMinutes - the number of minutes at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInHours

public CalendarIntervalScheduleBuilder withIntervalInHours(int intervalInHours)
Specify an interval in the IntervalUnit.HOUR that the produced Trigger will repeat at.

Parameters:
intervalInHours - the number of hours at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInDays

public CalendarIntervalScheduleBuilder withIntervalInDays(int intervalInDays)
Specify an interval in the IntervalUnit.DAY that the produced Trigger will repeat at.

Parameters:
intervalInDays - the number of days at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInWeeks

public CalendarIntervalScheduleBuilder withIntervalInWeeks(int intervalInWeeks)
Specify an interval in the IntervalUnit.WEEK that the produced Trigger will repeat at.

Parameters:
intervalInWeeks - the number of weeks at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInMonths

public CalendarIntervalScheduleBuilder withIntervalInMonths(int intervalInMonths)
Specify an interval in the IntervalUnit.MONTH that the produced Trigger will repeat at.

Parameters:
intervalInMonths - the number of months at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withIntervalInYears

public CalendarIntervalScheduleBuilder withIntervalInYears(int intervalInYears)
Specify an interval in the IntervalUnit.YEAR that the produced Trigger will repeat at.

Parameters:
intervalInYears - the number of years at which the trigger should repeat.
Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.getRepeatInterval(), CalendarIntervalTrigger.getRepeatIntervalUnit()

withMisfireHandlingInstructionIgnoreMisfires

public CalendarIntervalScheduleBuilder withMisfireHandlingInstructionIgnoreMisfires()
If the Trigger misfires, use the Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY instruction.

Returns:
the updated CronScheduleBuilder
See Also:
Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY

withMisfireHandlingInstructionDoNothing

public CalendarIntervalScheduleBuilder withMisfireHandlingInstructionDoNothing()
If the Trigger misfires, use the CalendarIntervalTrigger.MISFIRE_INSTRUCTION_DO_NOTHING instruction.

Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.MISFIRE_INSTRUCTION_DO_NOTHING

withMisfireHandlingInstructionFireAndProceed

public CalendarIntervalScheduleBuilder withMisfireHandlingInstructionFireAndProceed()
If the Trigger misfires, use the CalendarIntervalTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction.

Returns:
the updated CalendarIntervalScheduleBuilder
See Also:
CalendarIntervalTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW


Copyright 2001-2011, Terracotta, Inc.