Package org.quartz

Examples of org.quartz.SimpleTrigger


                    "The createTimer(expiration, info) method cannot be called within the operation state '" + operationState
                            + "'.");
        }

        // Create the trigger that won't repeat
        Trigger trigger = new SimpleTrigger(getTriggerName(), getTriggerGroupName(), expiration);

        // Get timer
        return internalTimer(trigger, info);
    }
View Full Code Here


            throw new IllegalStateException("The createTimer(initialExpiration, intervalDuration, info) "
                    + "method cannot be called within the operation state '" + operationState + "'.");
        }

        // Create the trigger (repeat indefinitely)
        Trigger trigger = new SimpleTrigger(getTriggerName(), getTriggerGroupName(), initialExpiration, null,
                REPEAT_INDEFINITELY, intervalDuration);

        // Get timer
        return internalTimer(trigger, info);
    }
View Full Code Here

      String triggerName = nextUniqueName();
     
      JobDetail jobDetail = new JobDetail(jobName, null, QuartzJob.class);
      jobDetail.getJobDataMap().put("async", new AsynchronousEvent(type, parameters));
      
      SimpleTrigger trigger = new SimpleTrigger(triggerName, null);     
      try
      {
        scheduler.scheduleJob(jobDetail, trigger);
        return new QuartzTriggerHandle(triggerName);
      }
View Full Code Here

          TimerSchedule timerSchedule = (TimerSchedule) schedule;
          if (timerSchedule.getIntervalDuration() != null)
          {
             if ( timerSchedule.getExpiration()!=null )
             {
                SimpleTrigger trigger = new SimpleTrigger(triggerName, null,
                        timerSchedule.getExpiration(),
                        timerSchedule.getFinalExpiration(),
                        SimpleTrigger.REPEAT_INDEFINITELY,
                        timerSchedule.getIntervalDuration());
                scheduler.scheduleJob( jobDetail, trigger );
   
             }
             else if ( timerSchedule.getDuration()!=null )
             {
                 SimpleTrigger trigger = new SimpleTrigger(triggerName, null,
                         calculateDelayedDate(timerSchedule.getDuration()),
                         timerSchedule.getFinalExpiration(), SimpleTrigger.REPEAT_INDEFINITELY,
                         timerSchedule.getIntervalDuration());
                 scheduler.scheduleJob( jobDetail, trigger );
   
             }
             else
             {
                SimpleTrigger trigger = new SimpleTrigger(triggerName, null, new Date(),
                        timerSchedule.getFinalExpiration(),
                        SimpleTrigger.REPEAT_INDEFINITELY,
                        timerSchedule.getIntervalDuration());
                scheduler.scheduleJob( jobDetail, trigger );
   
             }
          }
          else
          {
            if ( schedule.getExpiration()!=null )
            {
                SimpleTrigger trigger = new SimpleTrigger (triggerName, null, schedule.getExpiration());
                scheduler.scheduleJob(jobDetail, trigger);
   
            }
            else if ( schedule.getDuration()!=null )
            {
                SimpleTrigger trigger = new SimpleTrigger (triggerName, null,
                        calculateDelayedDate(schedule.getDuration()));
                scheduler.scheduleJob(jobDetail, trigger);
   
            }
            else
            {
               SimpleTrigger trigger = new SimpleTrigger(triggerName, null);
               scheduler.scheduleJob(jobDetail, trigger);
   
            }
          }
      }
View Full Code Here

        QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myName?trigger.repeatCount=3");
        Trigger trigger = endpoint.getTrigger();
        assertEquals("getName()", "myName", trigger.getName());
        assertEquals("getGroup()", "myGroup", trigger.getGroup());

        SimpleTrigger simpleTrigger = assertIsInstanceOf(SimpleTrigger.class, trigger);
        assertEquals("getRepeatCount()", 3, simpleTrigger.getRepeatCount());
    }
View Full Code Here

        // create the trigger either cron or simple
        if (ObjectHelper.isNotEmpty(cron)) {
            cron = encodeCronExpression(cron);
            trigger = createCronTrigger(cron);
        } else {
            trigger = new SimpleTrigger();
            if (fireNow) {
                String intervalString = (String) triggerParameters.get("repeatInterval");
                if (intervalString != null) {
                    long interval = Long.valueOf(intervalString);
                    trigger.setStartTime(new Date(System.currentTimeMillis() - interval));
View Full Code Here

     * @param date The trigger date.
     *
     * @return DOCUMENT ME!
     */
    public static Trigger createSimpleTrigger(String jobName, String jobGroup, Date date) {
        return new SimpleTrigger(createUniqueTriggerId(), "triggerGroup1", jobName, jobGroup, date,
            null, 0, 0);
    }
View Full Code Here

    throws Exception {
        final long ms = period * 1000;
        if ( name == null ) {
            name = "Sling Quartz Scheduler " + UUID.randomUUID().toString();
        }
        final SimpleTrigger timeEntry =
            new SimpleTrigger(name, DEFAULT_QUARTZ_JOB_GROUP, new Date(System.currentTimeMillis() + ms), null,
                              SimpleTrigger.REPEAT_INDEFINITELY, ms);

        this.scheduleJob(name, job, config, timeEntry, canRunConcurrently);
    }
View Full Code Here

        final String name = job.getClass().getName();
        final JobDataMap dataMap = this.initDataMap(name, job, config, true);

        final JobDetail detail = this.createJobDetail(name, dataMap);

        final Trigger trigger = new SimpleTrigger(name, DEFAULT_QUARTZ_JOB_GROUP);
        this.scheduler.scheduleJob(detail, trigger);
    }
View Full Code Here

     */
    public void fireJobAt(String name, Object job, Map<String, Serializable> config, Date date) throws Exception {
        if ( name == null ) {
            name = "Sling Quartz Scheduler " + UUID.randomUUID().toString();
        }
        final SimpleTrigger trigger = new SimpleTrigger(name, DEFAULT_QUARTZ_JOB_GROUP, date);
        this.scheduleJob(name, job, config, trigger, true);
    }
View Full Code Here

TOP

Related Classes of org.quartz.SimpleTrigger

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.