Package adams.flow.core
Class AbstractCallableActor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.core.AbstractCallableActor
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,CallableActorUser
,ErrorHandler
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractCallableDatabaseConnection
,CallableSink
,CallableSource
,CallableTransformer
,ClearCallableDisplay
,CloseCallableDisplay
public abstract class AbstractCallableActor extends AbstractActor implements CallableActorUser
Abstract ancestor for all actors that access callable actors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_CALLABLEACTOR
the key for backing up the callable actor.static String
BACKUP_CONFIGURED
the key for backing up the configured state.protected Actor
m_CallableActor
the callable actor.protected CallableActorReference
m_CallableName
the callable name.protected boolean
m_Configured
whether the callable actor has been configured.protected String
m_FindCallableActorError
for storing any errors duringfindCallableActor()
.protected CallableActorHelper
m_Helper
the helper class.protected boolean
m_Optional
whether the callable actor is optional.-
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 AbstractCallableActor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.String
callableNameTipText()
Returns the tip text for this property.void
cleanUp()
Cleans up after the execution has finished.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.protected abstract String
executeCallableActor()
Executes the callable actor.protected Actor
findCallableActor()
Tries to find the callable actor referenced by its callable name.Actor
getCallableActor()
Returns the currently set callable actor.CallableActorReference
getCallableName()
Returns the name of the callable actor in use.boolean
getOptional()
Returns whether the callable actor is optional.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
hasCallableActor()
Checks whether a reference to the callable actor is currently available.protected void
initialize()
Initializes the members.boolean
isFinished()
Returns whether the actor has finished.String
optionalTipText()
Returns the tip text for this property.protected void
pruneBackup()
Removes entries from the backup.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setCallableName(CallableActorReference value)
Sets the name of the callable actor to use.void
setOptional(boolean value)
Sets whether the callable actor is optional.String
setUp()
Initializes the item for flow execution.protected String
setUpCallableActor()
Configures the callable actor.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, 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, isBackedUp, isExecuted, isExecuting, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged, wrapUp
-
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
-
BACKUP_CALLABLEACTOR
public static final String BACKUP_CALLABLEACTOR
the key for backing up the callable actor.- See Also:
- Constant Field Values
-
BACKUP_CONFIGURED
public static final String BACKUP_CONFIGURED
the key for backing up the configured state.- See Also:
- Constant Field Values
-
m_CallableName
protected CallableActorReference m_CallableName
the callable name.
-
m_CallableActor
protected Actor m_CallableActor
the callable actor.
-
m_Configured
protected boolean m_Configured
whether the callable actor has been configured.
-
m_Helper
protected CallableActorHelper m_Helper
the helper class.
-
m_Optional
protected boolean m_Optional
whether the callable actor is optional.
-
m_FindCallableActorError
protected String m_FindCallableActorError
for storing any errors duringfindCallableActor()
.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
setCallableName
public void setCallableName(CallableActorReference value)
Sets the name of the callable actor to use.- Parameters:
value
- the callable name
-
getCallableName
public CallableActorReference getCallableName()
Returns the name of the callable actor in use.- Returns:
- the callable name
-
callableNameTipText
public String callableNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOptional
public void setOptional(boolean value)
Sets whether the callable actor is optional.- Parameters:
value
- true if optional
-
getOptional
public boolean getOptional()
Returns whether the callable actor is optional.- Returns:
- true if optional
-
optionalTipText
public String optionalTipText()
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 interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
findCallableActor
protected Actor findCallableActor()
Tries to find the callable actor referenced by its callable name.- Returns:
- the callable actor or null if not found
-
hasCallableActor
public boolean hasCallableActor()
Checks whether a reference to the callable actor is currently available.- Returns:
- true if a reference is available
- See Also:
getCallableActor()
-
getCallableActor
public Actor getCallableActor()
Returns the currently set callable actor.- Specified by:
getCallableActor
in interfaceCallableActorUser
- Returns:
- the actor, can be null
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackup
in classAbstractActor
- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractActor
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractActor
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
setUpCallableActor
protected String setUpCallableActor()
Configures the callable actor.- Returns:
- null if successful, otherwise error message
-
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()
-
executeCallableActor
protected abstract String executeCallableActor()
Executes the callable actor. Derived classes might need to override this method to ensure atomicity.- Returns:
- null if no error, otherwise error message
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
isFinished
public boolean isFinished()
Returns whether the actor has finished.- Specified by:
isFinished
in interfaceActor
- Overrides:
isFinished
in classAbstractActor
- Returns:
- true if finished
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
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
-
-