當前位置: 首頁>>代碼示例>>Java>>正文


Java TriggerFiredBundle類代碼示例

本文整理匯總了Java中org.quartz.spi.TriggerFiredBundle的典型用法代碼示例。如果您正苦於以下問題:Java TriggerFiredBundle類的具體用法?Java TriggerFiredBundle怎麽用?Java TriggerFiredBundle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TriggerFiredBundle類屬於org.quartz.spi包,在下文中一共展示了TriggerFiredBundle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
protected void initJob(TriggerFiredBundle bundle, Object job) {
	// The following code is copied from SpringBeanJobFactory in spring-context-support-4.2.5.RELEASE
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
	if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (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);
		}
	}
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:24,代碼來源:YadaQuartzJobFactory.java

示例2: createJobInstance

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:30,代碼來源:SpringBeanJobFactory.java

示例3: createJobInstance

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/**
 * 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(getJobDetailDataMap(bundle));
		pvs.addPropertyValues(getTriggerDataMap(bundle));
		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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:30,代碼來源:SpringBeanJobFactory.java

示例4: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
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;
        }
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:SimpleJobFactory.java

示例5: JobExecutionContextImpl

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/**
 * <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());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:JobExecutionContextImpl.java

示例6: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
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;
        }
    }
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:20,代碼來源:SimpleJobFactory.java

示例7: JobExecutionContext

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/**
 * <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());
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:23,代碼來源:JobExecutionContext.java

示例8: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@Override
public Job newJob(final TriggerFiredBundle bundle, final Scheduler scheduler) throws SchedulerException {
    Preconditions.checkNotNull(applicationContext, "applicationContext cannot be null, should call setApplicationContext first.");
    Job job = null;
    try {
        for (Job each : applicationContext.getBeansOfType(Job.class).values()) {
            if (AopUtils.getTargetClass(each) == bundle.getJobDetail().getJobClass()) {
                job = each;
                break;
            }
        }
        if (null == job) {
            throw new NoSuchBeanDefinitionException("");
        }
    } catch (final BeansException ex) {
        log.info("Elastic job: cannot found bean for class: '{}'. This job is not managed for spring.", bundle.getJobDetail().getJobClass().getCanonicalName());
        return super.newJob(bundle, scheduler);
    }
    JobDataMap jobDataMap = new JobDataMap();
    jobDataMap.putAll(scheduler.getContext());
    jobDataMap.putAll(bundle.getJobDetail().getJobDataMap());
    jobDataMap.putAll(bundle.getTrigger().getJobDataMap());
    Job target = (Job) AopTargetUtils.getTarget(job);
    setBeanProps(target, jobDataMap);
    return target;
}
 
開發者ID:artoderk,項目名稱:elastic-jobx,代碼行數:27,代碼來源:SpringJobFactory.java

示例9: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle arg0, Scheduler arg1) throws SchedulerException {
	JobDataMap data = arg0.getJobDetail().getJobDataMap();
	ExecutionRunnable task;
	Execution execution;
	if(data.containsKey(Executor.EXECUTION_ID)) {
		String executionID = data.getString(Executor.EXECUTION_ID);
		execution = context.getExecutionAccessor().get(executionID);
	} else {
		String executionTaskID = data.getString(Executor.EXECUTION_TASK_ID);
		ExecutionParameters executionParams = (ExecutionParameters) data.get(Executor.EXECUTION_PARAMETERS);
		execution = executionRunnableFactory.createExecution(executionParams, executionTaskID);			
	}
	task = executionRunnableFactory.newExecutionRunnable(execution);
	
	ExecutionJob job = new ExecutionJob(task);
	return job;
}
 
開發者ID:denkbar,項目名稱:step,代碼行數:19,代碼來源:ExecutionJobFactory.java

示例10: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@Override
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
    final Job job = super.newJob(bundle, scheduler);
    Injections.inject(job, servletContext, null);
    return new Job() {
        @Override
        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
            job.execute(jobExecutionContext);
            try {
                //In a different class to make the database module optional at runtime
                SessionCleaner.closeSessions(servletContext);
            } catch (NoClassDefFoundError e) {
                logger.debug("Database module not available, not closing sessions", e);
            }
        }
    };
}
 
開發者ID:ManyDesigns,項目名稱:Portofino,代碼行數:18,代碼來源:PortofinoJobFactory.java

示例11: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@Override
public Job newJob(final TriggerFiredBundle triggerFiredBundle, final Scheduler schdlr) throws SchedulerException {
    // Get the job detail so we can get the job class
    final JobDetail jobDetail = triggerFiredBundle.getJobDetail();
    final Class jobClass = jobDetail.getJobClass();

    try {
        // Get a new instance of that class from Guice so we can do dependency injection
        return (Job) injector.getInstance(jobClass);
    } catch (Exception e) {
        // Something went wrong.  Print out the stack trace here so SLF4J doesn't hide it.
        LOGGER.error("Problem with building job.", e);

        // Rethrow the exception as an UnsupportedOperationException
        throw new UnsupportedOperationException(e);
    }
}
 
開發者ID:SoftTeco,項目名稱:st-toolset,代碼行數:18,代碼來源:GuiceJobFactory.java

示例12: createJobInstance

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@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;
}
 
開發者ID:apache,項目名稱:syncope,代碼行數:25,代碼來源:AutowiringSpringBeanJobFactory.java

示例13: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/** {@inheritDoc} */
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    Class<ReportJob> jobClass = getJobClass(jobDetail);
    
    ReportJob job = null;
    
    try {
        job = jobClass.newInstance();
        job.setReportd(getReportd());
        return job;
    } catch (Throwable e) {
        SchedulerException se = new SchedulerException("failed to create job class: "+ jobDetail.getJobClass().getName()+"; "+
                                                       e.getLocalizedMessage(), e);
        throw se;
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:19,代碼來源:ReportJobFactory.java

示例14: newJob

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
/** {@inheritDoc} */
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    Class<ImportJob> jobClass = getJobClass(jobDetail);
    
    ImportJob job = null;
    
    try {
        job = jobClass.newInstance();
        job.setProvisioner(getProvisioner());
        return job;
    } catch (Throwable e) {
        SchedulerException se = new SchedulerException("failed to create job class: "+jobDetail.getJobClass().getName()+"; "+
                                                       e.getLocalizedMessage(), e);
        throw se;
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:19,代碼來源:ImportJobFactory.java

示例15: triggersFired

import org.quartz.spi.TriggerFiredBundle; //導入依賴的package包/類
@Override
public List<TriggerFiredResult> triggersFired(List<OperableTrigger> triggers) throws JobPersistenceException {
    if (logger.isInfoEnabled()) {
        logger.info("Triggers fired " + triggers.size());
        logger.trace(triggers);
    }

    List<CouchDbTrigger> couchdbTriggers = fetchCouchDbTriggers(triggers);
    Map<String, Calendar> triggerCalendars = fetchCalendars(triggers);
    Map<JobKey, JobDetail> jobDetailMap = fetchJobDetails(triggers);

    List<TriggerFiredResult> firedResults = new ArrayList<TriggerFiredResult>();
    List<CouchDbTrigger> firedTriggers = triggerStore.triggersFired(couchdbTriggers, triggerCalendars);
    for (CouchDbTrigger firedTrigger : firedTriggers) {

        Date prevFireTime = find(couchdbTriggers, firedTrigger.getKey()).getPreviousFireTime();
        Calendar calendar = triggerCalendars.get(firedTrigger.getCalendarName());
        JobDetail job = jobDetailMap.get(firedTrigger.getJobKey());

        TriggerFiredBundle triggerFiredBundle = buildTriggerFiredBundle(firedTrigger, prevFireTime, calendar, job);
        firedResults.add(new TriggerFiredResult(triggerFiredBundle));
    }
    return firedResults;
}
 
開發者ID:motech,項目名稱:quartz-couchdb-store,代碼行數:25,代碼來源:CouchDbStore.java


注:本文中的org.quartz.spi.TriggerFiredBundle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。