Class DefaultScriptService

    • Constructor Detail

      • DefaultScriptService

        public DefaultScriptService()
    • Method Detail

      • getMenuPrefix

        public MenuPath getMenuPrefix​(File scriptDirectory)
        Description copied from interface: ScriptService
        Gets the menu path prefix for the given script directory, or null if none.
        Specified by:
        getMenuPrefix in interface ScriptService
      • addScriptDirectory

        public void addScriptDirectory​(File scriptDirectory,
                                       MenuPath menuPrefix)
        Description copied from interface: ScriptService
        Adds a base directory to scan for scripts, placing discovered scripts beneath the given menu path prefix.
        Specified by:
        addScriptDirectory in interface ScriptService
      • run

        public Future<ScriptModule> run​(File file,
                                        boolean process,
                                        Object... inputs)
        Description copied from interface: ScriptService
        Executes the script in the given file.
        Specified by:
        run in interface ScriptService
        Parameters:
        file - File containing the script to execute.
        process - If true, executes the script with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the script with no pre- or postprocessing.
        inputs - List of input parameter names and values. The expected order is in pairs: an input name followed by its value, for each desired input to populate. Leaving some inputs unpopulated is allowed. Passing the name of an input that is not valid for the plugin, or passing a value of a type incompatible with the associated input parameter, will issue an error and ignore that name/value pair.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public Future<ScriptModule> run​(File file,
                                        boolean process,
                                        Map<String,​Object> inputMap)
        Description copied from interface: ScriptService
        Executes the script in the given file.
        Specified by:
        run in interface ScriptService
        Parameters:
        file - File containing the script to execute.
        process - If true, executes the script with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the script with no pre- or postprocessing.
        inputMap - Table of input parameter values, with keys matching the plugin's input parameter names. Passing a value of a type incompatible with the associated input parameter will issue an error and ignore that value.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public Future<ScriptModule> run​(ScriptInfo info,
                                        boolean process,
                                        Object... inputs)
        Description copied from interface: ScriptService
        Executes the given script.
        Specified by:
        run in interface ScriptService
        Parameters:
        info - The script to instantiate and run.
        process - If true, executes the script with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the script with no pre- or postprocessing.
        inputs - List of input parameter names and values. The expected order is in pairs: an input name followed by its value, for each desired input to populate. Leaving some inputs unpopulated is allowed. Passing the name of an input that is not valid for the plugin, or passing a value of a type incompatible with the associated input parameter, will issue an error and ignore that name/value pair.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public Future<ScriptModule> run​(ScriptInfo info,
                                        boolean process,
                                        Map<String,​Object> inputMap)
        Description copied from interface: ScriptService
        Executes the given script.
        Specified by:
        run in interface ScriptService
        Parameters:
        info - The script to instantiate and run.
        process - If true, executes the script with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the script with no pre- or postprocessing.
        inputMap - Table of input parameter values, with keys matching the plugin's input parameter names. Passing a value of a type incompatible with the associated input parameter will issue an error and ignore that value.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • initialize

        public void initialize()
        Description copied from interface: Service
        Performs any needed initialization when the service is first loaded.

        NB: This method is not intended to be called directly. It is called by the service framework itself (specifically by the ServiceHelper) when initializing the service. It should not be called a second time.

        Specified by:
        initialize in interface Initializable
        Specified by:
        initialize in interface Service
        Specified by:
        initialize in interface SingletonService<ScriptLanguage>