Package adams.flow.control
Class InputOutputListener
- 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
public class InputOutputListener extends SubProcess
Listens to the input/output tokens of the sub-actors, sending them to callable actors.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: InputOutputListener
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console. default: false
-finish-before-stopping <boolean> (property: finishBeforeStopping) If enabled, actor first finishes processing all data before stopping. default: false
-actor <adams.flow.core.AbstractActor> [-actor ...] (property: actors) All the actors that define this sequence. default:
-on-input <boolean> (property: onInput) If enabled, input tokens are forwarded to the specified callable actor. default: false
-input-destination <adams.flow.core.CallableActorReference> (property: inputDestination) The callable actor to send the input tokens to. default:
-on-output <boolean> (property: onOutput) If enabled, output tokens are forwarded to the specified callable actor. default: false
-output-destination <adams.flow.core.CallableActorReference> (property: outputDestination) The callable actor to send the output tokens to. default:
- Version:
- $Revision: 7842 $
- 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_CALLABLEINPUT
the key for backing up the callable actor (input).static String
BACKUP_CALLABLEOUTPUT
the key for backing up the callable actor (output).static String
BACKUP_CONFIGURED
the key for backing up the configured state.protected Actor
m_CallableInput
the callable actor (input).protected Actor
m_CallableOutput
the callable actor (output).protected boolean
m_Configured
whether the callable actor has been configured.protected CallableActorHelper
m_Helper
the helper class.protected CallableActorReference
m_InputDestination
the callable actor to send the input tokens to.protected boolean
m_OnInput
whether to listen to the input tokens.protected boolean
m_OnOutput
whether to listen to the output tokens.protected CallableActorReference
m_OutputDestination
the callable actor to send the output tokens to.-
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 InputOutputListener()
-
Method Summary
All Methods Instance 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.void
defineOptions()
Adds options to the internal list of options.CallableActorReference
getInputDestination()
Returns the callable actor to send the input tokens to.boolean
getOnInput()
Returns whether to listen to input tokens.boolean
getOnOutput()
Returns whether to listen to output tokens.CallableActorReference
getOutputDestination()
Returns the callable actor to send the output tokens to.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.void
input(Token token)
The method that accepts the input token and then processes it.String
inputDestinationTipText()
Returns the tip text for this property.String
onInputTipText()
Returns the tip text for this property.String
onOutputTipText()
Returns the tip text for this property.Token
output()
Returns the generated token.String
outputDestinationTipText()
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
setInputDestination(CallableActorReference value)
Sets the callable actor to send the input tokens to.void
setOnInput(boolean value)
Sets whether to listen to input tokens.void
setOnOutput(boolean value)
Sets whether to listen to output tokens.void
setOutputDestination(CallableActorReference value)
Sets the callable actor to send the output tokens to.String
setUp()
Initializes the item for flow execution.protected String
setUpCallableActors()
Configures the callable actors.-
Methods inherited from class adams.flow.control.SubProcess
accepts, addOutputToken, cleanUp, execute, generates, getAllowEmpty, getConditionalEquivalent, getOutputTokens, getPauseStateManager, getTimedEquivalent, hasPendingOutput, newDirector, setAllowEmpty
-
Methods inherited from class adams.flow.control.Sequence
actorsTipText, currentInput, getActorHandlerInfo, getAllowSource, getAllowStandalones, getDefaultRestrictingStops, hasInput, isRestrictedStop, isRestrictingStops, postExecute, preExecute, restrictedStopExecution, restrictedStopExecution, setAllowSource, setAllowStandalones, setRestrictingStops, wrapUp
-
Methods inherited from class adams.flow.control.MutableConnectedControlActor
add, add, 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
doExecute, finishBeforeStoppingTipText, flushExecution, getDirector, getFinishBeforeStopping, 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, 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, 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, wrapUp
-
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, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_CALLABLEINPUT
public static final String BACKUP_CALLABLEINPUT
the key for backing up the callable actor (input).- See Also:
- Constant Field Values
-
BACKUP_CALLABLEOUTPUT
public static final String BACKUP_CALLABLEOUTPUT
the key for backing up the callable actor (output).- 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_OnInput
protected boolean m_OnInput
whether to listen to the input tokens.
-
m_InputDestination
protected CallableActorReference m_InputDestination
the callable actor to send the input tokens to.
-
m_OnOutput
protected boolean m_OnOutput
whether to listen to the output tokens.
-
m_OutputDestination
protected CallableActorReference m_OutputDestination
the callable actor to send the output tokens to.
-
m_CallableInput
protected Actor m_CallableInput
the callable actor (input).
-
m_CallableOutput
protected Actor m_CallableOutput
the callable actor (output).
-
m_Configured
protected boolean m_Configured
whether the callable actor has been configured.
-
m_Helper
protected CallableActorHelper m_Helper
the helper class.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Overrides:
globalInfo
in classSubProcess
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classMutableConnectedControlActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractControlActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classSubProcess
-
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 classAbstractDirectedControlActor
- Returns:
- null if no info available, otherwise short string
-
setOnInput
public void setOnInput(boolean value)
Sets whether to listen to input tokens.- Parameters:
value
- true if to listen to input
-
getOnInput
public boolean getOnInput()
Returns whether to listen to input tokens.- Returns:
- true if to listen to input
-
onInputTipText
public String onInputTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setInputDestination
public void setInputDestination(CallableActorReference value)
Sets the callable actor to send the input tokens to.- Parameters:
value
- the callable actor
-
getInputDestination
public CallableActorReference getInputDestination()
Returns the callable actor to send the input tokens to.- Returns:
- the callable actor
-
inputDestinationTipText
public String inputDestinationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOnOutput
public void setOnOutput(boolean value)
Sets whether to listen to output tokens.- Parameters:
value
- true if to listen to output
-
getOnOutput
public boolean getOnOutput()
Returns whether to listen to output tokens.- Returns:
- true if to listen to output
-
onOutputTipText
public String onOutputTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputDestination
public void setOutputDestination(CallableActorReference value)
Sets the callable actor to send the output tokens to.- Parameters:
value
- the callable actor
-
getOutputDestination
public CallableActorReference getOutputDestination()
Returns the callable actor to send the output tokens to.- Returns:
- the callable actor
-
outputDestinationTipText
public String outputDestinationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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 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()
-
setUpCallableActors
protected String setUpCallableActors()
Configures the callable actors.- Returns:
- null if OK, otherwise error message
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classSubProcess
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
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
-
output
public Token output()
Returns the generated token.- Specified by:
output
in interfaceOutputProducer
- Overrides:
output
in classSubProcess
- Returns:
- the generated token
-
-