org.drools.time.impl
Class CronTrigger

java.lang.Object
  extended by org.drools.time.impl.CronTrigger
All Implemented Interfaces:
Serializable, Trigger

public class CronTrigger
extends Object
implements Trigger

See Also:
Serialized Form

Field Summary
protected static int YEAR_TO_GIVEUP_SCHEDULING_AT
           
 
Constructor Summary
CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, CronExpression cronExpression, String[] calendarNames, org.drools.runtime.Calendars calendars)
           
CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, String cronExpression, String[] calendarNames, org.drools.runtime.Calendars calendars)
           
 
Method Summary
static CronExpression determineCronExpression(String cronExpression)
           
 Date getEndTime()
           Get the time at which the CronTrigger should quit repeating - even if repeastCount isn't yet satisfied.
 Date getNextFireTime()
           Returns the next time at which the Trigger is scheduled to fire.
 Date getPreviousFireTime()
           Returns the previous time at which the CronTrigger fired.
 Date getStartTime()
           
protected  Date getTimeAfter(Date afterTime)
           
 TimeZone getTimeZone()
           Returns the time zone for which the cronExpression of this CronTrigger will be resolved.
 Date hasNextFireTime()
          This method is used to query the trigger about the existence of a possible next fire time, but WITHOUT changing any internal state of the trigger.
 Date nextFireTime()
          This method returns the date of the next fire time and updates the internal state of the Trigger to the following fire time if one exists.
 void setCronExpression(CronExpression cronExpression)
           
 void setCronExpression(String cronExpression)
           
 void setEndTime(Date endTime)
           
 void setFirstFireTimeAfter()
           Returns the next time at which the CronTrigger will fire, after the given time.
 void setNextFireTime(Date nextFireTime)
           Sets the next time at which the CronTrigger will fire.
 void setPreviousFireTime(Date previousFireTime)
           Set the previous time at which the CronTrigger fired.
 void setStartTime(Date startTime)
           
 void setTimeZone(TimeZone timeZone)
           Sets the time zone for which the cronExpression of this CronTrigger will be resolved.
 void updateToNextIncludeDate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YEAR_TO_GIVEUP_SCHEDULING_AT

protected static final int YEAR_TO_GIVEUP_SCHEDULING_AT
See Also:
Constant Field Values
Constructor Detail

CronTrigger

public CronTrigger(long timestamp,
                   Date startTime,
                   Date endTime,
                   int repeatLimit,
                   String cronExpression,
                   String[] calendarNames,
                   org.drools.runtime.Calendars calendars)

CronTrigger

public CronTrigger(long timestamp,
                   Date startTime,
                   Date endTime,
                   int repeatLimit,
                   CronExpression cronExpression,
                   String[] calendarNames,
                   org.drools.runtime.Calendars calendars)
Method Detail

getStartTime

public Date getStartTime()

setStartTime

public void setStartTime(Date startTime)

getEndTime

public Date getEndTime()

Get the time at which the CronTrigger should quit repeating - even if repeastCount isn't yet satisfied.

See Also:
#getFinalFireTime()

setEndTime

public void setEndTime(Date endTime)

getNextFireTime

public Date getNextFireTime()

Returns the next time at which the Trigger is scheduled to fire. If the trigger will not fire again, null will be returned. Note that the time returned can possibly be in the past, if the time that was computed for the trigger to next fire has already arrived, but the scheduler has not yet been able to fire the trigger (which would likely be due to lack of resources e.g. threads).

The value returned is not guaranteed to be valid until after the Trigger has been added to the scheduler.

See Also:
TriggerUtils#computeFireTimesBetween(Trigger, org.quartz.Calendar , Date, Date)

getPreviousFireTime

public Date getPreviousFireTime()

Returns the previous time at which the CronTrigger fired. If the trigger has not yet fired, null will be returned.


setNextFireTime

public void setNextFireTime(Date nextFireTime)

Sets the next time at which the CronTrigger will fire. This method should not be invoked by client code.


setPreviousFireTime

public void setPreviousFireTime(Date previousFireTime)

Set the previous time at which the CronTrigger fired.

This method should not be invoked by client code.


getTimeZone

public TimeZone getTimeZone()

Returns the time zone for which the cronExpression of this CronTrigger will be resolved.


setTimeZone

public void setTimeZone(TimeZone timeZone)

Sets the time zone for which the cronExpression of this CronTrigger will be resolved.

If setCronExpression(CronExpression) is called after this method, the TimeZon setting on the CronExpression will "win". However if setCronExpression(String) is called after this method, the time zone applied by this method will remain in effect, since the String cron expression does not carry a time zone!


setCronExpression

public void setCronExpression(String cronExpression)

setCronExpression

public void setCronExpression(CronExpression cronExpression)

determineCronExpression

public static CronExpression determineCronExpression(String cronExpression)

hasNextFireTime

public Date hasNextFireTime()
Description copied from interface: Trigger
This method is used to query the trigger about the existence of a possible next fire time, but WITHOUT changing any internal state of the trigger. In other words, this method MUST not have side effects. As an analogy, if a trigger was a stack, this method would be the equivalent of a "peek()" call.

Specified by:
hasNextFireTime in interface Trigger
Returns:
the Date of the next fire time or null if there is no next fire time.

nextFireTime

public Date nextFireTime()
Description copied from interface: Trigger
This method returns the date of the next fire time and updates the internal state of the Trigger to the following fire time if one exists. As an analogy, if a trigger was a stack, this method would be the equivalent of a "pop()" call.

Specified by:
nextFireTime in interface Trigger
Returns:
the Date of the next fire time or null if there is no next fire time.

setFirstFireTimeAfter

public void setFirstFireTimeAfter()

Returns the next time at which the CronTrigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)


getTimeAfter

protected Date getTimeAfter(Date afterTime)

updateToNextIncludeDate

public void updateToNextIncludeDate()


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.