|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openeai.OpenEaiObject
org.openeai.afa.Schedule
public class Schedule
This is a class that wraps the execution details of a set of commands. It keeps track of when a particular command(s) should execute. The ScheduledApp class will use these objects to determine when commands associated to this Schedule should run. Then the ScheduledApp will execute the command(s) associated with this Schedule.
The Schedule object allows a flexible mechanism to associate certain times, days or intervals at which the ScheduledCommands associated to this schedule should run. By querying this information the ScheduledApp component can determine if the ScheduledCommands associated to this Schedule should run and if so, execute them.
| Field Summary | |
|---|---|
static java.lang.String |
FRIDAY
|
static java.lang.String |
MONDAY
|
static java.lang.String |
SATURDAY
|
static java.lang.String |
SUNDAY
|
static java.lang.String |
THURSDAY
|
static java.lang.String |
TUESDAY
|
static java.lang.String |
WEDNESDAY
|
| Fields inherited from class org.openeai.OpenEaiObject |
|---|
logger |
| Constructor Summary | |
|---|---|
Schedule(ScheduleConfig sConfig)
Constructs the Schedule object with a ScheduleConfig object which wraps the Schedules information found in the ScheduledApp's deployment document. |
|
| Method Summary | |
|---|---|
void |
addCommand(java.lang.String name,
CommandConfig cConfig)
Adds a command to this schedule. |
ScheduledCommand |
getCommand(java.lang.String name)
Returns a ScheduledCommand associated to this schedule by name. |
java.util.HashMap |
getCommands()
Returns all ScheduledCommands associated to this schedule. |
MailService |
getMailService()
This method returns the MailService object that will be associated to the Schedule as specified in the deployment document. |
java.lang.String |
getName()
Returns the Schedule name according to information found in the config document for the application being configured. |
ScheduleIdStore |
getScheduleIdStore()
|
java.util.List |
getScheduleRuntimes()
Returns a List that contains ScheduleRuntime objects associated to this Schedule. |
boolean |
isImmediate()
Tells the caller if this Schedule is suppose to run immediately. |
void |
setCommands(java.util.HashMap commands)
Sets all ScheduledCommands associated to this schedule. |
void |
setMailService(MailService m)
This method sets the MailService object that will be associated to the Schedule as specified in the deployment document. |
void |
setName(java.lang.String name)
Sets the Schedule name according to information found in the config document for the application being configured. |
void |
setScheduleIdStore(ScheduleIdStore store)
|
boolean |
shouldRun()
Determines if the ScheduledCommands associated to this Schedule should run. |
void |
stop()
|
| Methods inherited from class org.openeai.OpenEaiObject |
|---|
getAppName, getDebug, getFromAddr, getMailHost, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setProperties, setToAddr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SUNDAY
public static final java.lang.String MONDAY
public static final java.lang.String TUESDAY
public static final java.lang.String WEDNESDAY
public static final java.lang.String THURSDAY
public static final java.lang.String FRIDAY
public static final java.lang.String SATURDAY
| Constructor Detail |
|---|
public Schedule(ScheduleConfig sConfig)
throws java.lang.InstantiationException
java.lang.InstantiationException| Method Detail |
|---|
public void stop()
public void setScheduleIdStore(ScheduleIdStore store)
public ScheduleIdStore getScheduleIdStore()
public final void addCommand(java.lang.String name,
CommandConfig cConfig)
throws java.lang.InstantiationException,
java.lang.NoSuchMethodException
cConfig - CommandConfig the CommandConfig object that AppConfig has made available and is used
instantiate the command associated to this Schedule.
java.lang.InstantiationException
java.lang.NoSuchMethodExceptionpublic final ScheduledCommand getCommand(java.lang.String name)
name - String command name.
public final void setCommands(java.util.HashMap commands)
commands - HashMap of ScheduledCommands.public final java.util.HashMap getCommands()
public final void setName(java.lang.String name)
name - String the Schedule namepublic final java.lang.String getName()
public final java.util.List getScheduleRuntimes()
public void setMailService(MailService m)
setMailService in class OpenEaiObjectm - the mail service object to associate to this schedule.public MailService getMailService()
getMailService in class OpenEaiObject
public final boolean shouldRun()
throws ScheduleIdStoreException
Factors that determine when a Schedule should be ran include the Schedule's 'runtime'. The Schedule object contains a list of 'runtimes' associated to this Schedule that tell it the Days and Times that this Schedule should be ran. When a Schedule has been executed, it will update its ScheduleIdStore indicating that the Schedule has been run. This store is checked to ensure a Schedule is not executed more than once in a given day. This store is persisted to a configurable location to survive the application stopping and starting. When the day changes (midnight is reached) the Schedule will remove any Schedule id's from the store for the new day so they will again be executed.
ScheduleIdStoreException - if errors occur determining if the Schedule should be ran.ScheduleRuntime,
ScheduleIdStorepublic final boolean isImmediate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||