java.lang.Object
net.i2p.i2pcontrol.servlets.configuration.ConfigurationManager
Manage the configuration of I2PControl.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanTrue since settings changed without a save.private final LogLogger for this class.Settings whose value is a boolean.private final StringName of the config file.private final FileWhere the config file is read and written.Settings whose value is an integer.Settings whose value is a string.private final StringName of the webapp default config file.Constructor Summary
ConstructorsConstructorDescriptionConfigurationManager(I2PAppContext ctx, File dir, boolean isPlugin) Chooses the config filename for the plugin or webapp case, then reads it.Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if a specific boolean configuration exists.intCheck if a specific boolean configuration exists.Get a specific String configuration.Report the file this manager reads its key=value settings from and writes them back to.private voidparseConfigStr(Properties input) Try to parse the input as 'key=value', where value will (in order) be parsed as integer/boolean/string.voidReads configuration from file, every line is parsed as key=value.voidSet a specific boolean settingvoidSet a specific int settingvoidSet a specific string settingvoidWrite configuration into default config file.
Field Details
CONFIG_FILE
WEBAPP_CONFIG_FILE
Name of the webapp default config file.- See Also:
configLocation
Where the config file is read and written._log
Logger for this class._changed
private boolean _changedTrue since settings changed without a save.stringConfigurations
booleanConfigurations
integerConfigurations
Constructor Details
ConfigurationManager
Chooses the config filename for the plugin or webapp case, then reads it.- Parameters:
ctx- the application context supplying the log managerdir- the directory the configuration file is read fromisPlugin- true to read I2PControl.conf, false to read i2pcontrol.config
Method Details
getConfFile
Report the file this manager reads its key=value settings from and writes them back to.- Returns:
- the conf file
readConfFile
public void readConfFile()Reads configuration from file, every line is parsed as key=value.writeConfFile
public void writeConfFile()Write configuration into default config file. As of 0.12, doesn't actually write unless something changed.parseConfigStr
Try to parse the input as 'key=value', where value will (in order) be parsed as integer/boolean/string.- Parameters:
input- the properties to parse, each value tried as an integer, then a boolean, then a string
getConf
Check if a specific boolean configuration exists.- Parameters:
settingName- The key for the configuration.defaultValue- If the configuration is not found, we use a default value.- Returns:
- The value of a configuration: true if found, defaultValue if not found.
getConf
Check if a specific boolean configuration exists.- Parameters:
settingName- The key for the configuration.defaultValue- If the configuration is not found, we use a default value.- Returns:
- The value of a configuration: true if found, defaultValue if not found.
getConf
setConf
Set a specific int setting- Parameters:
settingName- the setting namenbr- the integer value to store for the setting
setConf
setConf
Set a specific boolean setting- Parameters:
settingName- the setting namebool- the boolean value to store for the setting