Package adams.flow.control
Class SubProcess
- 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:
AbstractContainerUpdater,ArrayProcess,AutogeneratedTransformer,CollectionProcess,ConditionalSubProcess,InactiveTransformer,InputOutputListener,TimedSubProcess,TransformerReset
public class SubProcess extends Sequence implements OutputProducer, PauseStateHandler, ActorWithConditionalEquivalent, ActorWithTimedEquivalent
Encapsulates a sequence of flow items. The first actor must accept input and the last one must produce output.
-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: SubProcess
-annotation <adams.core.base.BaseText> (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
-finish-before-stopping <boolean> (property: finishBeforeStopping) If enabled, actor first finishes processing all data before stopping. default: false
-actor <adams.flow.core.Actor> [-actor ...] (property: actors) All the actors that define this sequence. default:
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubProcess.SubProcessDirectorA specialized director for the SubProcess actor.
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_AllowEmptywhether to allow no sub-actors.protected List<Token>m_OutputTokensfor storing generated output tokens.-
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 SubProcess()Default constructor.SubProcess(String name)Initializes the actor with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.protected voidaddOutputToken(Token output)Adds the given token to the list of available output tokens.voidcleanUp()Cleans up data structures, frees up memory.Stringexecute()Executes the flow item.Class[]generates()Returns the class of objects that it generates.booleangetAllowEmpty()Returns whether it is possible to have no active sub-actors.ClassgetConditionalEquivalent()Returns the class that is the corresponding conditional equivalent.protected List<Token>getOutputTokens()Initializes m_OutputTokens if necessary and returns it.PauseStateManagergetPauseStateManager()Returns the pause state manager.ClassgetTimedEquivalent()Returns the class that is the corresponding timed equivalent.StringglobalInfo()Returns a string describing the object.booleanhasPendingOutput()Checks whether there is pending output to be collected after executing the flow item.protected voidinitialize()Initializes the members.voidinput(Token token)The method that accepts the input token and then processes it.protected SequentialDirectornewDirector()Returns an instance of a director.Tokenoutput()Returns the generated token.voidsetAllowEmpty(boolean value)Sets whether we can have no active sub-actors.StringsetUp()Initializes the item for flow execution.-
Methods inherited from class adams.flow.control.Sequence
actorsTipText, backupState, currentInput, getActorHandlerInfo, getAllowSource, getAllowStandalones, getDefaultRestrictingStops, hasInput, isRestrictedStop, isRestrictingStops, postExecute, preExecute, restoreState, restrictedStopExecution, restrictedStopExecution, setAllowSource, setAllowStandalones, setRestrictingStops, wrapUp
-
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
doExecute, 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, reset, 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, 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, defineOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Constructor Detail
-
SubProcess
public SubProcess()
Default constructor.
-
SubProcess
public SubProcess(String name)
Initializes the actor with the specified name.- Parameters:
name- the name to use
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Overrides:
globalInfoin classSequence- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classSequence
-
getConditionalEquivalent
public Class getConditionalEquivalent()
Returns the class that is the corresponding conditional equivalent.- Specified by:
getConditionalEquivalentin interfaceActorWithConditionalEquivalent- Returns:
- the class, null if none available
-
getTimedEquivalent
public Class getTimedEquivalent()
Returns the class that is the corresponding timed equivalent.- Specified by:
getTimedEquivalentin interfaceActorWithTimedEquivalent- Returns:
- the class, null if none available
-
getOutputTokens
protected List<Token> getOutputTokens()
Initializes m_OutputTokens if necessary and returns it.- Returns:
- m_OutputTokens
-
newDirector
protected SequentialDirector newDirector()
Returns an instance of a director.- Overrides:
newDirectorin classAbstractDirectedControlActor- Returns:
- the director
-
getPauseStateManager
public PauseStateManager getPauseStateManager()
Returns the pause state manager.- Specified by:
getPauseStateManagerin interfacePauseStateHandler- Returns:
- the manager
-
setAllowEmpty
public void setAllowEmpty(boolean value)
Sets whether we can have no active sub-actors.- Parameters:
value- true if to allow no active sub-actors
-
getAllowEmpty
public boolean getAllowEmpty()
Returns whether it is possible to have no active sub-actors.- Returns:
- true if no active sub-actors allowed
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUpin interfaceActor- Overrides:
setUpin classAbstractDirectedControlActor- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
acceptsin interfaceInputConsumer- Overrides:
acceptsin classSequence- Returns:
- the Class of objects that can be processed
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generatesin interfaceOutputProducer- 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:
inputin interfaceInputConsumer- Overrides:
inputin classSequence- Parameters:
token- the token to accept and process
-
addOutputToken
protected void addOutputToken(Token output)
Adds the given token to the list of available output tokens.- Parameters:
output- the token to add- See Also:
getOutputTokens()
-
execute
public String execute()
Executes the flow item.- Specified by:
executein interfaceActor- Overrides:
executein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
output
public Token output()
Returns the generated token.- Specified by:
outputin interfaceOutputProducer- Returns:
- the generated token
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.- Specified by:
hasPendingOutputin interfaceOutputProducer- Returns:
- true if there is pending output
-
-