org.oddjob.schedules.schedules
Class AfterSchedule

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

public final class AfterSchedule
extends AbstractSchedule
implements Serializable

Description

Schedule something after the given schedule.

This can be useful when wanting a schedule to begin at the end of an interval instead of the beginning, or for scheduling around holidays when a process is still required to run on the holiday, but not the day after the holiday.

The after schedule differs from the DayAfterSchedule in that day-after is designed to narrow it's parent interval but this schedule applies a refinement to it child schedule. The difference is subtle but hopefully the examples demonstrate how each should be used.

Example

A schedule for the end of the interval.
<schedules:count count="1" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <refinement>
        <schedules:after>
            <schedule>
                <schedules:interval interval="00:20"/>
            </schedule>
        </schedules:after>
    </refinement>
</schedules:count>
This would schedule a job to run once after 20 minutes. It could be used to stop a long running job for instance.

Example

A schedule for the day after a the current business day.
<schedules:after xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
    <schedule>
        <schedules:broken>
            <schedule>
                <schedules:weekly from="MONDAY" to="FRIDAY">
                    <refinement>
                        <schedules:daily/>
                    </refinement>
                </schedules:weekly>
            </schedule>
            <breaks>
                <schedules:date on="2011-05-02"/>
            </breaks>
        </schedules:broken>
    </schedule>
    <refinement>
        <schedules:time from="08:00"/>
    </refinement>
</schedules:after>
Normally this will schedule something from 08:00 am Tuesday to Saturday, but for the week where Monday 2nd of May was a public holiday the schedule will be from Wednesday to Saturday.
See Also:
Serialized Form
Author:
Rob Gordon

Constructor Summary
AfterSchedule()
           
 
Method Summary
 Schedule getSchedule()
           
 ScheduleResult nextDue(ScheduleContext context)
          For a given date a schedule will provide the interval this schedule should next be scheduled in.
 void setSchedule(Schedule schedule)
           
 
Methods inherited from class org.oddjob.schedules.AbstractSchedule
getRefinement, setRefinement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AfterSchedule

public AfterSchedule()
Method Detail

nextDue

public ScheduleResult nextDue(ScheduleContext context)
Description copied from interface: Schedule
For a given date a schedule will provide the interval this schedule should next be scheduled in.

If the schedule is never due again for the given date, null is returned.

Specified by:
nextDue in interface Schedule
Returns:
The next due interval for the schedule.

getSchedule

public Schedule getSchedule()

setSchedule

public void setSchedule(Schedule schedule)