org.openeai.config
Class ScheduledAppConfig

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.config.EnterpriseConfigurationObjectImpl
          extended by org.openeai.config.ScheduledAppConfig
All Implemented Interfaces:
EnterpriseConfigurationObject

public class ScheduledAppConfig
extends EnterpriseConfigurationObjectImpl
implements EnterpriseConfigurationObject

A ScheduledAppConfig is a wrapper class that takes information stored in an OpenEAI Deployment document (ScheduleAppConfig Element) and stores it in a Java object. Then the configuration object is passed to the constructor of the OpenEAI ScheduledApps and they are able to configure themselves with the information found in the config object.

Configuration Parameters:

These are the configuration parameters specified by the ScheduledAppConfig Element in the Deployment document. NOTE: Like all other OpenEAI configuration objects, there is a "container" level associated to ScheduledAppConfig objects. Many Elements and attributes are required at that level and may be optionally overridden at this level. This is to avoid having to enter redundant information in the Deployment document if all (or most) ScheduledAppConfig objects being configured should use the same configuration information. Therefore, many of the ScheduledApp configuration parameters are optional at this level but required at the "container" level. Where this is the case, it will be indicated by an "*".

Name Required Description
name yes Name of the ScheduledApp being configured. This should be unique.
type (daemon | application | triggered) no* This parameter indicates what type of Scheduled application is being started. Currently, there are three types:
  • daemon - indicates that the scheduled application should sleep for the specified interval, wake up, and if any Schedules should be executed, execute the ScheduledCommands associated to them. Then it should go back to sleep for the specified interval. It should continue this process indefinitely or until it's manually shut down. This allows an organization to use the flexible OpenEAI scheduling foundation to execute various business logic on different days and at different times (ScheduleRuntime) all within the same running process.
  • application - indicates that the scheduled application should sleep for the specified interval, wake up and execute the ScheduledCommands for all Schedules associated to this Scheduled App. Then it should exit when the Schedules have been executed. This would be a "typical" batch type application that starts, performs it's business logic and then exits. The reason this is a critical type of application is that it allows an organization to build many different applications that perform different business logic (ScheduledCommands) and run them all with the same start script. Instead of having to deploy a specific start script of some sort for each application developed.
  • triggered - behaves just like an "application" but instead of automatically exiting upon completion, it will wait until it recieves a shutdown hook from the operating system.
scheduleCheckInterval no* Time in milliseconds that the ScheduledApp should sleep between checking Schedules. If the Scheduled App is of type 'daemon' this is the amount of time between checking Schedules. If the app is of type 'application' or 'triggered' this is the initial amount of time the Scheduled App will sleep prior to executing the Schedules for the application.
ConfigClass no* Name of the configuration class that wraps the config Element (this class)
ObjectClass yes Name of the Java object that will be instantiated with this Config class (currently, org.openeai.afa.ScheduledApp)
ScheduleIdRepository no This elements allows you to specify where you would like the ScheduledApp to maintain the list of Schedules it's processed. This is a persistent repository it uses to survive being shutdown. When a 'daemon' Scheduled App executes a Schedule that has 'RunTimes' associated to it, it keeps a record of that execution so it won't execute it again if the application is restarted. This is all built into the Scheduled app foundation and is only applicable to Scheduled applications that are of type 'daemon' and have Schedules with 'Runtimes' associated to them.

By default, the file system is used to store this list of executed schedules. This repository is implemented in the org.openeai.afa.FileScheduleIdStore class. If no ScheduleIdRepository is specified, this repository will be used and the ScheduleIds will be written to a subdirectory called 'ScheduleIds' that is relevant to the location of execution.

Another useful repository implementation is the org.openeai.afa.DbScheduleIdStore class which uses a simple database structure to store the ids associated to executed schedules. This is very useful if you need to run multiple instances of a Scheduled Application on multiple hosts and they don't all have access to the same file system resources.

ThreadPoolConfig no* Contains information that the ScheduledApp uses to initialize a ThreadPool object that it uses to execute ScheduledCommands associated to Schedules when they are met.
Schedules yes Contains configuration information related to all the Schedules that this ScheduledApp will at some time execute. A ScheduledApp may execute ScheduledCommands associated to many different Schedules in the same running process. See ScheduleConfig and the Schedule object for more information about this item.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
ScheduleConfig, CommandConfig, ScheduledApp, Schedule, ScheduledCommand, ScheduleRuntime, FileScheduleIdStore, DbScheduleIdStore

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
ScheduledAppConfig()
          This is the constructor used by AppConfig to instantiate the config object.
ScheduledAppConfig(org.jdom.Element configElement)
           
 
Method Summary
 void addScheduleConfig(java.lang.String name, ScheduleConfig cConfig)
          Adds a Schedule configuration object to the HashMap of ScheduleConfigs contained within this ScheduledApp.
 ScheduleConfig getScheduleConfig(java.lang.String name)
          Returns a ScheduleConfig object for the name specified.
 java.util.HashMap getScheduleConfigs()
          Returns a HashMap containing all Schedule configuration objects that will be used to intialize the Schedules associated to this ScheduledApp.
 ScheduleIdStore getScheduleIdStore()
           
 ThreadPoolConfig getThreadPoolConfig()
          Returns the ThreadPool configuration object that will be used to initialize the ThreadPool associated to the ScheduledApp.
 void init(org.jdom.Element configElement)
          Implements the init(Element) method that all EnterpriseConfiguration objects must implement.
 void setScheduleIdStore(ScheduleIdStore store)
           
 void setThreadPoolConfig(ThreadPoolConfig tConfig)
          Sets the ThreadPool configuration object that will be used to initialize the ThreadPool associated to the ScheduledApp.
 
Methods inherited from class org.openeai.config.EnterpriseConfigurationObjectImpl
addProperty, getAppName, getConfigDoc, getConfigElementByAttributeValue, getElementByAttributeValue, getName, getType, getValidation, refresh, setAppName, setConfigDoc, setName, setRefresh, setType, setValidation
 
Methods inherited from class org.openeai.OpenEaiObject
getDebug, getFromAddr, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openeai.config.EnterpriseConfigurationObject
getAppName, getProperties, refresh, setAppName
 

Constructor Detail

ScheduledAppConfig

public ScheduledAppConfig()
This is the constructor used by AppConfig to instantiate the config object. Then, AppConfig calls this object's init(Element) method passing the configuration element it retrieved from the XML configuration document which this object uses to configure itself. After this object has initialized itself, it will be used to instantiate and initialize the framework object (MessageObject, Producers, Consumers, ThreadPools etc.) with the properties it's been initialized with.


ScheduledAppConfig

public ScheduledAppConfig(org.jdom.Element configElement)
                   throws EnterpriseConfigurationObjectException
Throws:
EnterpriseConfigurationObjectException
Method Detail

getScheduleConfigs

public java.util.HashMap getScheduleConfigs()
Returns a HashMap containing all Schedule configuration objects that will be used to intialize the Schedules associated to this ScheduledApp.

Returns:
HashMap

addScheduleConfig

public void addScheduleConfig(java.lang.String name,
                              ScheduleConfig cConfig)
Adds a Schedule configuration object to the HashMap of ScheduleConfigs contained within this ScheduledApp.

Parameters:
name - String the name of the Schedule that will be configured (also the key in the HashMap)
cConfig - ScheduleConfig the Schedule's configuration object that will be used to initialize the Schedule object.
See Also:
Schedule, ScheduleConfig

getScheduleConfig

public ScheduleConfig getScheduleConfig(java.lang.String name)
Returns a ScheduleConfig object for the name specified.

Parameters:
name - String the name of the schedule
Returns:
ScheduleConfig

setThreadPoolConfig

public void setThreadPoolConfig(ThreadPoolConfig tConfig)
Sets the ThreadPool configuration object that will be used to initialize the ThreadPool associated to the ScheduledApp.

Parameters:
tConfig - ThreadPoolConfig
See Also:
ScheduledApp, ThreadPool

getThreadPoolConfig

public ThreadPoolConfig getThreadPoolConfig()
Returns the ThreadPool configuration object that will be used to initialize the ThreadPool associated to the ScheduledApp.

Returns:
ThreadPoolConfig
See Also:
ScheduledApp, ThreadPool

setScheduleIdStore

public void setScheduleIdStore(ScheduleIdStore store)

getScheduleIdStore

public ScheduleIdStore getScheduleIdStore()

init

public void init(org.jdom.Element configElement)
          throws EnterpriseConfigurationObjectException
Implements the init(Element) method that all EnterpriseConfiguration objects must implement. This init method takes the Configuration element passed in and pulls out configuration information specific to the ScheduledApp being initialized. Then it sets various instance variables and properties on itself which will be used by the ScheduledApp when AppConfig instantiates it passing this configuration object. The ScheduledApp will then use the configuration java object to initialize itself.

Specified by:
init in interface EnterpriseConfigurationObject
Overrides:
init in class EnterpriseConfigurationObjectImpl
Parameters:
configElement - Element the configuration element that AppConfig has pulled from the configuration document relevant to the ScheduledApp being configured. Or, the element that was found in the init() method.
Throws:
EnterpriseConfigurationObjectException - if errors occur processing the configuration Element.


Copyright © 2002,2003 OpenEAI Software Foundation