Class ConfigurationManager


  • public class ConfigurationManager
    extends Object
    Manage the configuration of I2PControl.
    Author:
    mathias modified: hottuna
    • Constructor Detail

      • ConfigurationManager

        public ConfigurationManager​(I2PAppContext ctx,
                                    File dir,
                                    boolean isPlugin)
    • Method Detail

      • getConfFile

        public File getConfFile()
        Since:
        0.12
      • 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.
      • getConf

        public boolean getConf​(String settingName,
                               boolean defaultValue)
        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

        public int getConf​(String settingName,
                           int defaultValue)
        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

        public String getConf​(String settingName,
                              String defaultValue)
        Get a specific String configuration.
        Parameters:
        settingName - The key for the configuration.
        defaultValue - If the configuration is not found, we use a default value.
        Returns:
        The value of the configuration, or the defaultValue.
      • setConf

        public void setConf​(String settingName,
                            int nbr)
        Set a specific int setting
        Parameters:
        settingName -
        nbr -
      • setConf

        public void setConf​(String settingName,
                            String str)
        Set a specific string setting
        Parameters:
        settingName -
        str -
      • setConf

        public void setConf​(String settingName,
                            boolean bool)
        Set a specific boolean setting
        Parameters:
        settingName -
        bool -