Package org.quartz

Examples of org.quartz.CronTrigger


    }

    private Trigger convertToTrigger(JobTrigger jobTrigger) {
        Trigger trigger;
        if (jobTrigger.getRecurrenceType() == JobTrigger.RecurrenceType.CRON_EXPRESSION) {
            CronTrigger cronTrigger = new CronTrigger();
            try {
                cronTrigger.setCronExpression(jobTrigger.getCronExpression());
            } catch (ParseException e) {
                throw new RuntimeException(e);
            }
            trigger = cronTrigger;
        } else {
View Full Code Here


    public JobSpec() {
        int i = hashCode();

        detail = new JobDetail();
        trigger = new CronTrigger();

        detail.setJobClass(QuartzResourceAdapter.JobEndpoint.class);
        detail.getJobDataMap().setAllowsTransientData(true);

        setVolatile(true);
View Full Code Here

    }

    protected CronTrigger createCronTrigger(String path) throws ParseException {
        // replace + back to space so it's a cron expression
        path = path.replaceAll("\\+", " ");
        CronTrigger cron = new CronTrigger();
        cron.setCronExpression(path);
        return cron;
    }
View Full Code Here

        }
    }

    private boolean hasTriggerChanged(Trigger oldTrigger, Trigger newTrigger) {
        if (oldTrigger instanceof CronTrigger && oldTrigger.equals(newTrigger)) {
            CronTrigger oldCron = (CronTrigger) oldTrigger;
            CronTrigger newCron = (CronTrigger) newTrigger;
            return !oldCron.getCronExpression().equals(newCron.getCronExpression());
        } else {
            return !newTrigger.equals(oldTrigger);
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy#createTrigger(org.apache.camel.routepolicy.quartz.ScheduledRoutePolicyConstants.Action)
     */
    @Override
    protected Trigger createTrigger(Action action, Route route) throws Exception {
        CronTrigger trigger = null;
       
        if (action == Action.START) {
            trigger = new CronTrigger(TRIGGER_START + route.getId(), TRIGGER_GROUP + route.getId(), getRouteStartTime());
        } else if (action == Action.STOP) {
            trigger = new CronTrigger(TRIGGER_STOP + route.getId(), TRIGGER_GROUP + route.getId(), getRouteStopTime());
        } else if (action == Action.SUSPEND) {
            trigger = new CronTrigger(TRIGGER_SUSPEND + route.getId(), TRIGGER_GROUP + route.getId(), getRouteSuspendTime());
        } else if (action == Action.RESUME) {
            trigger = new CronTrigger(TRIGGER_RESUME + route.getId(), TRIGGER_GROUP + route.getId(), getRouteResumeTime());
        }
       
        return trigger;
    }
View Full Code Here

                                        .setJobData( jobDataMap )
                                        .build();

        try
        {
            CronTrigger trigger = TriggerBuilder.newTrigger()
                    .withIdentity( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId(), REPOSITORY_SCAN_GROUP )
                    .withSchedule( CronScheduleBuilder.cronSchedule( cronString ) )
                    .build();

            jobs.add( REPOSITORY_JOB + ":" + repoConfig.getId() );
View Full Code Here

            jobDetail.setGroup(groupName);

            if (cronExpression != null)
            {
                CronTrigger ctrigger = new CronTrigger();
                ctrigger.setCronExpression(cronExpression);
                trigger = ctrigger;
            }
            else if (repeatInterval != null)
            {
                SimpleTrigger strigger = new SimpleTrigger();
View Full Code Here

        jobDetail.setGroup(groupName);

        if (cronExpression != null)
        {
            CronTrigger ctrigger = new CronTrigger();
            ctrigger.setCronExpression(cronExpression);
            trigger = ctrigger;
        }
        else if (repeatInterval != null)
        {
            SimpleTrigger strigger = new SimpleTrigger();
View Full Code Here

      e.printStackTrace();
    }
   
    try {
      JobDetail jd = new JobDetail("waitJob", "groupJob", WaitJob.class);
      CronTrigger cronTrigger = new CronTrigger("waitTrigger", "groupTrigger");
      cronTrigger.setCronExpression("0 * * * * ?");
     
      sched.scheduleJob(jd, cronTrigger);
    } catch (ParseException e) {
      e.printStackTrace();
    } catch (SchedulerException e) {
View Full Code Here

      JobDetail jobDetail = new JobDetail(
          getConfValue(config, "task.name"),
          getConfValue(config, "task.group"),
          Class.forName(getConfValue(config, "task.class")));
      jobDetail.setDescription(getConfValue(config, "task.description"));
      CronTrigger trigger = new CronTrigger(getConfValue(config, "trigger.name"), getConfValue(config, "trigger.group"));
      trigger.setCronExpression(getConfValue(config, "trigger.cronExpression"));
      m_scheduler.scheduleJob(jobDetail, trigger);
    } catch (ClassNotFoundException e) {
      throw new SchedulerException("Failed to find job implementation class:", e);
    } catch (ParseException e) {
      throw new SchedulerException("Failed to parse cron trigger expression:", e);
View Full Code Here

TOP

Related Classes of org.quartz.CronTrigger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.