Constructor
new TwyrModuleLoader(twyrModuleopt)
Serves as the "base class" for all other loaders in the Twyr Web Application Server, including TwyrComponentLoader
,
TwyrMiddlewareLoader
, TwyrServiceLoader
, and TwyrTemplateLoader
.
- Source:
Serves as the "base class" for all other loaders in the Twyr Web Application Server, including TwyrComponentLoader
,
TwyrMiddlewareLoader
, TwyrServiceLoader
, and TwyrTemplateLoader
.
Responsible for invoking the standard "lifecycle" hooks on sub-modules of this module, if any - see TwyrBaseModule#load
,
TwyrBaseModule#initialize
, TwyrBaseModule#start
, TwyrBaseModule#stop
, TwyrBaseModule#uninitialize
,
and TwyrBaseModule#unload
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
twyrModule |
TwyrBaseModule |
<optional> |
The parent module, if any. |
Extends
Members
(readonly) basePath :string
- Source:
- Overrides:
Type:
- string
(readonly) name :string
- Source:
- Inherited From:
Type:
- string
Methods
(async) _doLifecycleAction(moduleType, action, args) → {Object}
Executes a lifecycle action on the given hashmap.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
moduleType |
string |
The type of the module to iterate over (services, components, etc.). |
action |
string |
The lifecycle action to execute (initialize, start, etc.). |
args |
Array |
The arguments to pass to the lifecycle method. |
Returns:
Hash map of the lifecycle status for each of the modules found.
- Type
- Object
(async) _exists(filepath, mode) → {boolean}
Checks to see if the path can be accessed by this process using the mode specified.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filepath |
string |
Path of the filesystem entity. |
mode |
number |
Permission to be checked for. |
Returns:
True / False.
- Type
- boolean
_filterStatus(status) → {Array}
Converts statuses to strings, depending on their type.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
status |
Array |
The statuses to process and filter. |
Returns:
The stringified statuses.
- Type
- Array
(async) _findFiles(rootDir, filename) → {Array}
Finds files in folders, and recursively, sub-folders, as well.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rootDir |
string |
Path of the folder to recursively search for. |
filename |
string |
Name of the file to search for. |
Returns:
List of files in the folder matching the name passed in.
- Type
- Array
_getDependencies(moduleInstance) → {Object}
Walks up the $twyrModule.$parent chain, and at each level searches for a $service.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
moduleInstance |
TwyrBaseModule |
The module to find dependencies for. |
Returns:
The dependencies.
- Type
- Object
_handleUncaughtException(err) → {undefined}
Logs Unhandled Exceptions to prevent the process from crashing.
- Source:
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error |
The unhandled exception. |
Returns:
Nothing.
- Type
- undefined
(async) _initializeComponents() → {Object}
Initialize Components defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the initialization status of each of the $twyrModule components.
- Type
- Object
(async) _initializeFeatures() → {Object}
Initialize Features defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the initialization status of each of the $twyrModule features.
- Type
- Object
(async) _initializeMiddlewares() → {Object}
Initialize Middlewares defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the initialization status of each of the $twyrModule middlewares.
- Type
- Object
(async) _initializeServices() → {Object}
Initialize Services defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the initialization status of each of the $twyrModule services.
- Type
- Object
(async) _initializeTemplates() → {Object}
Initialize Templates defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the initialization status of each of the $twyrModule templates.
- Type
- Object
(async) _loadComponents(configSrvc) → {Object}
Load components defined as part of this TwyrBaseModule
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule components.
- Type
- Object
(async) _loadFeatures(configSrvc) → {Object}
Load features defined as part of this TwyrBaseModule
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule features.
- Type
- Object
(async) _loadMiddlewares(configSrvc) → {Object}
Load middlewares defined as part of this TwyrBaseModule
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule middlewares.
- Type
- Object
(async) _loadServices(configSrvc) → {Object}
Load services defined as part of this TwyrBaseModule
.
- Source:
Special processing:
If the configSrvc parameter is undefined, load the ConfigurationService
first, if any found.
Since the ConfigurationServiceLoader
calls load / initialize / start in one shot, the other sub-modules get, basically,
a fully functional configuration service by the time they load, allowing them to use their configurations from the get-go.
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule services.
- Type
- Object
(async) _loadTemplates(configSrvc) → {Object}
Load templates defined as part of this TwyrBaseModule
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule templates.
- Type
- Object
(async) _loadUtilities(configSrvc) → {Object}
Load utilities defined as part of this TwyrBaseModule
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
Object containing the load status of each of the $twyrModule utilities.
- Type
- Object
(async) _startComponents() → {Object}
Start Components defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the start status of each of the $twyrModule components.
- Type
- Object
(async) _startFeatures() → {Object}
Start Features defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the start status of each of the $twyrModule features.
- Type
- Object
(async) _startMiddlewares() → {Object}
Start Middlewares defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the start status of each of the $twyrModule middlewares.
- Type
- Object
(async) _startServices() → {Object}
Start Services defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the start status of each of the $twyrModule services.
- Type
- Object
(async) _startTemplates() → {Object}
Start Templates defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the start status of each of the $twyrModule templates.
- Type
- Object
(async) _stopComponents() → {Object}
Stop Components defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the stop status of each of the $twyrModule components.
- Type
- Object
(async) _stopFeatures() → {Object}
Stop Features defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the stop status of each of the $twyrModule features.
- Type
- Object
(async) _stopMiddlewares() → {Object}
Stop Middlewares defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the stop status of each of the $twyrModule middlewares.
- Type
- Object
(async) _stopServices() → {Object}
Stop Services defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the stop status of each of the $twyrModule services.
- Type
- Object
(async) _stopTemplates() → {Object}
Stop Templates defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the stop status of each of the $twyrModule templates.
- Type
- Object
(async) _uninitializeComponents() → {Object}
Uninitialize Components defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the uninit status of each of the $twyrModule components.
- Type
- Object
(async) _uninitializeFeatures() → {Object}
Uninitialize Features defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the uninit status of each of the $twyrModule features.
- Type
- Object
(async) _uninitializeMiddlewares() → {Object}
Uninitialize Middlewares defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the uninit status of each of the $twyrModule middlewares.
- Type
- Object
(async) _uninitializeServices() → {Object}
Uninitialize Services defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the uninit status of each of the $twyrModule services.
- Type
- Object
(async) _uninitializeTemplates() → {Object}
Uninitialize Templates defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the uninit status of each of the $twyrModule templates.
- Type
- Object
(async) _unloadComponents() → {Object}
Unload Components defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule components.
- Type
- Object
(async) _unloadFeatures() → {Object}
Unload Features defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule features.
- Type
- Object
(async) _unloadMiddlewares() → {Object}
Unload Middlewares defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule middlewares.
- Type
- Object
(async) _unloadServices() → {Object}
Unload Services defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule services.
- Type
- Object
(async) _unloadTemplates() → {Object}
Unload Templates defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule templates.
- Type
- Object
(async) _unloadUtilities() → {Object}
Unload utilities defined as part of this TwyrBaseModule
.
- Source:
Returns:
Object containing the unload status of each of the $twyrModule utilities.
- Type
- Object
(async) initialize() → {Object}
Initializes sub-modules.
- Source:
Returns:
- The initialization status of $twyrModule's sub-modules.
- Type
- Object
(async) load(configSrvc) → {Object}
Loads sub-modules.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
configSrvc |
ConfigurationService |
Instance of the |
Returns:
- The load status of $twyrModule's sub-modules.
- Type
- Object
(async) start() → {Object}
Starts sub-modules.
- Source:
Returns:
- The start status of $twyrModule's sub-modules.
- Type
- Object
(async) stop() → {Object}
Stops sub-modules.
- Source:
Returns:
- The stop status of $twyrModule's sub-modules.
- Type
- Object
(async) uninitialize() → {Object}
Un-initializes sub-modules.
- Source:
Returns:
- The uninitialization status of $twyrModule's sub-modules.
- Type
- Object
(async) unload() → {Object}
Unloads sub-modules.
- Source:
Returns:
- The unloading status of $twyrModule's sub-modules.
- Type
- Object