All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.quartz.impl.StdScheduler Maven / Gradle / Ivy

Go to download

SDK for dev_appserver (local development) with some of the dependencies shaded (repackaged)

There is a newer version: 2.0.31
Show newest version
/* 
 * Copyright 2004-2005 OpenSymphony 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 * use this file except in compliance with the License. You may obtain a copy 
 * of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
 * License for the specific language governing permissions and limitations 
 * under the License.
 * 
 */

/*
 * Previously Copyright (c) 2001-2004 James House
 */
package org.quartz.impl;

import java.util.Date;
import java.util.List;
import java.util.Set;

import org.quartz.Calendar;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobListener;
import org.quartz.Scheduler;
import org.quartz.SchedulerContext;
import org.quartz.SchedulerException;
import org.quartz.SchedulerListener;
import org.quartz.SchedulerMetaData;
import org.quartz.Trigger;
import org.quartz.TriggerListener;
import org.quartz.UnableToInterruptJobException;
import org.quartz.core.QuartzScheduler;
import org.quartz.core.SchedulingContext;
import org.quartz.spi.JobFactory;

/**
 * 

* An implementation of the Scheduler interface that directly * proxies all method calls to the equivalent call on a given QuartzScheduler * instance. *

* * @see org.quartz.Scheduler * @see org.quartz.core.QuartzScheduler * @see org.quartz.core.SchedulingContext * * @author James House */ public class StdScheduler implements Scheduler { /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Data members. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ private QuartzScheduler sched; private SchedulingContext schedCtxt; /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Constructors. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Construct a StdScheduler instance to proxy the given * QuartzScheduler instance, and with the given SchedulingContext. *

*/ public StdScheduler(QuartzScheduler sched, SchedulingContext schedCtxt) { this.sched = sched; this.schedCtxt = schedCtxt; } /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Interface. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Returns the name of the Scheduler. *

*/ public String getSchedulerName() { return sched.getSchedulerName(); } /** *

* Returns the instance Id of the Scheduler. *

*/ public String getSchedulerInstanceId() { return sched.getSchedulerInstanceId(); } public SchedulerMetaData getMetaData() { return new SchedulerMetaData(getSchedulerName(), getSchedulerInstanceId(), getClass(), false, sched .runningSince() != null, isPaused(), isShutdown(), sched.runningSince(), sched.numJobsExecuted(), sched .getJobStoreClass(), sched.supportsPersistence(), sched .getThreadPoolClass(), sched.getThreadPoolSize(), sched .getVersion()); } /** *

* Returns the SchedulerContext of the Scheduler. *

*/ public SchedulerContext getContext() throws SchedulerException { return sched.getSchedulerContext(); } /////////////////////////////////////////////////////////////////////////// /// /// Schedululer State Management Methods /// /////////////////////////////////////////////////////////////////////////// /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void start() throws SchedulerException { sched.start(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

* * @deprecated * @see standby() */ public void pause() { this.standby(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void standby() { sched.standby(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean isInStandbyMode() { return sched.isInStandbyMode(); } /** * @deprecated */ public boolean isPaused() { return isInStandbyMode(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void shutdown() { sched.shutdown(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void shutdown(boolean waitForJobsToComplete) { sched.shutdown(waitForJobsToComplete); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean isShutdown() { return sched.isShutdown(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getCurrentlyExecutingJobs() { return sched.getCurrentlyExecutingJobs(); } /////////////////////////////////////////////////////////////////////////// /// /// Scheduling-related Methods /// /////////////////////////////////////////////////////////////////////////// /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Date scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException { return sched.scheduleJob(schedCtxt, jobDetail, trigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Date scheduleJob(Trigger trigger) throws SchedulerException { return sched.scheduleJob(schedCtxt, trigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void addJob(JobDetail jobDetail, boolean replace) throws SchedulerException { sched.addJob(schedCtxt, jobDetail, replace); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public boolean deleteJob(String jobName, String groupName) throws SchedulerException { return sched.deleteJob(schedCtxt, jobName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public boolean unscheduleJob(String triggerName, String groupName) throws SchedulerException { return sched.unscheduleJob(schedCtxt, triggerName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Date rescheduleJob(String triggerName, String groupName, Trigger newTrigger) throws SchedulerException { return sched.rescheduleJob(schedCtxt, triggerName, groupName, newTrigger); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void triggerJob(String jobName, String groupName) throws SchedulerException { triggerJob(jobName, groupName, null); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void triggerJob(String jobName, String groupName, JobDataMap data) throws SchedulerException { sched.triggerJob(schedCtxt, jobName, groupName, data); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void triggerJobWithVolatileTrigger(String jobName, String groupName) throws SchedulerException { triggerJobWithVolatileTrigger(jobName, groupName, null); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void triggerJobWithVolatileTrigger(String jobName, String groupName, JobDataMap data) throws SchedulerException { sched.triggerJobWithVolatileTrigger(schedCtxt, jobName, groupName, data); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void pauseTrigger(String triggerName, String groupName) throws SchedulerException { sched.pauseTrigger(schedCtxt, triggerName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void pauseTriggerGroup(String groupName) throws SchedulerException { sched.pauseTriggerGroup(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void pauseJob(String jobName, String groupName) throws SchedulerException { sched.pauseJob(schedCtxt, jobName, groupName); } /** * @see org.quartz.Scheduler#getPausedTriggerGroups() */ public Set getPausedTriggerGroups() throws SchedulerException { return sched.getPausedTriggerGroups(schedCtxt); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void pauseJobGroup(String groupName) throws SchedulerException { sched.pauseJobGroup(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void resumeTrigger(String triggerName, String groupName) throws SchedulerException { sched.resumeTrigger(schedCtxt, triggerName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void resumeTriggerGroup(String groupName) throws SchedulerException { sched.resumeTriggerGroup(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void resumeJob(String jobName, String groupName) throws SchedulerException { sched.resumeJob(schedCtxt, jobName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void resumeJobGroup(String groupName) throws SchedulerException { sched.resumeJobGroup(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void pauseAll() throws SchedulerException { sched.pauseAll(schedCtxt); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void resumeAll() throws SchedulerException { sched.resumeAll(schedCtxt); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public String[] getJobGroupNames() throws SchedulerException { return sched.getJobGroupNames(schedCtxt); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Trigger[] getTriggersOfJob(String jobName, String groupName) throws SchedulerException { return sched.getTriggersOfJob(schedCtxt, jobName, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public String[] getJobNames(String groupName) throws SchedulerException { return sched.getJobNames(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public String[] getTriggerGroupNames() throws SchedulerException { return sched.getTriggerGroupNames(schedCtxt); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public String[] getTriggerNames(String groupName) throws SchedulerException { return sched.getTriggerNames(schedCtxt, groupName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public JobDetail getJobDetail(String jobName, String jobGroup) throws SchedulerException { return sched.getJobDetail(schedCtxt, jobName, jobGroup); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Trigger getTrigger(String triggerName, String triggerGroup) throws SchedulerException { return sched.getTrigger(schedCtxt, triggerName, triggerGroup); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public int getTriggerState(String triggerName, String triggerGroup) throws SchedulerException { return sched.getTriggerState(schedCtxt, triggerName, triggerGroup); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers) throws SchedulerException { sched.addCalendar(schedCtxt, calName, calendar, replace, updateTriggers); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public boolean deleteCalendar(String calName) throws SchedulerException { return sched.deleteCalendar(schedCtxt, calName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public Calendar getCalendar(String calName) throws SchedulerException { return sched.getCalendar(schedCtxt, calName); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler, * passing the SchedulingContext associated with this * instance. *

*/ public String[] getCalendarNames() throws SchedulerException { return sched.getCalendarNames(schedCtxt); } /////////////////////////////////////////////////////////////////////////// /// /// Listener-related Methods /// /////////////////////////////////////////////////////////////////////////// /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addGlobalJobListener(JobListener jobListener) { sched.addGlobalJobListener(jobListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addJobListener(JobListener jobListener) { sched.addJobListener(jobListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean removeGlobalJobListener(JobListener jobListener) { return sched.removeGlobalJobListener(jobListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean removeJobListener(String name) { return sched.removeJobListener(name); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getGlobalJobListeners() { return sched.getGlobalJobListeners(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Set getJobListenerNames() { return sched.getJobListenerNames(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public JobListener getJobListener(String name) { return sched.getJobListener(name); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addGlobalTriggerListener(TriggerListener triggerListener) { sched.addGlobalTriggerListener(triggerListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addTriggerListener(TriggerListener triggerListener) { sched.addTriggerListener(triggerListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean removeGlobalTriggerListener(TriggerListener triggerListener) { return sched.removeGlobalTriggerListener(triggerListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean removeTriggerListener(String name) { return sched.removeTriggerListener(name); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getGlobalTriggerListeners() { return sched.getGlobalTriggerListeners(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public Set getTriggerListenerNames() { return sched.getTriggerListenerNames(); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public TriggerListener getTriggerListener(String name) { return sched.getTriggerListener(name); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public void addSchedulerListener(SchedulerListener schedulerListener) { sched.addSchedulerListener(schedulerListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public boolean removeSchedulerListener(SchedulerListener schedulerListener) { return sched.removeSchedulerListener(schedulerListener); } /** *

* Calls the equivalent method on the 'proxied' QuartzScheduler. *

*/ public List getSchedulerListeners() { return sched.getSchedulerListeners(); } public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException { return sched.interrupt(schedCtxt, jobName, groupName); } /** * @see org.quartz.Scheduler#setJobFactory(org.quartz.spi.JobFactory) */ public void setJobFactory(JobFactory factory) throws SchedulerException { sched.setJobFactory(factory); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy