|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.core.option.AbstractOptionHandler
adams.flow.core.AbstractActor
adams.flow.standalone.AbstractStandalone
adams.flow.standalone.Cron
public class Cron
Executes an actor according to a pre-defined schedule.
Note: since the actor merely starts the cron scheduler in the background, the actor finishes the execution pretty much immediately. Therefore, the flow needs to be kept alive in order to let the background jobs getting executed. This can be done with a simple WhileLoop actor using the 'adams.flow.condition.bool.True' condition and a nested Start/Sleep actor. You can use the adams.flow.template.EndlessLooptemplate to generate this loop automatically.
NB: Any newly scheduled jobs get dropped if the previous execution is still running.
For more information on the scheduler format see:
http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: Cron
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-cron-actor <adams.flow.core.AbstractActor> [-cron-actor ...] (property: cronActors) The actor to execute according to the cron schedule. default:
-schedule <adams.core.base.CronSchedule> (property: schedule) The schedule for execution the cron actor; format 'SECOND MINUTE HOUR DAYOFMONTH MONTH WEEKDAY [YEAR]'. default: 0 0 1 * * ?For more information on the schedule format, see CronTrigger Tutorial.
| Nested Class Summary | |
|---|---|
static class |
Cron.CronJob
Encapsulates a job to run. |
| Field Summary | |
|---|---|
static String |
BUSY
the result if actors are currently being executed. |
static String |
KEY_OWNER
the key for the owner in the JobExecutionContent. |
protected Sequence |
m_CronActors
for actors that get executed. |
protected boolean |
m_ExecutingCronActors
whether the cron-actors are currently being executed. |
protected CronSchedule |
m_Schedule
the cron schedule. |
protected org.quartz.Scheduler |
m_Scheduler
the scheduler. |
| Fields inherited from class adams.flow.core.AbstractActor |
|---|
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated |
| Fields inherited from class adams.core.option.AbstractOptionHandler |
|---|
m_DebugLevel, m_OptionManager |
| Fields inherited from interface adams.flow.core.Actor |
|---|
FILE_EXTENSION, FILE_EXTENSION_GZ |
| Constructor Summary | |
|---|---|
Cron()
|
|
| Method Summary | |
|---|---|
int |
active()
Returns the number of non-skipped actors. |
void |
add(AbstractActor actor)
Inserts the actor at the end. |
void |
add(int index,
AbstractActor actor)
Inserts the actor at the given position. |
String |
check()
Performs checks on the "sub-actors". |
protected String |
checkCronActors(AbstractActor[] actors)
Checks the cron actors before they are set via the setCronActors method. |
void |
cleanUp()
Cleans up after the execution has finished. |
String |
cronActorsTipText()
Returns the tip text for this property. |
void |
defineOptions()
Adds options to the internal list of options. |
protected String |
doExecute()
Executes the flow item. |
protected String |
executeCronActors()
Executes the cron actors. |
AbstractActor |
firstActive()
Returns the first non-skipped actor. |
protected void |
forceVariables(Variables value)
Updates the Variables instance in use. |
AbstractActor |
get(int index)
Returns the actor at the given position. |
ActorHandlerInfo |
getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution. |
AbstractActor[] |
getCronActors()
Returns the actors to execute on schedule. |
String |
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI. |
CronSchedule |
getSchedule()
Returns the name of the actor. |
String |
globalInfo()
Returns a string describing the object. |
int |
indexOf(String actor)
Returns the index of the actor. |
protected void |
initialize()
Initializes the members. |
AbstractActor |
lastActive()
Returns the last non-skipped actor. |
AbstractActor |
remove(int index)
Removes the actor at the given position and returns the removed object. |
void |
removeAll()
Removes all actors. |
String |
scheduleTipText()
Returns the tip text for this property. |
void |
set(int index,
AbstractActor actor)
Sets the actor at the given position. |
void |
setCronActors(AbstractActor[] value)
Sets the actors to execute on schedule. |
void |
setDebugLevel(int value)
Sets the debugging level (0 = off). |
void |
setSchedule(CronSchedule value)
Sets the execution schedule. |
String |
setUp()
Initializes the sub-actors for flow execution. |
int |
size()
Returns the size of the group. |
void |
stopExecution()
Stops the execution. |
protected void |
stopScheduler()
Stops the internal cron scheduler, if possible. |
protected void |
updateParent()
Updates the parent of all actors in this group. |
void |
wrapUp()
Cleans up after the execution has finished. |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface adams.flow.core.Actor |
|---|
compareTo, debug, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setVariables, sizeOf, stopExecution, variableChanged |
| Methods inherited from interface adams.core.AdditionalInformationHandler |
|---|
getAdditionalInformation |
| Methods inherited from interface adams.core.option.OptionHandler |
|---|
cleanUpOptions, getOptionManager |
| Field Detail |
|---|
public static final String KEY_OWNER
public static final String BUSY
protected Sequence m_CronActors
protected CronSchedule m_Schedule
protected org.quartz.Scheduler m_Scheduler
protected boolean m_ExecutingCronActors
| Constructor Detail |
|---|
public Cron()
| Method Detail |
|---|
public String globalInfo()
globalInfo in class AbstractOptionHandlerpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractActorprotected void initialize()
initialize in class AbstractActorpublic String getQuickInfo()
getQuickInfo in interface QuickInfoSupportergetQuickInfo in interface ActorgetQuickInfo in class AbstractActorpublic void setDebugLevel(int value)
setDebugLevel in interface DebuggablesetDebugLevel in class AbstractOptionHandlervalue - >0 if debugging output should be printedprotected String checkCronActors(AbstractActor[] actors)
actors - the actors to check
protected void updateParent()
public void setCronActors(AbstractActor[] value)
value - the actorspublic AbstractActor[] getCronActors()
public String cronActorsTipText()
public void setSchedule(CronSchedule value)
value - the schedulepublic CronSchedule getSchedule()
public String scheduleTipText()
protected String executeCronActors()
public int size()
size in interface ActorHandlerpublic AbstractActor get(int index)
get in interface ActorHandlerindex - the position
public void set(int index,
AbstractActor actor)
set in interface ActorHandlerindex - the positionactor - the actor to set at this positionpublic int indexOf(String actor)
indexOf in interface ActorHandleractor - the name of the actor to look for
public void add(AbstractActor actor)
add in interface MutableActorHandleractor - the actor to insert
public void add(int index,
AbstractActor actor)
add in interface MutableActorHandlerindex - the positionactor - the actor to insertpublic AbstractActor remove(int index)
remove in interface MutableActorHandlerindex - the position
public void removeAll()
removeAll in interface MutableActorHandlerpublic ActorHandlerInfo getActorHandlerInfo()
getActorHandlerInfo in interface ActorHandlerpublic int active()
public AbstractActor firstActive()
firstActive in interface ActorHandlerpublic AbstractActor lastActive()
lastActive in interface ActorHandlerpublic String check()
check in interface ActorHandlerprotected void forceVariables(Variables value)
forceVariables in class AbstractActorvalue - the instance to usepublic String setUp()
setUp in interface ActorsetUp in class AbstractActorprotected String doExecute()
doExecute in class AbstractActorprotected void stopScheduler()
public void stopExecution()
stopExecution in interface StoppablestopExecution in interface ActorstopExecution in class AbstractActorpublic void wrapUp()
wrapUp in interface ActorwrapUp in class AbstractActorpublic void cleanUp()
cleanUp in interface CleanUpHandlercleanUp in interface ActorcleanUp in class AbstractActor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||