ColdBox Platform v3.8.0

coldbox.system.web.services
Class ModuleService

WEB-INF.cftags.component
        extended by coldbox.system.web.services.BaseService
            extended by coldbox.system.web.services.ModuleService

public class ModuleService
extends BaseService

I oversee and manage ColdBox modules

Constructor Summary
init(any controller)
          Constructor
 
Method Summary
 void activateAllModules()
          Go over all the loaded module configurations and activate them for usage within the application
 boolean 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
 array getLoadedModules()
          Get a listing of all loaded modules
 struct getModuleConfigCache()
          Return the loaded module's configuration objects
 struct getModuleRegistry()
          Get the discovered module's registry structure
 any loadModuleConfiguration(struct config)
          Load the module configuration object
 void onConfigurationLoad()
          Called by loader service when configuration file loads
 void onShutdown()
          Called when the application stops
 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
 void 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=''])
          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
 boolean unload(string moduleName)
          Unload a module if found from the configuration
 void unloadAll()
          Unload all registered modules
 
Methods inherited from class coldbox.system.web.services.BaseService
convertToColdBox, getColdboxOCM, getController, getUtil, isFamilyType, setController
 
Methods inherited from class WEB-INF.cftags.component
None
 

Constructor Detail

init

public init(any controller)
Constructor

Parameters:
controller
Method Detail

activateAllModules

public void activateAllModules()
Go over all the loaded module configurations and activate them for usage within the application


activateModule

public boolean 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

getLoadedModules

public array getLoadedModules()
Get a listing of all loaded modules


getModuleConfigCache

public struct getModuleConfigCache()
Return the loaded module's configuration objects


getModuleRegistry

public struct getModuleRegistry()
Get the discovered module's registry structure


loadModuleConfiguration

public any loadModuleConfiguration(struct config)
Load the module configuration object

Parameters:
config - The module config structure

onConfigurationLoad

public void onConfigurationLoad()
Called by loader service when configuration file loads

Overrides:
onConfigurationLoad in class BaseService

onShutdown

public void onShutdown()
Called when the application stops

Overrides:
onShutdown in class BaseService

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 void 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=''])
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

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

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


ColdBox Platform v3.8.0