Package davmail

Class Settings

java.lang.Object
davmail.Settings

public final class Settings extends Object
Settings facade. DavMail settings are stored in the .davmail.properties file in current user home directory or in the file specified on the command line.
  • Field Details

  • Method Details

    • setConfigFilePath

      public static void setConfigFilePath(String path)
      Set config file path (from command line parameter).
      Parameters:
      path - davmail properties file path
    • isFirstStart

      public static boolean isFirstStart()
      Detect first launch (properties file does not exist).
      Returns:
      true if this is the first start with the current file path
    • load

      public static void load(InputStream inputStream) throws IOException
      Load properties from provided stream (used in webapp mode).
      Parameters:
      inputStream - properties stream
      Throws:
      IOException - on error
    • load

      public static void load()
      Load properties from current file path (command line or default).
    • setDefaultSettings

      public static void setDefaultSettings()
      Set all settings to default values. Ports above 1024 for unix/linux
    • getLogFilePath

      public static String getLogFilePath()
      Return DavMail log file path
      Returns:
      full log file path
    • getLogFileDirectory

      public static String getLogFileDirectory()
      Return DavMail log file directory
      Returns:
      full log file directory
    • updateLoggingConfig

      public static void updateLoggingConfig()
      Update Log4J config from settings.
    • save

      public static void save()
      Save settings in current file path (command line or default).
    • getProperty

      public static String getProperty(String property)
      Get a property value as String.
      Parameters:
      property - property name
      Returns:
      property value
    • getProperty

      public static String getProperty(String property, String defaultValue)
      Get property value or default.
      Parameters:
      property - property name
      defaultValue - default property value
      Returns:
      property value
    • getCharArrayProperty

      public static char[] getCharArrayProperty(String property)
      Get a property value as char[].
      Parameters:
      property - property name
      Returns:
      property value
    • setProperty

      public static void setProperty(String property, String value)
      Set a property value.
      Parameters:
      property - property name
      value - property value
    • getIntProperty

      public static int getIntProperty(String property)
      Get a property value as int.
      Parameters:
      property - property name
      Returns:
      property value
    • getIntProperty

      public static int getIntProperty(String property, int defaultValue)
      Get a property value as int, return default value if null.
      Parameters:
      property - property name
      defaultValue - default property value
      Returns:
      property value
    • getBooleanProperty

      public static boolean getBooleanProperty(String property)
      Get a property value as boolean.
      Parameters:
      property - property name
      Returns:
      property value
    • getBooleanProperty

      public static boolean getBooleanProperty(String property, boolean defaultValue)
      Get a property value as boolean.
      Parameters:
      property - property name
      defaultValue - default property value
      Returns:
      property value
    • loadRefreshToken

      public static String loadRefreshToken(String username)
    • storeRefreshToken

      public static void storeRefreshToken(String username, String refreshToken)
    • getLoggingLevel

      public static org.apache.log4j.Level getLoggingLevel(String category)
      Return Log4J logging level for the category.
      Parameters:
      category - logging category
      Returns:
      logging level
    • getSubProperties

      public static Properties getSubProperties(String scope)
      Get all properties that are in the specified scope, that is, that start with '<scope>.'.
      Parameters:
      scope - start of property name
      Returns:
      properties
    • setLoggingLevel

      public static void setLoggingLevel(String category, org.apache.log4j.Level level)
      Set Log4J logging level for the category
      Parameters:
      category - logging category
      level - logging level
    • saveProperty

      public static void saveProperty(String property, String value)
      Change and save a single property.
      Parameters:
      property - property name
      value - property value
    • isWindows

      public static boolean isWindows()
      Test if running on Windows
      Returns:
      true on Windows
    • isOSX

      public static boolean isOSX()
      Test if running on OSX
      Returns:
      true on Mac OS X
    • isLinux

      public static boolean isLinux()
      Test if running on Linux
      Returns:
      true on Linux
    • isUnix

      public static boolean isUnix()
    • getUserAgent

      public static String getUserAgent()
    • getOutlookUrl

      public static String getOutlookUrl()
    • getO365Url

      public static String getO365Url()
    • getGraphUrl

      public static String getGraphUrl()
      Handle custom graph endpoints. See ...
      Returns:
      graph endpoint url
    • getO365LoginUrl

      public static String getO365LoginUrl()
    • getOauthScope

      public static String getOauthScope()
    • isGraphEnabled

      public static boolean isGraphEnabled()
    • isSWTAvailable

      public static boolean isSWTAvailable()
    • isJFXAvailable

      public static boolean isJFXAvailable()
    • isDocker

      public static boolean isDocker()
    • isFlatpak

      public static boolean isFlatpak()
    • getConfigFilePath

      public static String getConfigFilePath()
      Set davmail properties path in Docker and Flatpak
      Returns:
      davmail.properties path