public class ConfigManager extends Object
| Constructor and Description |
|---|
ConfigManager(File file)
Creates a manager.
|
| Modifier and Type | Method and Description |
|---|---|
File |
getConfigFile() |
Configuration |
getConfiguration() |
Configuration |
getConfiguration(boolean forceLoad) |
boolean |
hasConfiguration() |
void |
updateConfiguration(Configuration config,
boolean createBackup)
Updates the configuration and writes it to the
file, overwriting
the previous content of the file. |
public ConfigManager(File file)
getConfiguration() to get the current configuration or
call #updateConfiguration(Configuration) to write the configuration.file - the configuration filepublic File getConfigFile()
public boolean hasConfiguration()
public Configuration getConfiguration()
hasConfiguration()public Configuration getConfiguration(boolean forceLoad) throws Exception
if - true the data from the config file will be reloaded, even if it was loaded before (this ensures
the in-memory configuration is refreshed from the file).fileException - if the configuration file is invalidpublic void updateConfiguration(Configuration config, boolean createBackup) throws Exception
file, overwriting
the previous content of the file.config - the new configurationcreateBackup - if true a .bak file is copied from the original as a backupException - if the new configuration cannot be written to the fileCopyright © 2015–2017 Red Hat, Inc.. All rights reserved.