Package org.quartz

Examples of org.quartz.CronTrigger


        // lets split the remaining into a group/name
        URI u = new URI(uri);
        String name;
        String group = "Camel";
        String path = u.getPath();
        CronTrigger cronTrigger = null;
        if (path != null && path.length() > 1) {
            if (path.startsWith("/")) {
                path = path.substring(1);
            }
            int idx = path.indexOf('/');
            if (idx > 0) {
                cronTrigger = new CronTrigger();
                name = path.substring(0, idx);
                String cronExpression = path.substring(idx + 1);
                // lets allow / instead of spaces and allow $ instead of ?
                cronExpression = cronExpression.replace('/', ' ');
                cronExpression = cronExpression.replace('$', '?');
                LOG.debug("Creating cron trigger: " + cronExpression);
                cronTrigger.setCronExpression(cronExpression);
                answer.setTrigger(cronTrigger);
            } else {
                name = path;
            }
            group = u.getHost();
View Full Code Here


     *
     * @return A trigger.
     */
    public static Trigger createCronTrigger(String jobName, String jobGroup, String cron_expression) {
        try {
            return new CronTrigger(createUniqueTriggerId(), "triggerGroup1", jobName, jobGroup,
                cron_expression);
        } catch (ParseException e) {
            log.error(".createCronTrigger(): " + e);
        }

View Full Code Here

                       Object job,
                       Map<String, Serializable>    config,
                       String schedulingExpression,
                       boolean canRunConcurrently)
    throws Exception {
        final CronTrigger cronJobEntry = new CronTrigger(name, DEFAULT_QUARTZ_JOB_GROUP);

        try {
            cronJobEntry.setCronExpression(schedulingExpression);
        } catch (final ParseException pe) {
            throw new Exception(pe.getMessage(), pe);
        }
        this.scheduleJob(name, job, config, cronJobEntry, canRunConcurrently);
    }
View Full Code Here

   }

   public void addCronJob(JobInfo jinfo, String exp) throws Exception
   {
      JobInfo jobinfo = getJobInfo(jinfo);
      CronTrigger trigger =
         new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
         exp);
      JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
      job.setDescription(jobinfo.getDescription());
      scheduler_.addJob(job, true);
      scheduler_.scheduleJob(trigger);
View Full Code Here

   }

   public void addCronJob(JobInfo jinfo, String exp, JobDataMap jdatamap) throws Exception
   {
      JobInfo jobinfo = getJobInfo(jinfo);
      CronTrigger trigger =
         new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
         exp);
      JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
      job.setJobDataMap(jdatamap);
      job.setDescription(jobinfo.getDescription());
      scheduler_.addJob(job, true);
View Full Code Here

   }

   public void addCronJob(JobInfo jinfo, String exp) throws Exception
   {
      JobInfo jobinfo = getJobInfo(jinfo);
      CronTrigger trigger =
         new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
         exp);
      JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
      job.setDescription(jobinfo.getDescription());
      scheduler_.addJob(job, true);
      scheduler_.scheduleJob(trigger);
View Full Code Here

   }

   public void addCronJob(JobInfo jinfo, String exp, JobDataMap jdatamap) throws Exception
   {
      JobInfo jobinfo = getJobInfo(jinfo);
      CronTrigger trigger =
         new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
         exp);
      JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
      job.setJobDataMap(jdatamap);
      job.setDescription(jobinfo.getDescription());
      scheduler_.addJob(job, true);
View Full Code Here

        // jobs can be scheduled before sched.start() has been called

        // job 1 will run every day at 2AM
        JobDetail job = new JobDetail("BirthdayWisher", "myalumni", BirthdayWishJob.class);
        //CronTrigger trigger = new CronTrigger("trigger1", "myalumni", "BirthdayWisher", "myalumni", "0 5 1 * * ?");
        CronTrigger trigger = new CronTrigger("trigger1", "myalumni", "BirthdayWisher", "myalumni", "0 0-15 14 * * ?");
       
        sched.addJob(job, true);
        Date ft = sched.scheduleJob(trigger);
        logger.info("===>" + job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " +  trigger.getCronExpression());

        logger.debug("------- Starting Scheduler ----------------");

        // All of the jobs have been added to the scheduler, but none of the
        // jobs
View Full Code Here

        // lets split the remaining into a group/name
        URI u = new URI(uri);
        String name;
        String group = "Camel";
        String path = u.getPath();
        CronTrigger cronTrigger = null;
        if (path != null && path.length() > 1) {
            if (path.startsWith("/")) {
                path = path.substring(1);
            }
            int idx = path.indexOf('/');
            if (idx > 0) {
                cronTrigger = new CronTrigger();
                name = path.substring(0, idx);
                String cronExpression = path.substring(idx + 1);
                // lets allow / instead of spaces and allow $ instead of ?
                cronExpression = cronExpression.replace('/', ' ');
                cronExpression = cronExpression.replace('$', '?');
                LOG.debug("Creating cron trigger: " + cronExpression);
                cronTrigger.setCronExpression(cronExpression);
                answer.setTrigger(cronTrigger);
            } else {
                name = path;
            }
            group = u.getHost();
View Full Code Here

        assertEquals("getGroup()", "Camel", trigger.getGroup());
    }

    public void testConfigureCronExpression() throws Exception {
        QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myTimerName/0/0/12/*/*/$");
        CronTrigger trigger = assertIsInstanceOf(CronTrigger.class, endpoint.getTrigger());
        assertEquals("getName()", "myTimerName", trigger.getName());
        assertEquals("getGroup()", "myGroup", trigger.getGroup());
        assertEquals("cron expression", "0 0 12 * * ?", trigger.getCronExpression());
    }
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.