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 Object

Validates a cron expression, and returns the future executions.


Method Summary
static List<Date> getFutureSchedules(String cronExpressionValue, int limit)
          Finds the next execution occurences of a cron expression from now.
static List<Date> getFutureSchedules(String cronExpressionValue, int limit, Date fromDate)
          Finds the next execution occurences of a cron expression from now.
static boolean isValid(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 List<Date> getFutureSchedules(String cronExpressionValue,
                                            int limit)
                                     throws 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:
ParseException - if the cron expression is invalid

getFutureSchedules

public static List<Date> getFutureSchedules(String cronExpressionValue,
                                            int limit,
                                            Date fromDate)
                                     throws 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:
ParseException - if the cron expression is invalid

isValid

public static boolean isValid(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-2013 Atlassian. All Rights Reserved.