Package adams.flow.core
Class AbstractExternalActor
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,FlowStructureModifier
,Actor
,ErrorHandler
,ExternalActorFileHandler
,ExternalActorHandler
,Serializable
,Comparable
- Direct Known Subclasses:
ExternalSink
,ExternalSource
,ExternalStandalone
,ExternalTransformer
public abstract class AbstractExternalActor extends AbstractBaseExternalActor implements ExternalActorHandler
Ancestor of actors that load another actor from disk and execute it.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_ActorFileChanged
whether the external actor file has changed.protected Boolean
m_ActorFileIsVariable
indicates whether a variable is attached to the external file.protected String
m_ActorFileVariable
the variable attached to the external file.protected Actor
m_ExternalActor
the external actor itself.protected FileChangeMonitor
m_Monitor
the file monitor.protected boolean
m_OnTheFly
whether the flow gets built on the fly and might not be present at the start.-
Fields inherited from class adams.flow.core.AbstractBaseExternalActor
m_ActorFile
-
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 AbstractExternalActor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up after the execution has finished.void
cleanUpExternalActor()
Cleans up the external actor.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.protected void
forceVariables(Variables value)
Updates the Variables instance in use.Actor
getExternalActor()
Returns the external actor.FileChangeMonitor
getMonitor()
Returns the file change monitor for the actor file.boolean
getOnTheFly()
Returns whether the flow file gets built on the fly and might not be present at start up time.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
monitorTipText()
Returns the tip text for this property.String
onTheFlyTipText()
Returns the tip text for this property.protected String
preExecuteExternalActorHook()
Gets called in the doExceute() method, after an optional setUpExternalActor() call (in case a variable is used for the actor file), but before the external actor's execute() method is called.void
setMonitor(FileChangeMonitor value)
Sets the file change monitor for the actor file.void
setOnTheFly(boolean value)
Sets whether the flow file gets built on the fly and might not be present at start up time.void
setParent(Actor value)
Sets the parent of this actor, e.g., the group it belongs to.String
setUp()
Initializes the item for flow execution.String
setUpExternalActor()
Sets up the external actor.void
stopExecution()
Stops the execution.void
variableChanged(VariableChangeEvent e)
Gets triggered when a variable changed (added, modified, removed).void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractBaseExternalActor
actorFileTipText, getActorFile, getActualActorFile, isModifyingStructure, setActorFile
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, 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, preExecute, pruneBackup, pruneBackup, reset, restoreState, setAnnotations, setErrorHandler, setName, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables
-
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
compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.flow.core.ExternalActorFileHandler
getActorFile, setActorFile
-
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
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_Monitor
protected FileChangeMonitor m_Monitor
the file monitor.
-
m_OnTheFly
protected boolean m_OnTheFly
whether the flow gets built on the fly and might not be present at the start.
-
m_ExternalActor
protected Actor m_ExternalActor
the external actor itself.
-
m_ActorFileIsVariable
protected Boolean m_ActorFileIsVariable
indicates whether a variable is attached to the external file.
-
m_ActorFileVariable
protected String m_ActorFileVariable
the variable attached to the external file.
-
m_ActorFileChanged
protected boolean m_ActorFileChanged
whether the external actor file has changed.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractBaseExternalActor
-
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 classAbstractBaseExternalActor
- Returns:
- null if no info available, otherwise short string
-
setMonitor
public void setMonitor(FileChangeMonitor value)
Sets the file change monitor for the actor file.- Parameters:
value
- the monitor
-
getMonitor
public FileChangeMonitor getMonitor()
Returns the file change monitor for the actor file.- Returns:
- the monitor
-
monitorTipText
public String monitorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOnTheFly
public void setOnTheFly(boolean value)
Sets whether the flow file gets built on the fly and might not be present at start up time.- Parameters:
value
- if true then the flow does not have to be present at start up time
-
getOnTheFly
public boolean getOnTheFly()
Returns whether the flow file gets built on the fly and might not be present at start up time.- Returns:
- true if the flow is not necessarily present at start up time
-
onTheFlyTipText
public String onTheFlyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setParent
public void setParent(Actor value)
Sets the parent of this actor, e.g., the group it belongs to.- Specified by:
setParent
in interfaceActor
- Overrides:
setParent
in classAbstractActor
- Parameters:
value
- the new parent
-
variableChanged
public void variableChanged(VariableChangeEvent e)
Gets triggered when a variable changed (added, modified, removed).- Specified by:
variableChanged
in interfaceActor
- Specified by:
variableChanged
in interfaceVariableChangeListener
- Overrides:
variableChanged
in classAbstractActor
- Parameters:
e
- the event
-
getExternalActor
public Actor getExternalActor()
Returns the external actor.- Specified by:
getExternalActor
in interfaceExternalActorHandler
- Returns:
- the actor, can be null if not initialized yet or failed to initialize
-
cleanUpExternalActor
public void cleanUpExternalActor()
Cleans up the external actor.- Specified by:
cleanUpExternalActor
in interfaceExternalActorHandler
-
setUpExternalActor
public String setUpExternalActor()
Sets up the external actor.- Specified by:
setUpExternalActor
in interfaceExternalActorHandler
- Returns:
- null if everything is fine, otherwise error message
-
forceVariables
protected void forceVariables(Variables value)
Updates the Variables instance in use.
Use with caution!- Overrides:
forceVariables
in classAbstractActor
- Parameters:
value
- the instance to use
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
preExecuteExternalActorHook
protected String preExecuteExternalActorHook()
Gets called in the doExceute() method, after an optional setUpExternalActor() call (in case a variable is used for the actor file), but before the external actor's execute() method is called.
Default implementation does nothing.- Returns:
- null if everything ok, otherwise error message
- See Also:
doExecute()
,setUpExternalActor()
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished.- Specified by:
cleanUp
in interfaceActor
- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractActor
-
-