-
Notifications
You must be signed in to change notification settings - Fork 2
Creating Modules
The platform is configured using a JSON configuration file as can be seen in this page.
In order to configure the platform based on the information of that file, the following definitions are needed:
- Modules of the infrastructure manager to be used.
- Connections between them and the commands which each input sends to its connected outputs.
Below, the process that the platform uses to create Modules and connect them from the information in the configuration file is explained.
-
The path of the configuration file is read. This can be the default path
src/main/resources/Configuration.json
or a path specified using console arguments while running (See here) -
This path is passed to the instance of
Master
, via itsconfigure
method. This, in turn, creates an object of typeModuleManagerConfigurator
and passes the path to it. -
The
ModuleManagerConfigurator
, using anObjectMapper
object (from Jackson), reads the data in the configuration file and deserialize it into a POJO (Plain Old Java Object) of typeModulesConfigurationFileData
and passes it to aModuleManager
in charge of creating and connecting the modules -
The
ModulesConfigurationFileData
object, as seen below, has a list ofModuleConfigData
objects. These are the raw data representation of each module. (Raw data in the sense, that the classes represent what is seen in the config file) -
Each module has a raw data class that
extends
ModuleConfigData
. This determines the fields in the JSON file. If working correctly, each "module" object in the JSON is mapped into a real java object of the appropriate raw class based on the fields it has. As an example, some of the classes are shown below: -
The
ModuleFactory
reads the raw data and, based on itstype
field, creates the appropriate module, as well as calls itsconfigure
method with the required information to configure each module. -
After the modules are created by the factory, the
ModuleManager
, call theconnectModule
method of aModuleConnector
object, to connect each module. This means, reading the raw connection data, and creating aConnection
object for each of the modules inputs. Finally these are send to the module using theaddConnection
method.