public class ConfigFileManager
extends java.lang.Object
load(boolean)
method may be used to load the configuration file.
The store()
method shall be called to write the properties changes to the file.Constructor and Description |
---|
ConfigFileManager(java.io.File conf)
Creates a new configuration file manager associated
to a given file object.
|
ConfigFileManager(java.lang.String path)
Creates a new configuration file manager to a given
path name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
clearProperty(java.lang.String key)
Discards a property.
|
java.util.List<java.lang.String> |
getOptions()
Get all the options
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Get a property's value.
|
void |
load(boolean justTry)
Loads a configuration file.
|
static void |
main(java.lang.String[] args)
Generates or modifies a CLIF configuration file, setting network-related properties.
|
java.lang.String |
setProperty(java.lang.String key,
java.lang.String value)
Set a property's value.
|
void |
store()
Writes the properties to the configuration file.
|
public ConfigFileManager(java.io.File conf)
conf
- the file to managepublic ConfigFileManager(java.lang.String path)
path
- the path name to the configuration filepublic static void main(java.lang.String[] args) throws java.io.IOException
args
- configuration_file_path_name [registry_host[:registry_port]]
[codeserver_host[:codeserver_port]]
java.io.IOException
public void load(boolean justTry) throws java.io.IOException
justTry
- when false, an exception will be thrown when the file can't
be loaded for any reason; when true, an exception will be thrown only when
the configuration file exists but can't be loaded (either because of
insufficient access rights, or because of I/O errors).java.io.IOException
- the configuration file could not be read.public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the property namedefaultValue
- the default value to return when the given property
is not definedpublic java.util.List<java.lang.String> getOptions()
public java.lang.String setProperty(java.lang.String key, java.lang.String value)
key
- the property namevalue
- the property valuepublic java.lang.String clearProperty(java.lang.String key)
key
- the property to discardpublic void store() throws java.io.IOException
java.io.IOException
- the configuration file could not be written