org.oddjob.schedules.schedules
Class DailySchedule

java.lang.Object
  extended by org.oddjob.schedules.AbstractSchedule
      extended by org.oddjob.schedules.ConstrainedSchedule
          extended by org.oddjob.schedules.schedules.DailySchedule
All Implemented Interfaces:
Serializable, RefineableSchedule, Schedule

public final class DailySchedule
extends ConstrainedSchedule
implements Serializable

Description

A schedule for each day at, or from a given time. This schedule enables job to be scheduled daily at a particular time or a from/to time which could be used to constrain a sub schedule.

If the 'to' time is less than the 'from' time it is assumed that the 'to' time is the next day.

Example

A simple daily schedule. Used with a Timer this would run a job every day at 10am.
<schedules:daily at="10:00" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/>

Example

Using an interval with a daily schedule to schedules something every 15 minutes between 10pm and 4am. The end time is 03:50 yet the last interval is 03:45 to 04:00 because the interval starts before the end time.
<schedules:daily from="22:00" to="03:50" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <refinement>
        <schedules:interval interval="00:15"/>
    </refinement>
</schedules:daily>
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
DailySchedule()
           
 
Method Summary
protected  Calendar fromCalendar(Date referenceDate, TimeZone timeZone)
          Provide a Calendar for the start of the constraint.
 String getFrom()
           
 String getTo()
           
protected  CalendarUnit intervalBetween()
          Sub classes must provide a unit which is what must be added to move the schedule on.
 void setAt(String at)
           
 void setFrom(String from)
           
 void setTo(String to)
           
protected  Calendar toCalendar(Date referenceDate, TimeZone timeZone)
          Provide a Calendar for the end of the constraint.
 String toString()
          Override toString.
 
Methods inherited from class org.oddjob.schedules.ConstrainedSchedule
lastInterval, nextDue, nextInterval, shiftFromCalendar, shiftToCalendar
 
Methods inherited from class org.oddjob.schedules.AbstractSchedule
getRefinement, setRefinement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DailySchedule

public DailySchedule()
Method Detail

setFrom

public void setFrom(String from)

Property: from

Description: The from time.

Required: No. Default to the start of the day.

Parameters:
from - The from date.

getFrom

public String getFrom()

setTo

public void setTo(String to)

Property: to

Description: The to time.

Required: No. Default to the end of the day.

Parameters:
to - The to date.

getTo

public String getTo()

setAt

public void setAt(String at)

Property: at

Description: The time at which this schedule is for. This has the same effect as setting from and to to the same thing.

Required: No.

Parameters:
at - The at time.

intervalBetween

protected CalendarUnit intervalBetween()
Description copied from class: ConstrainedSchedule
Sub classes must provide a unit which is what must be added to move the schedule on. I.e. the equivalent of a day, week, month etc.

Specified by:
intervalBetween in class ConstrainedSchedule
Returns:

fromCalendar

protected Calendar fromCalendar(Date referenceDate,
                                TimeZone timeZone)
Description copied from class: ConstrainedSchedule
Provide a Calendar for the start of the constraint.

Specified by:
fromCalendar in class ConstrainedSchedule
Parameters:
referenceDate - The date/time now.
timeZone - The time zone.
Returns:
A calendar for the from time.

toCalendar

protected Calendar toCalendar(Date referenceDate,
                              TimeZone timeZone)
Description copied from class: ConstrainedSchedule
Provide a Calendar for the end of the constraint.

Specified by:
toCalendar in class ConstrainedSchedule
Parameters:
referenceDate - The date/time now.
timeZone - The time zone.
Returns:
A calendar for the end time.

toString

public String toString()
Override toString.

Specified by:
toString in class ConstrainedSchedule
Returns:
A description of the schedule.