|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.objectledge.scheduler.CronSchedule
public class CronSchedule
A schedule that follows the configuration syntax of Unix cron utility.
The configuration grammar:
schedule_config := ( ( minute hour day month weekday ) | special ) special := ( "@reboot" | "@yearly" | "@annually" | "@monthly" | "@weekly" | "@daily" | "@midnight" | "@hourly" ) minute := value_spec hour := value_spec day := value_spec month := ( value_spec | month_name ) weekday := ( value_spec | weekday_name ) month_name := ( "jan" | "feb" | "mar" | "apr" | "may" | "jun" | "jul" | "aug" | "sep" | "oct" | "nov" | "dec" ) weekday_name := ( "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun" ) value_spec := ( "*" | list_of_values ) list_of_values := ( value_or_range ( "," value_or_range )* ) value_or_range := ( number | range ) range := number "-" number [ "/" number ] number := LEXICAL( [0-9]+ )
Configuration syntax is compatible with Paul Vixie's cron, version 3.0.
| Field Summary | |
|---|---|
private String |
config
The textual configuration form. |
private static int |
DAY_OF_MONTH
index of day field. |
private static int |
DAY_OF_WEEK
index of weekday field. |
protected String |
eol
The end of line string for this machine. |
private static int |
HOUR_OF_DAY
index of hour field. |
private I18n |
i18n
I18n component |
private static int |
MINUTE
index of minute field. |
private static int |
MONTH
index of month field. |
private int[][] |
schedule
The parserd schedule data. |
static String |
TYPE
The schedule type. |
| Constructor Summary | |
|---|---|
CronSchedule(I18n i18n)
Constructor. |
|
| Method Summary | |
|---|---|
protected String |
addEscapes(String str)
Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII string literal. |
boolean |
atStartup()
Checks if the job should be run at the very startup of the scheduler. |
private void |
computeDay(Calendar nextRun)
|
private void |
computeHour(Calendar nextRun)
|
private void |
computeMinute(Calendar nextRun)
|
private void |
computeMonth(Calendar nextRunDOM)
|
String |
getConfig()
Return the schedule configuration. |
Date |
getNextRunTime(Date currentTime,
Date lastRunTime)
Calculates the time of the job's next run. |
String |
getType()
Returns the name of the schedule type. |
void |
init(AbstractScheduler scheduler,
String config)
Initialize the schedule. |
private String |
localizeParseException(ParseException ex)
Create a localized message out of ParseException object. |
private String |
localizeValueOutOrRangeException(ValueOutOfRangeException ex)
Create a localized message out of ParseException object. |
void |
setConfig(String config)
Sets the schedule configuration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int MINUTE
private static final int HOUR_OF_DAY
private static final int DAY_OF_MONTH
private static final int MONTH
private static final int DAY_OF_WEEK
public static final String TYPE
private String config
private int[][] schedule
private I18n i18n
protected String eol
| Constructor Detail |
|---|
public CronSchedule(I18n i18n)
i18n - the i18n component.| Method Detail |
|---|
public void init(AbstractScheduler scheduler,
String config)
throws InvalidScheduleException
init in interface Schedulescheduler - the scheduler.config - the configuration.
InvalidScheduleException - if the specification is invalid.public String getType()
getType in interface Schedulepublic String getConfig()
The format of the string is dependant on the nature of the schedule.
getConfig in interface Schedule
public void setConfig(String config)
throws InvalidScheduleException
The format of the string is dependant on the nature of the schedule.
setConfig in interface Scheduleconfig - schedule configuration.
InvalidScheduleException - if the specification is invalidpublic boolean atStartup()
atStartup in interface Scheduletrue if the job should be run during the startup
of the scheduler.
public Date getNextRunTime(Date currentTime,
Date lastRunTime)
getNextRunTime in interface SchedulecurrentTime - the current time.lastRunTime - the last time the job was run, or null
if unknown.
null for never again.private void computeMonth(Calendar nextRunDOM)
private void computeDay(Calendar nextRun)
private void computeHour(Calendar nextRun)
private void computeMinute(Calendar nextRun)
private String localizeParseException(ParseException ex)
ex - the exception.private String localizeValueOutOrRangeException(ValueOutOfRangeException ex)
ex - the exception.protected String addEscapes(String str)
This method was copied from JavaCC generated code.
str - input string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||