|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.impl.jdbcjobstore.StdJDBCDelegate
public class StdJDBCDelegate
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
Field Summary | |
---|---|
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
|
Constructor Summary | |
---|---|
StdJDBCDelegate(org.slf4j.Logger logger,
java.lang.String tablePrefix,
java.lang.String schedName,
java.lang.String instanceId,
ClassLoadHelper classLoadHelper)
Create new StdJDBCDelegate instance. |
|
StdJDBCDelegate(org.slf4j.Logger logger,
java.lang.String tablePrefix,
java.lang.String schedName,
java.lang.String instanceId,
ClassLoadHelper classLoadHelper,
java.lang.Boolean useProperties)
Create new StdJDBCDelegate instance. |
Method Summary | |
---|---|
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)
Clear (delete!) all scheduling data - all Job s, Trigger s
Calendar s. |
protected static void |
closeResultSet(java.sql.ResultSet rs)
Cleanup helper method that closes the given ResultSet
while ignoring any errors. |
protected static void |
closeStatement(java.sql.Statement statement)
Cleanup helper method that closes the given Statement
while ignoring any errors. |
protected java.util.Map<?,?> |
convertFromProperty(java.util.Properties properties)
convert the JobDataMap into a list of properties |
protected java.util.Properties |
convertToProperty(java.util.Map<?,?> data)
convert the JobDataMap into a list of properties |
int |
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 instanceId)
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,
GroupMatcher<TriggerKey> matcher)
|
int |
deletePausedTriggerGroup(java.sql.Connection conn,
java.lang.String groupName)
|
int |
deleteSchedulerState(java.sql.Connection conn,
java.lang.String instanceId)
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(OperableTrigger trigger)
|
TriggerPersistenceDelegate |
findTriggerPersistenceDelegate(java.lang.String discriminator)
|
protected boolean |
getBoolean(java.sql.ResultSet rs,
int columnIndex)
Retrieves the value of the designated column index in the current row as a boolean . |
protected boolean |
getBoolean(java.sql.ResultSet rs,
java.lang.String columnName)
Retrieves the value of the designated column in the current row as a boolean . |
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(java.lang.String initString)
initStrings are of the format: settingName=settingValue|otherSettingName=otherSettingValue|... |
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 instanceId,
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. |
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 is null . |
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 is null . |
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. |
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 instanceId)
A List of all current SchedulerStateRecords . |
OperableTrigger |
selectTrigger(java.sql.Connection conn,
TriggerKey triggerKey)
Select a trigger. |
Key |
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 calendar |
java.util.List<OperableTrigger> |
selectTriggersForJob(java.sql.Connection conn,
JobKey jobKey)
Select the triggers for a job |
java.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 & next fire time). |
java.util.List<TriggerKey> |
selectTriggerToAcquire(java.sql.Connection conn,
long noLaterThan,
long noEarlierThan)
Select the next trigger which will fire to fire between the two given timestamps in ascending order of fire time, and then descending by priority. |
protected java.io.ByteArrayOutputStream |
serializeJobData(JobDataMap data)
Remove the transient data from and then create a serialized java.util.ByteArrayOutputStream
version of a . |
protected java.io.ByteArrayOutputStream |
serializeObject(java.lang.Object obj)
Create a serialized java.util.ByteArrayOutputStream
version of an Object. |
protected void |
setBoolean(java.sql.PreparedStatement ps,
int index,
boolean val)
Sets the designated parameter to the given Java boolean value. |
protected void |
setBytes(java.sql.PreparedStatement ps,
int index,
java.io.ByteArrayOutputStream baos)
Sets the designated parameter to the byte array of the given ByteArrayOutputStream . |
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 instanceId,
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.slf4j.Logger logger
protected java.lang.String tablePrefix
protected java.lang.String instanceId
protected java.lang.String schedName
protected boolean useProperties
protected ClassLoadHelper classLoadHelper
protected java.util.List<TriggerPersistenceDelegate> triggerPersistenceDelegates
Constructor Detail |
---|
public StdJDBCDelegate(org.slf4j.Logger logger, java.lang.String tablePrefix, java.lang.String schedName, java.lang.String instanceId, ClassLoadHelper classLoadHelper)
Create new StdJDBCDelegate instance.
logger
- the logger to use during executiontablePrefix
- the prefix of all table namespublic StdJDBCDelegate(org.slf4j.Logger logger, java.lang.String tablePrefix, java.lang.String schedName, java.lang.String instanceId, ClassLoadHelper classLoadHelper, java.lang.Boolean useProperties)
Create new StdJDBCDelegate instance.
logger
- the logger to use during executiontablePrefix
- the prefix of all table namesMethod Detail |
---|
public void initialize(java.lang.String initString) throws NoSuchDelegateException
initialize
in interface DriverDelegate
NoSuchDelegateException
protected void addDefaultTriggerPersistenceDelegates()
protected boolean canUseProperties()
public void addTriggerPersistenceDelegate(TriggerPersistenceDelegate delegate)
public TriggerPersistenceDelegate findTriggerPersistenceDelegate(OperableTrigger trigger)
public TriggerPersistenceDelegate findTriggerPersistenceDelegate(java.lang.String discriminator)
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.
updateTriggerStatesFromOtherStates
in interface DriverDelegate
conn
- the DB ConnectionnewState
- the new state for the triggersoldState1
- the first old state to updateoldState2
- the second old state to update
java.sql.SQLException
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.
selectMisfiredTriggers
in interface DriverDelegate
conn
- the DB Connection
Key
objects
java.sql.SQLException
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.
selectTriggersInState
in interface DriverDelegate
conn
- the DB Connectionstate
- the state the triggers must be in
Key
s
java.sql.SQLException
public java.util.List<TriggerKey> selectMisfiredTriggersInState(java.sql.Connection conn, java.lang.String state, long ts) throws java.sql.SQLException
DriverDelegate
Get the names of all of the triggers in the given state that have misfired - according to the given timestamp.
selectMisfiredTriggersInState
in interface DriverDelegate
conn
- the DB Connection
Key
objects
java.sql.SQLException
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.
hasMisfiredTriggersInState
in interface DriverDelegate
conn
- The DB Connectioncount
- The most misfired triggers to return, negative for allresultList
- Output parameter. A List of
Key
objects. Must not be null.
java.sql.SQLException
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.
countMisfiredTriggersInState
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
selectMisfiredTriggersInGroupInState
in interface DriverDelegate
conn
- the DB Connection
Key
objects
java.sql.SQLException
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_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.
selectTriggersForRecoveringJobs
in interface DriverDelegate
conn
- the DB Connection
Trigger
objects
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
public int deleteFiredTriggers(java.sql.Connection conn) throws java.sql.SQLException
Delete all fired triggers.
deleteFiredTriggers
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public int deleteFiredTriggers(java.sql.Connection conn, java.lang.String instanceId) throws java.sql.SQLException
DriverDelegate
Delete all fired triggers of the given instance.
deleteFiredTriggers
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public void clearData(java.sql.Connection conn) throws java.sql.SQLException
Job
s, Trigger
s
Calendar
s.
clearData
in interface DriverDelegate
JobPersistenceException
java.sql.SQLException
public int insertJobDetail(java.sql.Connection conn, JobDetail job) throws java.io.IOException, java.sql.SQLException
Insert the job detail record.
insertJobDetail
in interface DriverDelegate
conn
- the DB Connectionjob
- the job to insert
java.io.IOException
- if there were problems serializing the JobDataMap
java.sql.SQLException
public int updateJobDetail(java.sql.Connection conn, JobDetail job) throws java.io.IOException, java.sql.SQLException
Update the job detail record.
updateJobDetail
in interface DriverDelegate
conn
- the DB Connectionjob
- the job to update
java.io.IOException
- if there were problems serializing the JobDataMap
java.sql.SQLException
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.
selectTriggerKeysForJob
in interface DriverDelegate
conn
- the DB Connection
Key
objects
java.sql.SQLException
public int deleteJobDetail(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Delete the job detail record for the given job.
deleteJobDetail
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public boolean isJobNonConcurrent(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Check whether or not the given job is stateful.
isJobNonConcurrent
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public boolean jobExists(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Check whether or not the given job exists.
jobExists
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
updateJobData
in interface DriverDelegate
conn
- the DB Connectionjob
- the job to update
java.io.IOException
- if there were problems serializing the JobDataMap
java.sql.SQLException
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.
selectJobDetail
in interface DriverDelegate
conn
- the DB Connection
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found or if
the job class could not be found
java.io.IOException
- if deserialization causes an error
java.sql.SQLException
public int selectNumJobs(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of jobs stored.
selectNumJobs
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
selectJobGroups
in interface DriverDelegate
conn
- the DB Connection
String
group names
java.sql.SQLException
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.
selectJobsInGroup
in interface DriverDelegate
conn
- the DB Connectionmatcher
- the groupMatcher to evaluate the jobs against
String
job names
java.sql.SQLException
protected java.lang.String toSqlLikeClause(GroupMatcher matcher)
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.
insertTrigger
in interface DriverDelegate
conn
- the DB Connectiontrigger
- the trigger to insertstate
- the state that the trigger should be stored in
java.sql.SQLException
java.io.IOException
public int insertBlobTrigger(java.sql.Connection conn, OperableTrigger trigger) throws java.sql.SQLException, java.io.IOException
Insert the blob trigger data.
conn
- the DB Connectiontrigger
- the trigger to insert
java.sql.SQLException
java.io.IOException
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.
updateTrigger
in interface DriverDelegate
conn
- the DB Connectiontrigger
- the trigger to insertstate
- the state that the trigger should be stored in
java.sql.SQLException
java.io.IOException
public int updateBlobTrigger(java.sql.Connection conn, OperableTrigger trigger) throws java.sql.SQLException, java.io.IOException
Update the blob trigger data.
conn
- the DB Connectiontrigger
- the trigger to insert
java.sql.SQLException
java.io.IOException
public boolean triggerExists(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Check whether or not a trigger exists.
triggerExists
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public int updateTriggerState(java.sql.Connection conn, TriggerKey triggerKey, java.lang.String state) throws java.sql.SQLException
Update the state for a given trigger.
updateTriggerState
in interface DriverDelegate
conn
- the DB Connectionstate
- the new state for the trigger
java.sql.SQLException
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.
updateTriggerStateFromOtherStates
in interface DriverDelegate
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
java.sql.SQLException
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.
updateTriggerGroupStateFromOtherStates
in interface DriverDelegate
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
java.sql.SQLException
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.
updateTriggerStateFromOtherState
in interface DriverDelegate
conn
- the DB connectionnewState
- the new state for the triggeroldState
- the old state the trigger must be in
java.sql.SQLException
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.
updateTriggerGroupStateFromOtherState
in interface DriverDelegate
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
java.sql.SQLException
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.
updateTriggerStatesForJob
in interface DriverDelegate
conn
- the DB Connectionstate
- the new state for the triggers
java.sql.SQLException
public int updateTriggerStatesForJobFromOtherState(java.sql.Connection conn, JobKey jobKey, java.lang.String state, java.lang.String oldState) throws java.sql.SQLException
DriverDelegate
Update the states of any triggers associated with the given job, that are the given current state.
updateTriggerStatesForJobFromOtherState
in interface DriverDelegate
conn
- the DB Connectionstate
- the new state for the triggersoldState
- the old state of the triggers
java.sql.SQLException
public int deleteBlobTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Delete the cron trigger data for a trigger.
conn
- the DB Connection
java.sql.SQLException
public int deleteTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Delete the base trigger data for a trigger.
deleteTrigger
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
protected void deleteTriggerExtension(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
java.sql.SQLException
public int selectNumTriggersForJob(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
Select the number of triggers associated with a given job.
selectNumTriggersForJob
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
selectJobForTrigger
in interface DriverDelegate
conn
- the DB Connection
JobDetail
object
associated with the given trigger
java.sql.SQLException
java.lang.ClassNotFoundException
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
selectTriggersForJob
in interface DriverDelegate
conn
- the DB Connection
(@link org.quartz.Trigger)
objects
associated with a given job.
java.sql.SQLException
JobPersistenceException
java.lang.ClassNotFoundException
java.io.IOException
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
DriverDelegate
Select the triggers for a calendar
selectTriggersForCalendar
in interface DriverDelegate
conn
- the DB ConnectioncalName
- the name of the calendar
(@link org.quartz.Trigger)
objects
associated with the given calendar.
java.sql.SQLException
JobPersistenceException
java.lang.ClassNotFoundException
java.io.IOException
public OperableTrigger selectTrigger(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, JobPersistenceException
Select a trigger.
selectTrigger
in interface DriverDelegate
conn
- the DB Connection
Trigger
object
JobPersistenceException
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
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.
selectTriggerJobDataMap
in interface DriverDelegate
conn
- the DB ConnectiontriggerName
- the name of the triggergroupName
- the group containing the trigger
JobDataMap
of the Trigger,
never null, but possibly empty.
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
public java.lang.String selectTriggerState(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Select a trigger' state value.
selectTriggerState
in interface DriverDelegate
conn
- the DB Connection
Trigger
object
java.sql.SQLException
public TriggerStatus selectTriggerStatus(java.sql.Connection conn, TriggerKey triggerKey) throws java.sql.SQLException
Select a trigger' status (state & next fire time).
selectTriggerStatus
in interface DriverDelegate
conn
- the DB Connection
TriggerStatus
object, or null
java.sql.SQLException
public int selectNumTriggers(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of triggers stored.
selectNumTriggers
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
selectTriggerGroups
in interface DriverDelegate
conn
- the DB Connection
String
group names
java.sql.SQLException
public java.util.List<java.lang.String> selectTriggerGroups(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher) throws java.sql.SQLException
selectTriggerGroups
in interface DriverDelegate
java.sql.SQLException
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.
selectTriggersInGroup
in interface DriverDelegate
conn
- the DB Connectionmatcher
- to evaluate against known triggers
TriggerKey
s
java.sql.SQLException
public int insertPausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
insertPausedTriggerGroup
in interface DriverDelegate
java.sql.SQLException
public int deletePausedTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
deletePausedTriggerGroup
in interface DriverDelegate
java.sql.SQLException
public int deletePausedTriggerGroup(java.sql.Connection conn, GroupMatcher<TriggerKey> matcher) throws java.sql.SQLException
deletePausedTriggerGroup
in interface DriverDelegate
java.sql.SQLException
public int deleteAllPausedTriggerGroups(java.sql.Connection conn) throws java.sql.SQLException
deleteAllPausedTriggerGroups
in interface DriverDelegate
java.sql.SQLException
public boolean isTriggerGroupPaused(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
isTriggerGroupPaused
in interface DriverDelegate
java.sql.SQLException
public boolean isExistingTriggerGroup(java.sql.Connection conn, java.lang.String groupName) throws java.sql.SQLException
isExistingTriggerGroup
in interface DriverDelegate
java.sql.SQLException
public int insertCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar) throws java.io.IOException, java.sql.SQLException
Insert a new calendar.
insertCalendar
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name for the new calendarcalendar
- the calendar
java.io.IOException
- if there were problems serializing the calendar
java.sql.SQLException
public int updateCalendar(java.sql.Connection conn, java.lang.String calendarName, Calendar calendar) throws java.io.IOException, java.sql.SQLException
Update a calendar.
updateCalendar
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name for the new calendarcalendar
- the calendar
java.io.IOException
- if there were problems serializing the calendar
java.sql.SQLException
public boolean calendarExists(java.sql.Connection conn, java.lang.String calendarName) throws java.sql.SQLException
Check whether or not a calendar exists.
calendarExists
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name of the calendar
java.sql.SQLException
public Calendar selectCalendar(java.sql.Connection conn, java.lang.String calendarName) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException
Select a calendar.
selectCalendar
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name of the calendar
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found be
found
java.io.IOException
- if there were problems deserializing the calendar
java.sql.SQLException
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.
calendarIsReferenced
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name of the calendar
java.sql.SQLException
public int deleteCalendar(java.sql.Connection conn, java.lang.String calendarName) throws java.sql.SQLException
Delete a calendar.
deleteCalendar
in interface DriverDelegate
conn
- the DB ConnectioncalendarName
- the name of the trigger
java.sql.SQLException
public int selectNumCalendars(java.sql.Connection conn) throws java.sql.SQLException
Select the total number of calendars stored.
selectNumCalendars
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public java.util.List<java.lang.String> selectCalendars(java.sql.Connection conn) throws java.sql.SQLException
Select all of the stored calendars.
selectCalendars
in interface DriverDelegate
conn
- the DB Connection
String
calendar names
java.sql.SQLException
public long selectNextFireTime(java.sql.Connection conn) throws java.sql.SQLException
Select the next time that a trigger will be fired.
selectNextFireTime
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public Key selectTriggerForFireTime(java.sql.Connection conn, long fireTime) throws java.sql.SQLException
Select the trigger that will be fired at the given fire time.
selectTriggerForFireTime
in interface DriverDelegate
conn
- the DB ConnectionfireTime
- the time that the trigger will be fired
Key
representing the
trigger that will be fired at the given fire time, or null if no
trigger will be fired at that time
java.sql.SQLException
public java.util.List<TriggerKey> selectTriggerToAcquire(java.sql.Connection conn, long noLaterThan, long noEarlierThan) 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.
selectTriggerToAcquire
in interface DriverDelegate
conn
- the DB ConnectionnoLaterThan
- highest value of getNextFireTime()
of the triggers (exclusive)noEarlierThan
- highest value of getNextFireTime()
of the triggers (inclusive)
java.sql.SQLException
public int insertFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job) throws java.sql.SQLException
Insert a fired trigger.
insertFiredTrigger
in interface DriverDelegate
conn
- the DB Connectiontrigger
- the triggerstate
- the state that the trigger should be stored in
java.sql.SQLException
public int updateFiredTrigger(java.sql.Connection conn, OperableTrigger trigger, java.lang.String state, JobDetail job) throws java.sql.SQLException
Update a fired trigger.
updateFiredTrigger
in interface DriverDelegate
conn
- the DB Connectiontrigger
- the triggerstate
- the state that the trigger should be stored in
java.sql.SQLException
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
.
selectFiredTriggerRecords
in interface DriverDelegate
java.sql.SQLException
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
.
selectFiredTriggerRecordsByJob
in interface DriverDelegate
java.sql.SQLException
public java.util.List<FiredTriggerRecord> selectInstancesFiredTriggerRecords(java.sql.Connection conn, java.lang.String instanceName) throws java.sql.SQLException
DriverDelegate
Select the states of all fired-trigger records for a given scheduler instance.
selectInstancesFiredTriggerRecords
in interface DriverDelegate
java.sql.SQLException
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.)
selectFiredTriggerInstanceNames
in interface DriverDelegate
java.sql.SQLException
public int deleteFiredTrigger(java.sql.Connection conn, java.lang.String entryId) throws java.sql.SQLException
Delete a fired trigger.
deleteFiredTrigger
in interface DriverDelegate
conn
- the DB ConnectionentryId
- the fired trigger entry to delete
java.sql.SQLException
public int selectJobExecutionCount(java.sql.Connection conn, JobKey jobKey) throws java.sql.SQLException
DriverDelegate
Get the number instances of the identified job currently executing.
selectJobExecutionCount
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public int insertSchedulerState(java.sql.Connection conn, java.lang.String instanceId, long checkInTime, long interval) throws java.sql.SQLException
DriverDelegate
Insert a scheduler-instance state record.
insertSchedulerState
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public int deleteSchedulerState(java.sql.Connection conn, java.lang.String instanceId) throws java.sql.SQLException
DriverDelegate
Delete a scheduler-instance state record.
deleteSchedulerState
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public int updateSchedulerState(java.sql.Connection conn, java.lang.String instanceId, long checkInTime) throws java.sql.SQLException
DriverDelegate
Update a scheduler-instance state record.
updateSchedulerState
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
public java.util.List<SchedulerStateRecord> selectSchedulerStateRecords(java.sql.Connection conn, java.lang.String instanceId) throws java.sql.SQLException
DriverDelegate
A List of all current SchedulerStateRecords
.
If instanceId is not null, then only the record for the identified instance will be returned.
selectSchedulerStateRecords
in interface DriverDelegate
conn
- the DB Connection
java.sql.SQLException
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.
query
- the unsubstitued query
protected java.lang.String getSchedulerNameLiteral()
protected java.io.ByteArrayOutputStream serializeObject(java.lang.Object obj) throws java.io.IOException
Create a serialized java.util.ByteArrayOutputStream
version of an Object.
obj
- the object to serialize
java.io.IOException
- if serialization causes an errorprotected 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
data
- the JobDataMap to serialize
java.io.IOException
- if serialization causes an errorprotected java.lang.Object getKeyOfNonSerializableValue(java.util.Map<?,?> data)
protected java.util.Map<?,?> convertFromProperty(java.util.Properties properties) throws java.io.IOException
java.io.IOException
protected java.util.Properties convertToProperty(java.util.Map<?,?> data) throws java.io.IOException
java.io.IOException
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.
rs
- the result set, already queued to the correct rowcolName
- the column name for the BLOB
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found
java.io.IOException
- if deserialization causes an error
java.sql.SQLException
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.
rs
- the result set, already queued to the correct rowcolName
- the column name for the BLOB
java.lang.ClassNotFoundException
- if a class found during deserialization cannot be found
java.io.IOException
- if deserialization causes an error
java.sql.SQLException
public java.util.Set<java.lang.String> selectPausedTriggerGroups(java.sql.Connection conn) throws java.sql.SQLException
selectPausedTriggerGroups
in interface DriverDelegate
java.sql.SQLException
DriverDelegate.selectPausedTriggerGroups(java.sql.Connection)
protected static void closeResultSet(java.sql.ResultSet rs)
ResultSet
while ignoring any errors.
protected static void closeStatement(java.sql.Statement statement)
Statement
while ignoring any errors.
protected void setBoolean(java.sql.PreparedStatement ps, int index, boolean val) throws java.sql.SQLException
boolean
value.
This just wraps PreparedStatement.setBoolean(int, boolean)
by default, but it can be overloaded by subclass delegates for databases that
don't explicitly support the boolean type.
java.sql.SQLException
protected boolean getBoolean(java.sql.ResultSet rs, java.lang.String columnName) throws java.sql.SQLException
boolean
.
This just wraps ResultSet.getBoolean(java.lang.String)
by default, but it can be overloaded by subclass delegates for databases that
don't explicitly support the boolean type.
java.sql.SQLException
protected boolean getBoolean(java.sql.ResultSet rs, int columnIndex) throws java.sql.SQLException
boolean
.
This just wraps ResultSet.getBoolean(java.lang.String)
by default, but it can be overloaded by subclass delegates for databases that
don't explicitly support the boolean type.
java.sql.SQLException
protected void setBytes(java.sql.PreparedStatement ps, int index, java.io.ByteArrayOutputStream baos) throws java.sql.SQLException
ByteArrayOutputStream
. Will set parameter value to null if the
ByteArrayOutputStream
is null.
This just wraps PreparedStatement.setBytes(int, byte[])
by default, but it can be overloaded by subclass delegates for databases that
don't explicitly support storing bytes in this way.
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |