站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

JobDetailBean (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.scheduling.quartz
Class JobDetailBean

java.lang.Object
  extended by org.quartz.JobDetail
      extended by org.springframework.scheduling.quartz.JobDetailBean
All Implemented Interfaces:
Serializable, Cloneable, BeanNameAware, InitializingBean, ApplicationContextAware

public class JobDetailBean
extends JobDetail
implements BeanNameAware, ApplicationContextAware, InitializingBean

Convenience subclass of Quartz' JobDetail class that eases bean-style usage.

JobDetail itself is already a JavaBean but lacks sensible defaults. This class uses the Spring bean name as job name, and the Quartz default group ("DEFAULT") as job group if not specified.

Since:
18.02.2004
Author:
Juergen Hoeller
See Also:
JobDetail.setName(java.lang.String), JobDetail.setGroup(java.lang.String), BeanNameAware, Scheduler.DEFAULT_GROUP, Serialized Form

Constructor Summary
JobDetailBean()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 void setApplicationContext(ApplicationContext applicationContext)
          Set the ApplicationContext that this object runs in.
 void setApplicationContextJobDataKey(String applicationContextJobDataKey)
          Set the key of an ApplicationContext reference to expose in the JobDataMap, for example "applicationContext".
 void setBeanName(String beanName)
          Set the name of the bean in the bean factory that created this bean.
 void setJobDataAsMap(Map jobDataAsMap)
          Register objects in the JobDataMap via a given Map.
 void setJobListenerNames(String[] names)
          Set a list of JobListener names for this job, referring to non-global JobListeners registered with the Scheduler.
 
Methods inherited from class org.quartz.JobDetail
addJobListener, clone, getDescription, getFullName, getGroup, getJobClass, getJobDataMap, getJobListenerNames, getName, isDurable, isStateful, isVolatile, removeJobListener, requestsRecovery, setDescription, setDurability, setGroup, setJobClass, setJobDataMap, setName, setRequestsRecovery, setVolatility, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobDetailBean

public JobDetailBean()
Method Detail

setJobDataAsMap

public void setJobDataAsMap(Map jobDataAsMap)
Register objects in the JobDataMap via a given Map.

These objects will be available to this Job only, in contrast to objects in the SchedulerContext.

Note: When using persistent Jobs whose JobDetail will be kept in the database, do not put Spring-managed beans or an ApplicationContext reference into the JobDataMap but rather into the SchedulerContext.

Parameters:
jobDataAsMap - Map with String keys and any objects as values (for example Spring-managed beans)
See Also:
SchedulerFactoryBean.setSchedulerContextAsMap(java.util.Map)

setJobListenerNames

public void setJobListenerNames(String[] names)
Set a list of JobListener names for this job, referring to non-global JobListeners registered with the Scheduler.

A JobListener name always refers to the name returned by the JobListener implementation.

See Also:
SchedulerFactoryBean.setJobListeners(org.quartz.JobListener[]), JobListener.getName()

setBeanName

public void setBeanName(String beanName)
Description copied from interface: BeanNameAware
Set the name of the bean in the bean factory that created this bean.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method.

Specified by:
setBeanName in interface BeanNameAware
Parameters:
beanName - the name of the bean in the factory

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
Description copied from interface: ApplicationContextAware
Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ResourceLoaderAware's setResourceLoader.

Specified by:
setApplicationContext in interface ApplicationContextAware
Parameters:
applicationContext - ApplicationContext object to be used by this object
See Also:
BeanInitializationException

setApplicationContextJobDataKey

public void setApplicationContextJobDataKey(String applicationContextJobDataKey)
Set the key of an ApplicationContext reference to expose in the JobDataMap, for example "applicationContext". Default is none. Only applicable when running in a Spring ApplicationContext.

In case of a QuartzJobBean, the reference will be applied to the Job instance as bean property. An "applicationContext" attribute will correspond to a "setApplicationContext" method in that scenario.

Note that BeanFactory callback interfaces like ApplicationContextAware are not automatically applied to Quartz Job instances, because Quartz itself is reponsible for the lifecycle of its Jobs.

Note: When using persistent job stores where JobDetail contents will be kept in the database, do not put an ApplicationContext reference into the JobDataMap but rather into the SchedulerContext.

See Also:
SchedulerFactoryBean.setApplicationContextSchedulerContextKey(java.lang.String), ApplicationContext

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean


Copyright (c) 2002-2007 The Spring Framework Project.