org.openeai.afa
Class ScheduledApp

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.afa.ScheduledApp

public class ScheduledApp
extends OpenEaiObject

This component is used to wrap ScheduledApplications. It is similar to our PointToPointConsumer and PubSubConsumer messaging components. However, instead of consuming messages and executing commands based on the message it consumed, it 'sleeps' for a specified amount of time then wakes up and checks the Schedules it contains to see if the commands they manage should be executed. If so, it calls the execute method on each one of the commands associated to the Schedule it's currently checking.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
ScheduledApp(ScheduledAppConfig sConfig)
          Constructor
 
Method Summary
 void addSchedule(java.lang.String name, Schedule schedule)
          Adds an individual Schedule to the list of schedules managed by this ScheduledApp.
 Schedule getSchedule(java.lang.String name)
          Returns an individual Schedule from the list of schedules managed by this ScheduledApp.
 java.util.HashMap getSchedules()
          Returns the list of Schedules managed by this ScheduledApp
 java.lang.String getType()
          Returns the type of ScheduledApp that this is.
 void setThreadPool(ThreadPool tPool)
          Sets the ThreadPool object associated to this ScheduledApp.
 void stop()
           
 
Methods inherited from class org.openeai.OpenEaiObject
getAppName, getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScheduledApp

public ScheduledApp(ScheduledAppConfig sConfig)
             throws EnterpriseConfigurationObjectException
Constructor

Throws:
EnterpriseConfigurationObjectException
Method Detail

stop

public void stop()

getSchedules

public java.util.HashMap getSchedules()
Returns the list of Schedules managed by this ScheduledApp

Returns:
HashMap Schedule objects managed by this ScheduledApp

addSchedule

public void addSchedule(java.lang.String name,
                        Schedule schedule)
Adds an individual Schedule to the list of schedules managed by this ScheduledApp. This is called during configuration of this object based on information found in its config document.

Parameters:
name - String the Schedule name
schedule - Schedule the Schedule object

getSchedule

public Schedule getSchedule(java.lang.String name)
Returns an individual Schedule from the list of schedules managed by this ScheduledApp.

Parameters:
name - String the Schedule name
Returns:
Schedule the Schedule object associated to the name passed in.

setThreadPool

public void setThreadPool(ThreadPool tPool)
Sets the ThreadPool object associated to this ScheduledApp. The ThreadPool is is used to execute the commands associated to the Schedule.

Parameters:
tPool - ThreadPool

getType

public java.lang.String getType()
Returns the type of ScheduledApp that this is. Currently, those values can be 'application', 'triggered' or 'daemon'. These are set in the config document for this ScheduledApplication.

If the type is 'application' the ScheduledApp will retrieve all Schedules it manages and then call the execute methods on each command contained with those Schedules then exit.

If the type is 'triggered' the ScheduledApp will behave just like an 'application' except it will wait to be triggered before exiting. That is, some sort of 'kill' signal will have to be sent to the ScheduledApp. When that kill signal is received, it will exit.

If the type is 'daemon' the ScheduledApp will sleep for a specified period of time, then wake up and check each Schedule it manages and if that Schedule should be executed, it will call the execute method on each command managed by the Schedule.

Returns:
String the ScheduledApp type


Copyright © 2002,2003 OpenEAI Software Foundation