Java 类org.quartz.DateBuilder.IntervalUnit 实例源码

项目:lams    文件:CalendarIntervalTriggerPersistenceDelegate.java   
@Override
protected TriggerPropertyBundle getTriggerPropertyBundle(SimplePropertiesTriggerProperties props) {

    TimeZone tz = null; // if we use null, that's ok as system default tz will be used
    String tzId = props.getString2();
    if(tzId != null && tzId.trim().length() != 0) // there could be null entries from previously released versions
        tz = TimeZone.getTimeZone(tzId);

    ScheduleBuilder<?> sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule()
        .withInterval(props.getInt1(), IntervalUnit.valueOf(props.getString1()))
        .inTimeZone(tz)
        .preserveHourOfDayAcrossDaylightSavings(props.isBoolean1())
        .skipDayIfHourDoesNotExist(props.isBoolean2());

    int timesTriggered = props.getInt2();

    String[] statePropertyNames = { "timesTriggered" };
    Object[] statePropertyValues = { timesTriggered };

    return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues);
}
项目:red5-server-common    文件:QuartzSchedulingService.java   
/** {@inheritDoc} */
public String addScheduledJob(int interval, IScheduledJob job) {
    String name = getJobName();
    // Store reference to applications job and service      
    JobDataMap jobData = new JobDataMap();
    jobData.put(QuartzSchedulingServiceJob.SCHEDULING_SERVICE, this);
    jobData.put(QuartzSchedulingServiceJob.SCHEDULED_JOB, job);
    // detail
    JobDetail jobDetail = JobBuilder.newJob(QuartzSchedulingServiceJob.class).withIdentity(name).usingJobData(jobData).build();
    // create trigger that fires indefinitely every <interval> milliseconds
    Trigger trigger = TriggerBuilder.newTrigger().withIdentity(String.format("Trigger_%s", name)).startAt(DateBuilder.futureDate(1, IntervalUnit.MILLISECOND)).forJob(jobDetail).withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(interval).repeatForever()).build();
    // store keys by name
    TriggerKey tKey = trigger.getKey();
    JobKey jKey = trigger.getJobKey();
    log.debug("Job key: {} Trigger key: {}", jKey, tKey);
    ScheduledJobKey key = new ScheduledJobKey(tKey, jKey);
    keyMap.put(name, key);
    // schedule
    scheduleJob(trigger, jobDetail);
    return name;
}
项目:red5-server-common    文件:QuartzSchedulingService.java   
/** {@inheritDoc} */
public String addScheduledJobAfterDelay(int interval, IScheduledJob job, int delay) {
    String name = getJobName();
    // Store reference to applications job and service      
    JobDataMap jobData = new JobDataMap();
    jobData.put(QuartzSchedulingServiceJob.SCHEDULING_SERVICE, this);
    jobData.put(QuartzSchedulingServiceJob.SCHEDULED_JOB, job);
    // detail
    JobDetail jobDetail = JobBuilder.newJob(QuartzSchedulingServiceJob.class).withIdentity(name, null).usingJobData(jobData).build();
    // Create trigger that fires indefinitely every <interval> milliseconds
    Trigger trigger = TriggerBuilder.newTrigger().withIdentity(String.format("Trigger_%s", name)).startAt(DateBuilder.futureDate(delay, IntervalUnit.MILLISECOND)).forJob(jobDetail).withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMilliseconds(interval).repeatForever()).build();
    // store keys by name
    TriggerKey tKey = trigger.getKey();
    JobKey jKey = trigger.getJobKey();
    log.debug("Job key: {} Trigger key: {}", jKey, tKey);
    ScheduledJobKey key = new ScheduledJobKey(tKey, jKey);
    keyMap.put(name, key);
    // schedule
    scheduleJob(trigger, jobDetail);
    return name;
}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>Set the interval unit - the time unit on with the interval applies.</p>
 * 
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are 
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 */
public void setRepeatIntervalUnit(IntervalUnit intervalUnit) {
    if (repeatIntervalUnit == null || 
            !((repeatIntervalUnit.equals(IntervalUnit.SECOND) || 
            repeatIntervalUnit.equals(IntervalUnit.MINUTE) || 
            repeatIntervalUnit.equals(IntervalUnit.HOUR))))
        throw new IllegalArgumentException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
    this.repeatIntervalUnit = intervalUnit;
}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Validates whether the properties of the <code>JobDetail</code> are
 * valid for submission into a <code>Scheduler</code>.
 * 
 * @throws IllegalStateException
 *           if a required property (such as Name, Group, Class) is not
 *           set.
 */
@Override
public void validate() throws SchedulerException {
    super.validate();

    if (repeatIntervalUnit == null || !(repeatIntervalUnit.equals(IntervalUnit.SECOND) || 
            repeatIntervalUnit.equals(IntervalUnit.MINUTE) ||repeatIntervalUnit.equals(IntervalUnit.HOUR)))
        throw new SchedulerException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
    if (repeatInterval < 1) {
        throw new SchedulerException("Repeat Interval cannot be zero.");
    }

    // Ensure interval does not exceed 24 hours
    long secondsInHour = 24 * 60 * 60L;
    if (repeatIntervalUnit == IntervalUnit.SECOND && repeatInterval > secondsInHour) {
        throw new SchedulerException("repeatInterval can not exceed 24 hours (" + secondsInHour + " seconds). Given " + repeatInterval);
    }
    if (repeatIntervalUnit == IntervalUnit.MINUTE && repeatInterval > secondsInHour / 60L) {
        throw new SchedulerException("repeatInterval can not exceed 24 hours (" + secondsInHour / 60L + " minutes). Given " + repeatInterval);
    }
    if (repeatIntervalUnit == IntervalUnit.HOUR && repeatInterval > 24 ) {
        throw new SchedulerException("repeatInterval can not exceed 24 hours. Given " + repeatInterval + " hours.");
    }        

    // Ensure timeOfDay is in order.
    if (getEndTimeOfDay() != null && !getStartTimeOfDay().before(getEndTimeOfDay())) {
        throw new SchedulerException("StartTimeOfDay " + startTimeOfDay + " should not come after endTimeOfDay " + endTimeOfDay);
    }
}
项目:openhab1-addons    文件:CalDavLoaderImpl.java   
public void startLoading() {
    if (execService != null) {
        return;
    }
    log.trace("starting execution...");

    int i = 0;
    for (final CalendarRuntime eventRuntime : EventStorage.getInstance().getEventCache().values()) {
        try {
            JobDetail job = JobBuilder.newJob().ofType(EventReloaderJob.class)
                    .usingJobData(EventReloaderJob.KEY_CONFIG, eventRuntime.getConfig().getKey())
                    .withIdentity(eventRuntime.getConfig().getKey(), JOB_NAME_EVENT_RELOADER).storeDurably()
                    .build();
            this.scheduler.addJob(job, false);
            SimpleTrigger jobTrigger = TriggerBuilder.newTrigger().forJob(job)
                    .withIdentity(eventRuntime.getConfig().getKey(), JOB_NAME_EVENT_RELOADER)
                    .startAt(DateBuilder.futureDate(10 + i, IntervalUnit.SECOND)).withSchedule(SimpleScheduleBuilder
                            .repeatMinutelyForever(eventRuntime.getConfig().getReloadMinutes()))
                    .build();
            this.scheduler.scheduleJob(jobTrigger);
            log.info("reload job scheduled for: {}", eventRuntime.getConfig().getKey());
        } catch (SchedulerException e) {
            log.warn("Cannot schedule calendar reloader", e);
        }
        // next event 10 seconds later
        i += 10;
    }

}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
public IntervalUnit getRepeatIntervalUnit() {
    return repeatIntervalUnit;
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
public IntervalUnit getRepeatIntervalUnit() {
    return repeatIntervalUnit;
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>Set the interval unit - the time unit on with the interval applies.</p>
 */
public void setRepeatIntervalUnit(IntervalUnit intervalUnit) {
    this.repeatIntervalUnit = intervalUnit;
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Returns the final time at which the <code>DateIntervalTrigger</code> will
 * fire, if there is no end time set, null will be returned.
 * </p>
 * 
 * <p>
 * Note that the return time may be in the past.
 * </p>
 */
@Override
public Date getFinalFireTime() {
    if (complete || getEndTime() == null) {
        return null;
    }

    // back up a second from end time
    Date fTime = new Date(getEndTime().getTime() - 1000L);
    // find the next fire time after that
    fTime = getFireTimeAfter(fTime, true);

    // the the trigger fires at the end time, that's it!
    if(fTime.equals(getEndTime()))
        return fTime;

    // otherwise we have to back up one interval from the fire time after the end time

    Calendar lTime = Calendar.getInstance();
    if(timeZone != null)
        lTime.setTimeZone(timeZone);
    lTime.setTime(fTime);
    lTime.setLenient(true);

    if(getRepeatIntervalUnit().equals(IntervalUnit.SECOND)) {
        lTime.add(java.util.Calendar.SECOND, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.MINUTE)) {
        lTime.add(java.util.Calendar.MINUTE, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.HOUR)) {
        lTime.add(java.util.Calendar.HOUR_OF_DAY, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.DAY)) {
        lTime.add(java.util.Calendar.DAY_OF_YEAR, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.WEEK)) {
        lTime.add(java.util.Calendar.WEEK_OF_YEAR, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.MONTH)) {
        lTime.add(java.util.Calendar.MONTH, -1 * getRepeatInterval());
    }
    else if(getRepeatIntervalUnit().equals(IntervalUnit.YEAR)) {
        lTime.add(java.util.Calendar.YEAR, -1 * getRepeatInterval());
    }

    return lTime.getTime();
}
项目:lams    文件:DailyTimeIntervalScheduleBuilder.java   
/**
 * Calculate and set the endTimeOfDay using count, interval and starTimeOfDay. This means
 * that these must be set before this method is call.
 * 
 * @return the updated DailyTimeIntervalScheduleBuilder
 */
public DailyTimeIntervalScheduleBuilder endingDailyAfterCount(int count) {
    if(count <=0)
        throw new IllegalArgumentException("Ending daily after count must be a positive number!");

    if(startTimeOfDay == null)
        throw new IllegalArgumentException("You must set the startDailyAt() before calling this endingDailyAfterCount()!");

    Date today = new Date();
    Date startTimeOfDayDate = startTimeOfDay.getTimeOfDayForDate(today);
    Date maxEndTimeOfDayDate = TimeOfDay.hourMinuteAndSecondOfDay(23, 59, 59).getTimeOfDayForDate(today);
    long remainingMillisInDay = maxEndTimeOfDayDate.getTime() - startTimeOfDayDate.getTime();
    long intervalInMillis;
    if (intervalUnit == IntervalUnit.SECOND)
        intervalInMillis = interval * 1000L;
    else if (intervalUnit == IntervalUnit.MINUTE)
            intervalInMillis = interval * 1000L * 60;
    else if (intervalUnit == IntervalUnit.HOUR)
        intervalInMillis = interval * 1000L * 60 * 24;
    else
        throw new IllegalArgumentException("The IntervalUnit: " + intervalUnit + " is invalid for this trigger."); 

    if (remainingMillisInDay - intervalInMillis <= 0)
        throw new IllegalArgumentException("The startTimeOfDay is too late with given Interval and IntervalUnit values.");

    long maxNumOfCount = (remainingMillisInDay / intervalInMillis);
    if (count > maxNumOfCount)
        throw new IllegalArgumentException("The given count " + count + " is too large! The max you can set is " + maxNumOfCount);

    long incrementInMillis = (count - 1) * intervalInMillis;
    Date endTimeOfDayDate = new Date(startTimeOfDayDate.getTime() + incrementInMillis);

    if (endTimeOfDayDate.getTime() > maxEndTimeOfDayDate.getTime())
        throw new IllegalArgumentException("The given count " + count + " is too large! The max you can set is " + maxNumOfCount);

    Calendar cal = Calendar.getInstance();
    cal.setTime(endTimeOfDayDate);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int minute = cal.get(Calendar.MINUTE);
    int second = cal.get(Calendar.SECOND);

    endTimeOfDay = TimeOfDay.hourMinuteAndSecondOfDay(hour, minute, second);
    return this;
}
项目:path-optimizer    文件:WebApi.java   
private Scheduler createUpdateWeatherDataScheduler(int interval,
        TimeUnit unit, ResourceBinder resourceBinder, int startDelay)
        throws SchedulerException, IOException, URISyntaxException {

    StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
    Properties properties = new Properties();
    properties.setProperty("org.quartz.threadPool.threadCount",
            String.valueOf(1));
    schedulerFactory.initialize(properties);

    Scheduler scheduler = schedulerFactory.getScheduler();

    JobDetail job = JobBuilder.newJob(UpdateWeatherData.class).build();

    job.getJobDataMap().put("baseDir", ResourceBinder
            .getDataDir(this.getClass()).toFile().getCanonicalPath());
    job.getJobDataMap().put("resourceBinder", resourceBinder);

    int secs = 60;
    switch (unit) {
    case HOUR:
        secs = interval * 60 * 60;
        break;
    case MINUTE:
        secs = interval * 60;
    case SECOND:
        secs = interval;
        break;
    default:
        break;
    }

    ScheduleBuilder<SimpleTrigger> scheduleBuilder = SimpleScheduleBuilder
            .simpleSchedule().withIntervalInSeconds(secs).repeatForever();

    TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger()
            .withIdentity("trigger1", "group1");

    if (startDelay < 1)
        triggerBuilder.startNow();
    else
        triggerBuilder.startAt(
                DateBuilder.futureDate(startDelay, IntervalUnit.SECOND));

    Trigger trigger = triggerBuilder.withSchedule(scheduleBuilder).build();

    scheduler.scheduleJob(job, trigger);

    return scheduler;

}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DailyTimeIntervalTrigger</code> that will occur at the given time,
 * and repeat at the the given interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param startTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should begin occurring.          
 * @param endTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should stop occurring.          
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are 
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less.
 */
public DailyTimeIntervalTriggerImpl(String name, String group, Date startTime,
        Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, 
        IntervalUnit intervalUnit,  int repeatInterval) {
    super(name, group);

    setStartTime(startTime);
    setEndTime(endTime);
    setRepeatIntervalUnit(intervalUnit);
    setRepeatInterval(repeatInterval);
    setStartTimeOfDay(startTimeOfDay);
    setEndTimeOfDay(endTimeOfDay);
}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DailyTimeIntervalTrigger</code> that will occur at the given time,
 * fire the identified <code>Job</code> and repeat at the the given
 * interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param startTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should begin occurring.          
 * @param endTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should stop occurring.          
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are 
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less.
 */
public DailyTimeIntervalTriggerImpl(String name, String group, String jobName,
        String jobGroup, Date startTime, Date endTime, 
        TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay,
        IntervalUnit intervalUnit,  int repeatInterval) {
    super(name, group, jobName, jobGroup);

    setStartTime(startTime);
    setEndTime(endTime);
    setRepeatIntervalUnit(intervalUnit);
    setRepeatInterval(repeatInterval);
    setStartTimeOfDay(startTimeOfDay);
    setEndTimeOfDay(endTimeOfDay);
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DateIntervalTrigger</code> that will occur at the given time,
 * and repeat at the the given interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param intervalUnit
 *          The repeat interval unit (minutes, days, months, etc).
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 */
public CalendarIntervalTriggerImpl(String name, String group, Date startTime,
        Date endTime, IntervalUnit intervalUnit,  int repeatInterval) {
    super(name, group);

    setStartTime(startTime);
    setEndTime(endTime);
    setRepeatIntervalUnit(intervalUnit);
    setRepeatInterval(repeatInterval);
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DateIntervalTrigger</code> that will occur at the given time,
 * fire the identified <code>Job</code> and repeat at the the given
 * interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param intervalUnit
 *          The repeat interval unit (minutes, days, months, etc).
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 */
public CalendarIntervalTriggerImpl(String name, String group, String jobName,
        String jobGroup, Date startTime, Date endTime,  
        IntervalUnit intervalUnit,  int repeatInterval) {
    super(name, group, jobName, jobGroup);

    setStartTime(startTime);
    setEndTime(endTime);
    setRepeatIntervalUnit(intervalUnit);
    setRepeatInterval(repeatInterval);
}
项目:lams    文件:DailyTimeIntervalScheduleBuilder.java   
/**
 * Specify the time unit and interval for the Trigger to be produced.
 * 
 * @param timeInterval the interval at which the trigger should repeat.
 * @param unit the time unit (IntervalUnit) of the interval. The only intervals that are valid for this type of 
 * trigger are {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @return the updated DailyTimeIntervalScheduleBuilder
 * @see DailyTimeIntervalTrigger#getRepeatInterval()
 * @see DailyTimeIntervalTrigger#getRepeatIntervalUnit()
 */
public DailyTimeIntervalScheduleBuilder withInterval(int timeInterval, IntervalUnit unit) {
    if (unit == null || !(unit.equals(IntervalUnit.SECOND) || 
            unit.equals(IntervalUnit.MINUTE) ||unit.equals(IntervalUnit.HOUR)))
        throw new IllegalArgumentException("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
    validateInterval(timeInterval);
    this.interval = timeInterval;
    this.intervalUnit = unit;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify the time unit and interval for the Trigger to be produced.
 * 
 * @param timeInterval the interval at which the trigger should repeat.
 * @param unit  the time unit (IntervalUnit) of the interval.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withInterval(int timeInterval, IntervalUnit unit) {
    if(unit == null)
        throw new IllegalArgumentException("TimeUnit must be specified.");
    validateInterval(timeInterval);
    this.interval = timeInterval;
    this.intervalUnit = unit;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.SECOND that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInSeconds the number of seconds at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds) {
    validateInterval(intervalInSeconds);
    this.interval = intervalInSeconds;
    this.intervalUnit = IntervalUnit.SECOND;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.MINUTE that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInMinutes the number of minutes at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes) {
    validateInterval(intervalInMinutes);
    this.interval = intervalInMinutes;
    this.intervalUnit = IntervalUnit.MINUTE;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.HOUR that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInHours the number of hours at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInHours(int intervalInHours) {
    validateInterval(intervalInHours);
    this.interval = intervalInHours;
    this.intervalUnit = IntervalUnit.HOUR;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.DAY that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInDays the number of days at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInDays(int intervalInDays) {
    validateInterval(intervalInDays);
    this.interval = intervalInDays;
    this.intervalUnit = IntervalUnit.DAY;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.WEEK that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInWeeks the number of weeks at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInWeeks(int intervalInWeeks) {
    validateInterval(intervalInWeeks);
    this.interval = intervalInWeeks;
    this.intervalUnit = IntervalUnit.WEEK;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.MONTH that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInMonths the number of months at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInMonths(int intervalInMonths) {
    validateInterval(intervalInMonths);
    this.interval = intervalInMonths;
    this.intervalUnit = IntervalUnit.MONTH;
    return this;
}
项目:lams    文件:CalendarIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.YEAR that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInYears the number of years at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see CalendarIntervalTrigger#getRepeatInterval()
 * @see CalendarIntervalTrigger#getRepeatIntervalUnit()
 */
public CalendarIntervalScheduleBuilder withIntervalInYears(int intervalInYears) {
    validateInterval(intervalInYears);
    this.interval = intervalInYears;
    this.intervalUnit = IntervalUnit.YEAR;
    return this;
}
项目:lams    文件:DailyTimeIntervalTrigger.java   
/**
 * <p>Get the interval unit - the time unit on with the interval applies.</p>
 * 
 * <p>The only intervals that are valid for this type of trigger are {@link IntervalUnit#SECOND},
 * {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.</p>
 */
public IntervalUnit getRepeatIntervalUnit();
项目:lams    文件:CalendarIntervalTrigger.java   
/**
 * <p>Get the interval unit - the time unit on with the interval applies.</p>
 */
public IntervalUnit getRepeatIntervalUnit();
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DailyTimeIntervalTrigger</code> that will occur immediately, and
 * repeat at the the given interval.
 * </p>
 * 
 * @param startTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should begin occurring.          
 * @param endTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should stop occurring.          
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are 
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less.
 */
public DailyTimeIntervalTriggerImpl(String name, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, IntervalUnit intervalUnit,  int repeatInterval) {
    this(name, null, startTimeOfDay, endTimeOfDay, intervalUnit, repeatInterval);
}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DailyTimeIntervalTrigger</code> that will occur immediately, and
 * repeat at the the given interval.
 * </p>
 * 
 * @param startTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should begin occurring.          
 * @param endTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should stop occurring.          
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are 
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less.
 */
public DailyTimeIntervalTriggerImpl(String name, String group, TimeOfDay startTimeOfDay, 
        TimeOfDay endTimeOfDay, IntervalUnit intervalUnit, int repeatInterval) {
    this(name, group, new Date(), null, startTimeOfDay, endTimeOfDay, intervalUnit, repeatInterval);
}
项目:lams    文件:DailyTimeIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DailyTimeIntervalTrigger</code> that will occur at the given time,
 * and repeat at the the given interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param startTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should begin occurring.          
 * @param endTimeOfDay 
 *          The <code>TimeOfDay</code> that the repeating should stop occurring.          
 * @param intervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are
 * {@link IntervalUnit#SECOND}, {@link IntervalUnit#MINUTE}, and {@link IntervalUnit#HOUR}.
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 * @throws IllegalArgumentException if an invalid IntervalUnit is given, or the repeat interval is zero or less.
 */
public DailyTimeIntervalTriggerImpl(String name, Date startTime,
        Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, 
        IntervalUnit intervalUnit,  int repeatInterval) {
    this(name, null, startTime, endTime, startTimeOfDay, endTimeOfDay, intervalUnit, repeatInterval);
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DateIntervalTrigger</code> that will occur immediately, and
 * repeat at the the given interval.
 * </p>
 */
public CalendarIntervalTriggerImpl(String name, IntervalUnit intervalUnit,  int repeatInterval) {
    this(name, null, intervalUnit, repeatInterval);
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DateIntervalTrigger</code> that will occur immediately, and
 * repeat at the the given interval.
 * </p>
 */
public CalendarIntervalTriggerImpl(String name, String group, IntervalUnit intervalUnit,
        int repeatInterval) {
    this(name, group, new Date(), null, intervalUnit, repeatInterval);
}
项目:lams    文件:CalendarIntervalTriggerImpl.java   
/**
 * <p>
 * Create a <code>DateIntervalTrigger</code> that will occur at the given time,
 * and repeat at the the given interval until the given end time.
 * </p>
 * 
 * @param startTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to fire.
 * @param endTime
 *          A <code>Date</code> set to the time for the <code>Trigger</code>
 *          to quit repeat firing.
 * @param intervalUnit
 *          The repeat interval unit (minutes, days, months, etc).
 * @param repeatInterval
 *          The number of milliseconds to pause between the repeat firing.
 */
public CalendarIntervalTriggerImpl(String name, Date startTime,
        Date endTime, IntervalUnit intervalUnit,  int repeatInterval) {
    this(name, null, startTime, endTime, intervalUnit, repeatInterval);
}
项目:lams    文件:DailyTimeIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.SECOND that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInSeconds the number of seconds at which the trigger should repeat.
 * @return the updated DailyTimeIntervalScheduleBuilder
 * @see DailyTimeIntervalTrigger#getRepeatInterval()
 * @see DailyTimeIntervalTrigger#getRepeatIntervalUnit()
 */
public DailyTimeIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds) {
    withInterval(intervalInSeconds, IntervalUnit.SECOND);
    return this;
}
项目:lams    文件:DailyTimeIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.MINUTE that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInMinutes the number of minutes at which the trigger should repeat.
 * @return the updated CalendarIntervalScheduleBuilder
 * @see DailyTimeIntervalTrigger#getRepeatInterval()
 * @see DailyTimeIntervalTrigger#getRepeatIntervalUnit()
 */
public DailyTimeIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes) {
    withInterval(intervalInMinutes, IntervalUnit.MINUTE);
    return this;
}
项目:lams    文件:DailyTimeIntervalScheduleBuilder.java   
/**
 * Specify an interval in the IntervalUnit.HOUR that the produced 
 * Trigger will repeat at.
 * 
 * @param intervalInHours the number of hours at which the trigger should repeat.
 * @return the updated DailyTimeIntervalScheduleBuilder
 * @see DailyTimeIntervalTrigger#getRepeatInterval()
 * @see DailyTimeIntervalTrigger#getRepeatIntervalUnit()
 */
public DailyTimeIntervalScheduleBuilder withIntervalInHours(int intervalInHours) {
    withInterval(intervalInHours, IntervalUnit.HOUR);
    return this;
}
项目:sfera    文件:Scheduler.java   
/**
 * Schedules a set of events to be triggered with an initial delay from this
 * method call and a regular interval between events. Events will continue
 * until explicitly {@link #cancel(String) cancelled}.
 * 
 * @param id
 *            ID of the event to trigger
 * @param value
 *            value of the event to trigger
 * @param initialDelay
 *            delay in milliseconds after which the first event will be
 *            triggered
 * @param interval
 *            interval in milliseconds of the subsequent events
 * @throws SchedulerException
 *             if an error occurs
 */
public void repeat(String id, String value, int initialDelay, int interval) throws SchedulerException {
    Trigger trigger = newEventTrigger(id, value).startAt(futureDate(initialDelay, IntervalUnit.MILLISECOND))
            .withSchedule(simpleSchedule().withIntervalInMilliseconds(interval).repeatForever()).build();
    scheduleEvent(trigger);
}
项目:sfera    文件:Scheduler.java   
/**
 * Schedules a fixed number of events to be triggered with an initial delay
 * from this method call and a regular interval between events. Events will
 * continue until the specified number of events have been triggered or
 * explicitly {@link #cancel(String) cancelled}.
 * 
 * @param id
 *            ID of the event to trigger
 * @param value
 *            value of the event to trigger
 * @param initialDelay
 *            delay in milliseconds after which the first event will be
 *            triggered
 * @param interval
 *            interval in milliseconds of the subsequent events
 * @param times
 *            number of triggered events
 * @throws SchedulerException
 *             if an error occurs
 */
public void repeat(String id, String value, int initialDelay, int interval, int times) throws SchedulerException {
    Trigger trigger = newEventTrigger(id, value).startAt(futureDate(initialDelay, IntervalUnit.MILLISECOND))
            .withSchedule(simpleSchedule().withIntervalInMilliseconds(interval).withRepeatCount(times - 1)).build();
    scheduleEvent(trigger);
}