Class LaunchTrigger

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, Pausable, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, FlowPauseStateListener, VariableChangeListener, Actor, ActorHandler, ControlActor, ErrorHandler, Flushable, InputConsumer, MutableActorHandler, SubFlowWrapUp, Serializable, Comparable

    public class LaunchTrigger
    extends AbstractControlActor
    implements InputConsumer, MutableActorHandler
    Launches the sub-flow in a separate thread each time a token arrives.
    Internally, a adams.flow.control.LocalScopeTrigger is used to manage the scope.

    Input/output:
    - accepts:
       adams.flow.core.Unknown


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
        min-user-mode: Expert
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: LaunchTrigger
     
    -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
        min-user-mode: Expert
     
    -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
        min-user-mode: Expert
     
    -actors <adams.flow.core.Actor> [-actors ...] (property: actors)
        The actors to launch with the incoming tokens.
        default:
     
    -scope-handling-variables <EMPTY|COPY|SHARE> (property: scopeHandlingVariables)
        Defines how variables are handled in the local scope; whether to start with
        empty set, a copy of the outer scope variables or share variables with the
        outer scope.
        default: EMPTY
     
    -variables-filter <adams.core.base.BaseRegExp> (property: variablesFilter)
        The regular expression that variable names must match in order to get into
        the local scope (when using COPY).
        default: .*
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html
     
    -scope-handling-storage <EMPTY|COPY|SHARE> (property: scopeHandlingStorage)
        Defines how storage is handled in the local scope; whether to start with
        empty set, a (deep) copy of the outer scope storage or share the storage
        with the outer scope.
        default: EMPTY
     
    -storage-filter <adams.core.base.BaseRegExp> (property: storageFilter)
        The regular expression that storage item names must match in order to get
        into the local scope (when using COPY).
        default: .*
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_INPUT

        public static final String BACKUP_INPUT
        the key for storing the input token in the backup.
        See Also:
        Constant Field Values
      • m_VariablesFilter

        protected BaseRegExp m_VariablesFilter
        the regular expression of the variables to allow into the local scope.
      • m_StorageFilter

        protected BaseRegExp m_StorageFilter
        the regular expression of the storage items to allow into the local scope.
      • m_Actors

        protected Trigger m_Actors
        the sub-flow to launch.
      • m_InputToken

        protected transient Token m_InputToken
        the input token.
    • Constructor Detail

      • LaunchTrigger

        public LaunchTrigger()
    • Method Detail

      • setSkip

        public void setSkip​(boolean value)
        Sets whether the transformation is skipped or not.
        Specified by:
        setSkip in interface Actor
        Overrides:
        setSkip in class AbstractActor
        Parameters:
        value - true if transformation is to be skipped
      • get

        public Actor get​(int index)
        Returns the actor at the given position.
        Specified by:
        get in interface ActorHandler
        Specified by:
        get in class AbstractControlActor
        Parameters:
        index - the position
        Returns:
        the actor
      • set

        public String set​(int index,
                          Actor actor)
        Sets the actor at the given position.
        Specified by:
        set in interface ActorHandler
        Specified by:
        set in class AbstractControlActor
        Parameters:
        index - the position
        actor - the actor to set at this position
        Returns:
        null if successful, otherwise error message
      • indexOf

        public int indexOf​(String actor)
        Returns the index of the actor.
        Specified by:
        indexOf in interface ActorHandler
        Specified by:
        indexOf in class AbstractControlActor
        Parameters:
        actor - the name of the actor to look for
        Returns:
        the index of -1 if not found
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        the Class of objects that can be processed
      • input

        public void input​(Token token)
        The method that accepts the input token and then processes it.
        Specified by:
        input in interface InputConsumer
        Parameters:
        token - the token to accept and process
      • hasInput

        public boolean hasInput()
        Returns whether an input token is currently present.
        Specified by:
        hasInput in interface InputConsumer
        Returns:
        true if input token present
      • currentInput

        public Token currentInput()
        Returns the current input token, if any.
        Specified by:
        currentInput in interface InputConsumer
        Returns:
        the input token, null if none present
      • add

        public String add​(Actor actor)
        Inserts the actor at the end.
        Specified by:
        add in interface MutableActorHandler
        Parameters:
        actor - the actor to insert
        Returns:
        null if successful, otherwise error message
      • add

        public String add​(int index,
                          Actor actor)
        Inserts the actor at the given position.
        Specified by:
        add in interface MutableActorHandler
        Parameters:
        index - the position
        actor - the actor to insert
        Returns:
        null if successful, otherwise error message
      • remove

        public Actor remove​(int index)
        Removes the actor at the given position and returns the removed object.
        Specified by:
        remove in interface MutableActorHandler
        Parameters:
        index - the position
        Returns:
        the removed actor
      • checkSubActor

        protected String checkSubActor​(int index,
                                       Actor actor)
        Checks the sub actor before it is set. Returns an error message if the actor is not acceptable, null otherwise.
        Parameters:
        index - the index the actor gets set
        actor - the actor to check
        Returns:
        null if accepted, otherwise error message
      • checkSubActors

        protected String checkSubActors​(Actor[] actors)
        Checks the tee actors before they are set via the setSubActors method. Returns an error message if the actors are not acceptable, null otherwise.
        Parameters:
        actors - the actors to check
        Returns:
        null if accepted, otherwise error message
      • setActors

        public void setActors​(Actor[] value)
        Sets the actor to launch.
        Parameters:
        value - the actor
      • getActors

        public Actor[] getActors()
        Returns the actors to launch.
        Returns:
        the actors
      • actorsTipText

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

        public void setScopeHandlingVariables​(ScopeHandler.ScopeHandling value)
        Sets how to handle variables into the local scope.
        Parameters:
        value - the scope handling
      • getScopeHandlingVariables

        public ScopeHandler.ScopeHandling getScopeHandlingVariables()
        Returns how variables are handled in the local scope.
        Returns:
        the scope handling
      • scopeHandlingVariablesTipText

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

        public void setVariablesFilter​(BaseRegExp value)
        Sets the regular expression that variable names must match to get into the local scope.
        Parameters:
        value - the expression
      • getVariablesFilter

        public BaseRegExp getVariablesFilter()
        Returns the regular expression that variable names must match to get into the local scope.
        Returns:
        the expression
      • variablesFilterTipText

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

        public void setScopeHandlingStorage​(ScopeHandler.ScopeHandling value)
        Sets how to handle storage in the local scope.
        Parameters:
        value - the scope handling
      • getScopeHandlingStorage

        public ScopeHandler.ScopeHandling getScopeHandlingStorage()
        Returns how storage is handled in the local scope.
        Returns:
        the scope handling
      • scopeHandlingStorageTipText

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

        public void setStorageFilter​(BaseRegExp value)
        Sets the regular expression that storage item names must match to get into the local scope.
        Parameters:
        value - the expression
      • getStorageFilter

        public BaseRegExp getStorageFilter()
        Returns the regular expression that storage item names must match to get into the local scope.
        Returns:
        the expression
      • storageFilterTipText

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

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message