com.atlassian.confluence.plugins.schedule.admin.support
Class CronExpressionValidator

java.lang.Object
  extended by com.atlassian.confluence.plugins.schedule.admin.support.CronExpressionValidator

public class CronExpressionValidator
extends java.lang.Object

Validates a cron expression, and returns the future executions.


Method Summary
static java.util.List<java.util.Date> getFutureSchedules(java.lang.String cronExpressionValue, int limit)
          Finds the next execution occurences of a cron expression from now.
static java.util.List<java.util.Date> getFutureSchedules(java.lang.String cronExpressionValue, int limit, java.util.Date fromDate)
          Finds the next execution occurences of a cron expression from now.
static boolean isValid(java.lang.String cronExpressionValue)
          Determines if the cron expression is valid according to Quartz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFutureSchedules

public static java.util.List<java.util.Date> getFutureSchedules(java.lang.String cronExpressionValue,
                                                                int limit)
                                                         throws java.text.ParseException
Finds the next execution occurences of a cron expression from now.

Parameters:
cronExpressionValue - the expression to evaluation
limit - the maximum number of dates to return
Returns:
a list of update "limit" dates for the next executions
Throws:
java.text.ParseException - if the cron expression is invalid

getFutureSchedules

public static java.util.List<java.util.Date> getFutureSchedules(java.lang.String cronExpressionValue,
                                                                int limit,
                                                                java.util.Date fromDate)
                                                         throws java.text.ParseException
Finds the next execution occurences of a cron expression from now.

Parameters:
cronExpressionValue - the expression to evaluation
limit - the maximum number of dates to return
fromDate - the date to start from, or now if null
Returns:
a list of update "limit" dates for the next executions
Throws:
java.text.ParseException - if the cron expression is invalid

isValid

public static boolean isValid(java.lang.String cronExpressionValue)
Determines if the cron expression is valid according to Quartz.

The Quartz CronExpression seems a bit buggy - it seems to ignore last character in string when validating.

However, since ultimate the expression is consumed by Quartz, it will accept it anyway.

Parameters:
cronExpressionValue - the expression to validate
Returns:
true if considered valid


Copyright © 2003-2014 Atlassian. All Rights Reserved.