org.smart4j.plugin.job.SmartJobFactory Maven / Gradle / Ivy
package org.smart4j.plugin.job;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;
import org.smart4j.framework.ioc.BeanHelper;
public class SmartJobFactory implements JobFactory {
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
JobDetail jobDetail = bundle.getJobDetail();
Class extends Job> jobClass = jobDetail.getJobClass();
return BeanHelper.getBean(jobClass);
}
}