Package adams.flow.standalone.rats.input
Class Cron
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.standalone.rats.input.AbstractRatInput
-
- adams.flow.standalone.rats.input.AbstractMetaRatInput
-
- adams.flow.standalone.rats.input.Cron
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.ShallowCopySupporter<AbstractRatInput>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,RatInput
,Serializable
public class Cron extends AbstractMetaRatInput
Uses a cronjob for defining the execution of the base rat input.
For more information on the scheduler format see:
http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-input <adams.flow.standalone.rats.input.RatInput> (property: input) The receiver to wrap. default: adams.flow.standalone.rats.input.DummyInput
-schedule <adams.core.base.CronSchedule> (property: schedule) The schedule for executing the base rat input; format 'SECOND MINUTE HOUR DAYOFMONTH MONTH WEEKDAY [YEAR]'. default: 0 0 1 * * ?
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Cron.CronJob
Encapsulates a job to run.
-
Field Summary
Fields Modifier and Type Field Description static String
CRONDUMMY
the dummy data to feed into the flow.static String
KEY_OWNER
the key for the owner in the JobExecutionContent.protected adams.core.base.CronSchedule
m_Schedule
the cron schedule.protected org.quartz.Scheduler
m_Scheduler
the scheduler.-
Fields inherited from class adams.flow.standalone.rats.input.AbstractMetaRatInput
m_Data, m_Input
-
Fields inherited from class adams.flow.standalone.rats.input.AbstractRatInput
m_LoggingPrefix, m_Owner, m_ReceptionInterrupted, m_ReceptionRunning, m_Stopped
-
-
Constructor Summary
Constructors Constructor Description Cron()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
callReceive()
Hook method that calls the base-input's receive() method using a cronjob.void
defineOptions()
Adds options to the internal list of options.Class
generates()
Returns the type of data this scheme generates.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.adams.core.base.CronSchedule
getSchedule()
Returns the execution schedule.String
globalInfo()
Returns a string describing the object.String
initReception()
Initializes the reception.boolean
isReceptionRunning()
Returns whether the reception is currently running.protected String
receiveData()
Retrieves data using the base input.String
scheduleTipText()
Returns the tip text for this property.void
setSchedule(adams.core.base.CronSchedule value)
Sets the execution schedule.void
stopExecution()
Stops the execution.protected void
stopScheduler()
Stops the internal cron scheduler, if possible.-
Methods inherited from class adams.flow.standalone.rats.input.AbstractMetaRatInput
doReceive, getInput, hasPendingOutput, initialize, inputTipText, output, postReceive, preReceive, setInput, setOwner, setUp
-
Methods inherited from class adams.flow.standalone.rats.input.AbstractRatInput
canReceive, check, cleanUp, configureLogger, doWait, getAdditionalInformation, getFullName, getOwner, getQueue, getReceptionInterrupted, handleException, interruptReception, isStopped, receive, shallowCopy, shallowCopy, updatePrefix
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
CRONDUMMY
public static final String CRONDUMMY
the dummy data to feed into the flow.- See Also:
- Constant Field Values
-
KEY_OWNER
public static final String KEY_OWNER
the key for the owner in the JobExecutionContent.- See Also:
- Constant Field Values
-
m_Schedule
protected adams.core.base.CronSchedule m_Schedule
the cron schedule.
-
m_Scheduler
protected org.quartz.Scheduler m_Scheduler
the scheduler.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractMetaRatInput
-
setSchedule
public void setSchedule(adams.core.base.CronSchedule value)
Sets the execution schedule.- Parameters:
value
- the schedule
-
getSchedule
public adams.core.base.CronSchedule getSchedule()
Returns the execution schedule.- Returns:
- the schedule
-
scheduleTipText
public String scheduleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractMetaRatInput
- Returns:
- null if no info available, otherwise short string
-
generates
public Class generates()
Returns the type of data this scheme generates.- Specified by:
generates
in interfaceRatInput
- Specified by:
generates
in classAbstractRatInput
- Returns:
- the type of data
-
isReceptionRunning
public boolean isReceptionRunning()
Returns whether the reception is currently running.- Specified by:
isReceptionRunning
in interfaceRatInput
- Overrides:
isReceptionRunning
in classAbstractRatInput
- Returns:
- true if running
-
receiveData
protected String receiveData()
Retrieves data using the base input.- Returns:
- null if successful, otherwise error message
-
initReception
public String initReception()
Initializes the reception.- Specified by:
initReception
in interfaceRatInput
- Overrides:
initReception
in classAbstractMetaRatInput
- Returns:
- null if successfully initialized, otherwise error message
-
callReceive
protected String callReceive()
Hook method that calls the base-input's receive() method using a cronjob.- Overrides:
callReceive
in classAbstractMetaRatInput
- Returns:
- null if successful, otherwise error message
-
stopScheduler
protected void stopScheduler()
Stops the internal cron scheduler, if possible.
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceRatInput
- Specified by:
stopExecution
in interfaceadams.core.Stoppable
- Overrides:
stopExecution
in classAbstractMetaRatInput
-
-