Package adams.flow.control
Class AbstractContainerUpdater
- java.lang.Object
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,Pausable
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,FlowPauseStateListener
,VariableChangeListener
,AtomicExecution
,Actor
,ActorHandler
,ActorWithConditionalEquivalent
,ActorWithTimedEquivalent
,ControlActor
,ErrorHandler
,Flushable
,InputConsumer
,MutableActorHandler
,OptionalStopRestrictor
,OutputProducer
,PauseStateHandler
,StopRestrictor
,SubFlowWrapUp
,Serializable
,Comparable
- Direct Known Subclasses:
PlotContainerUpdater
,UpdateContainerValue
public abstract class AbstractContainerUpdater extends SubProcess
Ancestor for control actors that update a specific value of a container using the defined sub-actors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.flow.control.SubProcess
SubProcess.SubProcessDirector
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_OUTPUT
the key for storing the output token in the backup.protected String
m_ContainerValueName
the value to modify.protected Token
m_OutputToken
the output.-
Fields inherited from class adams.flow.control.SubProcess
m_AllowEmpty, m_OutputTokens
-
Fields inherited from class adams.flow.control.Sequence
BACKUP_CURRENT, m_AllowSource, m_AllowStandalones, m_CurrentToken, m_RestrictedStop, m_RestrictingStops
-
Fields inherited from class adams.flow.control.MutableConnectedControlActor
m_Actors
-
Fields inherited from class adams.flow.control.AbstractDirectedControlActor
m_Director, m_FinishBeforeStopping, m_StoppingTimeout, m_StoppingWarningInterval
-
Fields inherited from class adams.flow.control.AbstractControlActor
m_Compatibility, m_PauseStateManager, m_SetUpSubActors
-
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 AbstractContainerUpdater()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.protected String
doExecute()
Executes the actor.Class[]
generates()
Returns the class of objects that it generates.protected Object
getContainerValue(AbstractContainer cont)
Tries to obtain the container value.protected String
getContainerValueName()
Returns the container value to update.boolean
hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.void
input(Token token)
The method that accepts the input token and then processes it.Token
output()
Returns the generated token.protected String
postExecute()
Post-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.protected void
setContainerValueName(String value)
Sets the container value to update.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.control.SubProcess
addOutputToken, cleanUp, execute, getAllowEmpty, getConditionalEquivalent, getOutputTokens, getPauseStateManager, getTimedEquivalent, globalInfo, initialize, newDirector, setAllowEmpty, setUp
-
Methods inherited from class adams.flow.control.Sequence
actorsTipText, currentInput, getActorHandlerInfo, getAllowSource, getAllowStandalones, getDefaultRestrictingStops, hasInput, isRestrictedStop, isRestrictingStops, preExecute, restrictedStopExecution, restrictedStopExecution, setAllowSource, setAllowStandalones, setRestrictingStops
-
Methods inherited from class adams.flow.control.MutableConnectedControlActor
add, add, defineOptions, get, getActors, indexOf, remove, removeAll, set, setActors, size
-
Methods inherited from class adams.flow.control.AbstractConnectedControlActor
check, checkConnections, classesToString
-
Methods inherited from class adams.flow.control.AbstractDirectedControlActor
finishBeforeStoppingTipText, flushExecution, getDirector, getFinishBeforeStopping, getQuickInfo, getStoppingTimeout, getStoppingWarningInterval, setFinishBeforeStopping, setStoppingTimeout, setStoppingWarningInterval, stopExecution, stoppingTimeoutTipText, stoppingWarningIntervalTipText, updateVariables
-
Methods inherited from class adams.flow.control.AbstractControlActor
active, canInspectOptions, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, resumeExecution, setParent, setUpSubActors, updateParent, wrapUpSubFlow
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canPerformSetUpCheck, compareTo, configureLogger, equals, 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, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, pruneBackup, pruneBackup, setAnnotations, setErrorHandler, setName, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, 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, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.flow.core.ActorHandler
check, firstActive, flushExecution, lastActive
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
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, defineOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_OUTPUT
public static final String BACKUP_OUTPUT
the key for storing the output token in the backup.- See Also:
- Constant Field Values
-
m_ContainerValueName
protected String m_ContainerValueName
the value to modify.
-
m_OutputToken
protected Token m_OutputToken
the output.
-
-
Method Detail
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractControlActor
-
setContainerValueName
protected void setContainerValueName(String value)
Sets the container value to update.- Parameters:
value
- the name of the value
-
getContainerValueName
protected String getContainerValueName()
Returns the container value to update.- Returns:
- the name of the value
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classSequence
- 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 classSequence
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceInputConsumer
- Overrides:
accepts
in classSubProcess
- Returns:
- the Class of objects that can be processed
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generates
in interfaceOutputProducer
- Overrides:
generates
in classSubProcess
- Returns:
- the Class of the generated tokens
-
input
public void input(Token token)
The method that accepts the input token and then processes it.- Specified by:
input
in interfaceInputConsumer
- Overrides:
input
in classSubProcess
- Parameters:
token
- the token to accept and process
-
getContainerValue
protected Object getContainerValue(AbstractContainer cont)
Tries to obtain the container value.- Parameters:
cont
- the container to obtain the value from- Returns:
- the value, if available
- Throws:
IllegalStateException
- if failed to obtain value
-
doExecute
protected String doExecute()
Executes the actor.- Overrides:
doExecute
in classAbstractDirectedControlActor
- Returns:
- null if everything is fine, otherwise error message
-
postExecute
protected String postExecute()
Post-execute hook.- Overrides:
postExecute
in classSequence
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.m_Executed
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.- Specified by:
hasPendingOutput
in interfaceOutputProducer
- Overrides:
hasPendingOutput
in classSubProcess
- Returns:
- true if there is pending output
-
output
public Token output()
Returns the generated token.- Specified by:
output
in interfaceOutputProducer
- Overrides:
output
in classSubProcess
- Returns:
- the generated token
-
-