Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.spi
Interface JobStore

All Known Implementing Classes:
  JobStoreSupport, RAMJobStore

public interface JobStore

The interface to be implemented by classes that want to provide a ``Job`` and ``Trigger`` storage mechanism for the ``QuartzScheduler``'s use.

Storage of `Job` s and `Trigger` s should be keyed on the combination of their name and group for uniqueness.

Author:
  James House
See Also:
  `QuartzScheduler`, `Trigger`, `Job`, `JobDetail`, `JobDataMap`, `Calendar`

Method Summary
`Trigger` | `acquireNextTrigger(SchedulingContext ctxt, long noLaterThan)` Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.
`String[]` | `getCalendarNames(SchedulingContext ctxt)` Get the names of all of the ``Calendar`` s in the `JobStore`.
`String[]` | `getJobGroupNames(SchedulingContext ctxt)` Get the names of all of the ``Job`` groups.
`String[]` | `getJobNames(SchedulingContext ctxt, String groupName)` Get the names of all of the ``Job`` s that have the given group name.
`int` | `getNumberOfCalendars(SchedulingContext ctxt)` Get the number of ``Calendar`` s that are stored in the `JobsStore`.
`int` | `getNumberOfJobs(SchedulingContext ctxt)` Get the number of ``Job`` s that are stored in the `JobsStore`.
`int` | `getNumberOfTriggers(SchedulingContext ctxt)` Get the number of ``Trigger`` s that are stored in the `JobsStore`.
`Set` | `getPausedTriggerGroups(SchedulingContext ctxt)`
`String[]` | `getTriggerGroupNames(SchedulingContext ctxt)` Get the names of all of the ``Trigger`` groups.
`String[]` | `getTriggerNames(SchedulingContext ctxt, String groupName)` Get the names of all of the ``Trigger`` s that have the given group name.
`Trigger[]` | `getTriggersForJob(SchedulingContext ctxt, String jobName, String groupName)` Get all of the Triggers that are associated to the given Job.
`int` | `getTriggerState(SchedulingContext ctxt, String triggerName, String triggerGroup)` Get the current state of the identified ``Trigger``.
`void` | `initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)` Called by the QuartzScheduler before the `JobStore` is used, in order to give the it a chance to initialize.
`void` | `pauseAll(SchedulingContext ctxt)` Pause all triggers - equivalent of calling `pauseTriggerGroup(group)` on every group.
`void` | `pauseJob(SchedulingContext ctxt, String jobName, String groupName)` Pause the ``Job`` with the given name - by pausing all of its current `Trigger`s.
`void` | `pauseJobGroup(SchedulingContext ctxt, String groupName)` Pause all of the ``Job`s` in the given group - by pausing all of their `Trigger`s.
`void` | `pauseTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Pause the ``Trigger`` with the given name.
`void` | `pauseTriggerGroup(SchedulingContext ctxt, String groupName)` Pause all of the ``Trigger`s` in the given group.
`void` | `releaseAcquiredTrigger(SchedulingContext ctxt, Trigger trigger)` Inform the `JobStore` that the scheduler no longer plans to fire the given `Trigger`, that it had previously acquired (reserved).
`boolean` | `removeCalendar(SchedulingContext ctxt, String calName)` Remove (delete) the ``Calendar`` with the given name.
`boolean` | `removeJob(SchedulingContext ctxt, String jobName, String groupName)` Remove (delete) the ``Job`` with the given name, and any ``Trigger`` s that reference it.
`boolean` | `removeTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Remove (delete) the ``Trigger`` with the given name.
`boolean` | `replaceTrigger(SchedulingContext ctxt, String triggerName, String groupName, Trigger newTrigger)` Remove (delete) the ``Trigger`` with the given name, and store the new given one - which must be associated with the same job.
`void` | `resumeAll(SchedulingContext ctxt)` Resume (un-pause) all triggers - equivalent of calling `resumeTriggerGroup(group)` on every group.
`void` | `resumeJob(SchedulingContext ctxt, String jobName, String groupName)` Resume (un-pause) the ``Job`` with the given name.
`void` | `resumeJobGroup(SchedulingContext ctxt, String groupName)` Resume (un-pause) all of the ``Job`s` in the given group.
`void` | `resumeTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Resume (un-pause) the ``Trigger`` with the given name.
`void` | `resumeTriggerGroup(SchedulingContext ctxt, String groupName)` Resume (un-pause) all of the ``Trigger`s` in the given group.
`Calendar` | `retrieveCalendar(SchedulingContext ctxt, String calName)` Retrieve the given ``Trigger``.
`JobDetail` | `retrieveJob(SchedulingContext ctxt, String jobName, String groupName)` Retrieve the ``JobDetail`` for the given ``Job``.
`Trigger` | `retrieveTrigger(SchedulingContext ctxt, String triggerName, String groupName)` Retrieve the given ``Trigger``.
`void` | `schedulerStarted()` Called by the QuartzScheduler to inform the `JobStore` that the scheduler has started.
`void` | `shutdown()` Called by the QuartzScheduler to inform the `JobStore` that it should free up all of it's resources because the scheduler is shutting down.
`void` | `storeCalendar(SchedulingContext ctxt, String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers)` Store the given ``Calendar``.
`void` | `storeJob(SchedulingContext ctxt, JobDetail newJob, boolean replaceExisting)` Store the given ``JobDetail``.
`void` | `storeJobAndTrigger(SchedulingContext ctxt, JobDetail newJob, Trigger newTrigger)` Store the given ``JobDetail`` and ``Trigger``.
`void` | `storeTrigger(SchedulingContext ctxt, Trigger newTrigger, boolean replaceExisting)` Store the given ``Trigger``.
`boolean` | `supportsPersistence()`
`void` | `triggeredJobComplete(SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail, int triggerInstCode)` Inform the `JobStore` that the scheduler has completed the firing of the given `Trigger` (and the execution its associated `Job`), and that the ``JobDataMap`` in the given `JobDetail` should be updated if the `Job` is stateful.
`TriggerFiredBundle` | `triggerFired(SchedulingContext ctxt, Trigger trigger)` Inform the `JobStore` that the scheduler is now firing the given `Trigger` (executing its associated `Job`), that it had previously acquired (reserved).

Method Detail

### initialize

    public void initialize(ClassLoadHelper loadHelper,
                           SchedulerSignaler signaler)
                    throws SchedulerConfigException

  Called by the QuartzScheduler before the `JobStore` is used, in order to give the it a chance to initialize.

  Throws:
    `SchedulerConfigException`

### schedulerStarted

    public void schedulerStarted()
                          throws SchedulerException

  Called by the QuartzScheduler to inform the `JobStore` that the scheduler has started.

  Throws:
    `SchedulerException`

### shutdown

    public void shutdown()

  Called by the QuartzScheduler to inform the `JobStore` that it should free up all of it's resources because the scheduler is shutting down.

### supportsPersistence

    public boolean supportsPersistence()

### storeJobAndTrigger

    public void storeJobAndTrigger(SchedulingContext ctxt,
                                   JobDetail newJob,
                                   Trigger newTrigger)
                            throws ObjectAlreadyExistsException,
                                   JobPersistenceException

  Store the given ``JobDetail`` and ``Trigger``.

  Parameters:
    `newJob` - The `JobDetail` to be stored.
    `newTrigger` - The `Trigger` to be stored.
  Throws:
    `ObjectAlreadyExistsException` - if a `Job` with the same name/group already exists.
    `JobPersistenceException`

### storeJob

    public void storeJob(SchedulingContext ctxt,
                         JobDetail newJob,
                         boolean replaceExisting)
                  throws ObjectAlreadyExistsException,
                         JobPersistenceException

  Store the given ``JobDetail``.

  Parameters:
    `newJob` - The `JobDetail` to be stored.
    `replaceExisting` - If `true`, any `Job` existing in the `JobStore` with the same name & group should be over-written.
  Throws:
    `ObjectAlreadyExistsException` - if a `Job` with the same name/group already exists, and replaceExisting is set to false.
    `JobPersistenceException`

### removeJob

    public boolean removeJob(SchedulingContext ctxt,
                             String jobName,
                             String groupName)
                      throws JobPersistenceException

  Remove (delete) the ``Job`` with the given name, and any ``Trigger`` s that reference it.

  If removal of the `Job` results in an empty group, the group should be removed from the `JobStore`'s list of known group names.

  Parameters:
    `jobName` - The name of the `Job` to be removed.
    `groupName` - The group name of the `Job` to be removed.
  Returns:
    `true` if a `Job` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveJob

    public JobDetail retrieveJob(SchedulingContext ctxt,
                                 String jobName,
                                 String groupName)
                          throws JobPersistenceException

  Retrieve the ``JobDetail`` for the given ``Job``.

  Parameters:
    `jobName` - The name of the `Job` to be retrieved.
    `groupName` - The group name of the `Job` to be retrieved.
  Returns:
    The desired `Job`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### storeTrigger

    public void storeTrigger(SchedulingContext ctxt,
                             Trigger newTrigger,
                             boolean replaceExisting)
                      throws ObjectAlreadyExistsException,
                             JobPersistenceException

  Store the given ``Trigger``.

  Parameters:
    `newTrigger` - The `Trigger` to be stored.
    `replaceExisting` - If `true`, any `Trigger` existing in the `JobStore` with the same name & group should be over-written.
  Throws:
    `ObjectAlreadyExistsException` - if a `Trigger` with the same name/group already exists, and replaceExisting is set to false.
    `JobPersistenceException`
  See Also:
    `pauseTriggerGroup(SchedulingContext, String)`

### removeTrigger

    public boolean removeTrigger(SchedulingContext ctxt,
                                 String triggerName,
                                 String groupName)
                          throws JobPersistenceException

  Remove (delete) the ``Trigger`` with the given name.

  If removal of the `Trigger` results in an empty group, the group should be removed from the `JobStore`'s list of known group names.

  If removal of the `Trigger` results in an 'orphaned' `Job` that is not 'durable', then the `Job` should be deleted also.

  Parameters:
    `triggerName` - The name of the `Trigger` to be removed.
    `groupName` - The group name of the `Trigger` to be removed.
  Returns:
    `true` if a `Trigger` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### replaceTrigger

    public boolean replaceTrigger(SchedulingContext ctxt,
                                  String triggerName,
                                  String groupName,
                                  Trigger newTrigger)
                           throws JobPersistenceException

  Remove (delete) the ``Trigger`` with the given name, and store the new given one - which must be associated with the same job.

  Parameters:
    `triggerName` - The name of the `Trigger` to be removed.
    `groupName` - The group name of the `Trigger` to be removed.
    `newTrigger` - The new `Trigger` to be stored.
  Returns:
    `true` if a `Trigger` with the given name & group was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveTrigger

    public Trigger retrieveTrigger(SchedulingContext ctxt,
                                   String triggerName,
                                   String groupName)
                            throws JobPersistenceException

  Retrieve the given ``Trigger``.

  Parameters:
    `triggerName` - The name of the `Trigger` to be retrieved.
    `groupName` - The group name of the `Trigger` to be retrieved.
  Returns:
    The desired `Trigger`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### storeCalendar

    public void storeCalendar(SchedulingContext ctxt,
                              String name,
                              Calendar calendar,
                              boolean replaceExisting,
                              boolean updateTriggers)
                       throws ObjectAlreadyExistsException,
                              JobPersistenceException

  Store the given ``Calendar``.

  Parameters:
    `calendar` - The `Calendar` to be stored.
    `replaceExisting` - If `true`, any `Calendar` existing in the `JobStore` with the same name & group should be over-written.
    `updateTriggers` - If `true`, any `Trigger`s existing in the `JobStore` that reference an existing Calendar with the same name with have their next fire time re-computed with the new `Calendar`.
  Throws:
    `ObjectAlreadyExistsException` - if a `Calendar` with the same name already exists, and replaceExisting is set to false.
    `JobPersistenceException`

### removeCalendar

    public boolean removeCalendar(SchedulingContext ctxt,
                                  String calName)
                           throws JobPersistenceException

  Remove (delete) the ``Calendar`` with the given name.

  If removal of the `Calendar` would result in s pointing to non-existent calendars, then a `JobPersistenceException` will be thrown.

  *

  Parameters:
    `calName` - The name of the `Calendar` to be removed.
  Returns:
    `true` if a `Calendar` with the given name was found and removed from the store.
  Throws:
    `JobPersistenceException`

### retrieveCalendar

    public Calendar retrieveCalendar(SchedulingContext ctxt,
                                     String calName)
                              throws JobPersistenceException

  Retrieve the given ``Trigger``.

  Parameters:
    `calName` - The name of the `Calendar` to be retrieved.
  Returns:
    The desired `Calendar`, or null if there is no match.
  Throws:
    `JobPersistenceException`

### getNumberOfJobs

    public int getNumberOfJobs(SchedulingContext ctxt)
                        throws JobPersistenceException

  Get the number of ``Job`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getNumberOfTriggers

    public int getNumberOfTriggers(SchedulingContext ctxt)
                            throws JobPersistenceException

  Get the number of ``Trigger`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getNumberOfCalendars

    public int getNumberOfCalendars(SchedulingContext ctxt)
                             throws JobPersistenceException

  Get the number of ``Calendar`` s that are stored in the `JobsStore`.

  Throws:
    `JobPersistenceException`

### getJobNames

    public String[] getJobNames(SchedulingContext ctxt,
                                String groupName)
                         throws JobPersistenceException

  Get the names of all of the ``Job`` s that have the given group name.

  If there are no jobs in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggerNames

    public String[] getTriggerNames(SchedulingContext ctxt,
                                    String groupName)
                             throws JobPersistenceException

  Get the names of all of the ``Trigger`` s that have the given group name.

  If there are no triggers in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getJobGroupNames

    public String[] getJobGroupNames(SchedulingContext ctxt)
                              throws JobPersistenceException

  Get the names of all of the ``Job`` groups.

  If there are no known group names, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggerGroupNames

    public String[] getTriggerGroupNames(SchedulingContext ctxt)
                                  throws JobPersistenceException

  Get the names of all of the ``Trigger`` groups.

  If there are no known group names, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getCalendarNames

    public String[] getCalendarNames(SchedulingContext ctxt)
                              throws JobPersistenceException

  Get the names of all of the ``Calendar`` s in the `JobStore`.

  If there are no Calendars in the given group name, the result should be a zero-length array (not `null`).

  Throws:
    `JobPersistenceException`

### getTriggersForJob

    public Trigger[] getTriggersForJob(SchedulingContext ctxt,
                                       String jobName,
                                       String groupName)
                                throws JobPersistenceException

  Get all of the Triggers that are associated to the given Job.

  If there are no matches, a zero-length array should be returned.

  Throws:
    `JobPersistenceException`

### getTriggerState

    public int getTriggerState(SchedulingContext ctxt,
                               String triggerName,
                               String triggerGroup)
                        throws JobPersistenceException

  Get the current state of the identified ``Trigger``.

  Throws:
    `JobPersistenceException`
  See Also:
    `Trigger.STATE_NORMAL`, `Trigger.STATE_PAUSED`, `Trigger.STATE_COMPLETE`, `Trigger.STATE_ERROR`, `Trigger.STATE_NONE`

### pauseTrigger

    public void pauseTrigger(SchedulingContext ctxt,
                             String triggerName,
                             String groupName)
                      throws JobPersistenceException

  Pause the ``Trigger`` with the given name.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeTrigger(SchedulingContext, String, String)`

### pauseTriggerGroup

    public void pauseTriggerGroup(SchedulingContext ctxt,
                                  String groupName)
                           throws JobPersistenceException

  Pause all of the ``Trigger`s` in the given group.

  The JobStore should "remember" that the group is paused, and impose the pause on any new triggers that are added to the group while the group is paused.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeTriggerGroup(SchedulingContext, String)`

### pauseJob

    public void pauseJob(SchedulingContext ctxt,
                         String jobName,
                         String groupName)
                  throws JobPersistenceException

  Pause the ``Job`` with the given name - by pausing all of its current `Trigger`s.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeJob(SchedulingContext, String, String)`

### pauseJobGroup

    public void pauseJobGroup(SchedulingContext ctxt,
                              String groupName)
                       throws JobPersistenceException

  Pause all of the ``Job`s` in the given group - by pausing all of their `Trigger`s.

  The JobStore should "remember" that the group is paused, and impose the pause on any new jobs that are added to the group while the group is paused.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeJobGroup(SchedulingContext, String)`

### resumeTrigger

    public void resumeTrigger(SchedulingContext ctxt,
                              String triggerName,
                              String groupName)
                       throws JobPersistenceException

  Resume (un-pause) the ``Trigger`` with the given name.

  If the `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseTrigger(SchedulingContext, String, String)`

### resumeTriggerGroup

    public void resumeTriggerGroup(SchedulingContext ctxt,
                                   String groupName)
                            throws JobPersistenceException

  Resume (un-pause) all of the ``Trigger`s` in the given group.

  If any `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseTriggerGroup(SchedulingContext, String)`

### getPausedTriggerGroups

    public Set getPausedTriggerGroups(SchedulingContext ctxt)
                               throws JobPersistenceException

  Throws:
    `JobPersistenceException`

### resumeJob

    public void resumeJob(SchedulingContext ctxt,
                          String jobName,
                          String groupName)
                   throws JobPersistenceException

  Resume (un-pause) the ``Job`` with the given name.

  If any of the `Job`'s`Trigger` s missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseJob(SchedulingContext, String, String)`

### resumeJobGroup

    public void resumeJobGroup(SchedulingContext ctxt,
                               String groupName)
                        throws JobPersistenceException

  Resume (un-pause) all of the ``Job`s` in the given group.

  If any of the `Job` s had `Trigger` s that missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseJobGroup(SchedulingContext, String)`

### pauseAll

    public void pauseAll(SchedulingContext ctxt)
                  throws JobPersistenceException

  Pause all triggers - equivalent of calling `pauseTriggerGroup(group)` on every group.

  When `resumeAll()` is called (to un-pause), trigger misfire instructions WILL be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `resumeAll(SchedulingContext)`, `pauseTriggerGroup(SchedulingContext, String)`

### resumeAll

    public void resumeAll(SchedulingContext ctxt)
                   throws JobPersistenceException

  Resume (un-pause) all triggers - equivalent of calling `resumeTriggerGroup(group)` on every group.

  If any `Trigger` missed one or more fire-times, then the `Trigger`'s misfire instruction will be applied.

  Throws:
    `JobPersistenceException`
  See Also:
    `pauseAll(SchedulingContext)`

### acquireNextTrigger

    public Trigger acquireNextTrigger(SchedulingContext ctxt,
                                      long noLaterThan)
                               throws JobPersistenceException

  Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.

  Parameters:
    `noLaterThan` - If > 0, the JobStore should only return a Trigger that will fire no later than the time represented in this value as milliseconds.
  Throws:
    `JobPersistenceException`
  See Also:
    `releaseAcquiredTrigger(SchedulingContext, Trigger)`

### releaseAcquiredTrigger

    public void releaseAcquiredTrigger(SchedulingContext ctxt,
                                       Trigger trigger)
                                throws JobPersistenceException

  Inform the `JobStore` that the scheduler no longer plans to fire the given `Trigger`, that it had previously acquired (reserved).

  Throws:
    `JobPersistenceException`

### triggerFired

    public TriggerFiredBundle triggerFired(SchedulingContext ctxt,
                                           Trigger trigger)
                                    throws JobPersistenceException

  Inform the `JobStore` that the scheduler is now firing the given `Trigger` (executing its associated `Job`), that it had previously acquired (reserved).

  Returns:
    null if the trigger or it's job or calendar no longer exist, or if the trigger was not successfully put into the 'executing' state.
  Throws:
    `JobPersistenceException`

### triggeredJobComplete

    public void triggeredJobComplete(SchedulingContext ctxt,
                                     Trigger trigger,
                                     JobDetail jobDetail,
                                     int triggerInstCode)
                              throws JobPersistenceException

  Inform the `JobStore` that the scheduler has completed the firing of the given `Trigger` (and the execution its associated `Job`), and that the ``JobDataMap`` in the given `JobDetail` should be updated if the `Job` is stateful.

  Throws:
    `JobPersistenceException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Quartz Enterprise Job Scheduler Project Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD