Class ConfigHelper

java.lang.Object
org.apache.hadoop.yarn.service.utils.ConfigHelper

public class ConfigHelper extends Object
Methods to aid in config, both in the Configuration class and with other parts of setting up Slider-initated processes. Some of the methods take an argument of a map iterable for their sources; this allows the same method
  • Constructor Details

    • ConfigHelper

      public ConfigHelper()
  • Method Details

    • addConfigMap

      public static void addConfigMap(org.apache.hadoop.conf.Configuration config, Map<String,String> map, String origin) throws BadConfigException
      Set an entire map full of values
      Parameters:
      config - config to patch
      map - map of data
      origin - origin data
      Throws:
      BadConfigException
    • addConfigMap

      public static void addConfigMap(org.apache.hadoop.conf.Configuration config, Iterable<Map.Entry<String,String>> map, String origin) throws BadConfigException
      Set an entire map full of values
      Parameters:
      config - config to patch
      map - map of data
      origin - origin data
      Throws:
      BadConfigException
    • toXml

      public static String toXml(org.apache.hadoop.conf.Configuration conf) throws IOException
      Convert to an XML string
      Parameters:
      conf - configuration
      Returns:
      conf
      Throws:
      IOException
    • registerDefaultResource

      public static URL registerDefaultResource(String resource)
      Register a resource as a default resource. Do not attempt to use this unless you understand that the order in which default resources are loaded affects the outcome, and that subclasses of Configuration often register new default resources
      Parameters:
      resource - the resource name
      Returns:
      the URL or null
    • loadFromResource

      public static org.apache.hadoop.conf.Configuration loadFromResource(String resource)
      Load a configuration from a resource on this classpath. If the resource is not found, an empty configuration is returned
      Parameters:
      resource - the resource name
      Returns:
      the loaded configuration.
    • getResourceUrl

      public static URL getResourceUrl(String resource)
      Get the URL to a resource, null if not on the CP
      Parameters:
      resource - resource to look for
      Returns:
      the URL or null
    • resolveConfiguration

      public static org.apache.hadoop.conf.Configuration resolveConfiguration(Iterable<Map.Entry<String,String>> keysource, org.apache.hadoop.conf.Configuration valuesource)
      This goes through the keyset of one configuration and retrieves each value from a value source -a different or the same configuration. This triggers the property resolution process of the value, resolving any variables against in-config or inherited configurations
      Parameters:
      keysource - source of keys
      valuesource - the source of values
      Returns:
      a new configuration where foreach key in keysource, get(key)==valuesource.get(key)