Class BabelPropertiesReader

java.lang.Object
pt.unl.fct.di.novasys.babel2.utils.BabelPropertiesReader

public final class BabelPropertiesReader extends Object
Utility class for loading Babel protocol configuration from a properties file and/or command-line arguments.

The primary entry point is loadConfig(Path, String...), which reads a Properties file and then applies any overrides supplied as key=value command-line arguments. A custom configuration file path may be specified at launch using the -conf <path> flag.

This class is not instantiable; use its static methods directly.

  • Method Details

    • loadConfig

      public static Properties loadConfig(Path defaultConfigFile, String... args) throws IOException, IllegalArgumentException
      Reads either the default or the given properties file (the file can be given with the argument -conf). Builds a configuration file with the properties from the file and then merges ad-hoc properties given in the arguments.

      Argument properties should be provided as: propertyName=value

      Parameters:
      defaultConfigFile - the path to the default properties file
      args - console parameters
      Returns:
      the configurations built
      Throws:
      IOException - if the provided file does not exist
      IllegalArgumentException - if the console parameters are not in the format: prop=value