org.quartz.impl.jdbcjobstore.DriverDelegate Maven / Gradle / Ivy
/*
* Copyright 2004-2005 OpenSymphony
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
/*
* Previously Copyright (c) 2001-2004 James House
*/
package org.quartz.impl.jdbcjobstore;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Set;
import org.quartz.Calendar;
import org.quartz.CronTrigger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
import org.quartz.spi.ClassLoadHelper;
import org.quartz.utils.Key;
import org.quartz.utils.TriggerStatus;
/**
*
* This is the base interface for all driver delegate classes.
*
*
*
* This interface is very similar to the {@link
* org.quartz.spi.JobStore}
* interface except each method has an additional {@link java.sql.Connection}
* parameter.
*
*
*
* Unless a database driver has some extremely-DB-specific
* requirements, any DriverDelegate implementation classes should extend the
* {@link org.quartz.impl.jdbcjobstore.StdJDBCDelegate}
class.
*
*
* @author Jeffrey Wescott
* @author James House
*/
public interface DriverDelegate {
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Interface.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//---------------------------------------------------------------------------
// startup / recovery
//---------------------------------------------------------------------------
/**
*
* Update all triggers having one of the two given states, to the given new
* state.
*
*
* @param conn
* the DB Connection
* @param newState
* the new state for the triggers
* @param oldState1
* the first old state to update
* @param oldState2
* the second old state to update
* @return number of rows updated
*/
public int updateTriggerStatesFromOtherStates(Connection conn,
String newState, String oldState1, String oldState2)
throws SQLException;
/**
*
* Get the names of all of the triggers that have misfired - according to
* the given timestamp.
*
*
* @param conn
* the DB Connection
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectMisfiredTriggers(Connection conn, long ts)
throws SQLException;
/**
*
* Get the names of all of the triggers in the given state that have
* misfired - according to the given timestamp.
*
*
* @param conn
* the DB Connection
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectMisfiredTriggersInState(Connection conn, 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.
*
*
* @param conn
* the DB Connection
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectMisfiredTriggersInGroupInState(Connection conn,
String groupName, String state, long ts) throws SQLException;
/**
*
* 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 {@link
* org.quartz.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.
*
*
* @param conn
* the DB Connection
* @return an array of {@link org.quartz.Trigger}
objects
*/
public Trigger[] selectTriggersForRecoveringJobs(Connection conn)
throws SQLException, IOException, ClassNotFoundException;
/**
*
* Delete all fired triggers.
*
*
* @param conn
* the DB Connection
* @return the number of rows deleted
*/
public int deleteFiredTriggers(Connection conn) throws SQLException;
/**
*
* Delete all fired triggers of the given instance.
*
*
* @param conn
* the DB Connection
* @return the number of rows deleted
*/
public int deleteFiredTriggers(Connection conn, String instanceId)
throws SQLException;
/**
*
* Delete all volatile fired triggers.
*
*
* @param conn
* the DB Connection
* @return the number of rows deleted
*/
public int deleteVolatileFiredTriggers(Connection conn) throws SQLException;
/**
*
* Get the names of all of the triggers that are volatile.
*
*
* @param conn
* the DB Connection
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectVolatileTriggers(Connection conn) throws SQLException;
/**
*
* Get the names of all of the jobs that are volatile.
*
*
* @param conn
* the DB Connection
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectVolatileJobs(Connection conn) throws SQLException;
//---------------------------------------------------------------------------
// jobs
//---------------------------------------------------------------------------
/**
*
* Insert the job detail record.
*
*
* @param conn
* the DB Connection
* @param job
* the job to insert
* @return number of rows inserted
* @throws IOException
* if there were problems serializing the JobDataMap
*/
public int insertJobDetail(Connection conn, JobDetail job)
throws IOException, SQLException;
/**
*
* Update the job detail record.
*
*
* @param conn
* the DB Connection
* @param job
* the job to update
* @return number of rows updated
* @throws IOException
* if there were problems serializing the JobDataMap
*/
public int updateJobDetail(Connection conn, JobDetail job)
throws IOException, SQLException;
/**
*
* Get the names of all of the triggers associated with the given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the job name
* @param groupName
* the job group
* @return an array of {@link
* org.quartz.utils.Key}
objects
*/
public Key[] selectTriggerNamesForJob(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Delete all job listeners for the given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @return the number of rows deleted
*/
public int deleteJobListeners(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Delete the job detail record for the given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @return the number of rows deleted
*/
public int deleteJobDetail(Connection conn, String jobName, String groupName)
throws SQLException;
/**
*
* Check whether or not the given job is stateful.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @return true if the job exists and is stateful, false otherwise
*/
public boolean isJobStateful(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Check whether or not the given job exists.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @return true if the job exists, false otherwise
*/
public boolean jobExists(Connection conn, String jobName, String groupName)
throws SQLException;
/**
*
* Update the job data map for the given job.
*
*
* @param conn
* the DB Connection
* @param job
* the job to update
* @return the number of rows updated
* @throws IOException
* if there were problems serializing the JobDataMap
*/
public int updateJobData(Connection conn, JobDetail job)
throws IOException, SQLException;
/**
*
* Associate a listener with a job.
*
*
* @param conn
* the DB Connection
* @param job
* the job to associate with the listener
* @param listener
* the listener to insert
* @return the number of rows inserted
*/
public int insertJobListener(Connection conn, JobDetail job, String listener)
throws SQLException;
/**
*
* Get all of the listeners for a given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the job name whose listeners are wanted
* @param groupName
* the group containing the job
* @return array of String
listener names
*/
public String[] selectJobListeners(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Select the JobDetail object for a given job name / group name.
*
*
* @param conn
* the DB Connection
* @param jobName
* the job name whose listeners are wanted
* @param groupName
* the group containing the job
* @return the populated JobDetail object
* @throws ClassNotFoundException
* if a class found during deserialization cannot be found or if
* the job class could not be found
* @throws IOException
* if deserialization causes an error
*/
public JobDetail selectJobDetail(Connection conn, String jobName,
String groupName, ClassLoadHelper loadHelper)
throws ClassNotFoundException, IOException, SQLException;
/**
*
* Select the total number of jobs stored.
*
*
* @param conn
* the DB Connection
* @return the total number of jobs stored
*/
public int selectNumJobs(Connection conn) throws SQLException;
/**
*
* Select all of the job group names that are stored.
*
*
* @param conn
* the DB Connection
* @return an array of String
group names
*/
public String[] selectJobGroups(Connection conn) throws SQLException;
/**
*
* Select all of the jobs contained in a given group.
*
*
* @param conn
* the DB Connection
* @param groupName
* the group containing the jobs
* @return an array of String
job names
*/
public String[] selectJobsInGroup(Connection conn, String groupName)
throws SQLException;
//---------------------------------------------------------------------------
// triggers
//---------------------------------------------------------------------------
/**
*
* Insert the base trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @param state
* the state that the trigger should be stored in
* @return the number of rows inserted
*/
public int insertTrigger(Connection conn, Trigger trigger, String state,
JobDetail jobDetail) throws SQLException, IOException;
/**
*
* Insert the simple trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows inserted
*/
public int insertSimpleTrigger(Connection conn, SimpleTrigger trigger)
throws SQLException;
/**
*
* Insert the blob trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows inserted
*/
public int insertBlobTrigger(Connection conn, Trigger trigger)
throws SQLException, IOException;
/**
*
* Insert the cron trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows inserted
*/
public int insertCronTrigger(Connection conn, CronTrigger trigger)
throws SQLException;
/**
*
* Update the base trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @param state
* the state that the trigger should be stored in
* @return the number of rows updated
*/
public int updateTrigger(Connection conn, Trigger trigger, String state,
JobDetail jobDetail) throws SQLException, IOException;
/**
*
* Update the simple trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows updated
*/
public int updateSimpleTrigger(Connection conn, SimpleTrigger trigger)
throws SQLException;
/**
*
* Update the cron trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows updated
*/
public int updateCronTrigger(Connection conn, CronTrigger trigger)
throws SQLException;
/**
*
* Update the blob trigger data.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger to insert
* @return the number of rows updated
*/
public int updateBlobTrigger(Connection conn, Trigger trigger)
throws SQLException, IOException;
/**
*
* Check whether or not a trigger exists.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows updated
*/
public boolean triggerExists(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Update the state for a given trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @param state
* the new state for the trigger
* @return the number of rows updated
*/
public int updateTriggerState(Connection conn, String triggerName,
String groupName, String state) throws SQLException;
/**
*
* Update the given trigger to the given new state, if it is in the given
* old state.
*
*
* @param conn
* the DB connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @param newState
* the new state for the trigger
* @param oldState
* the old state the trigger must be in
* @return int the number of rows updated
* @throws SQLException
*/
public 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 one of the
* given old states.
*
*
* @param conn
* the DB connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @param newState
* the new state for the trigger
* @param oldState1
* one of the old state the trigger must be in
* @param oldState2
* one of the old state the trigger must be in
* @param oldState3
* one of the old state the trigger must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerStateFromOtherStates(Connection conn,
String triggerName, String groupName, String newState,
String oldState1, String oldState2, String oldState3)
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.
*
*
* @param conn
* the DB connection
* @param newState
* the new state for the trigger
* @param oldState1
* one of the old state the trigger must be in
* @param oldState2
* one of the old state the trigger must be in
* @param time
* the time before which the trigger's next fire time must be
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerStateFromOtherStatesBeforeTime(Connection conn,
String newState, String oldState1, String oldState2, long time)
throws SQLException;
/**
*
* Update all triggers in the given group to the given new state, if they
* are in one of the given old states.
*
*
* @param conn
* the DB connection
* @param groupName
* the group containing the trigger
* @param newState
* the new state for the trigger
* @param oldState1
* one of the old state the trigger must be in
* @param oldState2
* one of the old state the trigger must be in
* @param oldState3
* one of the old state the trigger must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerGroupStateFromOtherStates(Connection conn,
String groupName, String newState, String oldState1,
String oldState2, String oldState3) throws SQLException;
/**
*
* Update all of the triggers of the given group to the given new state, if
* they are in the given old state.
*
*
* @param conn
* the DB connection
* @param groupName
* the group containing the triggers
* @param newState
* the new state for the trigger group
* @param oldState
* the old state the triggers must be in
* @return int the number of rows updated
* @throws SQLException
*/
public int updateTriggerGroupStateFromOtherState(Connection conn,
String groupName, String newState, String oldState)
throws SQLException;
/**
*
* Update the states of all triggers associated with the given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @param state
* the new state for the triggers
* @return the number of rows updated
*/
public int updateTriggerStatesForJob(Connection conn, String jobName,
String groupName, String state) throws SQLException;
/**
*
* Update the states of any triggers associated with the given job, that
* are the given current state.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @param state
* the new state for the triggers
* @param oldState
* the old state of the triggers
* @return the number of rows updated
*/
public int updateTriggerStatesForJobFromOtherState(Connection conn,
String jobName, String groupName, String state, String oldState)
throws SQLException;
/**
*
* Delete all of the listeners associated with a given trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger whose listeners will be deleted
* @param groupName
* the name of the group containing the trigger
* @return the number of rows deleted
*/
public int deleteTriggerListeners(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Associate a listener with the given trigger.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger
* @param listener
* the name of the listener to associate with the trigger
* @return the number of rows inserted
*/
public int insertTriggerListener(Connection conn, Trigger trigger,
String listener) throws SQLException;
/**
*
* Select the listeners associated with a given trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return array of String
trigger listener names
*/
public String[] selectTriggerListeners(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Delete the simple trigger data for a trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteSimpleTrigger(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Delete the BLOB trigger data for a trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteBlobTrigger(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Delete the cron trigger data for a trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteCronTrigger(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Delete the base trigger data for a trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the number of rows deleted
*/
public int deleteTrigger(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Select the number of triggers associated with a given job.
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the job
* @param groupName
* the group containing the job
* @return the number of triggers for the given job
*/
public int selectNumTriggersForJob(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Select the job to which the trigger is associated.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the {@link org.quartz.JobDetail}
object
* associated with the given trigger
*/
public JobDetail selectJobForTrigger(Connection conn, String triggerName,
String groupName, ClassLoadHelper loadHelper)
throws ClassNotFoundException, SQLException;
/**
*
* Select the stateful jobs which are referenced by triggers in the given
* trigger group.
*
*
* @param conn
* the DB Connection
* @param groupName
* the trigger group
* @return a List of Keys to jobs.
*/
public List selectStatefulJobsOfTriggerGroup(Connection conn,
String groupName) throws SQLException;
/**
*
* Select the triggers for a job
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return an array of (@link org.quartz.Trigger)
objects
* associated with a given job.
* @throws SQLException
*/
public Trigger[] selectTriggersForJob(Connection conn, String jobName,
String groupName) throws SQLException, ClassNotFoundException,
IOException;
/**
*
* Select the triggers for a calendar
*
*
* @param conn
* the DB Connection
* @param jobName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return an array of (@link org.quartz.Trigger)
objects
* associated with a given job.
* @throws SQLException
*/
public Trigger[] selectTriggersForCalendar(Connection conn, String calName)
throws SQLException, ClassNotFoundException, IOException;
/**
*
* Select a trigger.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the {@link org.quartz.Trigger}
object
*/
public Trigger selectTrigger(Connection conn, String triggerName,
String groupName) throws SQLException, ClassNotFoundException,
IOException;
/**
*
* Select a trigger's JobDataMap.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the {@link org.quartz.JobDataMap}
of the Trigger,
* never null, but possibly empty.
*/
public JobDataMap selectTriggerJobDataMap(Connection conn, String triggerName,
String groupName) throws SQLException, ClassNotFoundException,
IOException;
/**
*
* Select a trigger' state value.
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the {@link org.quartz.Trigger}
object
*/
public String selectTriggerState(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Select a trigger' status (state & next fire time).
*
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return a TriggerStatus
object, or null
*/
public TriggerStatus selectTriggerStatus(Connection conn,
String triggerName, String groupName) throws SQLException;
/**
*
* Select the total number of triggers stored.
*
*
* @param conn
* the DB Connection
* @return the total number of triggers stored
*/
public int selectNumTriggers(Connection conn) throws SQLException;
/**
*
* Select all of the trigger group names that are stored.
*
*
* @param conn
* the DB Connection
* @return an array of String
group names
*/
public String[] selectTriggerGroups(Connection conn) throws SQLException;
/**
*
* Select all of the triggers contained in a given group.
*
*
* @param conn
* the DB Connection
* @param groupName
* the group containing the triggers
* @return an array of String
trigger names
*/
public String[] selectTriggersInGroup(Connection conn, String groupName)
throws SQLException;
/**
*
* Select all of the triggers in a given state.
*
*
* @param conn
* the DB Connection
* @param state
* the state the triggers must be in
* @return an array of trigger Key
s
*/
public Key[] selectTriggersInState(Connection conn, String state)
throws SQLException;
public int insertPausedTriggerGroup(Connection conn, String groupName)
throws SQLException;
public int deletePausedTriggerGroup(Connection conn, String groupName)
throws SQLException;
public int deleteAllPausedTriggerGroups(Connection conn)
throws SQLException;
public boolean isTriggerGroupPaused(Connection conn, String groupName)
throws SQLException;
public Set selectPausedTriggerGroups(Connection conn)
throws SQLException;
public boolean isExistingTriggerGroup(Connection conn, String groupName)
throws SQLException;
//---------------------------------------------------------------------------
// calendars
//---------------------------------------------------------------------------
/**
*
* Insert a new calendar.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name for the new calendar
* @param calendar
* the calendar
* @return the number of rows inserted
* @throws IOException
* if there were problems serializing the calendar
*/
public int insertCalendar(Connection conn, String calendarName,
Calendar calendar) throws IOException, SQLException;
/**
*
* Update a calendar.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name for the new calendar
* @param calendar
* the calendar
* @return the number of rows updated
* @throws IOException
* if there were problems serializing the calendar
*/
public int updateCalendar(Connection conn, String calendarName,
Calendar calendar) throws IOException, SQLException;
/**
*
* Check whether or not a calendar exists.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name of the calendar
* @return true if the trigger exists, false otherwise
*/
public boolean calendarExists(Connection conn, String calendarName)
throws SQLException;
/**
*
* Select a calendar.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name of the calendar
* @return the Calendar
* @throws ClassNotFoundException
* if a class found during deserialization cannot be found be
* found
* @throws IOException
* if there were problems deserializing the calendar
*/
public Calendar selectCalendar(Connection conn, String calendarName)
throws ClassNotFoundException, IOException, SQLException;
/**
*
* Check whether or not a calendar is referenced by any triggers.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name of the calendar
* @return true if any triggers reference the calendar, false otherwise
*/
public boolean calendarIsReferenced(Connection conn, String calendarName)
throws SQLException;
/**
*
* Delete a calendar.
*
*
* @param conn
* the DB Connection
* @param calendarName
* the name of the trigger
* @return the number of rows deleted
*/
public int deleteCalendar(Connection conn, String calendarName)
throws SQLException;
/**
*
* Select the total number of calendars stored.
*
*
* @param conn
* the DB Connection
* @return the total number of calendars stored
*/
public int selectNumCalendars(Connection conn) throws SQLException;
/**
*
* Select all of the stored calendars.
*
*
* @param conn
* the DB Connection
* @return an array of String
calendar names
*/
public String[] selectCalendars(Connection conn) throws SQLException;
//---------------------------------------------------------------------------
// trigger firing
//---------------------------------------------------------------------------
/**
*
* Select the next time that a trigger will be fired.
*
*
* @param conn
* the DB Connection
* @return the next fire time, or 0 if no trigger will be fired
*/
public long selectNextFireTime(Connection conn) throws SQLException;
/**
*
* Select the trigger that will be fired at the given fire time.
*
*
* @param conn
* the DB Connection
* @param fireTime
* the time that the trigger will be fired
* @return a {@link org.quartz.utils.Key}
representing the
* trigger that will be fired at the given fire time, or null if no
* trigger will be fired at that time
*/
public Key selectTriggerForFireTime(Connection conn, long fireTime)
throws SQLException;
/**
*
* Insert a fired trigger.
*
*
* @param conn
* the DB Connection
* @param trigger
* the trigger
* @param state
* the state that the trigger should be stored in
* @return the number of rows inserted
*/
public int insertFiredTrigger(Connection conn, Trigger trigger,
String state, JobDetail jobDetail) throws SQLException;
/**
*
* Select the states of all fired-trigger records for a given trigger, or
* trigger group if trigger name is null
.
*
*
* @return a List of FiredTriggerRecord objects.
*/
public List selectFiredTriggerRecords(Connection conn, String triggerName,
String groupName) throws SQLException;
/**
*
* Select the states of all fired-trigger records for a given job, or job
* group if job name is null
.
*
*
* @return a List of FiredTriggerRecord objects.
*/
public List selectFiredTriggerRecordsByJob(Connection conn, String jobName,
String groupName) throws SQLException;
/**
*
* Select the states of all fired-trigger records for a given scheduler
* instance.
*
*
* @return a List of FiredTriggerRecord objects.
*/
public List selectInstancesFiredTriggerRecords(Connection conn,
String instanceName) throws SQLException;
/**
*
* Delete a fired trigger.
*
*
* @param conn
* the DB Connection
* @param entryId
* the fired trigger entry to delete
* @return the number of rows deleted
*/
public int deleteFiredTrigger(Connection conn, String entryId)
throws SQLException;
/**
*
* Get the number instances of the identified job currently executing.
*
*
* @param conn
* the DB Connection
* @return the number instances of the identified job currently executing.
*/
public int selectJobExecutionCount(Connection conn, String jobName,
String jobGroup) throws SQLException;
/**
*
* Insert a scheduler-instance state record.
*
*
* @param conn
* the DB Connection
* @return the number of inserted rows.
*/
public int insertSchedulerState(Connection conn, String instanceId,
long checkInTime, long interval, String recoverer)
throws SQLException;
/**
*
* Delete a scheduler-instance state record.
*
*
* @param conn
* the DB Connection
* @return the number of deleted rows.
*/
public int deleteSchedulerState(Connection conn, String instanceId)
throws SQLException;
/**
*
* Update a scheduler-instance state record.
*
*
* @param conn
* the DB Connection
* @return the number of updated rows.
*/
public int updateSchedulerState(Connection conn, String instanceId, long checkInTime, String recoverer)
throws SQLException;
/**
*
* A List of all current SchedulerStateRecords
.
*
*
*
* If instanceId is not null, then only the record for the identified
* instance will be returned.
*
*
* @param conn
* the DB Connection
*/
public List selectSchedulerStateRecords(Connection conn, String instanceId) // TODO: this method would be more handy if it returned a map.
throws SQLException;
}
// EOF