Class ConfigLoader

java.lang.Object
com.framed.orchestrator.ConfigLoader

public class ConfigLoader extends Object
The ConfigLoader class provides utility methods for loading and validating JSON-based configuration files used by the orchestrator.

Features:

  • Loads configuration from a file path into a JSONObject.
  • Validates service instantiation configurations for required attributes.
  • Validates communication configurations for required attributes.

Validation Rules:

  • Service configs must contain class and id attributes.
  • Communication configs must contain port and type attributes.
  • peers attribute in communication config is optional.
  • Method Details

    • loadConfig

      public static org.json.JSONObject loadConfig(String path) throws IOException
      Loads a JSON configuration file from the specified path.
      Parameters:
      path - the file system path to the configuration file
      Returns:
      a JSONObject representing the configuration
      Throws:
      IOException - if the file cannot be read or parsed
    • validateServiceConfigs

      public static void validateServiceConfigs(org.json.JSONObject serviceConfig)
      Validates service instantiation configurations.

      Each service object must contain class and id attributes.

      Parameters:
      serviceConfig - the JSON object containing service definitions
    • validateCommunicationConfigs

      public static void validateCommunicationConfigs(org.json.JSONObject communicationConfig)
      Validates communication configurations.

      The configuration must contain port and type attributes. The peers attribute is optional.

      Parameters:
      communicationConfig - the JSON object representing communication settings