Class StdJDBCDelegate
- java.lang.Object
-
- org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-
- All Implemented Interfaces:
Constants
,DriverDelegate
,StdJDBCConstants
- Direct Known Subclasses:
CacheDelegate
,CUBRIDDelegate
,DB2v6Delegate
,DB2v7Delegate
,DB2v8Delegate
,HSQLDBDelegate
,MSSQLDelegate
,OracleDelegate
,PointbaseDelegate
,PostgreSQLDelegate
,SybaseDelegate
,WebLogicDelegate
public class StdJDBCDelegate extends java.lang.Object implements DriverDelegate, StdJDBCConstants
This is meant to be an abstract base class for most, if not all,
implementations. Subclasses should override only those methods that need special handling for the DBMS driver in question.DriverDelegate
- Author:
- Jeffrey Wescott, James House, Eric Mueller
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassLoadHelper
classLoadHelper
protected java.lang.String
instanceId
protected org.slf4j.Logger
logger
protected java.lang.String
schedName
protected java.lang.String
tablePrefix
protected java.util.List<TriggerPersistenceDelegate>
triggerPersistenceDelegates
protected boolean
useProperties
-
Fields inherited from interface org.quartz.impl.jdbcjobstore.Constants
ALIAS_COL_NEXT_FIRE_TIME, ALL_GROUPS_PAUSED, COL_BLOB, COL_CALENDAR, COL_CALENDAR_NAME, COL_CHECKIN_INTERVAL, COL_CRON_EXPRESSION, COL_DESCRIPTION, COL_END_TIME, COL_ENTRY_ID, COL_ENTRY_STATE, COL_FIRED_TIME, COL_INSTANCE_NAME, COL_IS_DURABLE, COL_IS_NONCONCURRENT, COL_IS_UPDATE_DATA, COL_IS_VOLATILE, COL_JOB_CLASS, COL_JOB_DATAMAP, COL_JOB_GROUP, COL_JOB_NAME, COL_LAST_CHECKIN_TIME, COL_LOCK_NAME, COL_MISFIRE_INSTRUCTION, COL_NEXT_FIRE_TIME, COL_PREV_FIRE_TIME, COL_PRIORITY, COL_REPEAT_COUNT, COL_REPEAT_INTERVAL, COL_REQUESTS_RECOVERY, COL_SCHED_TIME, COL_SCHEDULER_NAME, COL_START_TIME, COL_TIME_ZONE_ID, COL_TIMES_TRIGGERED, COL_TRIGGER_GROUP, COL_TRIGGER_NAME, COL_TRIGGER_STATE, COL_TRIGGER_TYPE, DEFAULT_TABLE_PREFIX, STATE_ACQUIRED, STATE_BLOCKED, STATE_COMPLETE, STATE_DELETED, STATE_ERROR, STATE_EXECUTING, STATE_MISFIRED, STATE_PAUSED, STATE_PAUSED_BLOCKED, STATE_WAITING, TABLE_BLOB_TRIGGERS, TABLE_CALENDARS, TABLE_CRON_TRIGGERS, TABLE_FIRED_TRIGGERS, TABLE_JOB_DETAILS, TABLE_LOCKS, TABLE_PAUSED_TRIGGERS, TABLE_SCHEDULER_STATE, TABLE_SIMPLE_TRIGGERS, TABLE_TRIGGERS, TTYPE_BLOB, TTYPE_CAL_INT, TTYPE_CRON, TTYPE_DAILY_TIME_INT, TTYPE_SIMPLE
-
Fields inherited from interface org.quartz.impl.jdbcjobstore.StdJDBCConstants
COUNT_MISFIRED_TRIGGERS_IN_STATE, DELETE_ALL_BLOB_TRIGGERS, DELETE_ALL_CALENDARS, DELETE_ALL_CRON_TRIGGERS, DELETE_ALL_JOB_DETAILS, DELETE_ALL_PAUSED_TRIGGER_GRPS, DELETE_ALL_SIMPLE_TRIGGERS, DELETE_ALL_SIMPROP_TRIGGERS, DELETE_ALL_TRIGGERS, DELETE_BLOB_TRIGGER, DELETE_CALENDAR, DELETE_CRON_TRIGGER, DELETE_FIRED_TRIGGER, DELETE_FIRED_TRIGGERS, DELETE_INSTANCES_FIRED_TRIGGERS, DELETE_JOB_DETAIL, DELETE_NO_RECOVERY_FIRED_TRIGGERS, DELETE_PAUSED_TRIGGER_GROUP, DELETE_PAUSED_TRIGGER_GROUPS, DELETE_SCHEDULER_STATE, DELETE_SIMPLE_TRIGGER, DELETE_TRIGGER, INSERT_BLOB_TRIGGER, INSERT_CALENDAR, INSERT_CRON_TRIGGER, INSERT_FIRED_TRIGGER, INSERT_JOB_DETAIL, INSERT_PAUSED_TRIGGER_GROUP, INSERT_SCHEDULER_STATE, INSERT_SIMPLE_TRIGGER, INSERT_TRIGGER, SCHED_NAME_SUBST, SELECT_BLOB_TRIGGER, SELECT_CALENDAR, SELECT_CALENDAR_EXISTENCE, SELECT_CALENDARS, SELECT_CRON_TRIGGER, SELECT_FIRED_TRIGGER, SELECT_FIRED_TRIGGER_GROUP, SELECT_FIRED_TRIGGER_INSTANCE_NAMES, SELECT_FIRED_TRIGGERS, SELECT_FIRED_TRIGGERS_OF_JOB, SELECT_FIRED_TRIGGERS_OF_JOB_GROUP, SELECT_HAS_MISFIRED_TRIGGERS_IN_STATE, SELECT_INSTANCES_FIRED_TRIGGERS, SELECT_INSTANCES_RECOVERABLE_FIRED_TRIGGERS, SELECT_JOB_DETAIL, SELECT_JOB_EXECUTION_COUNT, SELECT_JOB_EXISTENCE, SELECT_JOB_FOR_TRIGGER, SELECT_JOB_GROUPS, SELECT_JOB_NONCONCURRENT, SELECT_JOBS_IN_GROUP, SELECT_JOBS_IN_GROUP_LIKE, SELECT_MISFIRED_TRIGGERS, SELECT_MISFIRED_TRIGGERS_IN_GROUP_IN_STATE, SELECT_MISFIRED_TRIGGERS_IN_STATE, SELECT_NEXT_FIRE_TIME, SELECT_NEXT_TRIGGER_TO_ACQUIRE, SELECT_NUM_CALENDARS, SELECT_NUM_JOBS, SELECT_NUM_TRIGGERS, SELECT_NUM_TRIGGERS_FOR_JOB, SELECT_NUM_TRIGGERS_IN_GROUP, SELECT_PAUSED_TRIGGER_GROUP, SELECT_PAUSED_TRIGGER_GROUPS, SELECT_REFERENCED_CALENDAR, SELECT_SCHEDULER_STATE, SELECT_SCHEDULER_STATES, SELECT_SIMPLE_TRIGGER, SELECT_TRIGGER, SELECT_TRIGGER_DATA, SELECT_TRIGGER_EXISTENCE, SELECT_TRIGGER_FOR_FIRE_TIME, SELECT_TRIGGER_GROUPS, SELECT_TRIGGER_GROUPS_FILTERED, SELECT_TRIGGER_STATE, SELECT_TRIGGER_STATUS, SELECT_TRIGGERS_FOR_CALENDAR, SELECT_TRIGGERS_FOR_JOB, SELECT_TRIGGERS_IN_GROUP, SELECT_TRIGGERS_IN_GROUP_LIKE, SELECT_TRIGGERS_IN_STATE, TABLE_PREFIX_SUBST, UPDATE_BLOB_TRIGGER, UPDATE_CALENDAR, UPDATE_CRON_TRIGGER, UPDATE_FIRED_TRIGGER, UPDATE_JOB_DATA, UPDATE_JOB_DETAIL, UPDATE_JOB_TRIGGER_STATES, UPDATE_JOB_TRIGGER_STATES_FROM_OTHER_STATE, UPDATE_SCHEDULER_STATE, UPDATE_SIMPLE_TRIGGER, UPDATE_TRIGGER, UPDATE_TRIGGER_GROUP_STATE_FROM_STATE, UPDATE_TRIGGER_GROUP_STATE_FROM_STATES, UPDATE_TRIGGER_SKIP_DATA, UPDATE_TRIGGER_STATE, UPDATE_TRIGGER_STATE_FROM_STATE, UPDATE_TRIGGER_STATE_FROM_STATES, UPDATE_TRIGGER_STATES_FROM_OTHER_STATES
-
-
Constructor Summary
Constructors Constructor Description StdJDBCDelegate()
Create new StdJDBCDelegate instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addDefaultTriggerPersistenceDelegates()
void
addTriggerPersistenceDelegate(TriggerPersistenceDelegate delegate)
boolean
calendarExists(java.sql.Connection conn, java.lang.String calendarName)
Check whether or not a calendar exists.boolean
calendarIsReferenced(java.sql.Connection conn, java.lang.String calendarName)
Check whether or not a calendar is referenced by any triggers.protected boolean
canUseProperties()
void
clearData(java.sql.Connection conn)
protected static void
closeResultSet(java.sql.ResultSet rs)
Cleanup helper method that closes the givenResultSet
while ignoring any errors.protected static void
closeStatement(java.sql.Statement statement)
Cleanup helper method that closes the givenStatement
while ignoring any errors.protected java.util.Map<?,?>
convertFromProperty(java.util.Properties properties)
convert the JobDataMap into a list of propertiesprotected java.util.Properties
convertToProperty(java.util.Map<?,?> data)
convert the JobDataMap into a list of propertiesint
countMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state1, long ts)
Get the number of triggers in the given states that have misfired - according to the given timestamp.int
deleteAllPausedTriggerGroups(java.sql.Connection conn)
int
deleteBlobTrigger(java.sql.Connection conn, TriggerKey triggerKey)
Delete the cron trigger data for a trigger.int
deleteCalendar(java.sql.Connection conn, java.lang.String calendarName)
Delete a calendar.int
deleteFiredTrigger(java.sql.Connection conn, java.lang.String entryId)
Delete a fired trigger.int
deleteFiredTriggers(java.sql.Connection conn)
Delete all fired triggers.int
deleteFiredTriggers(java.sql.Connection conn, java.lang.String theInstanceId)
Delete all fired triggers of the given instance.int
deleteJobDetail(java.sql.Connection conn, JobKey jobKey)
Delete the job detail record for the given job.int
deletePausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName)
int
deletePausedTriggerGroup(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher)
int
deleteSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId)
Delete a scheduler-instance state record.int
deleteTrigger(java.sql.Connection conn, TriggerKey triggerKey)
Delete the base trigger data for a trigger.protected void
deleteTriggerExtension(java.sql.Connection conn, TriggerKey triggerKey)
TriggerPersistenceDelegate
findTriggerPersistenceDelegate(java.lang.String discriminator)
TriggerPersistenceDelegate
findTriggerPersistenceDelegate(OperableTrigger trigger)
protected boolean
getBoolean(java.sql.ResultSet rs, int columnIndex)
Retrieves the value of the designated column index in the current row as aboolean
.protected boolean
getBoolean(java.sql.ResultSet rs, java.lang.String columnName)
Retrieves the value of the designated column in the current row as aboolean
.protected java.lang.Object
getJobDataFromBlob(java.sql.ResultSet rs, java.lang.String colName)
This method should be overridden by any delegate subclasses that need special handling for BLOBs for job details.protected java.lang.Object
getKeyOfNonSerializableValue(java.util.Map<?,?> data)
Find the key of the first non-serializable value in the given Map.protected java.lang.Object
getObjectFromBlob(java.sql.ResultSet rs, java.lang.String colName)
This method should be overridden by any delegate subclasses that need special handling for BLOBs.protected java.lang.String
getSchedulerNameLiteral()
boolean
hasMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state1, long ts, int count, java.util.List<TriggerKey> resultList)
Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.void
initialize(org.slf4j.Logger logger, java.lang.String tablePrefix, java.lang.String schedName, java.lang.String instanceId, ClassLoadHelper classLoadHelper, boolean useProperties, java.lang.String initString)
int
insertBlobTrigger(java.sql.Connection conn, OperableTrigger trigger)
Insert the blob trigger data.int
insertCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar)
Insert a new calendar.int
insertFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job)
Insert a fired trigger.int
insertJobDetail(java.sql.Connection conn, JobDetail job)
Insert the job detail record.int
insertPausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName)
int
insertSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId, long checkInTime, long interval)
Insert a scheduler-instance state record.int
insertTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail jobDetail)
Insert the base trigger data.boolean
isExistingTriggerGroup(java.sql.Connection conn, java.lang.String groupName)
boolean
isJobNonConcurrent(java.sql.Connection conn, JobKey jobKey)
Check whether or not the given job is stateful.protected boolean
isMatcherEquals(GroupMatcher<?> matcher)
boolean
isTriggerGroupPaused(java.sql.Connection conn, java.lang.String groupName)
boolean
jobExists(java.sql.Connection conn, JobKey jobKey)
Check whether or not the given job exists.protected java.lang.String
rtp(java.lang.String query)
Replace the table prefix in a query by replacing any occurrences of "{0}" with the table prefix.Calendar
selectCalendar(java.sql.Connection conn, java.lang.String calendarName)
Select a calendar.java.util.List<java.lang.String>
selectCalendars(java.sql.Connection conn)
Select all of the stored calendars.java.util.Set<java.lang.String>
selectFiredTriggerInstanceNames(java.sql.Connection conn)
Select the distinct instance names of all fired-trigger records.java.util.List<FiredTriggerRecord>
selectFiredTriggerRecords(java.sql.Connection conn, java.lang.String triggerName, java.lang.String groupName)
Select the states of all fired-trigger records for a given trigger, or trigger group if trigger name isnull
.java.util.List<FiredTriggerRecord>
selectFiredTriggerRecordsByJob(java.sql.Connection conn, java.lang.String jobName, java.lang.String groupName)
Select the states of all fired-trigger records for a given job, or job group if job name isnull
.java.util.List<FiredTriggerRecord>
selectInstancesFiredTriggerRecords(java.sql.Connection conn, java.lang.String instanceName)
Select the states of all fired-trigger records for a given scheduler instance.JobDetail
selectJobDetail(java.sql.Connection conn, JobKey jobKey, ClassLoadHelper loadHelper)
Select the JobDetail object for a given job name / group name.int
selectJobExecutionCount(java.sql.Connection conn, JobKey jobKey)
Get the number instances of the identified job currently executing.JobDetail
selectJobForTrigger(java.sql.Connection conn, ClassLoadHelper loadHelper, TriggerKey triggerKey)
Select the job to which the trigger is associated.JobDetail
selectJobForTrigger(java.sql.Connection conn, ClassLoadHelper loadHelper, TriggerKey triggerKey, boolean loadJobClass)
Select the job to which the trigger is associated.java.util.List<java.lang.String>
selectJobGroups(java.sql.Connection conn)
Select all of the job group names that are stored.java.util.Set<JobKey>
selectJobsInGroup(java.sql.Connection conn, GroupMatcher<JobKey> matcher)
Select all of the jobs contained in a given group.java.util.List<TriggerKey>
selectMisfiredTriggers(java.sql.Connection conn, long ts)
Get the names of all of the triggers that have misfired.java.util.List<TriggerKey>
selectMisfiredTriggersInGroupInState(java.sql.Connection conn, java.lang.String groupName, java.lang.String state, long ts)
Get the names of all of the triggers in the given group and state that have misfired.java.util.List<TriggerKey>
selectMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state, long ts)
Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.long
selectNextFireTime(java.sql.Connection conn)
Deprecated.Does not account for misfires.int
selectNumCalendars(java.sql.Connection conn)
Select the total number of calendars stored.int
selectNumJobs(java.sql.Connection conn)
Select the total number of jobs stored.int
selectNumTriggers(java.sql.Connection conn)
Select the total number of triggers stored.int
selectNumTriggersForJob(java.sql.Connection conn, JobKey jobKey)
Select the number of triggers associated with a given job.java.util.Set<java.lang.String>
selectPausedTriggerGroups(java.sql.Connection conn)
java.util.List<SchedulerStateRecord>
selectSchedulerStateRecords(java.sql.Connection conn, java.lang.String theInstanceId)
A List of all currentSchedulerStateRecords
.OperableTrigger
selectTrigger(java.sql.Connection conn, TriggerKey triggerKey)
Select a trigger.TriggerKey
selectTriggerForFireTime(java.sql.Connection conn, long fireTime)
Select the trigger that will be fired at the given fire time.java.util.List<java.lang.String>
selectTriggerGroups(java.sql.Connection conn)
Select all of the trigger group names that are stored.java.util.List<java.lang.String>
selectTriggerGroups(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher)
JobDataMap
selectTriggerJobDataMap(java.sql.Connection conn, java.lang.String triggerName, java.lang.String groupName)
Select a trigger's JobDataMap.java.util.List<TriggerKey>
selectTriggerKeysForJob(java.sql.Connection conn, JobKey jobKey)
Get the names of all of the triggers associated with the given job.java.util.List<OperableTrigger>
selectTriggersForCalendar(java.sql.Connection conn, java.lang.String calName)
Select the triggers for a calendarjava.util.List<OperableTrigger>
selectTriggersForJob(java.sql.Connection conn, JobKey jobKey)
Select the triggers for a jobjava.util.List<OperableTrigger>
selectTriggersForRecoveringJobs(java.sql.Connection conn)
Select all of the triggers for jobs that are requesting recovery.java.util.Set<TriggerKey>
selectTriggersInGroup(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher)
Select all of the triggers contained in a given group.java.util.List<TriggerKey>
selectTriggersInState(java.sql.Connection conn, java.lang.String state)
Select all of the triggers in a given state.java.lang.String
selectTriggerState(java.sql.Connection conn, TriggerKey triggerKey)
Select a trigger' state value.TriggerStatus
selectTriggerStatus(java.sql.Connection conn, TriggerKey triggerKey)
Select a trigger' status (state and next fire time).java.util.List<TriggerKey>
selectTriggerToAcquire(java.sql.Connection conn, long noLaterThan, long noEarlierThan)
Deprecated.- This remained for compatibility reason.java.util.List<TriggerKey>
selectTriggerToAcquire(java.sql.Connection conn, long noLaterThan, long noEarlierThan, int maxCount)
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.protected java.io.ByteArrayOutputStream
serializeJobData(JobDataMap data)
Remove the transient data from and then create a serializedjava.util.ByteArrayOutputStream
version of a
.JobDataMap
protected java.io.ByteArrayOutputStream
serializeObject(java.lang.Object obj)
Create a serializedjava.util.ByteArrayOutputStream
version of an Object.protected void
setBoolean(java.sql.PreparedStatement ps, int index, boolean val)
Sets the designated parameter to the given Javaboolean
value.protected void
setBytes(java.sql.PreparedStatement ps, int index, java.io.ByteArrayOutputStream baos)
Sets the designated parameter to the byte array of the givenByteArrayOutputStream
.protected java.lang.String
toSqlEqualsClause(GroupMatcher<?> matcher)
protected java.lang.String
toSqlLikeClause(GroupMatcher<?> matcher)
boolean
triggerExists(java.sql.Connection conn, TriggerKey triggerKey)
Check whether or not a trigger exists.int
updateBlobTrigger(java.sql.Connection conn, OperableTrigger trigger)
Update the blob trigger data.int
updateCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar)
Update a calendar.int
updateFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job)
Update a fired trigger.int
updateJobData(java.sql.Connection conn, JobDetail job)
Update the job data map for the given job.int
updateJobDetail(java.sql.Connection conn, JobDetail job)
Update the job detail record.int
updateSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId, long checkInTime)
Update a scheduler-instance state record.int
updateTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail jobDetail)
Update the base trigger data.int
updateTriggerGroupStateFromOtherState(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher, java.lang.String newState, java.lang.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(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2, java.lang.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(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String state)
Update the state for a given trigger.int
updateTriggerStateFromOtherState(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String newState, java.lang.String oldState)
Update the given trigger to the given new state, if it is in the given old state.int
updateTriggerStateFromOtherStates(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2, java.lang.String oldState3)
Update the given trigger to the given new state, if it is one of the given old states.int
updateTriggerStatesForJob(java.sql.Connection conn, JobKey jobKey, java.lang.String state)
Update the states of all triggers associated with the given job.int
updateTriggerStatesForJobFromOtherState(java.sql.Connection conn, JobKey jobKey, java.lang.String state, java.lang.String oldState)
Update the states of any triggers associated with the given job, that are the given current state.int
updateTriggerStatesFromOtherStates(java.sql.Connection conn, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2)
Insert the job detail record.
-
-
-
Field Detail
-
logger
protected org.slf4j.Logger logger
-
tablePrefix
protected java.lang.String tablePrefix
-
instanceId
protected java.lang.String instanceId
-
schedName
protected java.lang.String schedName
-
useProperties
protected boolean useProperties
-
classLoadHelper
protected ClassLoadHelper classLoadHelper
-
triggerPersistenceDelegates
protected java.util.List<TriggerPersistenceDelegate> triggerPersistenceDelegates
-
-
Method Detail
-
initialize
public void initialize(org.slf4j.Logger logger, java.lang.String tablePrefix, java.lang.String schedName, java.lang.String instanceId, ClassLoadHelper classLoadHelper, boolean useProperties, java.lang.String initString) throws NoSuchDelegateException
- Specified by:
initialize
in interfaceDriverDelegate
- Parameters:
initString
- of the format: settingName=settingValue|otherSettingName=otherSettingValue|...- Throws:
NoSuchDelegateException
-
addDefaultTriggerPersistenceDelegates
protected void addDefaultTriggerPersistenceDelegates()
-
canUseProperties
protected boolean canUseProperties()
-
addTriggerPersistenceDelegate
public void addTriggerPersistenceDelegate(TriggerPersistenceDelegate delegate)
-
findTriggerPersistenceDelegate
public TriggerPersistenceDelegate findTriggerPersistenceDelegate(OperableTrigger trigger)
-
findTriggerPersistenceDelegate
public TriggerPersistenceDelegate findTriggerPersistenceDelegate(java.lang.String discriminator)
-
updateTriggerStatesFromOtherStates
public int updateTriggerStatesFromOtherStates(java.sql.Connection conn, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2) throws java.sql.SQLException
Insert the job detail record.
- Specified by:
updateTriggerStatesFromOtherStates
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectionnewState
- the new state for the triggersoldState1
- the first old state to updateoldState2
- the second old state to update- Returns:
- number of rows updated
- Throws:
java.sql.SQLException
-
selectMisfiredTriggers
public java.util.List<TriggerKey> selectMisfiredTriggers(java.sql.Connection conn, long ts) throws java.sql.SQLException
Get the names of all of the triggers that have misfired.
- Specified by:
selectMisfiredTriggers
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
objectsKey
- Throws:
java.sql.SQLException
-
selectTriggersInState
public java.util.List<TriggerKey> selectTriggersInState(java.sql.Connection conn, java.lang.String state) throws java.sql.SQLException
Select all of the triggers in a given state.
- Specified by:
selectTriggersInState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionstate
- the state the triggers must be in- Returns:
- an array of trigger
Key
s - Throws:
java.sql.SQLException
-
selectMisfiredTriggersInState
public java.util.List<TriggerKey> selectMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state, long ts) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.
- Specified by:
selectMisfiredTriggersInState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
objectsKey
- Throws:
java.sql.SQLException
-
hasMisfiredTriggersInState
public boolean hasMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state1, long ts, int count, java.util.List<TriggerKey> resultList) throws java.sql.SQLException
Get the names of all of the triggers in the given state that have misfired - according to the given timestamp. No more than count will be returned.
- Specified by:
hasMisfiredTriggersInState
in interfaceDriverDelegate
- Parameters:
conn
- The DB Connectioncount
- The most misfired triggers to return, negative for allresultList
- Output parameter. A List of
objects. Must not be null.Key
- Returns:
- Whether there are more misfired triggers left to find beyond the given count.
- Throws:
java.sql.SQLException
-
countMisfiredTriggersInState
public int countMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state1, long ts) throws java.sql.SQLException
Get the number of triggers in the given states that have misfired - according to the given timestamp.
- Specified by:
countMisfiredTriggersInState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Throws:
java.sql.SQLException
-
selectMisfiredTriggersInGroupInState
public java.util.List<TriggerKey> selectMisfiredTriggersInGroupInState(java.sql.Connection conn, java.lang.String groupName, java.lang.String state, long ts) throws java.sql.SQLException
Get the names of all of the triggers in the given group and state that have misfired.
- Specified by:
selectMisfiredTriggersInGroupInState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
objectsKey
- Throws:
java.sql.SQLException
-
selectTriggersForRecoveringJobs
public java.util.List<OperableTrigger> selectTriggersForRecoveringJobs(java.sql.Connection conn) throws java.sql.SQLException, java.io.IOException, java.lang.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
trigger group.Scheduler
.DEFAULT_RECOVERY_GROUPIn order to preserve the ordering of the triggers, the fire time will be set from the
COL_FIRED_TIME
column in theTABLE_FIRED_TRIGGERS
table. The caller is responsible for callingcomputeFirstFireTime
on each returned trigger. It is also up to the caller to insert the returned triggers to ensure that they are fired.- Specified by:
selectTriggersForRecoveringJobs
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
objectsTrigger
- Throws:
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
-
deleteFiredTriggers
public int deleteFiredTriggers(java.sql.Connection conn) throws java.sql.SQLException
Delete all fired triggers.
- Specified by:
deleteFiredTriggers
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
deleteFiredTriggers
public int deleteFiredTriggers(java.sql.Connection conn, java.lang.String theInstanceId) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Delete all fired triggers of the given instance.
- Specified by:
deleteFiredTriggers
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
clearData
public void clearData(java.sql.Connection conn) throws java.sql.SQLException
- Specified by:
clearData
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
insertJobDetail
public int insertJobDetail(java.sql.Connection conn, JobDetail job) throws java.io.IOException, java.sql.SQLException
Insert the job detail record.
- Specified by:
insertJobDetail
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionjob
- the job to insert- Returns:
- number of rows inserted
- Throws:
java.io.IOException
- if there were problems serializing the JobDataMapjava.sql.SQLException
-
updateJobDetail
public int updateJobDetail(java.sql.Connection conn, JobDetail job) throws java.io.IOException, java.sql.SQLException
Update the job detail record.
- Specified by:
updateJobDetail
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionjob
- the job to update- Returns:
- number of rows updated
- Throws:
java.io.IOException
- if there were problems serializing the JobDataMapjava.sql.SQLException
-
selectTriggerKeysForJob
public java.util.List<TriggerKey> selectTriggerKeysForJob(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Get the names of all of the triggers associated with the given job.
- Specified by:
selectTriggerKeysForJob
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
objectsKey
- Throws:
java.sql.SQLException
-
deleteJobDetail
public int deleteJobDetail(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Delete the job detail record for the given job.
- Specified by:
deleteJobDetail
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
isJobNonConcurrent
public boolean isJobNonConcurrent(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Check whether or not the given job is stateful.
- Specified by:
isJobNonConcurrent
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- true if the job exists and is stateful, false otherwise
- Throws:
java.sql.SQLException
-
jobExists
public boolean jobExists(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Check whether or not the given job exists.
- Specified by:
jobExists
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- true if the job exists, false otherwise
- Throws:
java.sql.SQLException
-
updateJobData
public int updateJobData(java.sql.Connection conn, JobDetail job) throws java.io.IOException, java.sql.SQLException
Update the job data map for the given job.
- Specified by:
updateJobData
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionjob
- the job to update- Returns:
- the number of rows updated
- Throws:
java.io.IOException
- if there were problems serializing the JobDataMapjava.sql.SQLException
-
selectJobDetail
public JobDetail selectJobDetail(java.sql.Connection conn, JobKey jobKey, ClassLoadHelper loadHelper) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException
Select the JobDetail object for a given job name / group name.
- Specified by:
selectJobDetail
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the populated JobDetail object
- Throws:
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found or if the job class could not be foundjava.io.IOException
- if deserialization causes an errorjava.sql.SQLException
-
selectNumJobs
public int selectNumJobs(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of jobs stored.
- Specified by:
selectNumJobs
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the total number of jobs stored
- Throws:
java.sql.SQLException
-
selectJobGroups
public java.util.List<java.lang.String> selectJobGroups(java.sql.Connection conn) throws java.sql.SQLException
Select all of the job group names that are stored.
- Specified by:
selectJobGroups
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
String
group names - Throws:
java.sql.SQLException
-
selectJobsInGroup
public java.util.Set<JobKey> selectJobsInGroup(java.sql.Connection conn, GroupMatcher<JobKey> matcher) throws java.sql.SQLException
Select all of the jobs contained in a given group.
- Specified by:
selectJobsInGroup
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionmatcher
- the groupMatcher to evaluate the jobs against- Returns:
- an array of
String
job names - Throws:
java.sql.SQLException
-
isMatcherEquals
protected boolean isMatcherEquals(GroupMatcher<?> matcher)
-
toSqlEqualsClause
protected java.lang.String toSqlEqualsClause(GroupMatcher<?> matcher)
-
toSqlLikeClause
protected java.lang.String toSqlLikeClause(GroupMatcher<?> matcher)
-
insertTrigger
public int insertTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail jobDetail) throws java.sql.SQLException, java.io.IOException
Insert the base trigger data.
- Specified by:
insertTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectiontrigger
- the trigger to insertstate
- the state that the trigger should be stored in- Returns:
- the number of rows inserted
- Throws:
java.sql.SQLException
java.io.IOException
-
insertBlobTrigger
public int insertBlobTrigger(java.sql.Connection conn, OperableTrigger trigger) throws java.sql.SQLException, java.io.IOException
Insert the blob trigger data.
- Parameters:
conn
- the DB Connectiontrigger
- the trigger to insert- Returns:
- the number of rows inserted
- Throws:
java.sql.SQLException
java.io.IOException
-
updateTrigger
public int updateTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail jobDetail) throws java.sql.SQLException, java.io.IOException
Update the base trigger data.
- Specified by:
updateTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectiontrigger
- the trigger to insertstate
- the state that the trigger should be stored in- Returns:
- the number of rows updated
- Throws:
java.sql.SQLException
java.io.IOException
-
updateBlobTrigger
public int updateBlobTrigger(java.sql.Connection conn, OperableTrigger trigger) throws java.sql.SQLException, java.io.IOException
Update the blob trigger data.
- Parameters:
conn
- the DB Connectiontrigger
- the trigger to insert- Returns:
- the number of rows updated
- Throws:
java.sql.SQLException
java.io.IOException
-
triggerExists
public boolean triggerExists(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Check whether or not a trigger exists.
- Specified by:
triggerExists
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- true if the trigger exists, false otherwise
- Throws:
java.sql.SQLException
-
updateTriggerState
public int updateTriggerState(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String state) throws java.sql.SQLException
Update the state for a given trigger.
- Specified by:
updateTriggerState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionstate
- the new state for the trigger- Returns:
- the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerStateFromOtherStates
public int updateTriggerStateFromOtherStates(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2, java.lang.String oldState3) throws java.sql.SQLException
Update the given trigger to the given new state, if it is one of the given old states.
- Specified by:
updateTriggerStateFromOtherStates
in interfaceDriverDelegate
- Parameters:
conn
- the DB connectionnewState
- the new state for the triggeroldState1
- one of the old state the trigger must be inoldState2
- one of the old state the trigger must be inoldState3
- one of the old state the trigger must be in- Returns:
- int the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerGroupStateFromOtherStates
public int updateTriggerGroupStateFromOtherStates(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher, java.lang.String newState, java.lang.String oldState1, java.lang.String oldState2, java.lang.String oldState3) throws java.sql.SQLException
Update all triggers in the given group to the given new state, if they are in one of the given old states.
- Specified by:
updateTriggerGroupStateFromOtherStates
in interfaceDriverDelegate
- Parameters:
conn
- the DB connectionmatcher
- the groupMatcher to evaluate the triggers againstnewState
- the new state for the triggeroldState1
- one of the old state the trigger must be inoldState2
- one of the old state the trigger must be inoldState3
- one of the old state the trigger must be in- Returns:
- int the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerStateFromOtherState
public int updateTriggerStateFromOtherState(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String newState, java.lang.String oldState) throws java.sql.SQLException
Update the given trigger to the given new state, if it is in the given old state.
- Specified by:
updateTriggerStateFromOtherState
in interfaceDriverDelegate
- Parameters:
conn
- the DB connectionnewState
- the new state for the triggeroldState
- the old state the trigger must be in- Returns:
- int the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerGroupStateFromOtherState
public int updateTriggerGroupStateFromOtherState(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher, java.lang.String newState, java.lang.String oldState) throws java.sql.SQLException
Update all of the triggers of the given group to the given new state, if they are in the given old state.
- Specified by:
updateTriggerGroupStateFromOtherState
in interfaceDriverDelegate
- Parameters:
conn
- the DB connectionmatcher
- the groupMatcher to evaluate the triggers againstnewState
- the new state for the trigger groupoldState
- the old state the triggers must be in- Returns:
- int the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerStatesForJob
public int updateTriggerStatesForJob(java.sql.Connection conn, JobKey jobKey, java.lang.String state) throws java.sql.SQLException
Update the states of all triggers associated with the given job.
- Specified by:
updateTriggerStatesForJob
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionstate
- the new state for the triggers- Returns:
- the number of rows updated
- Throws:
java.sql.SQLException
-
updateTriggerStatesForJobFromOtherState
public int updateTriggerStatesForJobFromOtherState(java.sql.Connection conn, JobKey jobKey, java.lang.String state, java.lang.String oldState) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Update the states of any triggers associated with the given job, that are the given current state.
- Specified by:
updateTriggerStatesForJobFromOtherState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionstate
- the new state for the triggersoldState
- the old state of the triggers- Returns:
- the number of rows updated
- Throws:
java.sql.SQLException
-
deleteBlobTrigger
public int deleteBlobTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Delete the cron trigger data for a trigger.
- Parameters:
conn
- the DB Connection- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
deleteTrigger
public int deleteTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Delete the base trigger data for a trigger.
- Specified by:
deleteTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
deleteTriggerExtension
protected void deleteTriggerExtension(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
selectNumTriggersForJob
public int selectNumTriggersForJob(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Select the number of triggers associated with a given job.
- Specified by:
selectNumTriggersForJob
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of triggers for the given job
- Throws:
java.sql.SQLException
-
selectJobForTrigger
public JobDetail selectJobForTrigger(java.sql.Connection conn, ClassLoadHelper loadHelper, TriggerKey triggerKey) throws java.lang.ClassNotFoundException, java.sql.SQLException
Select the job to which the trigger is associated.
- Specified by:
selectJobForTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the
object associated with the given triggerJobDetail
- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
-
selectJobForTrigger
public JobDetail selectJobForTrigger(java.sql.Connection conn, ClassLoadHelper loadHelper, TriggerKey triggerKey, boolean loadJobClass) throws java.lang.ClassNotFoundException, java.sql.SQLException
Select the job to which the trigger is associated. Allow option to load actual job class or not. When case of remove, we do not need to load the class, which in many cases, it's no longer exists.
- Specified by:
selectJobForTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the
object associated with the given triggerJobDetail
- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
-
selectTriggersForJob
public java.util.List<OperableTrigger> selectTriggersForJob(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, JobPersistenceException
Select the triggers for a job
- Specified by:
selectTriggersForJob
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
(@link org.quartz.Trigger)
objects associated with a given job. - Throws:
java.sql.SQLException
JobPersistenceException
java.lang.ClassNotFoundException
java.io.IOException
-
selectTriggersForCalendar
public java.util.List<OperableTrigger> selectTriggersForCalendar(java.sql.Connection conn, java.lang.String calName) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, JobPersistenceException
Description copied from interface:DriverDelegate
Select the triggers for a calendar
- Specified by:
selectTriggersForCalendar
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalName
- the name of the calendar- Returns:
- an array of
(@link org.quartz.Trigger)
objects associated with the given calendar. - Throws:
java.sql.SQLException
JobPersistenceException
java.lang.ClassNotFoundException
java.io.IOException
-
selectTrigger
public OperableTrigger selectTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, JobPersistenceException
Select a trigger.
- Specified by:
selectTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the
objectTrigger
- Throws:
JobPersistenceException
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
-
selectTriggerJobDataMap
public JobDataMap selectTriggerJobDataMap(java.sql.Connection conn, java.lang.String triggerName, java.lang.String groupName) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException
Select a trigger's JobDataMap.
- Specified by:
selectTriggerJobDataMap
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectiontriggerName
- the name of the triggergroupName
- the group containing the trigger- Returns:
- the
of the Trigger, never null, but possibly empty.JobDataMap
- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
-
selectTriggerState
public java.lang.String selectTriggerState(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Select a trigger' state value.
- Specified by:
selectTriggerState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the
objectTrigger
- Throws:
java.sql.SQLException
-
selectTriggerStatus
public TriggerStatus selectTriggerStatus(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Select a trigger' status (state and next fire time).
- Specified by:
selectTriggerStatus
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- a
TriggerStatus
object, or null - Throws:
java.sql.SQLException
-
selectNumTriggers
public int selectNumTriggers(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of triggers stored.
- Specified by:
selectNumTriggers
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the total number of triggers stored
- Throws:
java.sql.SQLException
-
selectTriggerGroups
public java.util.List<java.lang.String> selectTriggerGroups(java.sql.Connection conn) throws java.sql.SQLException
Select all of the trigger group names that are stored.
- Specified by:
selectTriggerGroups
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
String
group names - Throws:
java.sql.SQLException
-
selectTriggerGroups
public java.util.List<java.lang.String> selectTriggerGroups(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher) throws java.sql.SQLException
- Specified by:
selectTriggerGroups
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
selectTriggersInGroup
public java.util.Set<TriggerKey> selectTriggersInGroup(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher) throws java.sql.SQLException
Select all of the triggers contained in a given group.
- Specified by:
selectTriggersInGroup
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectionmatcher
- to evaluate against known triggers- Returns:
- a Set of
TriggerKey
s - Throws:
java.sql.SQLException
-
insertPausedTriggerGroup
public int insertPausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
- Specified by:
insertPausedTriggerGroup
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
deletePausedTriggerGroup
public int deletePausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
- Specified by:
deletePausedTriggerGroup
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
deletePausedTriggerGroup
public int deletePausedTriggerGroup(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher) throws java.sql.SQLException
- Specified by:
deletePausedTriggerGroup
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
deleteAllPausedTriggerGroups
public int deleteAllPausedTriggerGroups(java.sql.Connection conn) throws java.sql.SQLException
- Specified by:
deleteAllPausedTriggerGroups
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
isTriggerGroupPaused
public boolean isTriggerGroupPaused(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
- Specified by:
isTriggerGroupPaused
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
isExistingTriggerGroup
public boolean isExistingTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
- Specified by:
isExistingTriggerGroup
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
-
insertCalendar
public int insertCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar) throws java.io.IOException, java.sql.SQLException
Insert a new calendar.
- Specified by:
insertCalendar
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name for the new calendarcalendar
- the calendar- Returns:
- the number of rows inserted
- Throws:
java.io.IOException
- if there were problems serializing the calendarjava.sql.SQLException
-
updateCalendar
public int updateCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar) throws java.io.IOException, java.sql.SQLException
Update a calendar.
- Specified by:
updateCalendar
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name for the new calendarcalendar
- the calendar- Returns:
- the number of rows updated
- Throws:
java.io.IOException
- if there were problems serializing the calendarjava.sql.SQLException
-
calendarExists
public boolean calendarExists(java.sql.Connection conn, java.lang.String calendarName) throws java.sql.SQLException
Check whether or not a calendar exists.
- Specified by:
calendarExists
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name of the calendar- Returns:
- true if the trigger exists, false otherwise
- Throws:
java.sql.SQLException
-
selectCalendar
public Calendar selectCalendar(java.sql.Connection conn, java.lang.String calendarName) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException
Select a calendar.
- Specified by:
selectCalendar
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name of the calendar- Returns:
- the Calendar
- Throws:
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found be foundjava.io.IOException
- if there were problems deserializing the calendarjava.sql.SQLException
-
calendarIsReferenced
public boolean calendarIsReferenced(java.sql.Connection conn, java.lang.String calendarName) throws java.sql.SQLException
Check whether or not a calendar is referenced by any triggers.
- Specified by:
calendarIsReferenced
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name of the calendar- Returns:
- true if any triggers reference the calendar, false otherwise
- Throws:
java.sql.SQLException
-
deleteCalendar
public int deleteCalendar(java.sql.Connection conn, java.lang.String calendarName) throws java.sql.SQLException
Delete a calendar.
- Specified by:
deleteCalendar
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectioncalendarName
- the name of the trigger- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
selectNumCalendars
public int selectNumCalendars(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of calendars stored.
- Specified by:
selectNumCalendars
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the total number of calendars stored
- Throws:
java.sql.SQLException
-
selectCalendars
public java.util.List<java.lang.String> selectCalendars(java.sql.Connection conn) throws java.sql.SQLException
Select all of the stored calendars.
- Specified by:
selectCalendars
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- an array of
String
calendar names - Throws:
java.sql.SQLException
-
selectNextFireTime
@Deprecated public long selectNextFireTime(java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Does not account for misfires.Select the next time that a trigger will be fired.
- Specified by:
selectNextFireTime
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the next fire time, or 0 if no trigger will be fired
- Throws:
java.sql.SQLException
-
selectTriggerForFireTime
public TriggerKey selectTriggerForFireTime(java.sql.Connection conn, long fireTime) throws java.sql.SQLException
Select the trigger that will be fired at the given fire time.
- Specified by:
selectTriggerForFireTime
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectionfireTime
- the time that the trigger will be fired- Returns:
- a
representing the trigger that will be fired at the given fire time, or null if no trigger will be fired at that timeKey
- Throws:
java.sql.SQLException
-
selectTriggerToAcquire
@Deprecated public java.util.List<TriggerKey> selectTriggerToAcquire(java.sql.Connection conn, long noLaterThan, long noEarlierThan) throws java.sql.SQLException
Deprecated.- This remained for compatibility reason. UseselectTriggerToAcquire(Connection, long, long, int)
instead.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.
- Specified by:
selectTriggerToAcquire
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectionnoLaterThan
- highest value ofgetNextFireTime()
of the triggers (exclusive)noEarlierThan
- highest value ofgetNextFireTime()
of the triggers (inclusive)- Returns:
- A (never null, possibly empty) list of the identifiers (Key objects) of the next triggers to be fired.
- Throws:
java.sql.SQLException
-
selectTriggerToAcquire
public java.util.List<TriggerKey> selectTriggerToAcquire(java.sql.Connection conn, long noLaterThan, long noEarlierThan, int maxCount) throws java.sql.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.
- Specified by:
selectTriggerToAcquire
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectionnoLaterThan
- highest value ofgetNextFireTime()
of the triggers (exclusive)noEarlierThan
- highest value ofgetNextFireTime()
of the triggers (inclusive)maxCount
- maximum number of trigger keys allow to acquired in the returning list.- Returns:
- A (never null, possibly empty) list of the identifiers (Key objects) of the next triggers to be fired.
- Throws:
java.sql.SQLException
-
insertFiredTrigger
public int insertFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job) throws java.sql.SQLException
Insert a fired trigger.
- Specified by:
insertFiredTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectiontrigger
- the triggerstate
- the state that the trigger should be stored in- Returns:
- the number of rows inserted
- Throws:
java.sql.SQLException
-
updateFiredTrigger
public int updateFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job) throws java.sql.SQLException
Update a fired trigger.
- Specified by:
updateFiredTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connectiontrigger
- the triggerstate
- the state that the trigger should be stored in- Returns:
- the number of rows inserted
- Throws:
java.sql.SQLException
-
selectFiredTriggerRecords
public java.util.List<FiredTriggerRecord> selectFiredTriggerRecords(java.sql.Connection conn, java.lang.String triggerName, java.lang.String groupName) throws java.sql.SQLException
Select the states of all fired-trigger records for a given trigger, or trigger group if trigger name is
null
.- Specified by:
selectFiredTriggerRecords
in interfaceDriverDelegate
- Returns:
- a List of FiredTriggerRecord objects.
- Throws:
java.sql.SQLException
-
selectFiredTriggerRecordsByJob
public java.util.List<FiredTriggerRecord> selectFiredTriggerRecordsByJob(java.sql.Connection conn, java.lang.String jobName, java.lang.String groupName) throws java.sql.SQLException
Select the states of all fired-trigger records for a given job, or job group if job name is
null
.- Specified by:
selectFiredTriggerRecordsByJob
in interfaceDriverDelegate
- Returns:
- a List of FiredTriggerRecord objects.
- Throws:
java.sql.SQLException
-
selectInstancesFiredTriggerRecords
public java.util.List<FiredTriggerRecord> selectInstancesFiredTriggerRecords(java.sql.Connection conn, java.lang.String instanceName) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Select the states of all fired-trigger records for a given scheduler instance.
- Specified by:
selectInstancesFiredTriggerRecords
in interfaceDriverDelegate
- Returns:
- a List of FiredTriggerRecord objects.
- Throws:
java.sql.SQLException
-
selectFiredTriggerInstanceNames
public java.util.Set<java.lang.String> selectFiredTriggerInstanceNames(java.sql.Connection conn) throws java.sql.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.)
- Specified by:
selectFiredTriggerInstanceNames
in interfaceDriverDelegate
- Returns:
- a Set of String objects.
- Throws:
java.sql.SQLException
-
deleteFiredTrigger
public int deleteFiredTrigger(java.sql.Connection conn, java.lang.String entryId) throws java.sql.SQLException
Delete a fired trigger.
- Specified by:
deleteFiredTrigger
in interfaceDriverDelegate
- Parameters:
conn
- the DB ConnectionentryId
- the fired trigger entry to delete- Returns:
- the number of rows deleted
- Throws:
java.sql.SQLException
-
selectJobExecutionCount
public int selectJobExecutionCount(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Get the number instances of the identified job currently executing.
- Specified by:
selectJobExecutionCount
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number instances of the identified job currently executing.
- Throws:
java.sql.SQLException
-
insertSchedulerState
public int insertSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId, long checkInTime, long interval) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Insert a scheduler-instance state record.
- Specified by:
insertSchedulerState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of inserted rows.
- Throws:
java.sql.SQLException
-
deleteSchedulerState
public int deleteSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Delete a scheduler-instance state record.
- Specified by:
deleteSchedulerState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of deleted rows.
- Throws:
java.sql.SQLException
-
updateSchedulerState
public int updateSchedulerState(java.sql.Connection conn, java.lang.String theInstanceId, long checkInTime) throws java.sql.SQLException
Description copied from interface:DriverDelegate
Update a scheduler-instance state record.
- Specified by:
updateSchedulerState
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Returns:
- the number of updated rows.
- Throws:
java.sql.SQLException
-
selectSchedulerStateRecords
public java.util.List<SchedulerStateRecord> selectSchedulerStateRecords(java.sql.Connection conn, java.lang.String theInstanceId) throws java.sql.SQLException
Description copied from interface:DriverDelegate
A List of all current
SchedulerStateRecords
.If instanceId is not null, then only the record for the identified instance will be returned.
- Specified by:
selectSchedulerStateRecords
in interfaceDriverDelegate
- Parameters:
conn
- the DB Connection- Throws:
java.sql.SQLException
-
rtp
protected final java.lang.String rtp(java.lang.String query)
Replace the table prefix in a query by replacing any occurrences of "{0}" with the table prefix.
- Parameters:
query
- the unsubstitued query- Returns:
- the query, with proper table prefix substituted
-
getSchedulerNameLiteral
protected java.lang.String getSchedulerNameLiteral()
-
serializeObject
protected java.io.ByteArrayOutputStream serializeObject(java.lang.Object obj) throws java.io.IOException
Create a serialized
java.util.ByteArrayOutputStream
version of an Object.- Parameters:
obj
- the object to serialize- Returns:
- the serialized ByteArrayOutputStream
- Throws:
java.io.IOException
- if serialization causes an error
-
serializeJobData
protected java.io.ByteArrayOutputStream serializeJobData(JobDataMap data) throws java.io.IOException
Remove the transient data from and then create a serialized
java.util.ByteArrayOutputStream
version of a
.JobDataMap
- Parameters:
data
- the JobDataMap to serialize- Returns:
- the serialized ByteArrayOutputStream
- Throws:
java.io.IOException
- if serialization causes an error
-
getKeyOfNonSerializableValue
protected java.lang.Object getKeyOfNonSerializableValue(java.util.Map<?,?> data)
Find the key of the first non-serializable value in the given Map.- Returns:
- The key of the first non-serializable value in the given Map or null if all values are serializable.
-
convertFromProperty
protected java.util.Map<?,?> convertFromProperty(java.util.Properties properties) throws java.io.IOException
convert the JobDataMap into a list of properties- Throws:
java.io.IOException
-
convertToProperty
protected java.util.Properties convertToProperty(java.util.Map<?,?> data) throws java.io.IOException
convert the JobDataMap into a list of properties- Throws:
java.io.IOException
-
getObjectFromBlob
protected java.lang.Object getObjectFromBlob(java.sql.ResultSet rs, java.lang.String colName) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException
This method should be overridden by any delegate subclasses that need special handling for BLOBs. The default implementation uses standard JDBC
java.sql.Blob
operations.- Parameters:
rs
- the result set, already queued to the correct rowcolName
- the column name for the BLOB- Returns:
- the deserialized Object from the ResultSet BLOB
- Throws:
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be foundjava.io.IOException
- if deserialization causes an errorjava.sql.SQLException
-
getJobDataFromBlob
protected java.lang.Object getJobDataFromBlob(java.sql.ResultSet rs, java.lang.String colName) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException
This method should be overridden by any delegate subclasses that need special handling for BLOBs for job details. The default implementation uses standard JDBC
java.sql.Blob
operations.- Parameters:
rs
- the result set, already queued to the correct rowcolName
- the column name for the BLOB- Returns:
- the deserialized Object from the ResultSet BLOB
- Throws:
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be foundjava.io.IOException
- if deserialization causes an errorjava.sql.SQLException
-
selectPausedTriggerGroups
public java.util.Set<java.lang.String> selectPausedTriggerGroups(java.sql.Connection conn) throws java.sql.SQLException
- Specified by:
selectPausedTriggerGroups
in interfaceDriverDelegate
- Throws:
java.sql.SQLException
- See Also:
DriverDelegate.selectPausedTriggerGroups(java.sql.Connection)
-
closeResultSet
protected static void closeResultSet(java.sql.ResultSet rs)
Cleanup helper method that closes the givenResultSet
while ignoring any errors.
-
closeStatement
protected static void closeStatement(java.sql.Statement statement)
Cleanup helper method that closes the givenStatement
while ignoring any errors.
-
setBoolean
protected void setBoolean(java.sql.PreparedStatement ps, int index, boolean val) throws java.sql.SQLException
Sets the designated parameter to the given Javaboolean
value. This just wraps
by default, but it can be overloaded by subclass delegates for databases that don't explicitly support the boolean type.PreparedStatement.setBoolean(int, boolean)
- Throws:
java.sql.SQLException
-
getBoolean
protected boolean getBoolean(java.sql.ResultSet rs, java.lang.String columnName) throws java.sql.SQLException
Retrieves the value of the designated column in the current row as aboolean
. This just wraps
by default, but it can be overloaded by subclass delegates for databases that don't explicitly support the boolean type.ResultSet.getBoolean(java.lang.String)
- Throws:
java.sql.SQLException
-
getBoolean
protected boolean getBoolean(java.sql.ResultSet rs, int columnIndex) throws java.sql.SQLException
Retrieves the value of the designated column index in the current row as aboolean
. This just wraps
by default, but it can be overloaded by subclass delegates for databases that don't explicitly support the boolean type.ResultSet.getBoolean(java.lang.String)
- Throws:
java.sql.SQLException
-
setBytes
protected void setBytes(java.sql.PreparedStatement ps, int index, java.io.ByteArrayOutputStream baos) throws java.sql.SQLException
Sets the designated parameter to the byte array of the givenByteArrayOutputStream
. Will set parameter value to null if theByteArrayOutputStream
is null. This just wraps
by default, but it can be overloaded by subclass delegates for databases that don't explicitly support storing bytes in this way.PreparedStatement.setBytes(int, byte[])
- Throws:
java.sql.SQLException
-
-