Class BabelPropertiesReader
java.lang.Object
pt.unl.fct.di.novasys.babel2.utils.BabelPropertiesReader
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 Summary
Modifier and TypeMethodDescriptionstatic PropertiesloadConfig(Path defaultConfigFile, String... args) Reads either the default or the given properties file (the file can be given with the argument -conf).
-
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 fileargs- console parameters- Returns:
- the configurations built
- Throws:
IOException- if the provided file does not existIllegalArgumentException- if the console parameters are not in the format: prop=value
-