Class DefaultScriptRunner

  • All Implemented Interfaces:
    ScriptRunner

    public class DefaultScriptRunner
    extends java.lang.Object
    implements ScriptRunner
    Default implementation of ScriptRunner that reads a script file line by line and executes each line through the dispatcher.

    Features:

    • Skips blank lines and lines starting with # (comments)
    • Supports \ line continuation (backslash at end of line joins with the next line)
    • Each complete line is fed to CommandDispatcher.execute(String)
    Since:
    4.0
    See Also:
    ScriptRunner
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultScriptRunner()
      Creates a new DefaultScriptRunner.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(java.nio.file.Path script, CommandSession session, CommandDispatcher dispatcher)
      Executes a script file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultScriptRunner

        public DefaultScriptRunner()
        Creates a new DefaultScriptRunner.
    • Method Detail

      • execute

        public void execute​(java.nio.file.Path script,
                            CommandSession session,
                            CommandDispatcher dispatcher)
                     throws java.lang.Exception
        Description copied from interface: ScriptRunner
        Executes a script file.
        Specified by:
        execute in interface ScriptRunner
        Parameters:
        script - the path to the script file
        session - the current command session
        dispatcher - the command dispatcher to execute lines through
        Throws:
        java.lang.Exception - if script execution fails