public class Job
extends java.lang.Object
Scheduler job.
For each job, the following can be defined:
name - the job name; must be unique and is case insensitive.type - the kind of the job being started:
JobType.PROCESS - start a new P2J process.
-JobType.CLASS - execute a certain java class which implements
Runnable.
-JobType.METHOD - execute a certain java method.
-JobType.INSTANCE - execute a given Runnable instance. This job
can't be configured in the directory.
target
- in case of JobType.PROCESS, is the subject ID of a P2J process.
- in case of JobType.CLASS, is the qualified name of a Java class which
implements the Runnable interface
- in case of JobType.METHOD, is the qualified name of a Java class followed by
the name of a no-arguments method, i.e. foo.bar.Something.execute
- in case of JobType.INSTANCE, this field will be null.
instance - the instance to be ran, only for JobType.INSTANCEenabled - flag indicating if this job is enabled or not.mode - the job mode. One of the following values:
- JobMode.NOW - for jobs being executed immediately
- JobMode.ONE_TIME - for jobs being executed at a certain time/date,
a single time.
- JobMode.RECURRING - for recurrent jobs executed at a certain time/date.
second, minute, hour, dayOfMonth,
dayOfWeek, month and year need to be specified only for
JobMode.RECURRING or JobMode.ONE_TIME jobs. They follow the
CronExpression specification for each cron field.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
dayOfMonth
The day the month expression when the job needs to be executed.
|
private java.lang.String |
dayOfWeek
The day of the week expression when the job needs to be executed.
|
private boolean |
enabled
Flag indicating if this job is enabled.
|
private java.lang.String |
hour
The hour expression when the job needs to be executed.
|
private java.lang.Runnable |
instance
The instance of this job, only with
JobType.INSTANCE. |
private java.lang.String |
minute
The minute expression when the job needs to be executed.
|
private JobMode |
mode
The execution mode of this job, one of the
JobMode values. |
private java.lang.String |
month
The month expression when the job needs to be executed.
|
private java.lang.String |
name
The name of this job.
|
private java.lang.String |
second
The second expression when the job needs to be executed.
|
private java.lang.String |
target
The target of this job.
|
private JobType |
type
The type of this job, one of the
JobType values. |
private java.lang.String |
year
The year expression when the job needs to be executed.
|
| Constructor and Description |
|---|
Job(java.lang.String name,
JobType type,
java.lang.String target,
boolean enabled,
JobMode mode)
Create a new job.
|
Job(java.lang.String name,
java.lang.Runnable instance,
boolean enabled,
JobMode mode)
Create a new job, with type
JobType.INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getDayOfMonth()
Get the job's
dayOfMonth. |
java.lang.String |
getDayOfWeek()
Get the job's
dayOfWeek. |
java.lang.String |
getHour()
Get the job's
hour. |
java.lang.Runnable |
getInstance()
Get the instance of this job.
|
java.lang.String |
getMinute()
Get the job's
minute. |
JobMode |
getMode()
Get the job's
mode. |
java.lang.String |
getMonth()
Get the job's
month. |
java.lang.String |
getName()
Get the job's
name. |
java.lang.String |
getSecond()
Get the job's
second. |
java.lang.String |
getTarget()
Get the job's
target. |
JobType |
getType()
Get the job's
type. |
java.lang.String |
getYear()
Get the job's
year. |
boolean |
isEnabled()
Get the job's
enabled state. |
void |
setDayOfMonth(java.lang.String dayOfMonth)
Set the job's execution
dayOfMonth. |
void |
setDayOfWeek(java.lang.String dayOfWeek)
Set the job's execution
dayOfWeek. |
void |
setHour(java.lang.String hour)
Set the job's execution
hour. |
void |
setMinute(java.lang.String minute)
Set the job's execution
minute. |
void |
setMonth(java.lang.String month)
Set the job's execution
month. |
void |
setSecond(java.lang.String second)
Set the job's execution
second. |
void |
setYear(java.lang.String year)
Set the job's execution
year. |
java.lang.String |
toString()
Get the string representation of this job, using the
"<name> [<type>:<mode>] - <target>" format. |
private final java.lang.String name
private java.lang.String target
private java.lang.Runnable instance
JobType.INSTANCE.private boolean enabled
private java.lang.String second
private java.lang.String minute
private java.lang.String hour
private java.lang.String dayOfMonth
private java.lang.String dayOfWeek
private java.lang.String month
private java.lang.String year
public Job(java.lang.String name,
JobType type,
java.lang.String target,
boolean enabled,
JobMode mode)
public Job(java.lang.String name,
java.lang.Runnable instance,
boolean enabled,
JobMode mode)
JobType.INSTANCEname - The name of this job.instance - The instance of this job.enabled - Flag indicating if this job is enabled.mode - The execution mode of this job, one of the JobMode values.public java.lang.Runnable getInstance()
instance, to be executed.public java.lang.String getName()
name.public java.lang.String getTarget()
target.public boolean isEnabled()
enabled state.public java.lang.String getSecond()
second.public void setSecond(java.lang.String second)
second.second - The second, null or a value following the CronExpression syntax.public java.lang.String getMinute()
minute.public void setMinute(java.lang.String minute)
minute.minute - The minute, null or a value following the CronExpression syntax.public java.lang.String getHour()
hour.public void setHour(java.lang.String hour)
hour.hour - The hour, null or a value following the CronExpression syntax.public java.lang.String getDayOfMonth()
dayOfMonth.public void setDayOfMonth(java.lang.String dayOfMonth)
dayOfMonth.dayOfMonth - The day of the month, null or a value following the CronExpression
syntax.public java.lang.String getDayOfWeek()
dayOfWeek.public void setDayOfWeek(java.lang.String dayOfWeek)
dayOfWeek.dayOfWeek - The day of the week, null or a value following the CronExpression
syntax.public java.lang.String getMonth()
month.public void setMonth(java.lang.String month)
month.month - The month, null or a value following the CronExpression syntax.public java.lang.String getYear()
year.public void setYear(java.lang.String year)
year.year - The year, null or a year following the CronExpression syntax.public java.lang.String toString()
"<name> [<type>:<mode>] - <target>" format.toString in class java.lang.Object