Class RecurringTask


  • public class RecurringTask
    extends Object
    This class defines a information about a recurring task, which will be used to repeatedly schedule tasks for processing.
    It also provides some static methods that allow to validate strings in crontab (5) format.
    • Constructor Detail

      • RecurringTask

        public RecurringTask​(ServerContext serverContext,
                             TaskScheduler taskScheduler,
                             Entry recurringTaskEntry)
                      throws DirectoryException
        Creates a new recurring task based on the information in the provided entry.
        Parameters:
        serverContext - The server context.
        taskScheduler - A reference to the task scheduler that may be used to schedule new tasks.
        recurringTaskEntry - The entry containing the information to use to define the task to process.
        Throws:
        DirectoryException - If the provided entry does not contain a valid recurring task definition.
    • Method Detail

      • getRecurringTaskID

        public String getRecurringTaskID()
        Retrieves the unique ID assigned to this recurring task.
        Returns:
        The unique ID assigned to this recurring task.
      • getRecurringTaskEntryDN

        public DN getRecurringTaskEntryDN()
        Retrieves the DN of the entry containing the data for this recurring task.
        Returns:
        The DN of the entry containing the data for this recurring task.
      • getRecurringTaskEntry

        public Entry getRecurringTaskEntry()
        Retrieves the entry containing the data for this recurring task.
        Returns:
        The entry containing the data for this recurring task.
      • getTaskClassName

        public String getTaskClassName()
        Retrieves the fully-qualified name of the Java class that provides the implementation logic for this recurring task.
        Returns:
        The fully-qualified name of the Java class that provides the implementation logic for this recurring task.
      • scheduleNextIteration

        public Task scheduleNextIteration​(GregorianCalendar calendar)
                                   throws DirectoryException
        Schedules the next iteration of this recurring task for processing.
        Parameters:
        calendar - date and time to schedule next iteration from.
        Returns:
        The task that has been scheduled for processing.
        Throws:
        DirectoryException - to indicate an error.
      • parseTaskTab

        public static void parseTaskTab​(String taskSchedule)
                                 throws DirectoryException
        Parse and validate recurring task schedule.
        Parameters:
        taskSchedule - recurring task schedule tab in crontab(5) format.
        Throws:
        DirectoryException - to indicate an error.
      • parseTaskTabField

        public static boolean[] parseTaskTabField​(String tabField,
                                                  int minValue,
                                                  int maxValue)
                                           throws IllegalArgumentException
        Parse and validate recurring task schedule field.
        Parameters:
        tabField - recurring task schedule field in crontab(5) format.
        minValue - minimum value allowed for this field.
        maxValue - maximum value allowed for this field.
        Returns:
        boolean schedule slots range set according to the schedule field.
        Throws:
        IllegalArgumentException - if tab field is invalid.