类org.quartz.spi.TriggerFiredBundle源码实例Demo

下面列出了怎么用org.quartz.spi.TriggerFiredBundle的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: SpringBeanJobFactory.java
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = super.createJobInstance(bundle);
	if (isEligibleForPropertyPopulation(job)) {
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}
	return job;
}
 
源代码2 项目: deltaspike   文件: CdiAwareJobFactory.java
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException
{
    Job result = null;
    try
    {
        Class<? extends Job> jobClass = bundle.getJobDetail().getJobClass();
        result = BeanProvider.getContextualReference(jobClass);
        scheduler.getContext().put(jobClass.getName(), Boolean.TRUE);
    }
    catch (Exception e)
    {
        if (result == null)
        {
            result = defaultFactory.newJob(bundle, scheduler);
        }
    }
    return result;
}
 
源代码3 项目: lams   文件: SimpleJobFactory.java
public Job newJob(TriggerFiredBundle bundle, Scheduler Scheduler) throws SchedulerException {

        JobDetail jobDetail = bundle.getJobDetail();
        Class<? extends Job> jobClass = jobDetail.getJobClass();
        try {
            if(log.isDebugEnabled()) {
                log.debug(
                    "Producing instance of Job '" + jobDetail.getKey() + 
                    "', class=" + jobClass.getName());
            }
            
            return jobClass.newInstance();
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "Problem instantiating class '"
                            + jobDetail.getJobClass().getName() + "'", e);
            throw se;
        }
    }
 
源代码4 项目: lams   文件: JobExecutionContextImpl.java
/**
 * <p>
 * Create a JobExcecutionContext with the given context data.
 * </p>
 */
public JobExecutionContextImpl(Scheduler scheduler,
        TriggerFiredBundle firedBundle, Job job) {
    this.scheduler = scheduler;
    this.trigger = firedBundle.getTrigger();
    this.calendar = firedBundle.getCalendar();
    this.jobDetail = firedBundle.getJobDetail();
    this.job = job;
    this.recovering = firedBundle.isRecovering();
    this.fireTime = firedBundle.getFireTime();
    this.scheduledFireTime = firedBundle.getScheduledFireTime();
    this.prevFireTime = firedBundle.getPrevFireTime();
    this.nextFireTime = firedBundle.getNextFireTime();
    
    this.jobDataMap = new JobDataMap();
    this.jobDataMap.putAll(jobDetail.getJobDataMap());
    this.jobDataMap.putAll(trigger.getJobDataMap());
}
 
源代码5 项目: AsuraFramework   文件: SimpleJobFactory.java
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

        JobDetail jobDetail = bundle.getJobDetail();
        Class jobClass = jobDetail.getJobClass();
        try {
            if(log.isDebugEnabled()) {
                log.debug(
                    "Producing instance of Job '" + jobDetail.getFullName() + 
                    "', class=" + jobClass.getName());
            }
            
            return (Job) jobClass.newInstance();
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "Problem instantiating class '"
                            + jobDetail.getJobClass().getName() + "'", e);
            throw se;
        }
    }
 
源代码6 项目: AsuraFramework   文件: JobExecutionContext.java
/**
 * <p>
 * Create a JobExcecutionContext with the given context data.
 * </p>
 */
public JobExecutionContext(Scheduler scheduler,
        TriggerFiredBundle firedBundle, Job job) {
    this.scheduler = scheduler;
    this.trigger = firedBundle.getTrigger();
    this.calendar = firedBundle.getCalendar();
    this.jobDetail = firedBundle.getJobDetail();
    this.job = job;
    this.recovering = firedBundle.isRecovering();
    this.fireTime = firedBundle.getFireTime();
    this.scheduledFireTime = firedBundle.getScheduledFireTime();
    this.prevFireTime = firedBundle.getPrevFireTime();
    this.nextFireTime = firedBundle.getNextFireTime();
    
    this.jobDataMap = new JobDataMap();
    this.jobDataMap.putAll(jobDetail.getJobDataMap());
    this.jobDataMap.putAll(trigger.getJobDataMap());
}
 
源代码7 项目: AsuraFramework   文件: JobStoreSupport.java
/**
 * <p>
 * Inform the <code>JobStore</code> that the scheduler is now firing the
 * given <code>Trigger</code> (executing its associated <code>Job</code>),
 * that it had previously acquired (reserved).
 * </p>
 * 
 * @return null if the trigger or its job or calendar no longer exist, or
 *         if the trigger was not successfully put into the 'executing'
 *         state.
 */
public TriggerFiredBundle triggerFired(
        final SchedulingContext ctxt, final Trigger trigger) throws JobPersistenceException {
    return 
        (TriggerFiredBundle)executeInNonManagedTXLock(
            LOCK_TRIGGER_ACCESS,
            new TransactionCallback() {
                public Object execute(Connection conn) throws JobPersistenceException {
                    try {
                        return triggerFired(conn, ctxt, trigger);
                    } catch (JobPersistenceException jpe) {
                        // If job didn't exisit, we still want to commit our work and return null.
                        if (jpe.getErrorCode() == SchedulerException.ERR_PERSISTENCE_JOB_DOES_NOT_EXIST) {
                            return null;
                        } else {
                            throw jpe;
                        }
                    }
                }
            });
}
 
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = super.createJobInstance(bundle);
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
	if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}
	return job;
}
 
源代码9 项目: quartz-glass   文件: GlassJobFactory.java
private void setTargetObject(Job job, TriggerFiredBundle bundle, boolean forceCreateObject) throws Exception {
    PojoJobMeta pojoJobMeta = getPojoJobMeta(bundle.getJobDetail());
    if (pojoJobMeta == null) return;
    if (pojoJobMeta.getTargetObject() != null && !forceCreateObject) return;

    Object targetObject;
    Class targetClass = pojoJobMeta.getTargetClass();
    try {
        targetObject = beanFactory.getBean(targetClass);
    } catch (NoSuchBeanDefinitionException e) {
        targetObject = targetClass.newInstance();
        beanFactory.autowireBean(targetObject);
    }

    populateJobDataMapTargetObject(bundle, targetObject);
    pojoJobMeta.setTargetObject(targetObject);

    MethodInvokingJobDetailFactoryBean methodInvoker = createMethodInvoker(pojoJobMeta);
    methodInvoker.setTargetObject(targetObject);

    MethodInvokingJob methodInvokingJob = (MethodInvokingJob) job;
    methodInvokingJob.setMethodInvoker(methodInvoker);
}
 
源代码10 项目: syncope   文件: AutowiringSpringBeanJobFactory.java
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
    Object job = beanFactory.getBean(bundle.getJobDetail().getKey().getName());
    if (isEligibleForPropertyPopulation(job)) {
        BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
        MutablePropertyValues pvs = new MutablePropertyValues();
        if (this.schedulerContext != null) {
            pvs.addPropertyValues(this.schedulerContext);
        }
        pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
        pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
        if (this.ignoredUnknownProperties != null) {
            for (String propName : this.ignoredUnknownProperties) {
                if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
                    pvs.removePropertyValue(propName);
                }
            }
            bw.setPropertyValues(pvs);
        } else {
            bw.setPropertyValues(pvs, true);
        }
    }
    return job;
}
 
源代码11 项目: sk-admin   文件: QuartzConfig.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {

	//调用父类的方法
	Object jobInstance = super.createJobInstance(bundle);
	capableBeanFactory.autowireBean(jobInstance);
	return jobInstance;
}
 
源代码12 项目: RCT   文件: JobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	// 调用父类的方法
	Object jobInstance = super.createJobInstance(bundle);
	// 进行注入
	capableBeanFactory.autowireBean(jobInstance);
	return jobInstance;
}
 
源代码13 项目: spring-analysis-note   文件: AdaptableJobFactory.java
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
	try {
		Object jobObject = createJobInstance(bundle);
		return adaptJob(jobObject);
	}
	catch (Throwable ex) {
		throw new SchedulerException("Job instantiation failed", ex);
	}
}
 
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = (this.applicationContext != null ?
			this.applicationContext.getAutowireCapableBeanFactory().createBean(
					bundle.getJobDetail().getJobClass(), AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false) :
			super.createJobInstance(bundle));

	if (isEligibleForPropertyPopulation(job)) {
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}

	return job;
}
 
源代码15 项目: WeEvent   文件: AutoWiringSpringBeanJobFactory.java
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
    log.info("+++++++createJobInstance");
    final Object job = super.createJobInstance(bundle);
    beanFactory.autowireBean(job);
    return job;
}
 
源代码16 项目: WeEvent   文件: JobFactory.java
/**
 * create the job
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {

    Object job = super.createJobInstance(bundle);
    factory.autowireBean(job);
    return job;
}
 
源代码17 项目: yshopmall   文件: QuartzConfig.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {

	//调用父类的方法
	Object jobInstance = super.createJobInstance(bundle);
	capableBeanFactory.autowireBean(jobInstance);
	return jobInstance;
}
 
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
	try {
		Object jobObject = createJobInstance(bundle);
		return adaptJob(jobObject);
	}
	catch (Throwable ex) {
		throw new SchedulerException("Job instantiation failed", ex);
	}
}
 
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = (this.applicationContext != null ?
			this.applicationContext.getAutowireCapableBeanFactory().createBean(
					bundle.getJobDetail().getJobClass(), AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false) :
			super.createJobInstance(bundle));

	if (isEligibleForPropertyPopulation(job)) {
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}

	return job;
}
 
源代码20 项目: Almost-Famous   文件: JobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
    //调用父类的方法
    Object jobInstance = super.createJobInstance(bundle);
    //进行注入
    capableBeanFactory.autowireBean(jobInstance);
    return jobInstance;
}
 
源代码21 项目: Almost-Famous   文件: JobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
    //调用父类的方法
    Object jobInstance = super.createJobInstance(bundle);
    //进行注入
    capableBeanFactory.autowireBean(jobInstance);
    return jobInstance;
}
 
源代码22 项目: uyuni   文件: RhnJobFactory.java
/**
 * {@inheritDoc}
 */
@Override
public synchronized Job newJob(TriggerFiredBundle trigger, Scheduler s)
    throws SchedulerException {
    Long scheduleId = trigger.getJobDetail().getJobDataMap().getLong("schedule_id");

    return new TaskoJob(scheduleId);
}
 
源代码23 项目: TrackRay   文件: SpringJobFactory.java
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
    final Object job = super.createJobInstance(bundle);

    beanFactory.autowireBean(job);

    return job;
}
 
源代码24 项目: eladmin   文件: QuartzConfig.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {

	//调用父类的方法
	Object jobInstance = super.createJobInstance(bundle);
	capableBeanFactory.autowireBean(jobInstance);
	return jobInstance;
}
 
源代码25 项目: FlyCms   文件: ScheduleConfig.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	//调用父类的方法
	Object jobInstance = super.createJobInstance(bundle);
	//进行注入,这属于Spring的技术,不清楚的可以查看Spring的API.
	capableBeanFactory.autowireBean(jobInstance);
	return jobInstance;
}
 
源代码26 项目: quarkus   文件: QuartzScheduler.java
@Override
public Job newJob(TriggerFiredBundle bundle, org.quartz.Scheduler Scheduler) throws SchedulerException {
    Class<? extends Job> jobClass = bundle.getJobDetail().getJobClass();
    if (jobClass.equals(InvokerJob.class)) {
        return new InvokerJob(invokers);
    }
    return super.newJob(bundle, Scheduler);
}
 
源代码27 项目: redis-manager   文件: JobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
    // 调用父类的方法
    Object jobInstance = super.createJobInstance(bundle);
    // 进行注入
    capableBeanFactory.autowireBean(jobInstance);
    return jobInstance;
}
 
源代码28 项目: yyblog   文件: JobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
    //调用父类的方法
    Object jobInstance = super.createJobInstance(bundle);
    //进行注入
    capableBeanFactory.autowireBean(jobInstance);
    return jobInstance;
}
 
源代码29 项目: griffin   文件: AutowiringSpringBeanJobFactory.java
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) {
    try {
        final Object job = super.createJobInstance(bundle);
        beanFactory.autowireBean(job);
        return job;
    } catch (Exception e) {
        LOGGER.error("fail to create job instance. {}", e);
    }
    return null;
}
 
源代码30 项目: alfresco-repository   文件: AlfrescoJobFactory.java
@Override
protected Object createJobInstance(TriggerFiredBundle bundle)
      throws Exception {
   Object job = super.createJobInstance(bundle);
   if(job instanceof ApplicationContextAware)
   {
      ((ApplicationContextAware)job).setApplicationContext(context);
   }
   return job;
}
 
 类所在包
 同包方法