Class ConfigHelper
java.lang.Object
org.apache.hadoop.yarn.service.utils.ConfigHelper
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddConfigMap(org.apache.hadoop.conf.Configuration config, Iterable<Map.Entry<String, String>> map, String origin) Set an entire map full of valuesstatic voidaddConfigMap(org.apache.hadoop.conf.Configuration config, Map<String, String> map, String origin) Set an entire map full of valuesstatic URLgetResourceUrl(String resource) Get the URL to a resource, null if not on the CPstatic org.apache.hadoop.conf.ConfigurationloadFromResource(String resource) Load a configuration from a resource on this classpath.static URLregisterDefaultResource(String resource) Register a resource as a default resource.static org.apache.hadoop.conf.ConfigurationresolveConfiguration(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.static StringtoXml(org.apache.hadoop.conf.Configuration conf) Convert to an XML string
-
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 BadConfigExceptionSet an entire map full of values- Parameters:
config- config to patchmap- map of dataorigin- origin data- Throws:
BadConfigException
-
addConfigMap
public static void addConfigMap(org.apache.hadoop.conf.Configuration config, Iterable<Map.Entry<String, String>> map, String origin) throws BadConfigExceptionSet an entire map full of values- Parameters:
config- config to patchmap- map of dataorigin- origin data- Throws:
BadConfigException
-
toXml
Convert to an XML string- Parameters:
conf- configuration- Returns:
- conf
- Throws:
IOException
-
registerDefaultResource
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
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
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 keysvaluesource- the source of values- Returns:
- a new configuration where
foreach key in keysource, get(key)==valuesource.get(key)
-