Class DrillConfig

java.lang.Object
org.apache.drill.common.config.DrillConfig
All Implemented Interfaces:
com.typesafe.config.Config, com.typesafe.config.ConfigMergeable

public class DrillConfig extends Object
  • Constructor Details

    • DrillConfig

      public DrillConfig(com.typesafe.config.Config config)
  • Method Details

    • getInstance

      public <T> T getInstance(String path, Class<T> iface, Object... constructorArgs)
      Get an instance of the provided interface using the configuration path provided. Construct the object based on the provided constructor arguments.
      Parameters:
      path - The configuration path to use.
      iface - The Interface or Superclass of the instance you requested.
      constructorArgs - Any arguments required for constructing the requested type.
      Returns:
      The new Object instance that implements the provided Interface
    • getStartupArguments

      public List<String> getStartupArguments()
    • create

      public static DrillConfig create()
      Creates a DrillConfig object using the default config file name and with server-specific configuration options enabled.
      Returns:
      The new DrillConfig object.
    • forClient

      public static DrillConfig forClient()
      Creates a configuration using the default config file name and with server-specific configuration options disabled.
      Returns:
      DrillConfig instance
    • create

      public static DrillConfig create(String overrideFileResourcePathname)
      DrillConfig loads up Drill configuration information. It does this utilizing a combination of classpath scanning and Configuration fallbacks provided by the TypeSafe configuration library. The order of precedence is as follows:

      Configuration values are retrieved as follows:

      • Check a single copy of "drill-override.conf". If multiple copies are on the classpath, which copy is read is indeterminate. If a non-null value for overrideFileResourcePathname is provided, this is used instead of "drill-override.conf".
      • Check a single copy of "drill-distrib.conf". If multiple copies are on the classpath, which copy is read is indeterminate.
      • Check all copies of "drill-module.conf". Loading order is indeterminate.
      • Check a single copy of "drill-default.conf". If multiple copies are on the classpath, which copy is read is indeterminate.

      Parameters:
      overrideFileResourcePathname - the classpath resource pathname of the file to use for configuration override purposes; null specifies to use the default pathname (ConfigConstants.CONFIG_OVERRIDE_RESOURCE_PATHNAME) (does not specify to suppress trying to load an overrides file)
      Returns:
      A merged Config object.
    • create

      public static DrillConfig create(Properties testConfigurations)
      Do not use this method outside of test code.
    • create

      public static DrillConfig create(String overrideFileResourcePathname, boolean enableServerConfigs)
      Parameters:
      overrideFileResourcePathname - see create(String)'s overrideFileResourcePathname
    • createForRM

      public static DrillConfig createForRM()
      Merged DrillConfig object for all the RM Configurations provided through various resource files. The order of precedence is as follows:

      Configuration values are retrieved as follows:

      • Check a single copy of "drill-rm-override.conf". If multiple copies are on the classpath, which copy is read is indeterminate.
      • Check a single copy of "drill-rm-distrib.conf". If multiple copies are on the classpath, which copy is read is indeterminate.
      • Check a single copy of "drill-rm-default.conf". If multiple copies are on the classpath, which copy is read is indeterminate.

      Returns:
      A merged Config object.
    • create

      public static DrillConfig create(com.typesafe.config.Config config)
      Creates a drill configuration using the provided config file.
      Parameters:
      config - custom configuration file
      Returns:
      DrillConfig instance
    • create

      public static DrillConfig create(String overrideFileResourcePathname, Properties overriderProps, boolean enableServerConfigs, ConfigFileInfo configInfo, com.typesafe.config.ConfigMergeable fallbackConfig)
      Parameters:
      overrideFileResourcePathname - see create(String)'s overrideFileResourcePathname
      overriderProps - optional property map for further overriding (after override file is assimilated
      enableServerConfigs - whether to enable server-specific configuration options
      configInfo - see ConfigFileInfo
      fallbackConfig - existing config which will be used as fallback
      Returns:
      DrillConfig object with all configs from passed in resource files
    • getInstanceOf

      public <T> T getInstanceOf(String location, Class<T> clazz) throws DrillConfigurationException
      Throws:
      DrillConfigurationException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMaxDirectMemory

      public static long getMaxDirectMemory()
    • root

      public com.typesafe.config.ConfigObject root()
      Specified by:
      root in interface com.typesafe.config.Config
    • origin

      public com.typesafe.config.ConfigOrigin origin()
      Specified by:
      origin in interface com.typesafe.config.Config
    • withFallback

      public com.typesafe.config.Config withFallback(com.typesafe.config.ConfigMergeable other)
      Specified by:
      withFallback in interface com.typesafe.config.Config
      Specified by:
      withFallback in interface com.typesafe.config.ConfigMergeable
    • resolve

      public com.typesafe.config.Config resolve()
      Specified by:
      resolve in interface com.typesafe.config.Config
    • resolve

      public com.typesafe.config.Config resolve(com.typesafe.config.ConfigResolveOptions options)
      Specified by:
      resolve in interface com.typesafe.config.Config
    • checkValid

      public void checkValid(com.typesafe.config.Config reference, String... restrictToPaths)
      Specified by:
      checkValid in interface com.typesafe.config.Config
    • hasPath

      public boolean hasPath(String path)
      Specified by:
      hasPath in interface com.typesafe.config.Config
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface com.typesafe.config.Config
    • entrySet

      public Set<Map.Entry<String,com.typesafe.config.ConfigValue>> entrySet()
      Specified by:
      entrySet in interface com.typesafe.config.Config
    • getBoolean

      public boolean getBoolean(String path)
      Specified by:
      getBoolean in interface com.typesafe.config.Config
    • getNumber

      public Number getNumber(String path)
      Specified by:
      getNumber in interface com.typesafe.config.Config
    • getInt

      public int getInt(String path)
      Specified by:
      getInt in interface com.typesafe.config.Config
    • getLong

      public long getLong(String path)
      Specified by:
      getLong in interface com.typesafe.config.Config
    • getDouble

      public double getDouble(String path)
      Specified by:
      getDouble in interface com.typesafe.config.Config
    • getString

      public String getString(String path)
      Specified by:
      getString in interface com.typesafe.config.Config
    • getObject

      public com.typesafe.config.ConfigObject getObject(String path)
      Specified by:
      getObject in interface com.typesafe.config.Config
    • getConfig

      public com.typesafe.config.Config getConfig(String path)
      Specified by:
      getConfig in interface com.typesafe.config.Config
    • getAnyRef

      public Object getAnyRef(String path)
      Specified by:
      getAnyRef in interface com.typesafe.config.Config
    • getValue

      public com.typesafe.config.ConfigValue getValue(String path)
      Specified by:
      getValue in interface com.typesafe.config.Config
    • getBytes

      public Long getBytes(String path)
      Specified by:
      getBytes in interface com.typesafe.config.Config
    • getMilliseconds

      public Long getMilliseconds(String path)
      Specified by:
      getMilliseconds in interface com.typesafe.config.Config
    • getNanoseconds

      public Long getNanoseconds(String path)
      Specified by:
      getNanoseconds in interface com.typesafe.config.Config
    • getList

      public com.typesafe.config.ConfigList getList(String path)
      Specified by:
      getList in interface com.typesafe.config.Config
    • getBooleanList

      public List<Boolean> getBooleanList(String path)
      Specified by:
      getBooleanList in interface com.typesafe.config.Config
    • getNumberList

      public List<Number> getNumberList(String path)
      Specified by:
      getNumberList in interface com.typesafe.config.Config
    • getIntList

      public List<Integer> getIntList(String path)
      Specified by:
      getIntList in interface com.typesafe.config.Config
    • getLongList

      public List<Long> getLongList(String path)
      Specified by:
      getLongList in interface com.typesafe.config.Config
    • getDoubleList

      public List<Double> getDoubleList(String path)
      Specified by:
      getDoubleList in interface com.typesafe.config.Config
    • getStringList

      public List<String> getStringList(String path)
      Specified by:
      getStringList in interface com.typesafe.config.Config
    • getObjectList

      public List<? extends com.typesafe.config.ConfigObject> getObjectList(String path)
      Specified by:
      getObjectList in interface com.typesafe.config.Config
    • getConfigList

      public List<? extends com.typesafe.config.Config> getConfigList(String path)
      Specified by:
      getConfigList in interface com.typesafe.config.Config
    • getAnyRefList

      public List<? extends Object> getAnyRefList(String path)
      Specified by:
      getAnyRefList in interface com.typesafe.config.Config
    • getBytesList

      public List<Long> getBytesList(String path)
      Specified by:
      getBytesList in interface com.typesafe.config.Config
    • getMillisecondsList

      public List<Long> getMillisecondsList(String path)
      Specified by:
      getMillisecondsList in interface com.typesafe.config.Config
    • getNanosecondsList

      public List<Long> getNanosecondsList(String path)
      Specified by:
      getNanosecondsList in interface com.typesafe.config.Config
    • withOnlyPath

      public com.typesafe.config.Config withOnlyPath(String path)
      Specified by:
      withOnlyPath in interface com.typesafe.config.Config
    • withoutPath

      public com.typesafe.config.Config withoutPath(String path)
      Specified by:
      withoutPath in interface com.typesafe.config.Config
    • atPath

      public com.typesafe.config.Config atPath(String path)
      Specified by:
      atPath in interface com.typesafe.config.Config
    • atKey

      public com.typesafe.config.Config atKey(String key)
      Specified by:
      atKey in interface com.typesafe.config.Config
    • withValue

      public com.typesafe.config.Config withValue(String path, com.typesafe.config.ConfigValue value)
      Specified by:
      withValue in interface com.typesafe.config.Config
    • isResolved

      public boolean isResolved()
      Specified by:
      isResolved in interface com.typesafe.config.Config
    • resolveWith

      public com.typesafe.config.Config resolveWith(com.typesafe.config.Config config)
      Specified by:
      resolveWith in interface com.typesafe.config.Config
    • resolveWith

      public com.typesafe.config.Config resolveWith(com.typesafe.config.Config config, com.typesafe.config.ConfigResolveOptions configResolveOptions)
      Specified by:
      resolveWith in interface com.typesafe.config.Config
    • hasPathOrNull

      public boolean hasPathOrNull(String s)
      Specified by:
      hasPathOrNull in interface com.typesafe.config.Config
    • getIsNull

      public boolean getIsNull(String s)
      Specified by:
      getIsNull in interface com.typesafe.config.Config
    • getEnum

      public <T extends Enum<T>> T getEnum(Class<T> aClass, String s)
      Specified by:
      getEnum in interface com.typesafe.config.Config
    • getMemorySize

      public com.typesafe.config.ConfigMemorySize getMemorySize(String s)
      Specified by:
      getMemorySize in interface com.typesafe.config.Config
    • getDuration

      public long getDuration(String s, TimeUnit timeUnit)
      Specified by:
      getDuration in interface com.typesafe.config.Config
    • getDuration

      public Duration getDuration(String s)
      Specified by:
      getDuration in interface com.typesafe.config.Config
    • getPeriod

      public Period getPeriod(String s)
      Specified by:
      getPeriod in interface com.typesafe.config.Config
    • getTemporal

      public TemporalAmount getTemporal(String s)
      Specified by:
      getTemporal in interface com.typesafe.config.Config
    • getEnumList

      public <T extends Enum<T>> List<T> getEnumList(Class<T> aClass, String s)
      Specified by:
      getEnumList in interface com.typesafe.config.Config
    • getMemorySizeList

      public List<com.typesafe.config.ConfigMemorySize> getMemorySizeList(String s)
      Specified by:
      getMemorySizeList in interface com.typesafe.config.Config
    • getDurationList

      public List<Long> getDurationList(String s, TimeUnit timeUnit)
      Specified by:
      getDurationList in interface com.typesafe.config.Config
    • getDurationList

      public List<Duration> getDurationList(String s)
      Specified by:
      getDurationList in interface com.typesafe.config.Config