org.openeai.config
Class ScheduleConfig

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

public class ScheduleConfig
extends EnterpriseConfigurationObjectImpl
implements EnterpriseConfigurationObject

A ScheduleConfig is a wrapper class that takes information stored in an OpenEAI Deployment document (Schedule Element) and stores it in a Java object. Then the configuration object is passed to the constructor of the OpenEAI Schedule objects 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 Schedule Element in the Deployment document. NOTE: Like all other OpenEAI configuration objects, there is a "container" level associated to Schedule elements. Many Elements and attributes are required at the container 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) Schedule objects being configured should use the same configuration information. Therefore, many of the Schedule 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 Schedule being configured. This should be unique.
isImmediate (true | false) no* This flag indicates weather or not the ScheduledCommands associated to this Schedule should be executed immediately when the ScheduledApp awakes from its sleepInterval rather than using a "RunTime" to determine when the Schedule should be processed. If this is true, when the ScheduledApp wakes up, it will execute all ScheduledCommands associated to this Schedule. If it is false, the ScheduledApp will determine when/if the ScheduledCommands associated to this Schedule should be executed based on the Runtime associated to the Schedule.
runMechanism (Thread | SubProcess) no* This parameter indicates how the ScheduledCommands associated to this Schedule should be executed. If "Thread" is specified, the ScheduledCommands will be executed by adding them to the ThreadPool associated to the ScheduledApp. NOTE: Currently, only a runMechansim of "Thread" is supported. In the future, if "SubProcess" is specified a new VM will be started and the ScheduledCommand will be executed in that SubProcess.
ObjectClass yes Name of the Java object that will be instantiated with this Config class (currently, org.openeai.afa.Schedule)
RunTime no If the 'isImmediate' parameter is false, this Element specifies on what day(s) and at what time(s) the ScheduledCommands associated to this Schedule should be executed. If isImmediate is true, this information is ignored. Days are specified as follows:
  • Daily (7 days a week)
  • Weekdays (Monday thru Friday)
  • Weekends (Saturday and Sunday)
  • Sunday
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
Times are specified as the Hour and Minute of the Day that the ScheduledCommands associated to the Schedule should be executed. It is possible to specify that a particular Schedule should be executed at multiple times within a given day.
Commands yes Provides configuration information for the ScheduledCommands associated to this Schedule. The ScheduledCommands use these CommandConfig objects to initialize themselves so they're ready to be executed when this Schedule is met.

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

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
ScheduleConfig()
          This is the constructor used by AppConfig to instantiate the config object.
ScheduleConfig(org.jdom.Element configElement)
           
 
Method Summary
 void addCommandConfig(java.lang.String name, CommandConfig cConfig)
          This method adds a ScheduledCommand's configuration object to the list of CommandConfigs that this Schedule needs to initialize all the ScheduledCommands that it must execute.
 java.lang.String getClassName()
          Ths method returns the class name that will be the Schedule implementation.
 CommandConfig getCommandConfig(java.lang.String name)
          Returns a CommandConfig object for the specified ScheduledCommand name.
 java.util.HashMap getCommandConfigs()
          This method returns a list of all CommandConfig objects associated to this Schedule.
 org.jdom.Element getDefaultParms()
          Returns the default paramaters associated to this Schedule as specified in the "Schedules" Configuration Element (the container) in the application's config document.
 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()
          This method returns the name that will be associated to the Schedule as specified in the deployment document.
 java.util.ArrayList getScheduleRuntimes()
          Returns the list of ScheduleRuntime objects that will be associated to the Schedule being configured with this configuration object.
 void init(org.jdom.Element configElement)
          Implements the init(Element) method that all EnterpriseConfiguration objects must implement.
 boolean isImmediate()
          Returns a flag indicating whether or not the Schedule being configured will be an "immediate" schedule.
 void setClassName(java.lang.String className)
          Ths method sets the class name that will be the Schedule implementation.
 void setDefaultParms(org.jdom.Element eDefaultParms)
          Sets the default paramaters associated to this Schedule as specified in the "Schedules" Configuration Element (the container) in the application's config document.
 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)
          This method sets the name that will be associated to the Schedule as specified in the deployment document.
 
Methods inherited from class org.openeai.config.EnterpriseConfigurationObjectImpl
addProperty, getAppName, getConfigDoc, getConfigElementByAttributeValue, getElementByAttributeValue, getType, getValidation, refresh, setAppName, setConfigDoc, setRefresh, setType, setValidation
 
Methods inherited from class org.openeai.OpenEaiObject
getDebug, getFromAddr, getMailHost, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setDebug, setFromAddr, setMailHost, 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

ScheduleConfig

public ScheduleConfig()
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.


ScheduleConfig

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

setDefaultParms

public void setDefaultParms(org.jdom.Element eDefaultParms)
Sets the default paramaters associated to this Schedule as specified in the "Schedules" Configuration Element (the container) in the application's config document.

These default parameters are built from the "container" level configuration component in the config document (Schedules). This is to allow "default" configuration information to be specified for all Schedules that exist within this container. If needed a particular Schedule can override these default parameters. Otherwise the default parameters are used. This way, duplicate configuration information does not have to be specified for each Schedule.

Parameters:
eDefaultParms - Element

getDefaultParms

public org.jdom.Element getDefaultParms()
Returns the default paramaters associated to this Schedule as specified in the "Schedules" Configuration Element (the container) in the application's config document.

These default parameters are built from the "container" level configuration component in the config document (Schedules). This is to allow "default" configuration information to be specified for all Schedules that exist within this container. If needed a particular Schedule can override these default parameters. Otherwise the default parameters are used. This way, duplicate configuration information does not have to be specified for each Schedule.

Returns:
Element

setName

public void setName(java.lang.String name)
This method sets the name that will be associated to the Schedule as specified in the deployment document.

Overrides:
setName in class EnterpriseConfigurationObjectImpl
Parameters:
name - String the Schedule's name.

getName

public java.lang.String getName()
This method returns the name that will be associated to the Schedule as specified in the deployment document.

Overrides:
getName in class EnterpriseConfigurationObjectImpl
Returns:
String the Schedule's name.

setClassName

public void setClassName(java.lang.String className)
Ths method sets the class name that will be the Schedule implementation. Generally, this will be org.openeai.afa.Schedule. However, by allowing the flexibility of specifying the Schedule implementation, organizations could develop a different implementation of a Schedule that behaves differently if necessary.

Parameters:
className - String the class name of the Schedule implementation.

getClassName

public java.lang.String getClassName()
Ths method returns the class name that will be the Schedule implementation. Generally, this will be org.openeai.afa.Schedule. However, by allowing the flexibility of specifying the Schedule implementation, organizations could develop a different implementation of a Schedule that behaves differently if necessary.

Returns:
String the class name of the Schedule implementation.

getCommandConfigs

public java.util.HashMap getCommandConfigs()
This method returns a list of all CommandConfig objects associated to this Schedule. These configuration objects will be used to initialize the actual ScheduledCommands that this Schedule must execute when the Schedule is met.

Returns:
HashMap
See Also:
Schedule, ScheduledCommand

setMailService

public void setMailService(MailService m)
This method sets the MailService object that will be associated to the Schedule as specified in the deployment document. This MailService object will be used by the ScheduleApp foundation to notify someone if a 'daemon' type application (ScheduledCommand) throws an exception during execution.

Overrides:
setMailService in class OpenEaiObject
Parameters:
m - the mail service object to associate to this schedule.

getMailService

public MailService getMailService()
This method returns the MailService object that will be associated to the Schedule as specified in the deployment document. This MailService object will be used by the ScheduleApp foundation to notify someone if a 'daemon' type application (ScheduledCommand) throws an exception during execution.

Overrides:
getMailService in class OpenEaiObject
Returns:
MailService the mail service object.

addCommandConfig

public void addCommandConfig(java.lang.String name,
                             CommandConfig cConfig)
This method adds a ScheduledCommand's configuration object to the list of CommandConfigs that this Schedule needs to initialize all the ScheduledCommands that it must execute. This method is called as the ScheduleConfig object reads through the deployment document and retrieves configuration information.

Parameters:
name - String the name of the ScheduledCommand
cConfig - CommandConfig the CommandConfig java object that wraps the configuration Element in the deployment document
See Also:
ScheduledCommand, CommandConfig, Schedule

getCommandConfig

public CommandConfig getCommandConfig(java.lang.String name)
Returns a CommandConfig object for the specified ScheduledCommand name.

Returns:
CommandConfig

getScheduleRuntimes

public java.util.ArrayList getScheduleRuntimes()
Returns the list of ScheduleRuntime objects that will be associated to the Schedule being configured with this configuration object.

Returns:
ArrayList
See Also:
Schedule, ScheduleRuntime

isImmediate

public boolean isImmediate()
Returns a flag indicating whether or not the Schedule being configured will be an "immediate" schedule.

Returns:
boolean
See Also:
Schedule

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 Schedule being initialized. Then it sets various instance variables and properties on itself which will be used by the Schedule when the ScheculedApp instantiates it passing this configuration object. The Schedule 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 Schedule being configured. Or, the element that was found in the init() method.
Throws:
EnterpriseConfigurationObjectException - if errors occur processing the configuration Element.
See Also:
Schedule, ScheduledApp


Copyright © 2002,2003 OpenEAI Software Foundation