Package com.framed.orchestrator
Class ConfigLoader
java.lang.Object
com.framed.orchestrator.ConfigLoader
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
classandidattributes. - Communication configs must contain
portandtypeattributes. peersattribute in communication config is optional.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.json.JSONObjectloadConfig(String path) Loads a JSON configuration file from the specified path.static voidvalidateCommunicationConfigs(org.json.JSONObject communicationConfig) Validates communication configurations.static voidvalidateServiceConfigs(org.json.JSONObject serviceConfig) Validates service instantiation configurations.
-
Method Details
-
loadConfig
Loads a JSON configuration file from the specified path.- Parameters:
path- the file system path to the configuration file- Returns:
- a
JSONObjectrepresenting 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
classandidattributes.- Parameters:
serviceConfig- the JSON object containing service definitions
-
validateCommunicationConfigs
public static void validateCommunicationConfigs(org.json.JSONObject communicationConfig) Validates communication configurations.The configuration must contain
portandtypeattributes. Thepeersattribute is optional.- Parameters:
communicationConfig- the JSON object representing communication settings
-