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,TriggerCallableStandalone
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 StringBACKUP_CALLABLEACTORthe key for backing up the callable actor.static StringBACKUP_CONFIGUREDthe key for backing up the configured state.protected Actorm_CallableActorthe callable actor.protected CallableActorReferencem_CallableNamethe callable name.protected booleanm_Configuredwhether the callable actor has been configured.protected Stringm_FindCallableActorErrorfor storing any errors duringfindCallableActor().protected CallableActorHelperm_Helperthe helper class.protected booleanm_Optionalwhether 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.StringcallableNameTipText()Returns the tip text for this property.voidcleanUp()Cleans up after the execution has finished.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.protected abstract StringexecuteCallableActor()Executes the callable actor.protected ActorfindCallableActor()Tries to find the callable actor referenced by its callable name.ActorgetCallableActor()Returns the currently set callable actor.CallableActorReferencegetCallableName()Returns the name of the callable actor in use.booleangetOptional()Returns whether the callable actor is optional.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.booleanhasCallableActor()Checks whether a reference to the callable actor is currently available.protected voidinitialize()Initializes the members.booleanisFinished()Returns whether the actor has finished.StringoptionalTipText()Returns the tip text for this property.protected voidpruneBackup()Removes entries from the backup.protected voidreset()Resets the scheme.protected voidrestoreState(Hashtable<String,Object> state)Restores the state of the actor before the variables got updated.voidsetCallableName(CallableActorReference value)Sets the name of the callable actor to use.voidsetOptional(boolean value)Sets whether the callable actor is optional.StringsetUp()Initializes the item for flow execution.protected StringsetUpCallableActor()Configures the callable actor.voidstopExecution()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:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein 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:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
getCallableActorin interfaceCallableActorUser- Returns:
- the actor, can be null
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackupin classAbstractActor- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupStatein 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:
restoreStatein 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:
setUpin interfaceActor- Overrides:
setUpin 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:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
isFinished
public boolean isFinished()
Returns whether the actor has finished.- Specified by:
isFinishedin interfaceActor- Overrides:
isFinishedin classAbstractActor- Returns:
- true if finished
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished.- Specified by:
cleanUpin interfaceActor- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin classAbstractActor
-
-