|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.JobBuilder
public class JobBuilder
JobBuilder
is used to instantiate JobDetail
s.
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);
TriggerBuilder
,
DateBuilder
,
JobDetail
Method Summary | |
---|---|
JobDetail |
build()
Produce the JobDetail instance defined by this
JobBuilder . |
static JobBuilder |
newJob()
Create a JobBuilder with which to define a JobDetail . |
static JobBuilder |
newJob(java.lang.Class<? extends Job> jobClass)
Create a JobBuilder with which to define a JobDetail ,
and set the class name of the Job to be executed. |
JobBuilder |
ofType(java.lang.Class<? extends Job> jobClass)
Set the class which will be instantiated and executed when a Trigger fires that is associated with this JobDetail. |
JobBuilder |
requestRecovery()
Instructs the Scheduler whether or not the Job
should be re-executed if a 'recovery' or 'fail-over' situation is
encountered. |
JobBuilder |
requestRecovery(boolean shouldRecover)
Instructs the Scheduler whether or not the Job
should be re-executed if a 'recovery' or 'fail-over' situation is
encountered. |
JobBuilder |
storeDurably()
Whether or not the Job should remain stored after it is
orphaned (no point to it). |
JobBuilder |
storeDurably(boolean durability)
Whether or not the Job should remain stored after it is
orphaned (no point to it). |
JobBuilder |
usingJobData(JobDataMap newJobDataMap)
Set the JobDetail's JobDataMap , adding any values to it
that were already set on this JobBuilder using any of the
other 'usingJobData' methods. |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.Boolean value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.Double value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.Float value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.Integer value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.Long value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
usingJobData(java.lang.String key,
java.lang.String value)
Add the given key-value pair to the JobDetail's JobDataMap . |
JobBuilder |
withDescription(java.lang.String description)
Set the given (human-meaningful) description of the Job. |
JobBuilder |
withIdentity(JobKey key)
Use a JobKey to identify the JobDetail. |
JobBuilder |
withIdentity(java.lang.String name)
Use a JobKey with the given name and default group to
identify the JobDetail. |
JobBuilder |
withIdentity(java.lang.String name,
java.lang.String group)
Use a JobKey with the given name and group to
identify the JobDetail. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static JobBuilder newJob()
JobDetail
.
public static JobBuilder newJob(java.lang.Class<? extends Job> jobClass)
JobDetail
,
and set the class name of the Job
to be executed.
public JobDetail build()
JobDetail
instance defined by this
JobBuilder
.
public JobBuilder withIdentity(java.lang.String name)
JobKey
with the given name and default group to
identify the JobDetail.
If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated.
name
- the name element for the Job's JobKey
JobKey
,
JobDetail.getKey()
public JobBuilder withIdentity(java.lang.String name, java.lang.String group)
JobKey
with the given name and group to
identify the JobDetail.
If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated.
name
- the name element for the Job's JobKeygroup
- the group element for the Job's JobKey
JobKey
,
JobDetail.getKey()
public JobBuilder withIdentity(JobKey key)
JobKey
to identify the JobDetail.
If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated.
key
- the Job's JobKey
JobKey
,
JobDetail.getKey()
public JobBuilder withDescription(java.lang.String description)
description
- the description for the Job
JobDetail.getDescription()
public JobBuilder ofType(java.lang.Class<? extends Job> jobClass)
jobClass
- a class implementing the Job interface.
JobDetail.getJobClass()
public JobBuilder requestRecovery()
Scheduler
whether or not the Job
should be re-executed if a 'recovery' or 'fail-over' situation is
encountered.
If not explicitly set, the default value is false
.
JobDetail.requestsRecovery()
public JobBuilder requestRecovery(boolean shouldRecover)
Scheduler
whether or not the Job
should be re-executed if a 'recovery' or 'fail-over' situation is
encountered.
If not explicitly set, the default value is false
.
shouldRecover
-
public JobBuilder storeDurably()
Job
should remain stored after it is
orphaned (no Trigger
s
point to it).
If not explicitly set, the default value is false
.
JobDetail.isDurable()
public JobBuilder storeDurably(boolean durability)
Job
should remain stored after it is
orphaned (no Trigger
s
point to it).
If not explicitly set, the default value is false
.
durability
- the value to set for the durability property.
JobDetail.isDurable()
public JobBuilder usingJobData(java.lang.String key, java.lang.String value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(java.lang.String key, java.lang.Integer value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(java.lang.String key, java.lang.Long value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(java.lang.String key, java.lang.Float value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(java.lang.String key, java.lang.Double value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(java.lang.String key, java.lang.Boolean value)
JobDataMap
.
JobDetail.getJobDataMap()
public JobBuilder usingJobData(JobDataMap newJobDataMap)
JobDataMap
, adding any values to it
that were already set on this JobBuilder using any of the
other 'usingJobData' methods.
JobDetail.getJobDataMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |