Package adams.flow.core
Class AbstractGroovyActor
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,FileBasedScripting
,FileBasedScriptingWithOptions
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,Serializable
,Comparable
public abstract class AbstractGroovyActor extends AbstractScriptedActor
Abstract ancestor for actors that execute Groovy scripts.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Groovy
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Actor
m_ActorObject
the loaded script object.protected GroovyScript
m_InlineScript
the inline script.-
Fields inherited from class adams.flow.core.AbstractScriptedActor
BACKUP_SCRIPTOBJECT, m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractGroovyActor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkScriptObject()
Checks the script object.void
defineOptions()
Adds options to the internal list of options.protected GroovyScript
getDefaultInlineScript()
Returns the default inline script.GroovyScript
getInlineScript()
Gets the inline script to use instead of the external script file.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.protected String
initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.String
inlineScriptTipText()
Returns the tip text for this property.protected String
loadScriptObject()
Loads the scripts object and sets its options.String
preExecute()
Pre-execute hook.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.String
scriptOptionsTipText()
Returns the tip text for this property.void
setInlineScript(GroovyScript value)
Sets the inline script to use instead of the external script file.protected String
updateScriptOptions()
Updates the script options.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractScriptedActor
backupState, getScriptFile, getScriptOptions, pruneBackup, scriptFileTipText, setScriptFile, setScriptOptions, stopExecution
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, doExecute, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
toCommandLine
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
-
-
-
Field Detail
-
m_ActorObject
protected transient Actor m_ActorObject
the loaded script object.
-
m_InlineScript
protected GroovyScript m_InlineScript
the inline script.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractScriptedActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractScriptedActor
- Returns:
- null if no info available, otherwise short string
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipText
in interfaceFileBasedScriptingWithOptions
- Overrides:
scriptOptionsTipText
in classAbstractScriptedActor
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultInlineScript
protected GroovyScript getDefaultInlineScript()
Returns the default inline script.- Returns:
- the default script
-
setInlineScript
public void setInlineScript(GroovyScript value)
Sets the inline script to use instead of the external script file.- Parameters:
value
- the inline script
-
getInlineScript
public GroovyScript getInlineScript()
Gets the inline script to use instead of the external script file.- Returns:
- the inline script
-
inlineScriptTipText
public String inlineScriptTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected String loadScriptObject()
Loads the scripts object and sets its options.- Specified by:
loadScriptObject
in classAbstractScriptedActor
- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObject
in classAbstractScriptedActor
- Returns:
- null if OK, otherwise the error message
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractScriptedActor
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
initScriptObject
protected String initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.- Overrides:
initScriptObject
in classAbstractScriptedActor
- Returns:
- null if OK, otherwise the error message
-
preExecute
public String preExecute()
Pre-execute hook.- Overrides:
preExecute
in classAbstractScriptedActor
- Returns:
- null if everything is fine, otherwise error message
-
updateScriptOptions
protected String updateScriptOptions()
Updates the script options.- Returns:
- null if successful, otherwise error message
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractScriptedActor
-
-