Package org.quartz

Examples of org.quartz.CronExpression


     */
    public void updateCronExpression() {
        String cronExpression = getCronExpressionString();
        try {
            // Check cron expression format
            new CronExpression(cronExpression);
        } catch (ParseException e) {
            LOG.info("Unable to parse cron expression", e);
            throw new WrongValueException(cronExpressionInputPopup,
                    _("Unable to parse cron expression") + ":\n"
                            + e.getMessage());
View Full Code Here


     * @return trigger object
     */
  public static Trigger getTrigger(String id, String groupName, String schedule, long maxEvery) {
    TriggerBuilder<Trigger> trigger = newTrigger().withIdentity(id, groupName);
        try {
          trigger.withSchedule(cronSchedule(new CronExpression(schedule)));
        } catch (ParseException e) {
          int periodMillis = 0;
          try {
              int everyMin = Integer.parseInt(schedule);
          periodMillis = everyMin * 1000 * 60;       
View Full Code Here

     *          <code>TimeZone.getDefault()</code> will be used.
     */
    public CronCalendar(Calendar baseCalendar,
            String expression, TimeZone timeZone) throws ParseException {
        super(baseCalendar);
        this.cronExpression = new CronExpression(expression);
        this.cronExpression.setTimeZone(timeZone);
    }
View Full Code Here

    }
   
    @Override
    public Object clone() {
        CronCalendar clone = (CronCalendar) super.clone();
        clone.cronExpression = new CronExpression(cronExpression);
        return clone;
    }
View Full Code Here

     * @param expression the new string value to build a cron expression from
     * @throws ParseException
     *         if the string expression cannot be parsed
     */
    public void setCronExpression(String expression) throws ParseException {
        CronExpression newExp = new CronExpression(expression);
       
        this.cronExpression = newExp;
    }
View Full Code Here

   
    @Override
    public Object clone() {
        CronTriggerImpl copy = (CronTriggerImpl) super.clone();
        if (cronEx != null) {
            copy.setCronExpression(new CronExpression(cronEx));
        }
        return copy;
    }
View Full Code Here

        return copy;
    }

    public void setCronExpression(String cronExpression) throws ParseException {
        TimeZone origTz = getTimeZone();
        this.cronEx = new CronExpression(cronExpression);
        this.cronEx.setTimeZone(origTz);
    }
View Full Code Here

    private static final long serialVersionUID = CronSchedule.class.getName().hashCode() + 1;

    private CronExpression cronExpression;

    public CronSchedule(ScheduledTriggerDetail schedTriggerDetails) throws ParseException {
        cronExpression = new CronExpression(schedTriggerDetails.getCronScheduleSpec());
    }
View Full Code Here

                freq= StringUtils.join(cronArray, " ");

                // The cronExpression class takes second
                // as the first field where oozie is operating on
                // minute basis
                CronExpression expr = new CronExpression("0 " + freq);
                expr.setTimeZone(tz);
                nextTime = expr.getNextValidTimeAfter(targetDate);
            }
            // If both fields are specified by non-wildcards,
            // we need to split it into two expressions
            else {
                String[] cronArray1 = freq.split(" ");
                String[] cronArray2 = freq.split(" ");

                cronArray1[2] = "?";
                cronArray2[4] = "?";

                String freq1 = StringUtils.join(cronArray1, " ");
                String freq2 = StringUtils.join(cronArray2, " ");

                // The cronExpression class takes second
                // as the first field where oozie is operating on
                // minute basis
                CronExpression expr1 = new CronExpression("0 " + freq1);
                expr1.setTimeZone(tz);
                CronExpression expr2 = new CronExpression("0 " + freq2);
                expr2.setTimeZone(tz);
                nextTime = expr1.getNextValidTimeAfter(targetDate);
                Date nextTime2 = expr2.getNextValidTimeAfter(targetDate);
                nextTime = nextTime.compareTo(nextTime2) < 0 ? nextTime: nextTime2;
            }
        }
        else {
            // The cronExpression class takes second
            // as the first field where oozie is operating on
            // minute basis
            CronExpression expr  = new CronExpression("0 " + freq);
            expr.setTimeZone(tz);
            nextTime = expr.getNextValidTimeAfter(targetDate);
        }

        return nextTime;
    }
View Full Code Here

                if (!cronArray2[2].trim().equals("?")) {
                    cronArray2[4] = "?";
                }

                new CronExpression("0 " + StringUtils.join(cronArray1, " "));
                new CronExpression("0 " + StringUtils.join(cronArray2, " "));
            }
            catch (ParseException pex) {
                throw new IllegalArgumentException(XLog.format(
                        "parameter [{0}] = [{1}]  must be an integer or a cron syntax. Parsing error {2}", "frequency",
                        val, ex.getMessage(), ex));
View Full Code Here

TOP

Related Classes of org.quartz.CronExpression

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.