Search in sources :

Example 1 with Report

use of org.opennms.netmgt.config.reportd.Report in project opennms by OpenNMS.

the class ReportScheduler method buildReportSchedule.

private void buildReportSchedule() {
    synchronized (m_lock) {
        for (Report report : m_configDao.getReports()) {
            JobDetail detail = null;
            CronTriggerImpl trigger = null;
            try {
                detail = new JobDetailImpl(report.getReportName(), JOB_GROUP, ReportJob.class, false, false);
                detail.getJobDataMap().put(ReportJob.KEY, report);
                trigger = new CronTriggerImpl(report.getReportName(), JOB_GROUP, report.getCronSchedule());
                trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);
                getScheduler().scheduleJob(detail, trigger);
            } catch (ParseException e) {
                LOG.error("buildReportSchedule: {}", e.getMessage(), e);
            } catch (SchedulerException e) {
                LOG.error("buildReportSchedule: {}", e.getMessage(), e);
            }
        }
    }
}
Also used : JobDetail(org.quartz.JobDetail) SchedulerException(org.quartz.SchedulerException) Report(org.opennms.netmgt.config.reportd.Report) JobDetailImpl(org.quartz.impl.JobDetailImpl) CronTriggerImpl(org.quartz.impl.triggers.CronTriggerImpl) ParseException(java.text.ParseException)

Aggregations

ParseException (java.text.ParseException)1 Report (org.opennms.netmgt.config.reportd.Report)1 JobDetail (org.quartz.JobDetail)1 SchedulerException (org.quartz.SchedulerException)1 JobDetailImpl (org.quartz.impl.JobDetailImpl)1 CronTriggerImpl (org.quartz.impl.triggers.CronTriggerImpl)1