public class Schedule extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
APRIL
every/only April
|
static int |
AUGUST
every/only August
|
static int |
DAILY
occurs using days
|
static int |
DECEMBER
every/only December
|
static int |
EVERYDAY
every day
|
static int |
FEBRUARY
every/only Febuary
|
static int |
FIRST
first week of month
|
static int |
FOURTH
fourth week of month
|
static int |
FREQUENCY
determines what type of reoccurance to use
|
static int |
FRIDAY
every friday
|
static int |
HOURLY
occurs using hours
|
static int |
JANUARY
every/only January
|
static int |
JULY
every/only July
|
static int |
JUNE
every/only June
|
static int |
LAST
fifth week of month
|
static int |
MARCH
every/only March
|
static int |
MAY
every/only May
|
static int |
MINUTELY
occurs using minute
|
static int |
MONDAY
every monday
|
static int |
MONTHLY
occurs using months
|
static int |
NaN
not a number if a value isn't set
|
static int |
NDAYS
every n days
|
static int |
NFREQUENCY
determines how frequent we execute on
|
static int |
NHOURS
every n hours
|
static int |
NMINUTES
every n minutes
|
static int |
NMONTHS
every n months
|
static int |
NOVEMBER
every/only November
|
static int |
NYEARS
every n years
|
static int |
OCTOBER
every/only October
|
static int |
SATURDAY
every satuarday
|
static int |
SECOND
second week of month
|
static int |
SEPTEMBER
every/only September
|
static int |
serialVersionUID
the serialized version number
|
static int |
SUNDAY
every sunday
|
static int |
THIRD
third week of month
|
static int |
THURSDAY
every thursday
|
static int |
TUESDAY
every tuesday
|
static int |
WEDNESDAY
every wednesday
|
static int |
WEEKDAY
every weekday
|
static int |
WEEKEND_DAY
every weekend day
|
static int |
WEEKLY
occurs using weeks
|
static int |
YEARLY
occurs using years
|
| Constructor and Description |
|---|
Schedule()
create a new empty schedule using the default locale
|
Schedule(Locale locale)
create a new empty schedule using the locale provided;
this is only used with create/writing a schedule, not
when a locale is defined within the schedule stream.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Schedule schedule)
Checks if this schedule is logical equivilent to another schedule.
|
static int[] |
getAllDaysInWeek()
Gets all days in a week.
|
static int[] |
getAllHoursInDay()
get all 24 hours in day
|
int |
getDayOfMonth()
Gets the day of the month for this schedule.
|
static String |
getDaysAsString(int[] days)
encode the days array as a string format listing
all the days
|
int[] |
getDaysOfWeek()
Gets the days of the week for this schedule.
|
int |
getFirstDayOfWeek()
Gets the day of the week for this schedule.
|
int |
getFrequency()
get the frequency for this schedule
|
static String |
getHoursAsString(int[] hours)
encode the hours array as a string presentation
|
static int[] |
getHoursBetween(int a,
int b)
get all hours between two times [a, b] of the same day
|
int[] |
getHoursOfDay()
Gets the hours of the day for this schedule.
|
Date |
getLastTime(Date now)
get the next time history data should be collected
|
Locale |
getLocale()
get the locale that this schedule is using currently
|
int |
getMonthOfYear()
Gets the month of the year for this schedule.
|
Date |
getNextTime(Date now,
boolean useInitialTime)
get the next time history data should be collected
|
Date |
getStartDate()
get the date/time that this schedule starts with used to seed
the date/time calculations and set a specific time to begin
|
int |
getSubType()
get the sub-type of this schedule
|
int |
getType()
get the type of this schedule
|
static int[] |
getWeekdays()
gets an array of days in week for weekdays only
|
int |
getWeekOfMonth()
Gets the week of the month for this schedule.
|
Date |
initializeScheduleTimes(boolean useInitialTime) |
static Schedule |
parse(int type,
Integer frequency,
int[] hoursOfDay,
int[] daysOfWeek,
Integer weekOfMonth,
Integer monthOfYear,
Integer dayOfMonth,
Date startDateTime)
Parses the individual field values to create a schedule object.
|
static int[] |
parseDays(String buf)
Decodes the days in the string representation and returns an
array of the days.
|
static int[] |
parseHours(String buf)
Decodes the hours in the string representation and returns an
array of the hours.
|
static Object[] |
parseLine(String line,
String format)
parse one line of text using the tokens provided returning
the tokenized values.
|
void |
setHourly(int hours,
int[] daysOfWeek,
int[] hoursOfDay)
Sets the schedule to hourly based upon the number of hours,
day descriptor and a inclusive time span.
|
void |
setLocale(Locale locale)
change the locale to the new locale and reload resources
from the new resource bundle
|
void |
setMinutely(int minutes,
int[] daysOfWeek,
int[] hoursOfDay)
set the schedule to minutely based upon the number of minutes,
day descriptor and a inclusive time span
|
void |
setMonthly(int months,
int weekOfMonth,
int[] daysOfWeek)
For Type 2, sets the schedule to monthly based upon the week descriptor,
day descriptor and month frequency.
|
void |
setMonthlyByDayOfMonth(int months,
int dayOfMonth)
Sets the schedule to monthly based upon the day of the month.
|
void |
setStartDate(Date inStart)
set the date/time that this schedule starts with used to seed
the date/time calculations and set the specific time to begin
|
void |
setWeekly(int weeks,
int[] days)
Sets the schedule to weekly and only execute on days specified.
|
void |
setYearlyByDayOfMonth(int monthOfYear,
int day)
Sets the schedule to yearly based upon the number of years,
month descriptor and day of the month (based upon the month).
|
void |
setYearlyByDayOfWeek(int weekOfMonth,
int[] daysOfWeek,
int monthOfYear)
Sets the schedule to yearly based upon the number of years,
week descriptor and day of the month (based upon the month).
|
String |
toString()
For debugging purposes, displays the schedule information.
|
public static final int serialVersionUID
public static final int NaN
public static final int FREQUENCY
public static final int MINUTELY
public static final int HOURLY
public static final int DAILY
public static final int WEEKLY
public static final int MONTHLY
public static final int YEARLY
public static final int NFREQUENCY
public static final int NMINUTES
public static final int NHOURS
public static final int NDAYS
public static final int NMONTHS
public static final int NYEARS
public static final int EVERYDAY
public static final int WEEKDAY
public static final int WEEKEND_DAY
public static final int SUNDAY
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
public static final int JANUARY
public static final int FEBRUARY
public static final int MARCH
public static final int APRIL
public static final int MAY
public static final int JUNE
public static final int JULY
public static final int AUGUST
public static final int SEPTEMBER
public static final int OCTOBER
public static final int NOVEMBER
public static final int DECEMBER
public static final int FIRST
public static final int SECOND
public static final int THIRD
public static final int FOURTH
public static final int LAST
public Schedule()
public Schedule(Locale locale)
locale - the locale to to create strings withinpublic Locale getLocale()
public void setLocale(Locale locale)
locale - the locale to change topublic void setStartDate(Date inStart)
initial - the initial date/time to start with; can not be nullpublic Date getStartDate()
public int getType()
public int getSubType()
public int getFrequency()
public int[] getHoursOfDay()
public int getFirstDayOfWeek()
public int[] getDaysOfWeek()
public int getWeekOfMonth()
public int getDayOfMonth()
public int getMonthOfYear()
public void setMinutely(int minutes,
int[] daysOfWeek,
int[] hoursOfDay)
throws OutOfRangeException
minutes - The number of minutes to wait between executions.daysOfWeek - The day of the week descriptors being one value
between {EVERYDAY through SATURDAY}.hoursOfDay - The hours to include for this schedule.OutOfRangeExceptionpublic void setHourly(int hours,
int[] daysOfWeek,
int[] hoursOfDay)
throws OutOfRangeException
hours - The number of hours to wait between executions.daysOfWeek - The day of the week descriptors being one value
between {EVERYDAY through SATURDAY}.hoursOfDay - The hours to include for this schedule.OutOfRangeExceptionpublic static int[] getWeekdays()
public void setWeekly(int weeks,
int[] days)
throws OutOfRangeException
weeks - The number of weeks to wait between executions.days - The specific days to execute on witin the range
{SUNDAY through SATURDAY}.OutOfRangeExceptionpublic void setMonthlyByDayOfMonth(int months,
int dayOfMonth)
throws OutOfRangeException
dayOfMonth - The day of the month.months - The frequency in months to waitOutOfRangeExceptionpublic void setMonthly(int months,
int weekOfMonth,
int[] daysOfWeek)
throws OutOfRangeException
months - The frequency in months to wait.weekOfMonth - The week descriptor being one of {FIRST through
LAST}.daysOfWeek - The days of week descriptor to execute on begin
one of {SUNDAY through SATURDAY}.OutOfRangeExceptionpublic void setYearlyByDayOfMonth(int monthOfYear,
int day)
throws OutOfRangeException
monthOfYear - The month of year descriptor begin one of
{JANUARY through DECEMBER}.day - The day of the month (1-31) for the month selectedOutOfRangeExceptionpublic void setYearlyByDayOfWeek(int weekOfMonth,
int[] daysOfWeek,
int monthOfYear)
throws OutOfRangeException
weekOfMonth - The week of the month to execute on being one
of (FIRST through LAST).daysOfWeek - The days of the week to execute on. In actuality
this should be an array of 1 element. The field
is stored as an array, but for YEARLY scheduling,
only one value will be present.monthOfYear - The month of year descriptor being one of
{JANUARY through DECEMBER}.OutOfRangeException - If invalid data passed in.public static Object[] parseLine(String line, String format) throws ParseException
line - the line of text to be parsed for valuesParseException - thrown if the format
of the text does not match the expected tokens listpublic static Schedule parse(int type, Integer frequency, int[] hoursOfDay, int[] daysOfWeek, Integer weekOfMonth, Integer monthOfYear, Integer dayOfMonth, Date startDateTime)
type - The schedule type.startDate - The date to use for seed calculations.frequency - How often to schedule.hoursOfDay - The hours of the day to execute on.daysOfWeek - The days of the week to execute on.weekOfMonth - The week of the month to execute on.monthOfYear - The month of the year to execute on.dayOfMonth - The day of the month to execute on.startDateTime - The start date/time.Schedule object.public static int[] getAllHoursInDay()
public static int[] getAllDaysInWeek()
public static String getHoursAsString(int[] hours)
hours - the set of hours to encodepublic static String getDaysAsString(int[] days)
days - the days to encodepublic static int[] parseHours(String buf) throws ParseException
buf - The string representation.ParseExceptionpublic static int[] parseDays(String buf) throws ParseException
buf - The string representation.ParseExceptionpublic static int[] getHoursBetween(int a,
int b)
public Date getNextTime(Date now, boolean useInitialTime) throws ParseException
ParseExceptionpublic Date getLastTime(Date now) throws ParseException
ParseExceptionpublic String toString()
public boolean equals(Schedule schedule)
rhs - The schedule to compare with.public Date initializeScheduleTimes(boolean useInitialTime)
? Copyright 2013 BMC Software, Inc.