commandbox.system.services

Class ModuleService

lucee.Component
    extended by commandbox.system.services.ModuleService
Class Attributes:
  • singleton
  •  
  • output : false
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any CommandService


    • access = public
    • returntype = any
    • inject = CommandService
    true false
    any ConfigService


    • access = public
    • returntype = any
    • inject = Configservice
    true false
    any EndpointService


    • access = public
    • returntype = any
    • inject = EndpointService
    true false
    any SystemSettings


    • access = public
    • returntype = any
    • inject = SystemSettings
    true false
    any consoleLogger


    • access = public
    • returntype = any
    • inject = logbox:logger:console
    true false
    any fileSystemUtil


    • access = public
    • returntype = any
    • inject = FileSystem
    true false
    any moduleData


    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(any shell)
          Constructor.
    Method Summary
    void activateAllModules()
         Go over all the loaded module configurations and activate them for usage within the application.
    ModuleService activateModule(string moduleName)
         Activate a module.
    private void buildRegistry(array locations)
         Build the modules registry.
    private boolean canLoad(string moduleName)
         Checks if the module can be loaded or registered.
    void configure()
         Called by loader service when configuration file loads.
    string getCommandService()
    string getConfigService()
    string getConsoleLogger()
    string getEndpointService()
    string getFileSystemUtil()
    array getLoadedModules()
         Get a listing of all loaded modules.
    struct getModuleConfigCache()
         Return the loaded module's configuration objects.
    string getModuleData()
    struct getModuleRegistry()
         Get the discovered module's registry structure.
    any getShell()
    string getSystemSettings()
    boolean isModuleActive(string moduleName)
         Check and see if a module has been activated.
    boolean isModuleRegistered(string moduleName)
         Check and see if a module has been registered.
    any loadMappings()
         Load all module mappings.
    any loadModuleConfiguration(struct config, string moduleName)
         Load the module configuration object and return it.
    void onShutdown()
         Called when the application stops.
    any overrideAllConfigSettings()
    any overrideConfigSettings(struct moduleSettings, string moduleName)
    any rebuildModuleRegistry()
         Rescan the module locations directories and re-register all located modules, this method does NOT register or activate any modules, it just reloads the found registry.
    ModuleService registerAllModules()
         Register all modules for the application.
    void registerAndActivateModule(string moduleName, [string invocationPath=''])
         Register and activate a new module.
    boolean registerModule(string moduleName, [string invocationPath=''], [string parent=''], [boolean force='false'])
         Register a module's configuration information and config object.
    void reload(string moduleName)
         Reload a targeted module.
    void reloadAll()
         Reload all modules.
    private void scanModulesDirectory(string dirPath)
         Get an array of modules found and add to the registry structure.
    any setCommandService(any CommandService)
    any setConfigService(any ConfigService)
    any setConsoleLogger(any consoleLogger)
    any setEndpointService(any EndpointService)
    any setFileSystemUtil(any fileSystemUtil)
    any setModuleData(any moduleData)
    any setSystemSettings(any SystemSettings)
    boolean unload(string moduleName)
         Unload a module if found from the configuration.
    void unloadAll()
         Unload all registered modules.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(any shell)

    Constructor

    Parameters:
    shell

    Property Detail

    CommandService

    property any CommandService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - CommandService
    serializable - true

    ConfigService

    property any ConfigService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - Configservice
    serializable - true

    EndpointService

    property any EndpointService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - EndpointService
    serializable - true

    SystemSettings

    property any SystemSettings

    Attributes:
    access - public
    required - false
    returntype - any
    inject - SystemSettings
    serializable - true

    consoleLogger

    property any consoleLogger

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:console
    serializable - true

    fileSystemUtil

    property any fileSystemUtil

    Attributes:
    access - public
    required - false
    returntype - any
    inject - FileSystem
    serializable - true

    moduleData

    property any moduleData

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    activateAllModules

    public void activateAllModules()

    Go over all the loaded module configurations and activate them for usage within the application


    activateModule

    public ModuleService activateModule(string moduleName)

    Activate a module

    Parameters:
    moduleName - The name of the module to load. It must exist and be valid. Else we ignore it by logging a warning and returning false.

    buildRegistry

    private void buildRegistry(array locations)

    Build the modules registry

    Parameters:
    locations - The array of locations to register

    canLoad

    private boolean canLoad(string moduleName)

    Checks if the module can be loaded or registered

    Parameters:
    moduleName - The module name

    configure

    public void configure()

    Called by loader service when configuration file loads


    getCommandService

    public string getCommandService()


    getConfigService

    public string getConfigService()


    getConsoleLogger

    public string getConsoleLogger()


    getEndpointService

    public string getEndpointService()


    getFileSystemUtil

    public string getFileSystemUtil()


    getLoadedModules

    public array getLoadedModules()

    Get a listing of all loaded modules


    getModuleConfigCache

    public struct getModuleConfigCache()

    Return the loaded module's configuration objects


    getModuleData

    public string getModuleData()


    getModuleRegistry

    public struct getModuleRegistry()

    Get the discovered module's registry structure


    getShell

    public any getShell()


    getSystemSettings

    public string getSystemSettings()


    isModuleActive

    public boolean isModuleActive(string moduleName)

    Check and see if a module has been activated

    Parameters:
    moduleName

    isModuleRegistered

    public boolean isModuleRegistered(string moduleName)

    Check and see if a module has been registered

    Parameters:
    moduleName

    loadMappings

    public any loadMappings()

    Load all module mappings


    loadModuleConfiguration

    public any loadModuleConfiguration(struct config, string moduleName)

    Load the module configuration object and return it

    Parameters:
    config - The module config structure
    moduleName - The module name

    onShutdown

    public void onShutdown()

    Called when the application stops


    overrideAllConfigSettings

    public any overrideAllConfigSettings()


    overrideConfigSettings

    public any overrideConfigSettings(struct moduleSettings, string moduleName)

    Parameters:
    moduleSettings - The module setting structure
    moduleName - The module name

    rebuildModuleRegistry

    public any rebuildModuleRegistry()

    Rescan the module locations directories and re-register all located modules, this method does NOT register or activate any modules, it just reloads the found registry


    registerAllModules

    public ModuleService registerAllModules()

    Register all modules for the application. Usually called by framework to load configuration data.


    registerAndActivateModule

    public void registerAndActivateModule(string moduleName, [string invocationPath=''])

    Register and activate a new module

    Parameters:
    moduleName - The name of the module to load.
    invocationPath - The module's invocation path to its root from the webroot (the instantiation path,ex:myapp.myCustomModules), if empty we use registry location, if not we are doing a explicit name+path registration. Do not include the module name, you passed that in the first argument right

    registerModule

    public boolean registerModule(string moduleName, [string invocationPath=''], [string parent=''], [boolean force='false'])

    Register a module's configuration information and config object

    Parameters:
    moduleName - The name of the module to load.
    invocationPath - The module's invocation path to its root from the webroot (the instantiation path,ex:myapp.myCustomModules), if empty we use registry location, if not we are doing a explicit name+path registration. Do not include the module name, you passed that in the first argument right
    parent - The name of the parent module
    force - Force a registration

    reload

    public void reload(string moduleName)

    Reload a targeted module

    Parameters:
    moduleName - The module to reload

    reloadAll

    public void reloadAll()

    Reload all modules


    scanModulesDirectory

    private void scanModulesDirectory(string dirPath)

    Get an array of modules found and add to the registry structure

    Parameters:
    dirPath - Path to scan

    setCommandService

    public any setCommandService(any CommandService)

    Parameters:
    CommandService

    setConfigService

    public any setConfigService(any ConfigService)

    Parameters:
    ConfigService

    setConsoleLogger

    public any setConsoleLogger(any consoleLogger)

    Parameters:
    consoleLogger

    setEndpointService

    public any setEndpointService(any EndpointService)

    Parameters:
    EndpointService

    setFileSystemUtil

    public any setFileSystemUtil(any fileSystemUtil)

    Parameters:
    fileSystemUtil

    setModuleData

    public any setModuleData(any moduleData)

    Parameters:
    moduleData

    setSystemSettings

    public any setSystemSettings(any SystemSettings)

    Parameters:
    SystemSettings

    unload

    public boolean unload(string moduleName)

    Unload a module if found from the configuration

    Parameters:
    moduleName - The module name to unload

    unloadAll

    public void unloadAll()

    Unload all registered modules