The Spring Framework

org.springframework.scheduling.quartz
Class AdaptableJobFactory

java.lang.Object
  extended by org.springframework.scheduling.quartz.AdaptableJobFactory
All Implemented Interfaces:
JobFactory
Direct Known Subclasses:
SpringBeanJobFactory

public class AdaptableJobFactory
extends Object
implements JobFactory

JobFactory implementation that supports Runnable objects as well as standard Quartz Job instances.

Since:
2.0
Author:
Juergen Hoeller
See Also:
DelegatingJob, adaptJob(Object)

Constructor Summary
AdaptableJobFactory()
           
 
Method Summary
protected  Job adaptJob(Object jobObject)
          Adapt the given job object to the Quartz Job interface.
protected  Object createJobInstance(TriggerFiredBundle bundle)
          Create an instance of the specified job class.
 Job newJob(TriggerFiredBundle bundle)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptableJobFactory

public AdaptableJobFactory()
Method Detail

newJob

public Job newJob(TriggerFiredBundle bundle)
           throws SchedulerException
Specified by:
newJob in interface JobFactory
Throws:
SchedulerException

createJobInstance

protected Object createJobInstance(TriggerFiredBundle bundle)
                            throws Exception
Create an instance of the specified job class.

Can be overridden to post-process the job instance.

Parameters:
bundle - the TriggerFiredBundle from which the JobDetail and other info relating to the trigger firing can be obtained
Returns:
the job instance
Throws:
Exception - if job instantiation failed

adaptJob

protected Job adaptJob(Object jobObject)
                throws Exception
Adapt the given job object to the Quartz Job interface.

The default implementation supports straight Quartz Jobs as well as Runnables, which get wrapped in a DelegatingJob.

Parameters:
jobObject - the original instance of the specified job class
Returns:
the adapted Quartz Job instance
Throws:
Exception - if the given job could not be adapted
See Also:
DelegatingJob

The Spring Framework

Copyright © 2002-2007 The Spring Framework.