Search in sources :

Example 6 with CronTriggerImpl

use of org.quartz.impl.triggers.CronTriggerImpl in project opennms by OpenNMS.

the class ImportScheduler method buildImportSchedule.

/**
     * <p>buildImportSchedule</p>
     */
protected void buildImportSchedule() {
    synchronized (m_lock) {
        Iterator<RequisitionDef> it = m_configDao.getDefs().iterator();
        while (it.hasNext()) {
            RequisitionDef def = it.next();
            JobDetail detail = null;
            CronTriggerImpl trigger = null;
            try {
                detail = new JobDetailImpl(def.getImportName().orElse(null), JOB_GROUP, ImportJob.class, false, false);
                detail.getJobDataMap().put(ImportJob.URL, def.getImportUrlResource());
                detail.getJobDataMap().put(ImportJob.RESCAN_EXISTING, def.getRescanExisting());
                trigger = new CronTriggerImpl(def.getImportName().orElse(null), JOB_GROUP, def.getCronSchedule().orElse(null));
                trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);
                getScheduler().scheduleJob(detail, trigger);
            } catch (ParseException e) {
                LOG.error("buildImportSchedule: {}", e.getLocalizedMessage(), e);
            } catch (SchedulerException e) {
                LOG.error("buildImportSchedule: {}", e.getLocalizedMessage(), e);
            }
        }
    }
    printCurrentSchedule();
}
Also used : JobDetail(org.quartz.JobDetail) SchedulerException(org.quartz.SchedulerException) JobDetailImpl(org.quartz.impl.JobDetailImpl) CronTriggerImpl(org.quartz.impl.triggers.CronTriggerImpl) RequisitionDef(org.opennms.netmgt.config.provisiond.RequisitionDef) ParseException(java.text.ParseException)

Aggregations

CronTriggerImpl (org.quartz.impl.triggers.CronTriggerImpl)6 ParseException (java.text.ParseException)3 SchedulerException (org.quartz.SchedulerException)3 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)2 Test (org.junit.Test)2 JobDetail (org.quartz.JobDetail)2 JobDetailImpl (org.quartz.impl.JobDetailImpl)2 Date (java.util.Date)1 RequisitionDef (org.opennms.netmgt.config.provisiond.RequisitionDef)1 Report (org.opennms.netmgt.config.reportd.Report)1 ReportServiceLocatorException (org.opennms.reporting.core.svclayer.ReportServiceLocatorException)1 MessageBuilder (org.springframework.binding.message.MessageBuilder)1