org.openeai.afa
Class DbScheduleIdStore

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.afa.ScheduleIdStoreImpl
          extended by org.openeai.afa.DbScheduleIdStore
All Implemented Interfaces:
ScheduleIdStore

public class DbScheduleIdStore
extends ScheduleIdStoreImpl
implements ScheduleIdStore

This maintains a list of all Schedules that have been executed by a given ScheduledApp. The Schedule is responsible for clearing the list of executed schedules when the day changes (12am). As a Schedule is executed, its Schedule Id is added to this store so the Schedule won't execute more than once during a 24 hour period. Additionally, this store is persisted to a configurable location so the store survives application starting and stopping.

This implementation, supports storing and loading schedule ids from a database. The configuration information for the repository is specified in the ScheduledAppConfig element.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org)
See Also:
Schedule, FileScheduleIdStore, ScheduledApp, ScheduledAppConfig

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
DbScheduleIdStore()
           
 
Method Summary
 void add(java.lang.String scheduleId)
          Adds a Schedule Id to this store.
 boolean contains(java.lang.String scheduleId)
          Determines if a particular Schedule Id exists in this store.
 void init(AppConfig aConfig)
           
 void load()
          Loads any previously ran schedule ids into memory when the application starts.
 void remove(java.lang.String scheduleId)
          Removes a specific schedule id from the repository that has an id equal to the schedule id passed in.
 void removeSchedulesLike(java.lang.String schedulePattern)
          Removes all schedule ids from the repository that have an id containing the pattern passed in.
 
Methods inherited from class org.openeai.afa.ScheduleIdStoreImpl
getAppConfig, getScheduleIds, setAppConfig, setScheduleIds
 
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

DbScheduleIdStore

public DbScheduleIdStore()
Method Detail

init

public final void init(AppConfig aConfig)
                throws ScheduleIdStoreException
Specified by:
init in interface ScheduleIdStore
Throws:
ScheduleIdStoreException

load

public final void load()
                throws ScheduleIdStoreException
Loads any previously ran schedule ids into memory when the application starts. This is how the store survives application starting and stopping. This ScheduleIdStore loads previously ran schedules from a database structure (T_PROCESSED_SCHEDULES).

Specified by:
load in interface ScheduleIdStore
Throws:
ScheduleIdStoreException

removeSchedulesLike

public final void removeSchedulesLike(java.lang.String schedulePattern)
                               throws ScheduleIdStoreException
Removes all schedule ids from the repository that have an id containing the pattern passed in.

Specified by:
removeSchedulesLike in interface ScheduleIdStore
Parameters:
schedulePattern - String schedulePattern (normally, the app name and the day name)
Throws:
ScheduleIdStoreException

remove

public final void remove(java.lang.String scheduleId)
                  throws ScheduleIdStoreException
Removes a specific schedule id from the repository that has an id equal to the schedule id passed in.

Specified by:
remove in interface ScheduleIdStore
Parameters:
scheduleId - (normally, the app name and the day name and the time (hour/minute))
Throws:
ScheduleIdStoreException

add

public final void add(java.lang.String scheduleId)
               throws ScheduleIdStoreException
Adds a Schedule Id to this store. Also, persists the schedule id to the database (in this case) so it will be available when/if the application is restarted.

Specified by:
add in interface ScheduleIdStore
Parameters:
scheduleId - String the schedule id to be added to the store.
Throws:
ScheduleIdStoreException

contains

public boolean contains(java.lang.String scheduleId)
                 throws ScheduleIdStoreException
Determines if a particular Schedule Id exists in this store. This method checks what's in memory in addition to what's been persisted in the database. If the schedule isn't in memory but it is in the persistent store, it will add the id to the in-memory list of schedule ids. If there are multiple instances running that use this repository, only one of them will execute the schedule. The other instance will always determine that the schedule has been executed by the other process.

Specified by:
contains in interface ScheduleIdStore
Overrides:
contains in class ScheduleIdStoreImpl
Returns:
boolean true if the schedule id exists, false if not.
Throws:
ScheduleIdStoreException


Copyright © 2002,2003 OpenEAI Software Foundation