public class ConfigLoader extends Object
Properties
object.Constructor and Description |
---|
ConfigLoader()
Uses "/" as the config file prefix and "RSB_" as the environment variable
prefix.
|
ConfigLoader(String prefix,
String environmentPrefix)
Creates a new instance with specific parameters.
|
Modifier and Type | Method and Description |
---|---|
Properties |
load(Properties results)
Loads properties from the default sources.
|
Properties |
loadEnv(Properties results)
Loads properties from the environment variable.
|
Properties |
loadFile(File file,
Properties results)
Reads options from a config file.
|
Properties |
loadFileIfAvailable(int index,
File file,
String description,
Properties results)
Loads a config file if the file exists.
|
public ConfigLoader(String prefix, String environmentPrefix)
prefix
- installation prefix to search for the config files in
prefix/etc/rsb.conf
.environmentPrefix
- prefix for environment variablespublic ConfigLoader()
public Properties load(Properties results)
Properties.reset()
.results
- the instance to fill with new propertiespublic Properties loadFileIfAvailable(int index, File file, String description, Properties results)
index
- the index of the file in the configuration file
cascadefile
- the file to read, might not existdescription
- a description of the file being loadedresults
- the instance to fill with new propertiespublic Properties loadFile(File file, Properties results) throws IOException
file
- the file to readresults
- the instance to fill with new propertiesIllegalArgumentException
- if the file does not existIOException
- error reading the filepublic Properties loadEnv(Properties results)
results
- the instance to fill with new propertiesCopyright © 2018 CoR-Lab. All rights reserved.