Save This Page
Home » quartz-1.6.0 » org » quartz » impl » jdbcjobstore » [javadoc | source]
org.quartz.impl.jdbcjobstore
public class: StdJDBCDelegate [javadoc | source]
java.lang.Object
   org.quartz.impl.jdbcjobstore.StdJDBCDelegate

All Implemented Interfaces:
    StdJDBCConstants, DriverDelegate

Direct Known Subclasses:
    PostgreSQLDelegate, DB2v7Delegate, WebLogicDelegate, DB2v6Delegate, PointbaseDelegate, CloudscapeDelegate, OracleDelegate, HSQLDBDelegate, DB2v8Delegate, WebLogicOracleDelegate, WebLogicOracleDelegate, MSSQLDelegate

This is meant to be an abstract base class for most, if not all, org.quartz.impl.jdbcjobstore.DriverDelegate implementations. Subclasses should override only those methods that need special handling for the DBMS driver in question.

Field Summary
protected  Log logger     
protected  String tablePrefix     
protected  String instanceId     
protected  boolean useProperties     
Constructor:
 public StdJDBCDelegate(Log logger,
    String tablePrefix,
    String instanceId) 

    Create new StdJDBCDelegate instance.

    Parameters:
    logger - the logger to use during execution
    tablePrefix - the prefix of all table names
 public StdJDBCDelegate(Log logger,
    String tablePrefix,
    String instanceId,
    Boolean useProperties) 

    Create new StdJDBCDelegate instance.

    Parameters:
    logger - the logger to use during execution
    tablePrefix - the prefix of all table names
Method from org.quartz.impl.jdbcjobstore.StdJDBCDelegate Summary:
calendarExists,   calendarIsReferenced,   canUseProperties,   closeResultSet,   closeStatement,   convertFromProperty,   convertToProperty,   countMisfiredTriggersInStates,   deleteAllPausedTriggerGroups,   deleteBlobTrigger,   deleteCalendar,   deleteCronTrigger,   deleteFiredTrigger,   deleteFiredTriggers,   deleteFiredTriggers,   deleteJobDetail,   deleteJobListeners,   deletePausedTriggerGroup,   deleteSchedulerState,   deleteSimpleTrigger,   deleteTrigger,   deleteTriggerListeners,   deleteVolatileFiredTriggers,   getBoolean,   getBoolean,   getJobDetailFromBlob,   getKeyOfNonSerializableValue,   getObjectFromBlob,   insertBlobTrigger,   insertCalendar,   insertCronTrigger,   insertFiredTrigger,   insertJobDetail,   insertJobListener,   insertPausedTriggerGroup,   insertSchedulerState,   insertSimpleTrigger,   insertTrigger,   insertTriggerListener,   isExistingTriggerGroup,   isJobStateful,   isTriggerGroupPaused,   jobExists,   rtp,   selectCalendar,   selectCalendars,   selectFiredTriggerInstanceNames,   selectFiredTriggerRecords,   selectFiredTriggerRecordsByJob,   selectInstancesFiredTriggerRecords,   selectJobDetail,   selectJobExecutionCount,   selectJobForTrigger,   selectJobGroups,   selectJobListeners,   selectJobsInGroup,   selectMisfiredTriggers,   selectMisfiredTriggersInGroupInState,   selectMisfiredTriggersInState,   selectMisfiredTriggersInStates,   selectNextFireTime,   selectNumCalendars,   selectNumJobs,   selectNumTriggers,   selectNumTriggersForJob,   selectPausedTriggerGroups,   selectSchedulerStateRecords,   selectStatefulJobsOfTriggerGroup,   selectTrigger,   selectTriggerForFireTime,   selectTriggerGroups,   selectTriggerJobDataMap,   selectTriggerListeners,   selectTriggerNamesForJob,   selectTriggerState,   selectTriggerStatus,   selectTriggerToAcquire,   selectTriggersForCalendar,   selectTriggersForJob,   selectTriggersForRecoveringJobs,   selectTriggersInGroup,   selectTriggersInState,   selectVolatileJobs,   selectVolatileTriggers,   serializeJobData,   serializeObject,   setBoolean,   setBytes,   triggerExists,   updateBlobTrigger,   updateCalendar,   updateCronTrigger,   updateJobData,   updateJobDetail,   updateSchedulerState,   updateSimpleTrigger,   updateTrigger,   updateTriggerGroupStateFromOtherState,   updateTriggerGroupStateFromOtherStates,   updateTriggerState,   updateTriggerStateFromOtherState,   updateTriggerStateFromOtherStates,   updateTriggerStateFromOtherStatesBeforeTime,   updateTriggerStatesForJob,   updateTriggerStatesForJobFromOtherState,   updateTriggerStatesFromOtherStates
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.quartz.impl.jdbcjobstore.StdJDBCDelegate Detail:
 public boolean calendarExists(Connection conn,
    String calendarName) throws SQLException 

    Check whether or not a calendar exists.

 public boolean calendarIsReferenced(Connection conn,
    String calendarName) throws SQLException 

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

 protected boolean canUseProperties() 
 protected  void closeResultSet(ResultSet rs) 
    Cleanup helper method that closes the given ResultSet while ignoring any errors.
 protected  void closeStatement(Statement statement) 
    Cleanup helper method that closes the given Statement while ignoring any errors.
 protected Map convertFromProperty(Properties properties) throws IOException 
    convert the JobDataMap into a list of properties
 protected Properties convertToProperty(Map data) throws IOException 
    convert the JobDataMap into a list of properties
 public int countMisfiredTriggersInStates(Connection conn,
    String state1,
    String state2,
    long ts) throws SQLException 

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

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

    Delete the cron trigger data for a trigger.

 public int deleteCalendar(Connection conn,
    String calendarName) throws SQLException 

    Delete a calendar.

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

    Delete the cron trigger data for a trigger.

 public int deleteFiredTrigger(Connection conn,
    String entryId) throws SQLException 

    Delete a fired trigger.

 public int deleteFiredTriggers(Connection conn) throws SQLException 

    Delete all fired triggers.

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

    Delete the job detail record for the given job.

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

    Delete all job listeners for the given job.

 public int deletePausedTriggerGroup(Connection conn,
    String groupName) throws SQLException 
 public int deleteSchedulerState(Connection conn,
    String instanceId) throws SQLException 
 public int deleteSimpleTrigger(Connection conn,
    String triggerName,
    String groupName) throws SQLException 

    Delete the simple trigger data for a trigger.

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

    Delete the base trigger data for a trigger.

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

    Delete all of the listeners associated with a given trigger.

 public int deleteVolatileFiredTriggers(Connection conn) throws SQLException 
 protected boolean getBoolean(ResultSet rs,
    String columnName) throws SQLException 
    Retrieves the value of the designated column in the current row as a 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.
 protected boolean getBoolean(ResultSet rs,
    int columnIndex) throws SQLException 
    Retrieves the value of the designated column index in the current row as a 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.
 protected Object getJobDetailFromBlob(ResultSet rs,
    String colName) throws IOException, ClassNotFoundException, 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.

 protected Object getKeyOfNonSerializableValue(Map data) 
    Find the key of the first non-serializable value in the given Map.
 protected Object getObjectFromBlob(ResultSet rs,
    String colName) throws IOException, ClassNotFoundException, 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.

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

    Insert the blob trigger data.

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

    Insert a new calendar.

 public int insertCronTrigger(Connection conn,
    CronTrigger trigger) throws SQLException 

    Insert the cron trigger data.

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

    Insert a fired trigger.

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

    Insert the job detail record.

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

    Associate a listener with a job.

 public int insertPausedTriggerGroup(Connection conn,
    String groupName) throws SQLException 
 public int insertSchedulerState(Connection conn,
    String instanceId,
    long checkInTime,
    long interval) throws SQLException 
 public int insertSimpleTrigger(Connection conn,
    SimpleTrigger trigger) throws SQLException 

    Insert the simple trigger data.

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

    Insert the base trigger data.

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

    Associate a listener with the given trigger.

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

    Check whether or not the given job is stateful.

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

    Check whether or not the given job exists.

 protected final String rtp(String query) 

    Replace the table prefix in a query by replacing any occurrences of "{0}" with the table prefix.

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

    Select a calendar.

 public String[] selectCalendars(Connection conn) throws SQLException 

    Select all of the stored calendars.

 public Set selectFiredTriggerInstanceNames(Connection conn) throws SQLException 

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

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

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

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

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

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

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

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

 public int selectJobExecutionCount(Connection conn,
    String jobName,
    String jobGroup) throws SQLException 
 public JobDetail selectJobForTrigger(Connection conn,
    String triggerName,
    String groupName,
    ClassLoadHelper loadHelper) throws ClassNotFoundException, SQLException 

    Select the job to which the trigger is associated.

 public String[] selectJobGroups(Connection conn) throws SQLException 

    Select all of the job group names that are stored.

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

    Get all of the listeners for a given job.

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

    Select all of the jobs contained in a given group.

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

    Get the names of all of the triggers that have misfired.

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

    Get the names of all of the triggers in the given group and state that have misfired.

 public Key[] selectMisfiredTriggersInState(Connection conn,
    String state,
    long ts) throws SQLException 
 public boolean selectMisfiredTriggersInStates(Connection conn,
    String state1,
    String state2,
    long ts,
    int count,
    List resultList) throws SQLException 

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

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

    Select the next time that a trigger will be fired.

 public int selectNumCalendars(Connection conn) throws SQLException 

    Select the total number of calendars stored.

 public int selectNumJobs(Connection conn) throws SQLException 

    Select the total number of jobs stored.

 public int selectNumTriggers(Connection conn) throws SQLException 

    Select the total number of triggers stored.

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

    Select the number of triggers associated with a given job.

 public Set selectPausedTriggerGroups(Connection conn) throws SQLException 
 public List selectSchedulerStateRecords(Connection conn,
    String instanceId) throws SQLException 
 public List selectStatefulJobsOfTriggerGroup(Connection conn,
    String groupName) throws SQLException 
 public Trigger selectTrigger(Connection conn,
    String triggerName,
    String groupName) throws IOException, ClassNotFoundException, SQLException 

    Select a trigger.

 public Key selectTriggerForFireTime(Connection conn,
    long fireTime) throws SQLException 

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

 public String[] selectTriggerGroups(Connection conn) throws SQLException 

    Select all of the trigger group names that are stored.

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

    Select a trigger's JobDataMap.

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

    Select the listeners associated with a given trigger.

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

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

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

    Select a trigger' state value.

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

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

 public Key selectTriggerToAcquire(Connection conn,
    long noLaterThan,
    long noEarlierThan) throws SQLException 

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

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

    Select the triggers for a job

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

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

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

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

    Select all of the triggers contained in a given group.

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

    Select all of the triggers in a given state.

 public Key[] selectVolatileJobs(Connection conn) throws SQLException 
 public Key[] selectVolatileTriggers(Connection conn) throws SQLException 
 protected ByteArrayOutputStream serializeJobData(JobDataMap data) throws IOException 

    Remove the transient data from and then create a serialized java.util.ByteArrayOutputStream version of a org.quartz.JobDataMap .

 protected ByteArrayOutputStream serializeObject(Object obj) throws IOException 

    Create a serialized java.util.ByteArrayOutputStream version of an Object.

 protected  void setBoolean(PreparedStatement ps,
    int index,
    boolean val) throws SQLException 
    Sets the designated parameter to the given Java 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.
 protected  void setBytes(PreparedStatement ps,
    int index,
    ByteArrayOutputStream baos) throws SQLException 
    Sets the designated parameter to the byte array of the given 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.
 public boolean triggerExists(Connection conn,
    String triggerName,
    String groupName) throws SQLException 

    Check whether or not a trigger exists.

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

    Update the blob trigger data.

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

    Update a calendar.

 public int updateCronTrigger(Connection conn,
    CronTrigger trigger) throws SQLException 

    Update the cron trigger data.

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

    Update the job data map for the given job.

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

    Update the job detail record.

 public int updateSchedulerState(Connection conn,
    String instanceId,
    long checkInTime) throws SQLException 
 public int updateSimpleTrigger(Connection conn,
    SimpleTrigger trigger) throws SQLException 

    Update the simple trigger data.

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

    Update the base trigger data.

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

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

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

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

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

    Update the state for a given trigger.

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

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

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

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

 public int updateTriggerStateFromOtherStatesBeforeTime(Connection conn,
    String newState,
    String oldState1,
    String oldState2,
    long time) throws SQLException 
 public int updateTriggerStatesForJob(Connection conn,
    String jobName,
    String groupName,
    String state) throws SQLException 

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

 public int updateTriggerStatesForJobFromOtherState(Connection conn,
    String jobName,
    String groupName,
    String state,
    String oldState) throws SQLException 
 public int updateTriggerStatesFromOtherStates(Connection conn,
    String newState,
    String oldState1,
    String oldState2) throws SQLException 

    Insert the job detail record.