Class DefaultModuleService

    • Constructor Detail

      • DefaultModuleService

        public DefaultModuleService()
    • Method Detail

      • getModuleById

        public ModuleInfo getModuleById​(String id)
        Description copied from interface: ModuleService
        Gets the module with the given identifier string.
        Specified by:
        getModuleById in interface ModuleService
        Parameters:
        id - The identifier string corresponding to the desired module.
        Returns:
        The Identifiable module with the given identifier.
      • getModuleForAccelerator

        public ModuleInfo getModuleForAccelerator​(Accelerator acc)
        Description copied from interface: ModuleService
        Gets the module for a given keyboard shortcut.
        Specified by:
        getModuleForAccelerator in interface ModuleService
        Parameters:
        acc - the accelerator for which to search.
        Returns:
        the module info for the corresponding module, or null.
      • createModule

        public Module createModule​(ModuleInfo info)
        Description copied from interface: ModuleService
        Creates an instance of the given module.

        If the module implements the Contextual interface, the appropriate context is injected. Similarly, if the module implements the Prioritized interface, the appropriate priority is injected.

        Note that in the case of commands, this method does not do any preprocessing on the command instances, so parameters will not be auto-populated, initializers will not be executed, etc.

        Specified by:
        createModule in interface ModuleService
      • run

        public Future<Module> run​(ModuleInfo info,
                                  boolean process,
                                  Object... inputs)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        info - The module to instantiate and run.
        process - If true, executes the module with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the module 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 module, 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<Module> run​(ModuleInfo info,
                                  boolean process,
                                  Map<String,​Object> inputMap)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        info - The module to instantiate and run.
        process - If true, executes the module with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the module with no pre- or postprocessing.
        inputMap - Table of input parameter values, with keys matching the ModuleInfo'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<Module> run​(ModuleInfo info,
                                  List<? extends ModulePreprocessor> pre,
                                  List<? extends ModulePostprocessor> post,
                                  Object... inputs)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        info - The module to instantiate and run.
        pre - List of preprocessing steps to perform.
        post - List of postprocessing steps to perform.
        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 module, 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<Module> run​(ModuleInfo info,
                                  List<? extends ModulePreprocessor> pre,
                                  List<? extends ModulePostprocessor> post,
                                  Map<String,​Object> inputMap)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        info - The module to instantiate and run.
        pre - List of preprocessing steps to perform.
        post - List of postprocessing steps to perform.
        inputMap - Table of input parameter values, with keys matching the ModuleInfo'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 <M extends ModuleFuture<M> run​(M module,
                                                boolean process,
                                                Object... inputs)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        module - The module to run.
        process - If true, executes the module with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the module 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 module, 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 <M extends ModuleFuture<M> run​(M module,
                                                boolean process,
                                                Map<String,​Object> inputMap)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        module - The module to run.
        process - If true, executes the module with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins in the plugin index; if false, executes the module with no pre- or postprocessing.
        inputMap - Table of input parameter values, with keys matching the ModuleInfo'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 <M extends ModuleFuture<M> run​(M module,
                                                List<? extends ModulePreprocessor> pre,
                                                List<? extends ModulePostprocessor> post,
                                                Object... inputs)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        module - The module to run.
        pre - List of preprocessing steps to perform.
        post - List of postprocessing steps to perform.
        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 module, 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 <M extends ModuleFuture<M> run​(M module,
                                                List<? extends ModulePreprocessor> pre,
                                                List<? extends ModulePostprocessor> post,
                                                Map<String,​Object> inputMap)
        Description copied from interface: ModuleService
        Executes the given module.
        Specified by:
        run in interface ModuleService
        Parameters:
        module - The module to run.
        pre - List of preprocessing steps to perform.
        post - List of postprocessing steps to perform.
        inputMap - Table of input parameter values, with keys matching the module's ModuleInfo'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.
      • getSingleInput

        public <T> ModuleItem<T> getSingleInput​(Module module,
                                                Class<T> type)
        Description copied from interface: ModuleService
        Checks the given module for a solitary unresolved fillable input of the given type, returning the relevant ModuleItem if found, or null if not exactly one unresolved fillable input of that type.
        Specified by:
        getSingleInput in interface ModuleService
      • getSingleOutput

        public <T> ModuleItem<T> getSingleOutput​(Module module,
                                                 Class<T> type)
        Description copied from interface: ModuleService
        Checks the given module for a solitary unresolved output of the given type, returning the relevant ModuleItem if found, or null if not exactly one unresolved output of that type.
        Specified by:
        getSingleOutput in interface ModuleService
      • 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