Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Creating Modules

juan-castrillon edited this page Feb 8, 2021 · 4 revisions

How does the platform read and create 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:

  1. Modules of the infrastructure manager to be used.
  2. 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.

  1. 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)

  2. This path is passed to the instance of Master, via its configure method. This, in turn, creates an object of type ModuleManagerConfigurator and passes the path to it.

  3. The ModuleManagerConfigurator, using an ObjectMapper object (from Jackson), reads the data in the configuration file and deserialize it into a POJO (Plain Old Java Object) of type ModulesConfigurationFileData and passes it to a ModuleManager in charge of creating and connecting the modules

  4. The ModulesConfigurationFileData object, as seen below, has a list of ModuleConfigData 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)

    modules_configuration_file_data

  5. 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:

    example_module_config_data_inheritance

  6. The ModuleFactory reads the raw data and, based on its type field, creates the appropriate module, as well as calls its configure method with the required information to configure each module.

  7. After the modules are created by the factory, the ModuleManager, call the connectModule method of a ModuleConnector object, to connect each module. This means, reading the raw connection data, and creating a Connection object for each of the modules inputs. Finally these are send to the module using the addConnection method.

Clone this wiki locally