ProcessContainer class
Inversion of control (IoC) container that runs as a system process. It processes command line arguments and handles unhandled exceptions and Ctrl-C signal to gracefully shutdown the container.
Command line arguments
--config / -c
path to JSON or YAML file with container configuration (default: './config/config.yml')--param / --params / -p
value(s) to parameterize the container configuration--help / -h
prints the container usage help
See Container
Example
var container = new ProcessContainer();
container.addFactory(MyComponentFactory());
container.run(process.args);
Constructors
- ProcessContainer([String name, String description])
- Creates a new instance of the container. [...]
Properties
- config ↔ ContainerConfig
-
read / write, inherited
- configPath ↔ String
-
read / write
- factories ↔ DefaultContainerFactory
-
read / write, inherited
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- info ↔ ContextInfo
-
read / write, inherited
- logger ↔ ILogger
-
read / write, inherited
- references ↔ ContainerReferences
-
read / write, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
addFactory(
IFactory factory) → void -
Adds a factory to the container. The factory is used to create components
added to the container by their locators (descriptors). [...]
inherited
-
close(
String correlationId) → Future -
Closes component and frees used resources. [...]
inherited
-
configure(
ConfigParams config) → void -
Configures component by passing configuration parameters. [...]
inherited
-
isOpen(
) → bool -
Checks if the component is opened. [...]
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
open(
String correlationId) → Future -
Opens the component. [...]
inherited
-
readConfigFromFile(
String correlationId, String path, ConfigParams parameters) → void -
Reads container configuration from JSON or YAML file
and parameterizes it with given values. [...]
inherited
-
run(
List< String> args) → void - Runs the container by instantiating and running components inside the container. [...]
-
setReferences(
IReferences references) → void -
Sets references to dependent components. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
-
unsetReferences(
) → void -
Unsets (clears) previously set references to dependent components.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited