## helma.util
Class CronJob

    java.lang.Object
      helma.util.CronJob

    public class CronJob

extends java.lang.Object

A cron entry, derived from Protomatter's CronEntry class. This class encapsulates a function call, a timeout value and a specification for when the given event should be delivered to the given topics. The specification of when the event should be delivered is based on the UNIX cron facility.

Constructor Summary
`CronJob(java.lang.String name)` Create an empty CronJob.

Method Summary
`void` `addDay(int day)` Add a day of the month to the list of years this entry applies to.
`void` `addHour(int hour)` Add an hour to the list of years this entry applies to.
`void` `addMinute(int minute)` Add a minute to the list of years this entry applies to.
`void` `addMonth(int month)` Add a month to the list of years this entry applies to.
`void` `addWeekday(int weekday)` Add a weekday to the list of years this entry applies to.
`void` `addYear(int year)` Add a year to the list of years this entry applies to.
`boolean` `appliesToDate(java.util.Date date)` Determines if this CronJob applies to the given date.
`java.lang.String` `getFunction()` Get this entry's function
`java.lang.String` `getName()` Get this entry's name
`long` `getTimeout()` Get this entry's timeout
`static long` `millisToNextFullMinute()`
`static CronJob` `newJob(java.lang.String functionName, java.lang.String year, java.lang.String month, java.lang.String day, java.lang.String weekday, java.lang.String hour, java.lang.String minute)` A method for parsing properties.
`static long` `nextFullMinute()`
`static java.util.List` `parse(java.util.Properties props)`
`void` `parseDay(java.lang.String day)`
`void` `parseHour(java.lang.String hour)`
`void` `parseMinute(java.lang.String minute)`
`void` `parseMonth(java.lang.String value)`
`void` `parseTimeout(java.lang.String timeout)`
`void` `parseWeekDay(java.lang.String weekday)`
`void` `parseYear(java.lang.String value)`
`void` `removeDay(int day)` Remove a day of the month from the list of years this entry applies to.
`void` `removeHour(int hour)` Remove an hour from the list of years this entry applies to.
`void` `removeMinute(int minute)` Remove a minute from the list of years this entry applies to.
`void` `removeMonth(int month)` Remove a month from the list of years this entry applies to.
`void` `removeWeekday(int weekday)` Remove a weekday from the list of years this entry applies to.
`void` `removeYear(int year)` Remove a year from the list of years this entry applies to.
`void` `setAllDays(boolean set)` Should the current day of the month be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addDay()` and `removeDay()` are taken into consideration.
`void` `setAllHours(boolean set)` Should the current hour be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addHour()` and `removeHour()` are taken into consideration.
`void` `setAllMinutes(boolean set)` Should the current minute be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addMinute()` and `removeMinute()` are taken into consideration.
`void` `setAllMonths(boolean set)` Should the current month be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addMonth()` and `removeMonth()` are taken into consideration.
`void` `setAllWeekdays(boolean set)` Should the current weekday be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addWeekday()` and `removeWeekday()` are taken into consideration.
`void` `setAllYears(boolean set)` Should the current year be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addYear()` and `removeYear()` are taken into consideration.
`void` `setFunction(java.lang.String function)` Set this entry's function
`void` `setName(java.lang.String name)` Set this entry's name
`void` `setTimeout(long timeout)` Set this entry's timeout
`static java.util.List` `sort(java.util.List list)`
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CronJob

    public CronJob(java.lang.String name)

  Create an empty CronJob.

Method Detail

### newJob

    public static CronJob newJob(java.lang.String functionName,
                                 java.lang.String year,
                                 java.lang.String month,
                                 java.lang.String day,
                                 java.lang.String weekday,
                                 java.lang.String hour,
                                 java.lang.String minute)

  A method for parsing properties. It looks through the properties file for entries that look like this:

  >       cron.name1.function = functionname

  >       cron.name1.year     = year-list
  >       cron.name1.month    = month-list
  >       cron.name1.day      = day-list
  >       cron.name1.weekday  = weekday-list
  >       cron.name1.hour     = hour-list
  >       cron.name1.minute   = minute-list

  >       cron.name1.timeout  = timeout-value

  And delivers corresponding `CronJob` objects in a collection. The specified lists from above are:

  `year-list`
    This is a comma (`,`) separated list of individual years or of year ranges. Examples: "`1999,2000`" or "`1999-2004,2005-2143,2650`"

  `month-list`
    This is a comma (`,`) separated list of month names. Example: "`january,march,may`"

  `day-list`
    This is a comma (`,`) separated list of individual day-of-month numbers or of day-of-month ranges. Examples: "`1,15`" or "`1-5,7,10-24`"

  `weekday-list`
    This is a comma (`,`) separated list of weekday names names. Example: "`monday,tuesday`"

  `hour-list`
    This is a comma (`,`) separated list of individual hours-of-day (24-hour time) or of hour-of-day ranges. Examples: "`12,15`" or "`8-17,19,20-22`"

  `minute-list`
    This is a comma (`,`) separated list of individual minutes (during an hour) or of minute ranges. Examples: "`0,15,30,45`" or "`0-5,8-14,23,28-32`"

  The value of each of those lists can also be an asterisk (`*`), which tells the cron system to disregard the given list when determining if a cron entry applies to a specific time -- for instance setting the `year-list` to `*` would cause the system to not take the current year into consideration. If a given list is not specified at all, it's the same as specifying it and giving it a value of `*`.

### parse

    public static java.util.List parse(java.util.Properties props)

### sort

    public static java.util.List sort(java.util.List list)

### parseYear

    public void parseYear(java.lang.String value)

### parseMonth

    public void parseMonth(java.lang.String value)

### parseDay

    public void parseDay(java.lang.String day)

### parseWeekDay

    public void parseWeekDay(java.lang.String weekday)

### parseHour

    public void parseHour(java.lang.String hour)

### parseMinute

    public void parseMinute(java.lang.String minute)

### parseTimeout

    public void parseTimeout(java.lang.String timeout)

### nextFullMinute

    public static long nextFullMinute()

### millisToNextFullMinute

    public static long millisToNextFullMinute()

### appliesToDate

    public boolean appliesToDate(java.util.Date date)

  Determines if this CronJob applies to the given date. Seconds and milliseconds in the date are ignored.

### addYear

    public void addYear(int year)

  Add a year to the list of years this entry applies to.

### removeYear

    public void removeYear(int year)

  Remove a year from the list of years this entry applies to.

### setAllYears

    public void setAllYears(boolean set)

  Should the current year be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addYear()` and `removeYear()` are taken into consideration. If this is set to true then the current year is not taken into consideration.

### addMonth

    public void addMonth(int month)

  Add a month to the list of years this entry applies to. Month numbers are taken from the constants on the `java.util.Calendar` class.

### removeMonth

    public void removeMonth(int month)

  Remove a month from the list of years this entry applies to. Month numbers are taken from the constants on the `java.util.Calendar` class.

### setAllMonths

    public void setAllMonths(boolean set)

  Should the current month be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addMonth()` and `removeMonth()` are taken into consideration. If this is set to true then the current month is not taken into consideration.

### addDay

    public void addDay(int day)

  Add a day of the month to the list of years this entry applies to.

### removeDay

    public void removeDay(int day)

  Remove a day of the month from the list of years this entry applies to.

### setAllDays

    public void setAllDays(boolean set)

  Should the current day of the month be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addDay()` and `removeDay()` are taken into consideration. If this is set to true then the current year is not taken into consideration.

### addWeekday

    public void addWeekday(int weekday)

  Add a weekday to the list of years this entry applies to. Weekday numbers are taken from the constants on the `java.util.Calendar` class.

### removeWeekday

    public void removeWeekday(int weekday)

  Remove a weekday from the list of years this entry applies to. Weekday numbers are taken from the constants on the `java.util.Calendar` class.

### setAllWeekdays

    public void setAllWeekdays(boolean set)

  Should the current weekday be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addWeekday()` and `removeWeekday()` are taken into consideration. If this is set to true then the current weekday is not taken into consideration.

### addHour

    public void addHour(int hour)

  Add an hour to the list of years this entry applies to.

### removeHour

    public void removeHour(int hour)

  Remove an hour from the list of years this entry applies to.

### setAllHours

    public void setAllHours(boolean set)

  Should the current hour be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addHour()` and `removeHour()` are taken into consideration. If this is set to true then the current hour is not taken into consideration.

### addMinute

    public void addMinute(int minute)

  Add a minute to the list of years this entry applies to.

### removeMinute

    public void removeMinute(int minute)

  Remove a minute from the list of years this entry applies to.

### setAllMinutes

    public void setAllMinutes(boolean set)

  Should the current minute be taken into consideration when deciding if this entry is applicable? If this is set to false (the default) then the values set with the `addMinute()` and `removeMinute()` are taken into consideration. If this is set to true then the current minute is not taken into consideration.

### setName

    public void setName(java.lang.String name)

  Set this entry's name

### getName

    public java.lang.String getName()

  Get this entry's name

### setFunction

    public void setFunction(java.lang.String function)

  Set this entry's function

### getFunction

    public java.lang.String getFunction()

  Get this entry's function

### setTimeout

    public void setTimeout(long timeout)

  Set this entry's timeout

### getTimeout

    public long getTimeout()

  Get this entry's timeout

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.