Class Configuration

java.lang.Object
io.deephaven.configuration.PropertyFile
io.deephaven.configuration.Configuration
Direct Known Subclasses:
Configuration.NullableConfiguration

public class Configuration extends PropertyFile
Utility class to provide an enhanced view and common access point for java properties files, as well as common configuration pieces.
  • Field Details

  • Constructor Details

    • Configuration

      protected Configuration()
  • Method Details

    • getInstance

      public static Configuration getInstance()
      Get the default Configuration instance.
      Returns:
      the single instance of Configuration allowed in an application
    • newConfigurationForTesting

      public static Configuration newConfigurationForTesting()
    • getContextKeyValues

      @NotNull public @NotNull Collection<String> getContextKeyValues()
      Return the configuration contexts for this process. This is the list of properties that may have been used to parse the configuration file. If the configuration has not been parsed, this collection may be empty. This collection will be immutable.
      Returns:
      the configuration contexts.
    • lookupPath

      public String lookupPath(String propertyName)
      Treat the system property propertyName as a path, and perform substitution with expandLinuxPath(String).
      Parameters:
      propertyName - system property containing a path
      Returns:
      The value of property propertyName after the manipulations.
    • expandLinuxPath

      public static String expandLinuxPath(String path)
      Expand the Linux-style path.
      • Change linux-style absolute paths to platform independent absolute. If the path starts with "/", replace "/" with the current directory's root (e.g. "C:\" on Windows.
      • If the path begins with "~/", then replace the ~ with the user.home system property.
      • If the path does not begin with "~/", then replace all occurrences of ~ with system property user.name.
      • Make sure the path ends in File.separator.
      Parameters:
      path - the path to be adjusted
      Returns:
      the path with substitutions performed
    • getServerTimezone

      public TimeZone getServerTimezone()
      Returns:
      the TimeZone the server is running in
    • reloadProperties

      public String reloadProperties() throws IOException, ConfigurationException
      Reload properties, then update with all system properties (properties set in System take precedence).
      Returns:
      the property file used
      Throws:
      IOException - if the property stream cannot be processed
      ConfigurationException - if the property stream cannot be opened
    • main

      public static void main(String[] args)
      The following main method compares two directories of prop files and outputs a CSV report of the differences. Usually run before the release of a new version into prod
      Parameters:
      args - dir1 dir2 outFile.csv