|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.service.scheduler.CalendarSchedule
public class CalendarSchedule
A CalendarSchedule expresses a repeating job in terms of months, days, hours, and minutes. For example, a CalendarSchedule might specify that a job take place on the 15th and 30th of every month, at 3:05am. A CalendarSchedule may also express a day in terms of day of the week, so that a job could take place every Monday in February at 2:30pm.
A CalendarSchedule is built by constructing a blank CalendarSchedule, then adding months, dates, days of the week, occurrences of days of the week in the month, hours, and minutes. Any times matching some combination of the added times will trigger the job. Specifically, the job will be triggered if:
The numerical values for the months, days, days of the week, hours, and minutes correspond to the same values used by the java.util.Calendar class fields MONTH, DATE, DAY_OF_WEEK, HOUR_OF_DAY, and MINUTE. The numerical values 1-4 for the occurrence of day of the week in the month similarly correspond to the values used by the Calendar field DAY_OF_WEEK_IN_MONTH; the special value of "last" is used to indicate the last occurrence in the month (e.g., last Monday of the month).
A CalendarSchedule may also be specified through a String, which the CalendarSchedule will parse. The String is of the form:
"<months> <dates> <days of week> <occurrences in month> <hours of day> <minutes>"
Each of the above elements, such as <dates>, is specified as one of the following:
For example, the following String specifies a job that will occur at 3:05pm on the 1st and 15th of every month:
"* 1,15 . . 15 5"
The following String specifies a job that will occur at midnight every Monday in the summer and winter:
"11-2,5-7 . 2 * 0 0"
And the following String specifies a job that will occur every hour on the hour on the first and last Wednesdays of every month:
"* . 4 1,last * 0"
See java.util.Calendar for more information.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static int |
LAST
Represents the last occurrence of day of the week in the month |
static java.lang.String |
LAST_STRING
The string corresponding to the LAST value |
Constructor Summary | |
---|---|
CalendarSchedule()
Constructs a blank new CalendarSchedue |
|
CalendarSchedule(java.lang.String pSchedule)
Constructs a new CalendarSchedule parsed from the given String |
|
CalendarSchedule(java.lang.String pSchedule,
java.util.Locale pLocale)
Constructs a new CalendarSchedule parsed from the given String |
Method Summary | |
---|---|
CalendarSchedule |
addAllDates()
Adds all dates to the schedule, so that the job will occur in every date of the month. |
CalendarSchedule |
addAllDaysOfTheWeek()
Adds all days of the week to the schedule, so that the job will occur in every day of the week. |
CalendarSchedule |
addAllHours()
Adds all hours to the schedule, so that the job will occur in every hour. |
CalendarSchedule |
addAllMinutes()
Adds all minutes to the schedule, so that the job will occur in every minute. |
CalendarSchedule |
addAllMonths()
Adds all months to the schedule, so that the job will occur in every month. |
CalendarSchedule |
addAllOccurrencesInTheMonth()
Adds all occurrences of day of the week in the month to the schedule, so that the job will occur at every occurrence of day of the week in the month. |
CalendarSchedule |
addDate(int pDate)
Adds the specified day of the month to the schedule (1-31). |
CalendarSchedule |
addDayOfTheWeek(int pDayOfTheWeek)
Adds the specified day of the week to the schedule (1=Sunday, 7=Saturday) |
CalendarSchedule |
addHour(int pHour)
Adds the specified hour to the schedule (0-23, 0=midnight). |
CalendarSchedule |
addMinute(int pMinute)
Adds the specified minute to the schedule (0-59). |
CalendarSchedule |
addMonth(int pMonth)
Adds the specified month to the schedule (0=January, 11=December) |
CalendarSchedule |
addOccurrenceInTheMonth(int pOccurrence)
Adds the specified occurrence of day of the week in the month to the schedule (1=first, 4=fourth, LAST=last) |
boolean |
equals(java.lang.Object pObject)
Returns true if the given object is a CalendarSchedule with all the same settings as this schedule. |
java.lang.String |
generateStringRepresentation(boolean[] pArray,
int startIndex)
represents the array as a string object to be embeded in the scheduleString. |
boolean[] |
getAllDates()
gets all dates of the month to the schedule will occur in. |
boolean[] |
getAllDaysOfTheWeek()
gets all days of the the week the schedule will occur in the zero'th entry can be ignored as counting starts at 1 |
boolean[] |
getAllHours()
gets all hours the schedule will occur in |
boolean[] |
getAllMinutes()
gets all minutes schedule will occur in |
boolean[] |
getAllMonths()
gets all months to the schedule will occur in |
boolean[] |
getAllOccurencesInTheMonth()
gets all occurences in the month the schedule will occur in the zero'th entry can be ignored as counting starts at 1 |
long |
getNextJobTime(long pLastOccurrenceTime)
Returns the next time that the job Scheduled by this will take place, or -1 if the job's next time could not be calculated. |
static java.util.ResourceBundle |
getResources(java.util.Locale pLocale)
|
int |
hashCode()
Returns a hash code value for this object. |
boolean |
isRepeating()
Returns true if this is a repeating job, false if this is a one-shot job. |
boolean |
jobOccursAtTime(java.util.Date pTime)
Returns true if the given time is one of the times that the job Scheduled by this may take place. |
static void |
main(java.lang.String[] pArgs)
Testing method |
boolean |
mustKnowFirstTime()
If true, then the first time getNextJobTime is called it will be called with -1. |
void |
parse(java.lang.String pSchedule)
Parses a CalendarSchedule from the specified String, adding all the elements specified by that String. |
void |
parse(java.lang.String pSchedule,
java.util.Locale pLocale)
Parses a CalendarSchedule from the specified String, adding all the elements specified by that String. |
java.lang.String |
scheduleString()
Returns a Parseable representation of this Schedule. |
java.lang.String |
scheduleString(java.util.Locale pLocale)
Returns a Parseable representation of this Schedule. |
void |
setMonthNames()
|
void |
setWeekdayNames()
|
java.lang.String |
toString()
|
java.lang.String |
toString(java.util.Locale pLocale)
Returns a String representation of this |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final int LAST
public static final java.lang.String LAST_STRING
Constructor Detail |
---|
public CalendarSchedule()
public CalendarSchedule(java.lang.String pSchedule)
java.lang.IllegalArgumentException
- if the string can not be
parsed as a CalendarSchedulepublic CalendarSchedule(java.lang.String pSchedule, java.util.Locale pLocale)
java.lang.IllegalArgumentException
- if the string can not be
parsed as a CalendarScheduleMethod Detail |
---|
public static java.util.ResourceBundle getResources(java.util.Locale pLocale)
public void setMonthNames()
public void setWeekdayNames()
public CalendarSchedule addMonth(int pMonth)
public CalendarSchedule addAllMonths()
public boolean[] getAllMonths()
public CalendarSchedule addDate(int pDate)
public CalendarSchedule addAllDates()
public boolean[] getAllDates()
public CalendarSchedule addDayOfTheWeek(int pDayOfTheWeek)
public CalendarSchedule addAllDaysOfTheWeek()
public boolean[] getAllDaysOfTheWeek()
public CalendarSchedule addOccurrenceInTheMonth(int pOccurrence)
public CalendarSchedule addAllOccurrencesInTheMonth()
public boolean[] getAllOccurencesInTheMonth()
public CalendarSchedule addHour(int pHour)
public CalendarSchedule addAllHours()
public boolean[] getAllHours()
public CalendarSchedule addMinute(int pMinute)
public CalendarSchedule addAllMinutes()
public boolean[] getAllMinutes()
public boolean jobOccursAtTime(java.util.Date pTime)
public long getNextJobTime(long pLastOccurrenceTime)
getNextJobTime
in interface Schedule
pLastOccurrenceTime
- the last time the job occurred,
or -1 if it has not yet occurred.
public boolean mustKnowFirstTime()
mustKnowFirstTime
in interface Schedule
public boolean isRepeating()
isRepeating
in interface Schedule
public void parse(java.lang.String pSchedule)
java.lang.IllegalArgumentException
- if the string can not be
parsed as a CalendarSchedulepublic void parse(java.lang.String pSchedule, java.util.Locale pLocale)
java.lang.IllegalArgumentException
- if the string can not be
parsed as a CalendarSchedulepublic java.lang.String scheduleString()
Schedule
scheduleString
in interface Schedule
public java.lang.String scheduleString(java.util.Locale pLocale)
scheduleString
in interface Schedule
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String generateStringRepresentation(boolean[] pArray, int startIndex)
public java.lang.String toString(java.util.Locale pLocale)
public boolean equals(java.lang.Object pObject)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static void main(java.lang.String[] pArgs)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |