Class Flow

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, Pausable, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesHandler, VariablesInspectionHandler, LogEntryHandler, MutableLogEntryHandler, FlowPauseStateListener, VariableChangeListener, AtomicExecution, ScopeHandler, StorageHandler, Actor, ActorHandler, ControlActor, ErrorHandler, Event, Flushable, MutableActorHandler, PauseStateHandler, StopRestrictor, SubFlowWrapUp, TriggerableEvent, FlowExecutionListeningSupporter, Serializable, Comparable

    public class Flow
    extends MutableConnectedControlActor
    implements MutableLogEntryHandler, StorageHandler, VariablesHandler, TriggerableEvent, PauseStateHandler, FlowExecutionListeningSupporter, ScopeHandler, StopRestrictor
    Container object for actors, used for executing a flow.

    -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: Flow
     
    -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 execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -finish-before-stopping <boolean> (property: finishBeforeStopping)
        If enabled, actor first finishes processing all data before stopping.
        default: false
     
    -stopping-timeout <int> (property: stoppingTimeout)
        The timeout in milliseconds when waiting for actors to finish (<= 0 for
        infinity; see 'finishBeforeStopping').
        default: -1
        minimum: -1
     
    -actor <adams.flow.core.Actor> [-actor ...] (property: actors)
        All the actors that define this flow.
        default:
     
    -read-only <boolean> (property: readOnly)
        If set to true, the flow is marked as read-only and the user gets prompted
        whether to succeed before allowing it to be edited.
        default: false
     
    -error-handling <ACTORS_ALWAYS_STOP_ON_ERROR|ACTORS_DECIDE_TO_STOP_ON_ERROR> (property: errorHandling)
        Defines how errors are handled that occur during execution of the flow;
        ACTORS_DECIDE_TO_STOP_ON_ERROR stops the flow only if the actor has the '
        stopFlowOnError' flag set.
        default: ACTORS_ALWAYS_STOP_ON_ERROR
     
    -log-errors <boolean> (property: logErrors)
        If set to true, errors are logged and can be retrieved after execution.
        default: false
     
    -execute-on-error <adams.core.io.FlowFile> (property: executeOnError)
        The external flow to execute in case the flow finishes with an error; allows
        the user to call a clean-up flow.
        default: ${CWD}
     
    -execute-on-finish <adams.core.io.FlowFile> (property: executeOnFinish)
        The external flow to execute in case the flow finishes normal, without any
        errors.
        default: ${CWD}
     
    -flow-execution-listening-enabled <boolean> (property: flowExecutionListeningEnabled)
        Enables/disables the flow execution listener.
        default: false
     
    -flow-execution-listener <adams.flow.execution.FlowExecutionListener> (property: flowExecutionListener)
        The listener for the flow execution; must be enabled explicitly.
        default: adams.flow.execution.NullListener
     
    -flow-restart-manager <adams.flow.control.flowrestart.AbstractFlowRestartManager> (property: flowRestartManager)
        The manager for restarting the flow.
        default: adams.flow.control.flowrestart.NullManager
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ReadOnly

        protected boolean m_ReadOnly
        whether to mark this flow as read-only (user gets prompted).
      • m_LogErrors

        protected boolean m_LogErrors
        whether to store errors (as LogEntry records).
      • m_LogEntries

        protected ArrayList<LogEntry> m_LogEntries
        for storing the LogEntry records.
      • m_Storage

        protected transient Storage m_Storage
        the storage for temporary data.
      • m_Variables

        protected FlowVariables m_Variables
        the 'local' variables.
      • m_ExecuteOnError

        protected FlowFile m_ExecuteOnError
        the external flow to execute in case of an abnormal stop.
      • m_ExecuteOnErrorActor

        protected Actor m_ExecuteOnErrorActor
        the external actor to execute in case of an abnormal stop.
      • m_ExecuteOnFinish

        protected FlowFile m_ExecuteOnFinish
        the external flow to execute in case the flow finishes normal.
      • m_ExecuteOnFinishActor

        protected Actor m_ExecuteOnFinishActor
        the external actor to execute in case the flow finishes normal.
      • m_AfterExecuteActor

        protected Actor m_AfterExecuteActor
        the actor that was executed after the flow finished.
      • m_PauseStateManager

        protected PauseStateManager m_PauseStateManager
        for managing the pause state.
      • m_FlowExecutionListeningEnabled

        protected boolean m_FlowExecutionListeningEnabled
        whether flow execution listening is enabled.
      • m_FlowExecutionListeningStarted

        protected boolean m_FlowExecutionListeningStarted
        whether flow execution listening has started.
      • m_FlowExecutionListener

        protected FlowExecutionListener m_FlowExecutionListener
        the execution listener to use.
      • m_EnforceCallableNameCheck

        protected boolean m_EnforceCallableNameCheck
        whether the callable name check is enforced.
      • m_ParentComponent

        protected transient Component m_ParentComponent
        the parent component to use for interactive actors.
      • m_DefaultCloseOperation

        protected int m_DefaultCloseOperation
        the default close operation.
      • m_Headless

        protected boolean m_Headless
        whether the execution is to be headless, i.e., no GUI components.
      • m_FlowID

        protected int m_FlowID
        the flow ID.
      • m_Register

        protected boolean m_Register
        whether to register the flow.
      • m_WindowRegister

        protected Map<Window,​String> m_WindowRegister
        the register for windows.
    • Constructor Detail

      • Flow

        public Flow()
    • Method Detail

      • actorsTipText

        public String actorsTipText()
        Returns the tip text for this property.
        Specified by:
        actorsTipText in class MutableConnectedControlActor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setReadOnly

        public void setReadOnly​(boolean value)
        Sets whether the flow is marked as read-only and the user gets prompted whether to succeed before allowing it to be edited.
        Parameters:
        value - true if read only
      • getReadOnly

        public boolean getReadOnly()
        Returns whether the flow is marked as read-only and the user gets prompted whether to succeed before allowing it to be edited.
        Returns:
        true if read only
      • readOnlyTipText

        public String readOnlyTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setErrorHandling

        public void setErrorHandling​(Flow.ErrorHandling value)
        Sets how errors are handled.
        Parameters:
        value - the error handling
      • getErrorHandling

        public Flow.ErrorHandling getErrorHandling()
        Returns how errors are handled.
        Returns:
        the error handling
      • errorHandlingTipText

        public String errorHandlingTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLogErrors

        public void setLogErrors​(boolean value)
        Sets whether to log errors.
        Parameters:
        value - true if to log errors
      • getLogErrors

        public boolean getLogErrors()
        Returns whether errors are logged.
        Returns:
        true if errors are logged
      • logErrorsTipText

        public String logErrorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setExecuteOnError

        public void setExecuteOnError​(FlowFile value)
        Sets the external flow to execute in case the flow finishes with an error.
        Parameters:
        value - the external flow
      • getExecuteOnError

        public FlowFile getExecuteOnError()
        Returns the external flow to execute in case the flow finishes with an error.
        Returns:
        the external flow
      • executeOnErrorTipText

        public String executeOnErrorTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setExecuteOnFinish

        public void setExecuteOnFinish​(FlowFile value)
        Sets the external flow to execute in case the flow finishes without any errors.
        Parameters:
        value - the external flow
      • getExecuteOnFinish

        public FlowFile getExecuteOnFinish()
        Returns the external flow to execute in case the flow finishes without any errors.
        Returns:
        the external flow
      • executeOnFinishTipText

        public String executeOnFinishTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • flowExecutionListeningEnabledTipText

        public String flowExecutionListeningEnabledTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • flowExecutionListenerTipText

        public String flowExecutionListenerTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFlowRestartManager

        public void setFlowRestartManager​(AbstractFlowRestartManager value)
        Sets the restart manager to use.
        Parameters:
        value - the manager
      • getFlowRestartManager

        public AbstractFlowRestartManager getFlowRestartManager()
        Returns the restart manager in use.
        Returns:
        the manager
      • flowRestartManagerTipText

        public String flowRestartManagerTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • registerWindow

        public void registerWindow​(Window window,
                                   String title)
        Adds the window to the register.
        Parameters:
        window - the window to register
        title - the title to use
      • deregisterWindow

        public void deregisterWindow​(Window window)
        Removes the window from the register.
        Parameters:
        window - the window to register
      • getWindowRegister

        public Map<Window,​String> getWindowRegister()
        Returns the current register.
        Returns:
        the register
      • addBreakpoint

        public void addBreakpoint​(AbstractBreakpoint breakpoint,
                                  AbstractScopeRestriction restriction,
                                  boolean showView)
        Adds the breakpoint to its flow execution listener setup.
        Parameters:
        breakpoint - the breakpoint to add
        restriction - the scope restriction to use
        showView - whether to show the debug view
      • getGraphicalFlowExecutionListenersHandler

        protected GraphicalFlowExecutionListenersHandler getGraphicalFlowExecutionListenersHandler()
        Retrieves the handler for GraphicalFlowExecutionListener objects.
        Returns:
        the handler, null if not available
      • registerGraphicalFlowExecutionListener

        protected void registerGraphicalFlowExecutionListener​(FlowExecutionListener l)
        Registers the graphical flow execution listener.
        Parameters:
        l - the listener to register
      • deregisterGraphicalFlowExecutionListener

        protected void deregisterGraphicalFlowExecutionListener​(FlowExecutionListener l)
        Deregisters the graphical flow execution listener.
        Parameters:
        l - the listener to register
      • showGraphicalFlowExecutionListeners

        public void showGraphicalFlowExecutionListeners()
        Displays the graphical flow executions listeners tab.
      • setParentComponent

        public void setParentComponent​(Component value)
        Sets the use for interactive actors.
        Parameters:
        value - the parent, can be null
      • setDefaultCloseOperation

        public void setDefaultCloseOperation​(int value)
        Sets the default close operation for frames.
        Parameters:
        value - the operation
      • getDefaultCloseOperation

        public int getDefaultCloseOperation()
        Returns the default close operation for frames.
        Returns:
        the operation
      • setHeadless

        public void setHeadless​(boolean value)
        Sets whether the actor is to be run in headless mode, i.e., suppressing GUI components.
        Parameters:
        value - if true then GUI components will be suppressed
      • isHeadless

        public boolean isHeadless()
        Returns whether the actor is run in headless mode.
        Specified by:
        isHeadless in interface Actor
        Overrides:
        isHeadless in class AbstractActor
        Returns:
        true if GUI components are suppressed
      • getRoot

        public Actor getRoot()
        Returns the root of this actor, e.g., the group at the highest level.
        Specified by:
        getRoot in interface Actor
        Overrides:
        getRoot in class AbstractActor
        Returns:
        the root, always itself
      • getFullName

        public String getFullName()
        Returns the full name of the actor, i.e., the concatenated names of all parents. Used in error messages.
        Specified by:
        getFullName in interface Actor
        Overrides:
        getFullName in class AbstractActor
        Returns:
        the full name
      • setUpSubActors

        protected String setUpSubActors()
        Performs the setUp of the sub-actors.
        Overrides:
        setUpSubActors in class AbstractControlActor
        Returns:
        null if everything is fine, otherwise error message
      • forceVariables

        protected void forceVariables​(Variables value)
        Updates the Variables instance in use.

        Use with caution!
        Overrides:
        forceVariables in class AbstractControlActor
        Parameters:
        value - the instance to use
      • getLogEntry

        public LogEntry getLogEntry​(int index)
        Returns the specified LogEntry record.
        Specified by:
        getLogEntry in interface MutableLogEntryHandler
        Parameters:
        index - the index of the record to return
        Returns:
        the requested LogEntry
      • removeLogEntry

        public LogEntry removeLogEntry​(int index)
        Removes the specified LogEntry record from the internal list.
        Specified by:
        removeLogEntry in interface MutableLogEntryHandler
        Parameters:
        index - the index of the record to delete
        Returns:
        the deleted LogEntry
      • countLogEntries

        public int countLogEntries()
        Returns the number of stored LogEntry records.
        Specified by:
        countLogEntries in interface LogEntryHandler
        Returns:
        the number of records
      • getFlowID

        public int getFlowID()
        Returns the flow ID (runtime).
        Returns:
        the ID
      • setRegister

        public void setRegister​(boolean value)
        Sets whether to register the flow with the running flows registry, making it visible to remote commands.
        Parameters:
        value - true if to register
      • getRegister

        public boolean getRegister()
        Returns whether to register the flow with the running flows registry, making it visible to remote commands.
        Returns:
        true if to register
      • setEnforceCallableNameCheck

        public void setEnforceCallableNameCheck​(boolean value)
        Sets whether to enforce the callable name check.
        Specified by:
        setEnforceCallableNameCheck in interface ScopeHandler
        Parameters:
        value - true if to enforce check
      • getEnforceCallableNameCheck

        public boolean getEnforceCallableNameCheck()
        Returns whether the check of callable names is enforced.
        Specified by:
        getEnforceCallableNameCheck in interface ScopeHandler
        Returns:
        true if check enforced
      • isRestrictingStops

        public boolean isRestrictingStops()
        Returns whether stops are being restricted.
        Specified by:
        isRestrictingStops in interface StopRestrictor
        Returns:
        true if restricting stops
      • execute

        public String execute()
        Executes the flow item.
        Specified by:
        execute in interface Actor
        Overrides:
        execute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
      • restrictedStopExecution

        public void restrictedStopExecution​(String msg)
        Stops the (restricted) execution.
        Specified by:
        restrictedStopExecution in interface StopRestrictor
        Parameters:
        msg - the message to set as reason for stopping, can be null
      • isRestrictedStop

        public boolean isRestrictedStop()
        Returns whether the stop was a restricted one (that can be resumed).
        Specified by:
        isRestrictedStop in interface StopRestrictor
        Returns:
        true if restricted stop occurred