Interface StreamScriptContext


  • public interface StreamScriptContext
    Scripts executed on a per stream basis (e.g. through the ScriptNode/ ScriptWorker) communicate with the server through this interface.
    • Method Detail

      • getNextInput

        Stream getNextInput()
        Get the next input stream.
        Returns:
        the next input Stream or null if there are no more streams to be processed.
      • hasNextInput

        boolean hasNextInput()
        Returns:
        true, if there is another Stream that waits for being processed
        See Also:
        getNextInput()
      • getClientJob

        Job getClientJob()
        Returns:
        The client-side Job associated with this ScriptNode
      • getParameters

        Map<String,​Serializable> getParameters()
        Returns:
        The script parameters supplied by the client.
      • output

        void output​(Node input,
                    Node output)
             throws Throwable
        Process a sub-pipeline defined by the input and output node. The pipeline between input and output node may be of arbitrary complexity, and may even encompass splits and merges. After its initialization, the current stream is piped into the input node of the sub-pipeline while the output of the output node is forwarded down-stream.
        Parameters:
        input - the Node to be used as the input for the current stream
        output - the Node which' result shall be forwarded down-stream
        Throws:
        Throwable - failure during sub-pipeline initialization
      • output

        void output​(Stream s)
        Output the given stream to down-stream nodes.
        Parameters:
        s - the Stream to be forwarded
      • loopback

        void loopback​(Node input,
                      Node output)
               throws Throwable
        Process a sub-pipeline defined by the input and output node and loop back its output into the current node. The pipeline between input and output node may be of arbitrary complexity, and may even encompass splits and merges. After its initialization, the current stream is piped into the input node of the sub-pipeline while the output of the output node is looped back into the current node.
        Parameters:
        input - the Node to be used as the input for the current stream
        output - the Node which' result shall be looped back into the current Node
        Throws:
        Throwable - if initializing the loopback fails
      • loopback

        void loopback​(Stream s)
        Loop back the given stream into the current node.
        Parameters:
        s - the Stream to loopback
      • process

        StreamBundle process​(Node inputNode,
                             Node outputNode)
                      throws Throwable
        Execute the sub-pipeline defined by the input and output node and return the result as a StreamBundle.
        Parameters:
        inputNode - the Node to be used as the input for the current stream
        outputNode - the Node which' result shall be the return value of this method
        Returns:
        the resulting StreamBundle of the sub-pipeline
        Throws:
        Throwable - if the processing fails
      • debug

        void debug​(String message,
                   Object... args)
        Emit a debug message into the log if debugging is enabled. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat.
        Parameters:
        message - log message
        args - optional parameters to be injected
      • info

        void info​(String message,
                  Object... args)
        Emit an info message into the log if info logging is enabled. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat.
        Parameters:
        message - log message
        args - optional parameters to be injected
      • warn

        void warn​(String message,
                  Object... args)
        Emit a warning message into the log. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat. The warning is also forwarded to any JobListeners of the current job.
        Parameters:
        message - log message
        args - optional parameters to be injected
      • warn

        void warn​(String message,
                  Throwable cause,
                  Object... args)
        Emit a warning message into the log. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat. The warning is also forwarded to any JobListeners of the current job. The message is accompanied with the given Throwable causing the warning.
        Parameters:
        message - log message
        args - optional parameters to be injected
        cause - a Throwable to be associated with the message
      • error

        void error​(String message,
                   Object... args)
        Emit an error message into the log. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat. The error message is also forwarded to any JobListeners of the current job.
        Parameters:
        message - log message
        args - optional parameters to be injected
      • error

        void error​(String message,
                   Throwable cause,
                   Object... args)
        Emit an error message into the log. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat. The error message is also forwarded to any JobListeners of the current job. The message is accompanied with the given Throwable causing the error.
        Parameters:
        message - log message
        args - optional parameters to be injected
        cause - a Throwable to be associated with the message
      • fail

        void fail​(String message,
                  Object... args)
        Abort the job giving the specified message as a reason. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat.
        Parameters:
        message - log message
        args - optional parameters to be injected
      • fail

        void fail​(String message,
                  Throwable cause,
                  Object... args)
        Abort the job giving the specified message as a reason. The given arguments (if any) are interpolated into the message according to the syntax specified in MessageFormat. The message is accompanied with the given Throwable causing the error.
        Parameters:
        message - log message
        args - optional parameters to be injected
        cause - a Throwable to be associated with the message
      • error

        void error​(org.jadice.util.log.qualified.MessageID messageId,
                   Throwable cause,
                   Object... args)
      • fail

        void fail​(org.jadice.util.log.qualified.MessageID messageId,
                  Throwable cause,
                  Object... args)
      • warn

        void warn​(org.jadice.util.log.qualified.MessageID messageId,
                  Throwable cause,
                  Object... args)