org.quartz.impl.jdbcjobstore
Interface DriverDelegate

All Known Implementing Classes:
CloudscapeDelegate, DB2v6Delegate, DB2v7Delegate, DB2v8Delegate, HSQLDBDelegate, MSSQLDelegate, OracleDelegate, PointbaseDelegate, PostgreSQLDelegate, StdJDBCDelegate, WebLogicDelegate, WebLogicOracleDelegate

public interface DriverDelegate

This is the base interface for all driver delegate classes.

This interface is very similar to the JobStore interface except each method has an additional Connection parameter.

Unless a database driver has some extremely-DB-specific requirements, any DriverDelegate implementation classes should extend the StdJDBCDelegate class.

Author:
Jeffrey Wescott, James House

Method Summary
 boolean calendarExists(Connection conn, String calendarName)
           Check whether or not a calendar exists.
 boolean calendarIsReferenced(Connection conn, String calendarName)
           Check whether or not a calendar is referenced by any triggers.
 int countMisfiredTriggersInStates(Connection conn, String state1, String state2, long ts)
           Get the number of triggers in the given states that have misfired - according to the given timestamp.
 int deleteAllPausedTriggerGroups(Connection conn)
           
 int deleteBlobTrigger(Connection conn, String triggerName, String groupName)
           Delete the BLOB trigger data for a trigger.
 int deleteCalendar(Connection conn, String calendarName)
           Delete a calendar.
 int deleteCronTrigger(Connection conn, String triggerName, String groupName)
           Delete the cron trigger data for a trigger.
 int deleteFiredTrigger(Connection conn, String entryId)
           Delete a fired trigger.
 int deleteFiredTriggers(Connection conn)
           Delete all fired triggers.
 int deleteFiredTriggers(Connection conn, String instanceId)
           Delete all fired triggers of the given instance.
 int deleteJobDetail(Connection conn, String jobName, String groupName)
           Delete the job detail record for the given job.
 int deleteJobListeners(Connection conn, String jobName, String groupName)
           Delete all job listeners for the given job.
 int deletePausedTriggerGroup(Connection conn, String groupName)
           
 int deleteSchedulerState(Connection conn, String instanceId)
           Delete a scheduler-instance state record.
 int deleteSimpleTrigger(Connection conn, String triggerName, String groupName)
           Delete the simple trigger data for a trigger.
 int deleteTrigger(Connection conn, String triggerName, String groupName)
           Delete the base trigger data for a trigger.
 int deleteTriggerListeners(Connection conn, String triggerName, String groupName)
           Delete all of the listeners associated with a given trigger.
 int deleteVolatileFiredTriggers(Connection conn)
           Delete all volatile fired triggers.
 int insertBlobTrigger(Connection conn, Trigger trigger)
           Insert the blob trigger data.
 int insertCalendar(Connection conn, String calendarName, Calendar calendar)
           Insert a new calendar.
 int insertCronTrigger(Connection conn, CronTrigger trigger)
           Insert the cron trigger data.
 int insertFiredTrigger(Connection conn, Trigger trigger, String state, JobDetail jobDetail)
           Insert a fired trigger.
 int insertJobDetail(Connection conn, JobDetail job)
           Insert the job detail record.
 int insertJobListener(Connection conn, JobDetail job, String listener)
           Associate a listener with a job.
 int insertPausedTriggerGroup(Connection conn, String groupName)
           
 int insertSchedulerState(Connection conn, String instanceId, long checkInTime, long interval)
           Insert a scheduler-instance state record.
 int insertSimpleTrigger(Connection conn, SimpleTrigger trigger)
           Insert the simple trigger data.
 int insertTrigger(Connection conn, Trigger trigger, String state, JobDetail jobDetail)
           Insert the base trigger data.
 int insertTriggerListener(Connection conn, Trigger trigger, String listener)
           Associate a listener with the given trigger.
 boolean isExistingTriggerGroup(Connection conn, String groupName)
           
 boolean isJobStateful(Connection conn, String jobName, String groupName)
           Check whether or not the given job is stateful.
 boolean isTriggerGroupPaused(Connection conn, String groupName)
           
 boolean jobExists(Connection conn, String jobName, String groupName)
           Check whether or not the given job exists.
 Calendar selectCalendar(Connection conn, String calendarName)
           Select a calendar.
 String[] selectCalendars(Connection conn)
           Select all of the stored calendars.
 Set selectFiredTriggerInstanceNames(Connection conn)
           Select the distinct instance names of all fired-trigger records.
 List selectFiredTriggerRecords(Connection conn, String triggerName, String groupName)
           Select the states of all fired-trigger records for a given trigger, or trigger group if trigger name is null.
 List selectFiredTriggerRecordsByJob(Connection conn, String jobName, String groupName)
           Select the states of all fired-trigger records for a given job, or job group if job name is null.
 List selectInstancesFiredTriggerRecords(Connection conn, String instanceName)
           Select the states of all fired-trigger records for a given scheduler instance.
 JobDetail selectJobDetail(Connection conn, String jobName, String groupName, ClassLoadHelper loadHelper)
           Select the JobDetail object for a given job name / group name.
 int selectJobExecutionCount(Connection conn, String jobName, String jobGroup)
           Get the number instances of the identified job currently executing.
 JobDetail selectJobForTrigger(Connection conn, String triggerName, String groupName, ClassLoadHelper loadHelper)
           Select the job to which the trigger is associated.
 String[] selectJobGroups(Connection conn)
           Select all of the job group names that are stored.
 String[] selectJobListeners(Connection conn, String jobName, String groupName)
           Get all of the listeners for a given job.
 String[] selectJobsInGroup(Connection conn, String groupName)
           Select all of the jobs contained in a given group.
 Key[] selectMisfiredTriggers(Connection conn, long ts)
           Get the names of all of the triggers that have misfired - according to the given timestamp.
 Key[] selectMisfiredTriggersInGroupInState(Connection conn, String groupName, String state, long ts)
           Get the names of all of the triggers in the given group and state that have misfired - according to the given timestamp.
 Key[] selectMisfiredTriggersInState(Connection conn, String state, long ts)
           Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.
 boolean selectMisfiredTriggersInStates(Connection conn, String state1, String state2, long ts, int count, List resultList)
           Get the names of all of the triggers in the given states that have misfired - according to the given timestamp.
 long selectNextFireTime(Connection conn)
          Deprecated. Does not account for misfires.
 int selectNumCalendars(Connection conn)
           Select the total number of calendars stored.
 int selectNumJobs(Connection conn)
           Select the total number of jobs stored.
 int selectNumTriggers(Connection conn)
           Select the total number of triggers stored.
 int selectNumTriggersForJob(Connection conn, String jobName, String groupName)
           Select the number of triggers associated with a given job.
 Set selectPausedTriggerGroups(Connection conn)
           
 List selectSchedulerStateRecords(Connection conn, String instanceId)
           A List of all current SchedulerStateRecords.
 List selectStatefulJobsOfTriggerGroup(Connection conn, String groupName)
           Select the stateful jobs which are referenced by triggers in the given trigger group.
 Trigger selectTrigger(Connection conn, String triggerName, String groupName)
           Select a trigger.
 Key selectTriggerForFireTime(Connection conn, long fireTime)
           Select the trigger that will be fired at the given fire time.
 String[] selectTriggerGroups(Connection conn)
           Select all of the trigger group names that are stored.
 JobDataMap selectTriggerJobDataMap(Connection conn, String triggerName, String groupName)
           Select a trigger's JobDataMap.
 String[] selectTriggerListeners(Connection conn, String triggerName, String groupName)
           Select the listeners associated with a given trigger.
 Key[] selectTriggerNamesForJob(Connection conn, String jobName, String groupName)
           Get the names of all of the triggers associated with the given job.
 Trigger[] selectTriggersForCalendar(Connection conn, String calName)
           Select the triggers for a calendar
 Trigger[] selectTriggersForJob(Connection conn, String jobName, String groupName)
           Select the triggers for a job
 Trigger[] selectTriggersForRecoveringJobs(Connection conn)
           Select all of the triggers for jobs that are requesting recovery.
 String[] selectTriggersInGroup(Connection conn, String groupName)
           Select all of the triggers contained in a given group.
 Key[] selectTriggersInState(Connection conn, String state)
           Select all of the triggers in a given state.
 String selectTriggerState(Connection conn, String triggerName, String groupName)
           Select a trigger' state value.
 TriggerStatus selectTriggerStatus(Connection conn, String triggerName, String groupName)
           Select a trigger' status (state & next fire time).
 List selectTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan)
           Select the next trigger which will fire to fire between the two given timestamps in ascending order of fire time, and then descending by priority.
 Key[] selectVolatileJobs(Connection conn)
           Get the names of all of the jobs that are volatile.
 Key[] selectVolatileTriggers(Connection conn)
           Get the names of all of the triggers that are volatile.
 boolean triggerExists(Connection conn, String triggerName, String groupName)
           Check whether or not a trigger exists.
 int updateBlobTrigger(Connection conn, Trigger trigger)
           Update the blob trigger data.
 int updateCalendar(Connection conn, String calendarName, Calendar calendar)
           Update a calendar.
 int updateCronTrigger(Connection conn, CronTrigger trigger)
           Update the cron trigger data.
 int updateJobData(Connection conn, JobDetail job)
           Update the job data map for the given job.
 int updateJobDetail(Connection conn, JobDetail job)
           Update the job detail record.
 int updateSchedulerState(Connection conn, String instanceId, long checkInTime)
           Update a scheduler-instance state record.
 int updateSimpleTrigger(Connection conn, SimpleTrigger trigger)
           Update the simple trigger data.
 int updateTrigger(Connection conn, Trigger trigger, String state, JobDetail jobDetail)
           Update the base trigger data.
 int updateTriggerGroupStateFromOtherState(Connection conn, String groupName, String newState, String oldState)
           Update all of the triggers of the given group to the given new state, if they are in the given old state.
 int updateTriggerGroupStateFromOtherStates(Connection conn, String groupName, String newState, String oldState1, String oldState2, String oldState3)
           Update all triggers in the given group to the given new state, if they are in one of the given old states.
 int updateTriggerState(Connection conn, String triggerName, String groupName, String state)
           Update the state for a given trigger.
 int updateTriggerStateFromOtherState(Connection conn, String triggerName, String groupName, String newState, String oldState)
           Update the given trigger to the given new state, if it is in the given old state.
 int updateTriggerStateFromOtherStates(Connection conn, String triggerName, String groupName, String newState, String oldState1, String oldState2, String oldState3)
           Update the given trigger to the given new state, if it is one of the given old states.
 int updateTriggerStateFromOtherStatesBeforeTime(Connection conn, String newState, String oldState1, String oldState2, long time)
           Update the all triggers to the given new state, if they are in one of the given old states AND its next fire time is before the given time.
 int updateTriggerStatesForJob(Connection conn, String jobName, String groupName, String state)
           Update the states of all triggers associated with the given job.
 int updateTriggerStatesForJobFromOtherState(Connection conn, String jobName, String groupName, String state, String oldState)
           Update the states of any triggers associated with the given job, that are the given current state.
 int updateTriggerStatesFromOtherStates(Connection conn, String newState, String oldState1, String oldState2)
           Update all triggers having one of the two given states, to the given new state.
 

Method Detail

updateTriggerStatesFromOtherStates

int updateTriggerStatesFromOtherStates(Connection conn,
                                       String newState,
                                       String oldState1,
                                       String oldState2)
                                       throws SQLException

Update all triggers having one of the two given states, to the given new state.

Parameters:
conn - the DB Connection
newState - the new state for the triggers
oldState1 - the first old state to update
oldState2 - the second old state to update
Returns:
number of rows updated
Throws:
SQLException

selectMisfiredTriggers

Key[] selectMisfiredTriggers(Connection conn,
                             long ts)
                             throws SQLException

Get the names of all of the triggers that have misfired - according to the given timestamp.

Parameters:
conn - the DB Connection
Returns:
an array of Key objects
Throws:
SQLException

selectMisfiredTriggersInState

Key[] selectMisfiredTriggersInState(Connection conn,
                                    String state,
                                    long ts)
                                    throws SQLException

Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.

Parameters:
conn - the DB Connection
Returns:
an array of Key objects
Throws:
SQLException

selectMisfiredTriggersInStates

boolean selectMisfiredTriggersInStates(Connection conn,
                                       String state1,
                                       String state2,
                                       long ts,
                                       int count,
                                       List resultList)
                                       throws SQLException

Get the names of all of the triggers in the given states that have misfired - according to the given timestamp. No more than count will be returned.

Parameters:
conn - the DB Connection
count - the most misfired triggers to return, negative for all
resultList - Output parameter. A List of Key objects. Must not be null.
Returns:
Whether there are more misfired triggers left to find beyond the given count.
Throws:
SQLException

countMisfiredTriggersInStates

int countMisfiredTriggersInStates(Connection conn,
                                  String state1,
                                  String state2,
                                  long ts)
                                  throws SQLException

Get the number of triggers in the given states that have misfired - according to the given timestamp.

Parameters:
conn - the DB Connection
Throws:
SQLException

selectMisfiredTriggersInGroupInState

Key[] selectMisfiredTriggersInGroupInState(Connection conn,
                                           String groupName,
                                           String state,
                                           long ts)
                                           throws SQLException

Get the names of all of the triggers in the given group and state that have misfired - according to the given timestamp.

Parameters:
conn - the DB Connection
Returns:
an array of Key objects
Throws:
SQLException

selectTriggersForRecoveringJobs

Trigger[] selectTriggersForRecoveringJobs(Connection conn)
                                          throws SQLException,
                                                 IOException,
                                                 ClassNotFoundException

Select all of the triggers for jobs that are requesting recovery. The returned trigger objects will have unique "recoverXXX" trigger names and will be in the Scheduler.DEFAULT_RECOVERY_GROUP trigger group.

In order to preserve the ordering of the triggers, the fire time will be set from the COL_FIRED_TIME column in the TABLE_FIRED_TRIGGERS table. The caller is responsible for calling computeFirstFireTime on each returned trigger. It is also up to the caller to insert the returned triggers to ensure that they are fired.

Parameters:
conn - the DB Connection
Returns:
an array of Trigger objects
Throws:
SQLException
IOException
ClassNotFoundException

deleteFiredTriggers

int deleteFiredTriggers(Connection conn)
                        throws SQLException

Delete all fired triggers.

Parameters:
conn - the DB Connection
Returns:
the number of rows deleted
Throws:
SQLException

deleteFiredTriggers

int deleteFiredTriggers(Connection conn,
                        String instanceId)
                        throws SQLException

Delete all fired triggers of the given instance.

Parameters:
conn - the DB Connection
Returns:
the number of rows deleted
Throws:
SQLException

deleteVolatileFiredTriggers

int deleteVolatileFiredTriggers(Connection conn)
                                throws SQLException

Delete all volatile fired triggers.

Parameters:
conn - the DB Connection
Returns:
the number of rows deleted
Throws:
SQLException

selectVolatileTriggers

Key[] selectVolatileTriggers(Connection conn)
                             throws SQLException

Get the names of all of the triggers that are volatile.

Parameters:
conn - the DB Connection
Returns:
an array of Key objects
Throws:
SQLException

selectVolatileJobs

Key[] selectVolatileJobs(Connection conn)
                         throws SQLException

Get the names of all of the jobs that are volatile.

Parameters:
conn - the DB Connection
Returns:
an array of Key objects
Throws:
SQLException

insertJobDetail

int insertJobDetail(Connection conn,
                    JobDetail job)
                    throws IOException,
                           SQLException

Insert the job detail record.

Parameters:
conn - the DB Connection
job - the job to insert
Returns:
number of rows inserted
Throws:
IOException - if there were problems serializing the JobDataMap
SQLException

updateJobDetail

int updateJobDetail(Connection conn,
                    JobDetail job)
                    throws IOException,
                           SQLException

Update the job detail record.

Parameters:
conn - the DB Connection
job - the job to update
Returns:
number of rows updated
Throws:
IOException - if there were problems serializing the JobDataMap
SQLException

selectTriggerNamesForJob

Key[] selectTriggerNamesForJob(Connection conn,
                               String jobName,
                               String groupName)
                               throws SQLException

Get the names of all of the triggers associated with the given job.

Parameters:
conn - the DB Connection
jobName - the job name
groupName - the job group
Returns:
an array of Key objects
Throws:
SQLException

deleteJobListeners

int deleteJobListeners(Connection conn,
                       String jobName,
                       String groupName)
                       throws SQLException

Delete all job listeners for the given job.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
Returns:
the number of rows deleted
Throws:
SQLException

deleteJobDetail

int deleteJobDetail(Connection conn,
                    String jobName,
                    String groupName)
                    throws SQLException

Delete the job detail record for the given job.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
Returns:
the number of rows deleted
Throws:
SQLException

isJobStateful

boolean isJobStateful(Connection conn,
                      String jobName,
                      String groupName)
                      throws SQLException

Check whether or not the given job is stateful.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
Returns:
true if the job exists and is stateful, false otherwise
Throws:
SQLException

jobExists

boolean jobExists(Connection conn,
                  String jobName,
                  String groupName)
                  throws SQLException

Check whether or not the given job exists.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
Returns:
true if the job exists, false otherwise
Throws:
SQLException

updateJobData

int updateJobData(Connection conn,
                  JobDetail job)
                  throws IOException,
                         SQLException

Update the job data map for the given job.

Parameters:
conn - the DB Connection
job - the job to update
Returns:
the number of rows updated
Throws:
IOException - if there were problems serializing the JobDataMap
SQLException

insertJobListener

int insertJobListener(Connection conn,
                      JobDetail job,
                      String listener)
                      throws SQLException

Associate a listener with a job.

Parameters:
conn - the DB Connection
job - the job to associate with the listener
listener - the listener to insert
Returns:
the number of rows inserted
Throws:
SQLException

selectJobListeners

String[] selectJobListeners(Connection conn,
                            String jobName,
                            String groupName)
                            throws SQLException

Get all of the listeners for a given job.

Parameters:
conn - the DB Connection
jobName - the job name whose listeners are wanted
groupName - the group containing the job
Returns:
array of String listener names
Throws:
SQLException

selectJobDetail

JobDetail selectJobDetail(Connection conn,
                          String jobName,
                          String groupName,
                          ClassLoadHelper loadHelper)
                          throws ClassNotFoundException,
                                 IOException,
                                 SQLException

Select the JobDetail object for a given job name / group name.

Parameters:
conn - the DB Connection
jobName - the job name whose listeners are wanted
groupName - the group containing the job
Returns:
the populated JobDetail object
Throws:
ClassNotFoundException - if a class found during deserialization cannot be found or if the job class could not be found
IOException - if deserialization causes an error
SQLException

selectNumJobs

int selectNumJobs(Connection conn)
                  throws SQLException

Select the total number of jobs stored.

Parameters:
conn - the DB Connection
Returns:
the total number of jobs stored
Throws:
SQLException

selectJobGroups

String[] selectJobGroups(Connection conn)
                         throws SQLException

Select all of the job group names that are stored.

Parameters:
conn - the DB Connection
Returns:
an array of String group names
Throws:
SQLException

selectJobsInGroup

String[] selectJobsInGroup(Connection conn,
                           String groupName)
                           throws SQLException

Select all of the jobs contained in a given group.

Parameters:
conn - the DB Connection
groupName - the group containing the jobs
Returns:
an array of String job names
Throws:
SQLException

insertTrigger

int insertTrigger(Connection conn,
                  Trigger trigger,
                  String state,
                  JobDetail jobDetail)
                  throws SQLException,
                         IOException

Insert the base trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
state - the state that the trigger should be stored in
Returns:
the number of rows inserted
Throws:
SQLException
IOException

insertSimpleTrigger

int insertSimpleTrigger(Connection conn,
                        SimpleTrigger trigger)
                        throws SQLException

Insert the simple trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows inserted
Throws:
SQLException

insertBlobTrigger

int insertBlobTrigger(Connection conn,
                      Trigger trigger)
                      throws SQLException,
                             IOException

Insert the blob trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows inserted
Throws:
SQLException
IOException

insertCronTrigger

int insertCronTrigger(Connection conn,
                      CronTrigger trigger)
                      throws SQLException

Insert the cron trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows inserted
Throws:
SQLException

updateTrigger

int updateTrigger(Connection conn,
                  Trigger trigger,
                  String state,
                  JobDetail jobDetail)
                  throws SQLException,
                         IOException

Update the base trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
state - the state that the trigger should be stored in
Returns:
the number of rows updated
Throws:
SQLException
IOException

updateSimpleTrigger

int updateSimpleTrigger(Connection conn,
                        SimpleTrigger trigger)
                        throws SQLException

Update the simple trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows updated
Throws:
SQLException

updateCronTrigger

int updateCronTrigger(Connection conn,
                      CronTrigger trigger)
                      throws SQLException

Update the cron trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows updated
Throws:
SQLException

updateBlobTrigger

int updateBlobTrigger(Connection conn,
                      Trigger trigger)
                      throws SQLException,
                             IOException

Update the blob trigger data.

Parameters:
conn - the DB Connection
trigger - the trigger to insert
Returns:
the number of rows updated
Throws:
SQLException
IOException

triggerExists

boolean triggerExists(Connection conn,
                      String triggerName,
                      String groupName)
                      throws SQLException

Check whether or not a trigger exists.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the number of rows updated
Throws:
SQLException

updateTriggerState

int updateTriggerState(Connection conn,
                       String triggerName,
                       String groupName,
                       String state)
                       throws SQLException

Update the state for a given trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
state - the new state for the trigger
Returns:
the number of rows updated
Throws:
SQLException

updateTriggerStateFromOtherState

int updateTriggerStateFromOtherState(Connection conn,
                                     String triggerName,
                                     String groupName,
                                     String newState,
                                     String oldState)
                                     throws SQLException

Update the given trigger to the given new state, if it is in the given old state.

Parameters:
conn - the DB connection
triggerName - the name of the trigger
groupName - the group containing the trigger
newState - the new state for the trigger
oldState - the old state the trigger must be in
Returns:
int the number of rows updated
Throws:
SQLException

updateTriggerStateFromOtherStates

int updateTriggerStateFromOtherStates(Connection conn,
                                      String triggerName,
                                      String groupName,
                                      String newState,
                                      String oldState1,
                                      String oldState2,
                                      String oldState3)
                                      throws SQLException

Update the given trigger to the given new state, if it is one of the given old states.

Parameters:
conn - the DB connection
triggerName - the name of the trigger
groupName - the group containing the trigger
newState - the new state for the trigger
oldState1 - one of the old state the trigger must be in
oldState2 - one of the old state the trigger must be in
oldState3 - one of the old state the trigger must be in
Returns:
int the number of rows updated
Throws:
SQLException

updateTriggerStateFromOtherStatesBeforeTime

int updateTriggerStateFromOtherStatesBeforeTime(Connection conn,
                                                String newState,
                                                String oldState1,
                                                String oldState2,
                                                long time)
                                                throws SQLException

Update the all triggers to the given new state, if they are in one of the given old states AND its next fire time is before the given time.

Parameters:
conn - the DB connection
newState - the new state for the trigger
oldState1 - one of the old state the trigger must be in
oldState2 - one of the old state the trigger must be in
time - the time before which the trigger's next fire time must be
Returns:
int the number of rows updated
Throws:
SQLException

updateTriggerGroupStateFromOtherStates

int updateTriggerGroupStateFromOtherStates(Connection conn,
                                           String groupName,
                                           String newState,
                                           String oldState1,
                                           String oldState2,
                                           String oldState3)
                                           throws SQLException

Update all triggers in the given group to the given new state, if they are in one of the given old states.

Parameters:
conn - the DB connection
groupName - the group containing the trigger
newState - the new state for the trigger
oldState1 - one of the old state the trigger must be in
oldState2 - one of the old state the trigger must be in
oldState3 - one of the old state the trigger must be in
Returns:
int the number of rows updated
Throws:
SQLException

updateTriggerGroupStateFromOtherState

int updateTriggerGroupStateFromOtherState(Connection conn,
                                          String groupName,
                                          String newState,
                                          String oldState)
                                          throws SQLException

Update all of the triggers of the given group to the given new state, if they are in the given old state.

Parameters:
conn - the DB connection
groupName - the group containing the triggers
newState - the new state for the trigger group
oldState - the old state the triggers must be in
Returns:
int the number of rows updated
Throws:
SQLException

updateTriggerStatesForJob

int updateTriggerStatesForJob(Connection conn,
                              String jobName,
                              String groupName,
                              String state)
                              throws SQLException

Update the states of all triggers associated with the given job.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
state - the new state for the triggers
Returns:
the number of rows updated
Throws:
SQLException

updateTriggerStatesForJobFromOtherState

int updateTriggerStatesForJobFromOtherState(Connection conn,
                                            String jobName,
                                            String groupName,
                                            String state,
                                            String oldState)
                                            throws SQLException

Update the states of any triggers associated with the given job, that are the given current state.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
state - the new state for the triggers
oldState - the old state of the triggers
Returns:
the number of rows updated
Throws:
SQLException

deleteTriggerListeners

int deleteTriggerListeners(Connection conn,
                           String triggerName,
                           String groupName)
                           throws SQLException

Delete all of the listeners associated with a given trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger whose listeners will be deleted
groupName - the name of the group containing the trigger
Returns:
the number of rows deleted
Throws:
SQLException

insertTriggerListener

int insertTriggerListener(Connection conn,
                          Trigger trigger,
                          String listener)
                          throws SQLException

Associate a listener with the given trigger.

Parameters:
conn - the DB Connection
trigger - the trigger
listener - the name of the listener to associate with the trigger
Returns:
the number of rows inserted
Throws:
SQLException

selectTriggerListeners

String[] selectTriggerListeners(Connection conn,
                                String triggerName,
                                String groupName)
                                throws SQLException

Select the listeners associated with a given trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
array of String trigger listener names
Throws:
SQLException

deleteSimpleTrigger

int deleteSimpleTrigger(Connection conn,
                        String triggerName,
                        String groupName)
                        throws SQLException

Delete the simple trigger data for a trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the number of rows deleted
Throws:
SQLException

deleteBlobTrigger

int deleteBlobTrigger(Connection conn,
                      String triggerName,
                      String groupName)
                      throws SQLException

Delete the BLOB trigger data for a trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the number of rows deleted
Throws:
SQLException

deleteCronTrigger

int deleteCronTrigger(Connection conn,
                      String triggerName,
                      String groupName)
                      throws SQLException

Delete the cron trigger data for a trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the number of rows deleted
Throws:
SQLException

deleteTrigger

int deleteTrigger(Connection conn,
                  String triggerName,
                  String groupName)
                  throws SQLException

Delete the base trigger data for a trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the number of rows deleted
Throws:
SQLException

selectNumTriggersForJob

int selectNumTriggersForJob(Connection conn,
                            String jobName,
                            String groupName)
                            throws SQLException

Select the number of triggers associated with a given job.

Parameters:
conn - the DB Connection
jobName - the name of the job
groupName - the group containing the job
Returns:
the number of triggers for the given job
Throws:
SQLException

selectJobForTrigger

JobDetail selectJobForTrigger(Connection conn,
                              String triggerName,
                              String groupName,
                              ClassLoadHelper loadHelper)
                              throws ClassNotFoundException,
                                     SQLException

Select the job to which the trigger is associated.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the JobDetail object associated with the given trigger
Throws:
ClassNotFoundException
SQLException

selectStatefulJobsOfTriggerGroup

List selectStatefulJobsOfTriggerGroup(Connection conn,
                                      String groupName)
                                      throws SQLException

Select the stateful jobs which are referenced by triggers in the given trigger group.

Parameters:
conn - the DB Connection
groupName - the trigger group
Returns:
a List of Keys to jobs.
Throws:
SQLException

selectTriggersForJob

Trigger[] selectTriggersForJob(Connection conn,
                               String jobName,
                               String groupName)
                               throws SQLException,
                                      ClassNotFoundException,
                                      IOException

Select the triggers for a job

Parameters:
conn - the DB Connection
jobName - the name of the trigger
groupName - the group containing the trigger
Returns:
an array of (@link org.quartz.Trigger) objects associated with a given job.
Throws:
SQLException
ClassNotFoundException
IOException

selectTriggersForCalendar

Trigger[] selectTriggersForCalendar(Connection conn,
                                    String calName)
                                    throws SQLException,
                                           ClassNotFoundException,
                                           IOException

Select the triggers for a calendar

Parameters:
conn - the DB Connection
calName - the name of the calendar
Returns:
an array of (@link org.quartz.Trigger) objects associated with the given calendar.
Throws:
SQLException
ClassNotFoundException
IOException

selectTrigger

Trigger selectTrigger(Connection conn,
                      String triggerName,
                      String groupName)
                      throws SQLException,
                             ClassNotFoundException,
                             IOException

Select a trigger.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the Trigger object
Throws:
SQLException
ClassNotFoundException
IOException

selectTriggerJobDataMap

JobDataMap selectTriggerJobDataMap(Connection conn,
                                   String triggerName,
                                   String groupName)
                                   throws SQLException,
                                          ClassNotFoundException,
                                          IOException

Select a trigger's JobDataMap.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the JobDataMap of the Trigger, never null, but possibly empty.
Throws:
SQLException
ClassNotFoundException
IOException

selectTriggerState

String selectTriggerState(Connection conn,
                          String triggerName,
                          String groupName)
                          throws SQLException

Select a trigger' state value.

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
the Trigger object
Throws:
SQLException

selectTriggerStatus

TriggerStatus selectTriggerStatus(Connection conn,
                                  String triggerName,
                                  String groupName)
                                  throws SQLException

Select a trigger' status (state & next fire time).

Parameters:
conn - the DB Connection
triggerName - the name of the trigger
groupName - the group containing the trigger
Returns:
a TriggerStatus object, or null
Throws:
SQLException

selectNumTriggers

int selectNumTriggers(Connection conn)
                      throws SQLException

Select the total number of triggers stored.

Parameters:
conn - the DB Connection
Returns:
the total number of triggers stored
Throws:
SQLException

selectTriggerGroups

String[] selectTriggerGroups(Connection conn)
                             throws SQLException

Select all of the trigger group names that are stored.

Parameters:
conn - the DB Connection
Returns:
an array of String group names
Throws:
SQLException

selectTriggersInGroup

String[] selectTriggersInGroup(Connection conn,
                               String groupName)
                               throws SQLException

Select all of the triggers contained in a given group.

Parameters:
conn - the DB Connection
groupName - the group containing the triggers
Returns:
an array of String trigger names
Throws:
SQLException

selectTriggersInState

Key[] selectTriggersInState(Connection conn,
                            String state)
                            throws SQLException

Select all of the triggers in a given state.

Parameters:
conn - the DB Connection
state - the state the triggers must be in
Returns:
an array of trigger Key s
Throws:
SQLException

insertPausedTriggerGroup

int insertPausedTriggerGroup(Connection conn,
                             String groupName)
                             throws SQLException
Throws:
SQLException

deletePausedTriggerGroup

int deletePausedTriggerGroup(Connection conn,
                             String groupName)
                             throws SQLException
Throws:
SQLException

deleteAllPausedTriggerGroups

int deleteAllPausedTriggerGroups(Connection conn)
                                 throws SQLException
Throws:
SQLException

isTriggerGroupPaused

boolean isTriggerGroupPaused(Connection conn,
                             String groupName)
                             throws SQLException
Throws:
SQLException

selectPausedTriggerGroups

Set selectPausedTriggerGroups(Connection conn)
                              throws SQLException
Throws:
SQLException

isExistingTriggerGroup

boolean isExistingTriggerGroup(Connection conn,
                               String groupName)
                               throws SQLException
Throws:
SQLException

insertCalendar

int insertCalendar(Connection conn,
                   String calendarName,
                   Calendar calendar)
                   throws IOException,
                          SQLException

Insert a new calendar.

Parameters:
conn - the DB Connection
calendarName - the name for the new calendar
calendar - the calendar
Returns:
the number of rows inserted
Throws:
IOException - if there were problems serializing the calendar
SQLException

updateCalendar

int updateCalendar(Connection conn,
                   String calendarName,
                   Calendar calendar)
                   throws IOException,
                          SQLException

Update a calendar.

Parameters:
conn - the DB Connection
calendarName - the name for the new calendar
calendar - the calendar
Returns:
the number of rows updated
Throws:
IOException - if there were problems serializing the calendar
SQLException

calendarExists

boolean calendarExists(Connection conn,
                       String calendarName)
                       throws SQLException

Check whether or not a calendar exists.

Parameters:
conn - the DB Connection
calendarName - the name of the calendar
Returns:
true if the trigger exists, false otherwise
Throws:
SQLException

selectCalendar

Calendar selectCalendar(Connection conn,
                        String calendarName)
                        throws ClassNotFoundException,
                               IOException,
                               SQLException

Select a calendar.

Parameters:
conn - the DB Connection
calendarName - the name of the calendar
Returns:
the Calendar
Throws:
ClassNotFoundException - if a class found during deserialization cannot be found be found
IOException - if there were problems deserializing the calendar
SQLException

calendarIsReferenced

boolean calendarIsReferenced(Connection conn,
                             String calendarName)
                             throws SQLException

Check whether or not a calendar is referenced by any triggers.

Parameters:
conn - the DB Connection
calendarName - the name of the calendar
Returns:
true if any triggers reference the calendar, false otherwise
Throws:
SQLException

deleteCalendar

int deleteCalendar(Connection conn,
                   String calendarName)
                   throws SQLException

Delete a calendar.

Parameters:
conn - the DB Connection
calendarName - the name of the trigger
Returns:
the number of rows deleted
Throws:
SQLException

selectNumCalendars

int selectNumCalendars(Connection conn)
                       throws SQLException

Select the total number of calendars stored.

Parameters:
conn - the DB Connection
Returns:
the total number of calendars stored
Throws:
SQLException

selectCalendars

String[] selectCalendars(Connection conn)
                         throws SQLException

Select all of the stored calendars.

Parameters:
conn - the DB Connection
Returns:
an array of String calendar names
Throws:
SQLException

selectNextFireTime

long selectNextFireTime(Connection conn)
                        throws SQLException
Deprecated. Does not account for misfires.

Select the next time that a trigger will be fired.

Parameters:
conn - the DB Connection
Returns:
the next fire time, or 0 if no trigger will be fired
Throws:
SQLException

selectTriggerForFireTime

Key selectTriggerForFireTime(Connection conn,
                             long fireTime)
                             throws SQLException

Select the trigger that will be fired at the given fire time.

Parameters:
conn - the DB Connection
fireTime - the time that the trigger will be fired
Returns:
a Key representing the trigger that will be fired at the given fire time, or null if no trigger will be fired at that time
Throws:
SQLException

selectTriggerToAcquire

List selectTriggerToAcquire(Connection conn,
                            long noLaterThan,
                            long noEarlierThan)
                            throws SQLException

Select the next trigger which will fire to fire between the two given timestamps in ascending order of fire time, and then descending by priority.

Parameters:
conn - the DB Connection
noLaterThan - highest value of getNextFireTime() of the triggers (exclusive)
noEarlierThan - highest value of getNextFireTime() of the triggers (inclusive)
Returns:
A (never null, possibly empty) list of the identifiers (Key objects) of the next triggers to be fired.
Throws:
SQLException

insertFiredTrigger

int insertFiredTrigger(Connection conn,
                       Trigger trigger,
                       String state,
                       JobDetail jobDetail)
                       throws SQLException

Insert a fired trigger.

Parameters:
conn - the DB Connection
trigger - the trigger
state - the state that the trigger should be stored in
Returns:
the number of rows inserted
Throws:
SQLException

selectFiredTriggerRecords

List selectFiredTriggerRecords(Connection conn,
                               String triggerName,
                               String groupName)
                               throws SQLException

Select the states of all fired-trigger records for a given trigger, or trigger group if trigger name is null.

Returns:
a List of FiredTriggerRecord objects.
Throws:
SQLException

selectFiredTriggerRecordsByJob

List selectFiredTriggerRecordsByJob(Connection conn,
                                    String jobName,
                                    String groupName)
                                    throws SQLException

Select the states of all fired-trigger records for a given job, or job group if job name is null.

Returns:
a List of FiredTriggerRecord objects.
Throws:
SQLException

selectInstancesFiredTriggerRecords

List selectInstancesFiredTriggerRecords(Connection conn,
                                        String instanceName)
                                        throws SQLException

Select the states of all fired-trigger records for a given scheduler instance.

Returns:
a List of FiredTriggerRecord objects.
Throws:
SQLException

selectFiredTriggerInstanceNames

Set selectFiredTriggerInstanceNames(Connection conn)
                                    throws SQLException

Select the distinct instance names of all fired-trigger records.

This is useful when trying to identify orphaned fired triggers (a fired trigger without a scheduler state record.)

Returns:
a Set of String objects.
Throws:
SQLException

deleteFiredTrigger

int deleteFiredTrigger(Connection conn,
                       String entryId)
                       throws SQLException

Delete a fired trigger.

Parameters:
conn - the DB Connection
entryId - the fired trigger entry to delete
Returns:
the number of rows deleted
Throws:
SQLException

selectJobExecutionCount

int selectJobExecutionCount(Connection conn,
                            String jobName,
                            String jobGroup)
                            throws SQLException

Get the number instances of the identified job currently executing.

Parameters:
conn - the DB Connection
Returns:
the number instances of the identified job currently executing.
Throws:
SQLException

insertSchedulerState

int insertSchedulerState(Connection conn,
                         String instanceId,
                         long checkInTime,
                         long interval)
                         throws SQLException

Insert a scheduler-instance state record.

Parameters:
conn - the DB Connection
Returns:
the number of inserted rows.
Throws:
SQLException

deleteSchedulerState

int deleteSchedulerState(Connection conn,
                         String instanceId)
                         throws SQLException

Delete a scheduler-instance state record.

Parameters:
conn - the DB Connection
Returns:
the number of deleted rows.
Throws:
SQLException

updateSchedulerState

int updateSchedulerState(Connection conn,
                         String instanceId,
                         long checkInTime)
                         throws SQLException

Update a scheduler-instance state record.

Parameters:
conn - the DB Connection
Returns:
the number of updated rows.
Throws:
SQLException

selectSchedulerStateRecords

List selectSchedulerStateRecords(Connection conn,
                                 String instanceId)
                                 throws SQLException

A List of all current SchedulerStateRecords.

If instanceId is not null, then only the record for the identified instance will be returned.

Parameters:
conn - the DB Connection
Throws:
SQLException


Copyright 2001-2011, Terracotta, Inc.