Class SchedulerAccessorBean
- java.lang.Object
- org.springframework.scheduling.quartz.SchedulerAccessor
- org.springframework.scheduling.quartz.SchedulerAccessorBean
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,InitializingBean
,ResourceLoaderAware
public class SchedulerAccessorBean extends SchedulerAccessor implements BeanFactoryAware, InitializingBean
Spring bean-style class for accessing a Quartz Scheduler, i.e. for registering jobs, triggers and listeners on a givenScheduler
instance.Compatible with Quartz 2.1.4 and higher, as of Spring 4.1.
- Since:
- 2.5.6
- Author:
- Juergen Hoeller
- See Also:
setScheduler(org.quartz.Scheduler)
,setSchedulerName(java.lang.String)
Field Summary
Fields inherited from class org.springframework.scheduling.quartz.SchedulerAccessor
logger, resourceLoader
Constructor Summary
Constructors Constructor Description SchedulerAccessorBean()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.protected Scheduler
findDefaultScheduler()
protected Scheduler
findScheduler(String schedulerName)
Scheduler
getScheduler()
Return the Quartz Scheduler instance that this accessor operates on.void
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.void
setScheduler(Scheduler scheduler)
Specify the QuartzScheduler
instance to operate on.void
setSchedulerName(String schedulerName)
Specify the QuartzScheduler
to operate on via its scheduler name in the Spring application context or also in the QuartzSchedulerRepository
.Methods inherited from class org.springframework.scheduling.quartz.SchedulerAccessor
registerJobsAndTriggers, registerListeners, setCalendars, setGlobalJobListeners, setGlobalTriggerListeners, setJobDetails, setJobSchedulingDataLocation, setJobSchedulingDataLocations, setOverwriteExistingJobs, setResourceLoader, setSchedulerListeners, setTransactionManager, setTriggers
Constructor Detail
SchedulerAccessorBean
public SchedulerAccessorBean()
Method Detail
setSchedulerName
public void setSchedulerName(String schedulerName)
Specify the QuartzScheduler
to operate on via its scheduler name in the Spring application context or also in the QuartzSchedulerRepository
.Schedulers can be registered in the repository through custom bootstrapping, e.g. via the
StdSchedulerFactory
orDirectSchedulerFactory
factory classes. However, in general, it's preferable to use Spring'sSchedulerFactoryBean
which includes the job/trigger/listener capabilities of this accessor as well.If not specified, this accessor will try to retrieve a default
Scheduler
bean from the containing application context.
setScheduler
public void setScheduler(Scheduler scheduler)
getScheduler
public Scheduler getScheduler()
Return the Quartz Scheduler instance that this accessor operates on.- Specified by:
getScheduler
in classSchedulerAccessor
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
Description copied from interface:BeanFactoryAware
Callback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- See Also:
BeanInitializationException
afterPropertiesSet
public void afterPropertiesSet() throws SchedulerException
Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
SchedulerException
findScheduler
protected Scheduler findScheduler(String schedulerName) throws SchedulerException
- Throws:
SchedulerException
findDefaultScheduler
protected Scheduler findDefaultScheduler()