Package com.wowza.wms.util.crontab
Class CrontabEvent
- Object
-
- com.wowza.wms.util.crontab.CrontabEvent
-
- All Implemented Interfaces:
Comparable<CrontabEvent>
public class CrontabEvent extends Object implements Comparable<CrontabEvent>
Holds an event's schedule and is responsible for calculating event activation.
-
-
Constructor Summary
Constructors Constructor Description CrontabEvent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(CrontabEvent o)
Allows CronEvents to be sorted via Java Sort Class.void
dump()
dumps this event's information to the consoleString
getError()
int
getErrorField()
ICrontabEventHandler
getEventHandler()
String
getEventStr()
com.wowza.wms.util.crontab.CrontabField
getField(int whichField)
org.joda.time.MutableDateTime
getLastRun()
org.joda.time.MutableDateTime
getNextRun()
String
getTarget()
boolean
isDebugOn()
boolean
isExpired()
Indicates whether or not all execution dates for this event occur in the pastboolean
isMatch(org.joda.time.MutableDateTime date)
Determines if this event will fire on the date passed invoid
setDebug(boolean debug)
turns on/off debug loggingvoid
setError(String error)
void
setErrorField(int errorField)
void
setEventHandler(ICrontabEventHandler handler)
void
setEventStr(String entry)
void
setField(int whichField, com.wowza.wms.util.crontab.CrontabField field)
void
setLastRun()
Sets the last run time to nowvoid
setLastRun(org.joda.time.MutableDateTime date)
void
setTarget(String target)
boolean
start()
Starts this events timervoid
stop()
stops this events timer
-
-
-
Field Detail
-
DT_FORMAT
public static org.joda.time.format.DateTimeFormatter DT_FORMAT
-
MINUTE
public static final int MINUTE
- See Also:
- Constant Field Values
-
HOUR
public static final int HOUR
- See Also:
- Constant Field Values
-
DAY
public static final int DAY
- See Also:
- Constant Field Values
-
MONTH
public static final int MONTH
- See Also:
- Constant Field Values
-
YEAR
public static final int YEAR
- See Also:
- Constant Field Values
-
WEEKDAY
public static final int WEEKDAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public boolean start()
Starts this events timer- Returns:
- true - if timer is started, else false
-
stop
public void stop()
stops this events timer
-
isMatch
public boolean isMatch(org.joda.time.MutableDateTime date)
Determines if this event will fire on the date passed in- Parameters:
date
-- Returns:
- boolean
-
setField
public void setField(int whichField, com.wowza.wms.util.crontab.CrontabField field)
-
getField
public com.wowza.wms.util.crontab.CrontabField getField(int whichField)
-
setTarget
public void setTarget(String target)
-
getTarget
public String getTarget()
-
setEventStr
public void setEventStr(String entry)
-
getEventStr
public String getEventStr()
-
getNextRun
public org.joda.time.MutableDateTime getNextRun()
-
getLastRun
public org.joda.time.MutableDateTime getLastRun()
-
setLastRun
public void setLastRun(org.joda.time.MutableDateTime date)
-
getError
public String getError()
-
setError
public void setError(String error)
-
getErrorField
public int getErrorField()
-
setErrorField
public void setErrorField(int errorField)
-
setLastRun
public void setLastRun()
Sets the last run time to now
-
setDebug
public void setDebug(boolean debug)
turns on/off debug logging- Parameters:
debug
- - true/false
-
isDebugOn
public boolean isDebugOn()
-
setEventHandler
public void setEventHandler(ICrontabEventHandler handler)
-
getEventHandler
public ICrontabEventHandler getEventHandler()
-
isExpired
public boolean isExpired()
Indicates whether or not all execution dates for this event occur in the past- Returns:
- true/false
-
compareTo
public int compareTo(CrontabEvent o)
Allows CronEvents to be sorted via Java Sort Class. Compares nextRun dates of two CronEvents where earlier events are considered "less" than later events, (e.g. today < tomorrow) and nulls are "greater" than events with dates (e.g. tomorrow < null) This provides the logic to sort events by soonest to latest with nulls at the end- Specified by:
compareTo
in interfaceComparable<CrontabEvent>
- Parameters:
o
- - CronEvent to compare this event to- Returns:
- -1,0,1 - if equal, if this event is greater than
-
dump
public void dump()
dumps this event's information to the console
-
-