Class ModuleManager


  • @Internal
    public class ModuleManager
    extends Object
    Responsible for loading/unloading modules, managing their life cycles, and resolving module objects.
    • Constructor Detail

      • ModuleManager

        public ModuleManager()
    • Method Detail

      • loadModule

        public void loadModule​(String name,
                               org.apache.flink.table.module.Module module)
        Load a module under a unique name. Modules will be kept in the loaded order, and new module will be added to the left before the unused module and turn on use by default.
        Parameters:
        name - name of the module
        module - the module instance
        Throws:
        org.apache.flink.table.api.ValidationException - when there already exists a module with the same name
      • unloadModule

        public void unloadModule​(String name)
        Unload a module with given name.
        Parameters:
        name - name of the module
        Throws:
        org.apache.flink.table.api.ValidationException - when there is no module with the given name
      • useModules

        public void useModules​(String... names)
        Enable modules in use with declared name order. Modules that have been loaded but not exist in names varargs will become unused.
        Parameters:
        names - module names to be used
        Throws:
        org.apache.flink.table.api.ValidationException - when module names contain an unloaded name
      • listModules

        public List<String> listModules()
        Get names of all used modules in resolution order.
        Returns:
        a list of names of used modules
      • listFullModules

        public List<ModuleEntry> listFullModules()
        Get all loaded modules with use status. Modules in use status are returned in resolution order.
        Returns:
        a list of module entries with module name and use status
      • listFunctions

        public Set<String> listFunctions()
        Get names of all functions from used modules. It excludes hidden functions.
        Returns:
        a set of function names of used modules
      • getFunctionDefinition

        public Optional<org.apache.flink.table.functions.FunctionDefinition> getFunctionDefinition​(String name)
        Get an optional of FunctionDefinition by a given name. Function will be resolved to modules in the used order, and the first match will be returned. If no match is found in all modules, return an optional.

        It includes hidden functions even though not listed in listFunctions().

        Parameters:
        name - name of the function
        Returns:
        an optional of FunctionDefinition
      • getFactory

        public <T extends org.apache.flink.table.factories.Factory> Optional<T> getFactory​(Function<org.apache.flink.table.module.Module,​Optional<T>> selector)
        Returns the first factory found in the loaded modules given a selector.

        Modules are checked in the order in which they have been loaded. The first factory returned by a module will be used. If no loaded module provides a factory, Optional.empty() is returned.