|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.TriggerBuilder<T>
public class TriggerBuilder<T extends Trigger>
TriggerBuilder
is used to instantiate Trigger
s.
The builder will always try to keep itself in a valid state, with reasonable defaults set for calling build() at any point. For instance if you do not invoke withSchedule(..) method, a default schedule of firing once immediately will be used. As another example, if you do not invoked withIdentity(..) a trigger name will be generated for you.
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);
JobBuilder
,
ScheduleBuilder
,
DateBuilder
,
Trigger
Method Summary | ||
---|---|---|
T |
build()
Produce the Trigger . |
|
TriggerBuilder<T> |
endAt(Date triggerEndTime)
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats. |
|
TriggerBuilder<T> |
forJob(JobDetail jobDetail)
Set the identity of the Job which should be fired by the produced Trigger, by extracting the JobKey from the given job. |
|
TriggerBuilder<T> |
forJob(JobKey keyOfJobToFire)
Set the identity of the Job which should be fired by the produced Trigger. |
|
TriggerBuilder<T> |
forJob(String jobName)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given
name and default group. |
|
TriggerBuilder<T> |
forJob(String jobName,
String jobGroup)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given
name and group. |
|
TriggerBuilder<T> |
modifiedByCalendar(String calName)
Set the name of the Calendar that should be applied to this
Trigger's schedule. |
|
static TriggerBuilder<Trigger> |
newTrigger()
Create a new TriggerBuilder with which to define a specification for a Trigger. |
|
TriggerBuilder<T> |
startAt(Date triggerStartTime)
Set the time the Trigger should start at - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger. |
|
TriggerBuilder<T> |
startNow()
Set the time the Trigger should start at to the current moment - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger. |
|
TriggerBuilder<T> |
usingJobData(JobDataMap newJobDataMap)
Set the Trigger's JobDataMap , adding any values to it
that were already set on this TriggerBuilder using any of the
other 'usingJobData' methods. |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
Boolean value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
Double value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
Float value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
Integer value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
Long value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(String dataKey,
String value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
withDescription(String triggerDescription)
Set the given (human-meaningful) description of the Trigger. |
|
TriggerBuilder<T> |
withIdentity(String name)
Use a TriggerKey with the given name and default group to
identify the Trigger. |
|
TriggerBuilder<T> |
withIdentity(String name,
String group)
Use a TriggerKey with the given name and group to identify the Trigger. |
|
TriggerBuilder<T> |
withIdentity(TriggerKey triggerKey)
Use the given TriggerKey to identify the Trigger. |
|
TriggerBuilder<T> |
withPriority(int triggerPriority)
Set the Trigger's priority. |
|
|
withSchedule(ScheduleBuilder<SBT> schedBuilder)
Set the ScheduleBuilder that will be used to define the
Trigger's schedule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TriggerBuilder<Trigger> newTrigger()
public T build()
Trigger
.
public TriggerBuilder<T> withIdentity(String name)
TriggerKey
with the given name and default group to
identify the Trigger.
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
name
- the name element for the Trigger's TriggerKey
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withIdentity(String name, String group)
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
name
- the name element for the Trigger's TriggerKeygroup
- the group element for the Trigger's TriggerKey
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withIdentity(TriggerKey triggerKey)
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
triggerKey
- the TriggerKey for the Trigger to be built
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withDescription(String triggerDescription)
triggerDescription
- the description for the Trigger
Trigger.getDescription()
public TriggerBuilder<T> withPriority(int triggerPriority)
triggerPriority
- the priority for the Trigger
Trigger.DEFAULT_PRIORITY
,
Trigger.getPriority()
public TriggerBuilder<T> modifiedByCalendar(String calName)
Calendar
that should be applied to this
Trigger's schedule.
calName
- the name of the Calendar to reference.
Calendar
,
Trigger.getCalendarName()
public TriggerBuilder<T> startAt(Date triggerStartTime)
triggerStartTime
- the start time for the Trigger.
Trigger.getStartTime()
,
DateBuilder
public TriggerBuilder<T> startNow()
Trigger.getStartTime()
public TriggerBuilder<T> endAt(Date triggerEndTime)
triggerEndTime
- the end time for the Trigger. If null, the end time is indefinite.
Trigger.getEndTime()
,
DateBuilder
public <SBT extends T> TriggerBuilder<SBT> withSchedule(ScheduleBuilder<SBT> schedBuilder)
ScheduleBuilder
that will be used to define the
Trigger's schedule.
The particular SchedulerBuilder
used will dictate
the concrete type of Trigger that is produced by the TriggerBuilder.
schedBuilder
- the SchedulerBuilder to use.
ScheduleBuilder
,
SimpleScheduleBuilder
,
CronScheduleBuilder
,
CalendarIntervalScheduleBuilder
public TriggerBuilder<T> forJob(JobKey keyOfJobToFire)
keyOfJobToFire
- the identity of the Job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(String jobName)
JobKey
will be produced with the given
name and default group.
jobName
- the name of the job (in default group) to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(String jobName, String jobGroup)
JobKey
will be produced with the given
name and group.
jobName
- the name of the job to fire.jobGroup
- the group of the job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(JobDetail jobDetail)
jobDetail
- the Job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> usingJobData(String dataKey, String value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(String dataKey, Integer value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(String dataKey, Long value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(String dataKey, Float value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(String dataKey, Double value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(String dataKey, Boolean value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(JobDataMap newJobDataMap)
JobDataMap
, adding any values to it
that were already set on this TriggerBuilder using any of the
other 'usingJobData' methods.
Trigger.getJobDataMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |