public class XConfiguration extends org.apache.hadoop.conf.Configuration
OConfiguration(InputStream is).
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION_SUBSTITUTE_DEPTH |
protected static boolean |
initalized |
Constructor and Description |
---|
XConfiguration()
Create an empty configuration.
|
XConfiguration(InputStream is)
Create a configuration from an InputStream.
|
XConfiguration(Properties props)
Create an configuration from a Properties instance.
|
XConfiguration(Reader reader)
Create a configuration from an Reader.
|
Modifier and Type | Method and Description |
---|---|
static void |
copy(org.apache.hadoop.conf.Configuration source,
org.apache.hadoop.conf.Configuration target)
Copy configuration key/value pairs from one configuration to another if a property exists in the target, it gets
replaced.
|
String |
get(String name)
Get the value of the
name property, null if
no such property exists. |
String |
get(String name,
String defaultValue)
Get the value of the
name property. |
Class<?> |
getClassByName(String name)
This is a stop gap fix for HADOOP-4416.
|
String[] |
getTrimmedStrings(String name)
Get the comma delimited values of the name property as an array of trimmed Strings.
|
static void |
injectDefaults(org.apache.hadoop.conf.Configuration source,
org.apache.hadoop.conf.Configuration target)
Injects configuration key/value pairs from one configuration to another if the key does not exist in the target
configuration.
|
XConfiguration |
resolve()
Returns a new XConfiguration instance with all inline values resolved.
|
Properties |
toProperties()
Return a Properties instance with the configuration properties.
|
String |
toXmlString()
Return a string with the configuration in XML format.
|
String |
toXmlString(boolean prolog) |
XConfiguration |
trim()
Returns a new XConfiguration with all values trimmed.
|
addDefaultResource, addDeprecation, addDeprecation, addDeprecation, addDeprecation, addDeprecations, addResource, addResource, addResource, addResource, addResource, addResource, clear, dumpConfiguration, dumpDeprecatedKeys, getBoolean, getClass, getClass, getClassByNameOrNull, getClasses, getClassLoader, getConfResourceAsInputStream, getConfResourceAsReader, getDouble, getEnum, getFile, getFinalParameters, getFloat, getInstances, getInt, getInts, getLocalPath, getLong, getLongBytes, getPassword, getPasswordFromConfig, getPasswordFromCredentialProviders, getPattern, getPropertySources, getProps, getRange, getRaw, getResource, getSocketAddr, getSocketAddr, getStringCollection, getStrings, getStrings, getTimeDuration, getTrimmed, getTrimmed, getTrimmedStringCollection, getTrimmedStrings, getValByRegex, hasWarnedDeprecation, isDeprecated, iterator, main, readFields, reloadConfiguration, set, set, setBoolean, setBooleanIfUnset, setClass, setClassLoader, setDeprecatedProperties, setDouble, setEnum, setFloat, setIfUnset, setInt, setLong, setPattern, setQuietMode, setSocketAddr, setStrings, setTimeDuration, size, toString, unset, updateConnectAddr, updateConnectAddr, write, writeXml, writeXml
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String CONFIGURATION_SUBSTITUTE_DEPTH
protected static volatile boolean initalized
public XConfiguration()
Default values are not loaded.
public XConfiguration(InputStream is) throws IOException
Code canibalized from Configuration.loadResource()
.
is
- inputstream to read the configuration from.IOException
- thrown if the configuration could not be read.public XConfiguration(Reader reader) throws IOException
Code canibalized from Configuration.loadResource()
.
reader
- reader to read the configuration from.IOException
- thrown if the configuration could not be read.public XConfiguration(Properties props)
props
- Properties instance to get all properties from.public Properties toProperties()
public String get(String name)
name
property, null
if
no such property exists.
Values are processed for variable expansion
before being returned.get
in class org.apache.hadoop.conf.Configuration
name
- the property name.name
property,
or null if no such property exists.public String get(String name, String defaultValue)
name
property. If no such property
exists, then defaultValue
is returned.get
in class org.apache.hadoop.conf.Configuration
name
- property name.defaultValue
- default value.defaultValue
if the property
doesn't exist.public Class<?> getClassByName(String name) throws ClassNotFoundException
getClassByName
in class org.apache.hadoop.conf.Configuration
ClassNotFoundException
public static void copy(org.apache.hadoop.conf.Configuration source, org.apache.hadoop.conf.Configuration target)
source
- source configuration.target
- target configuration.public static void injectDefaults(org.apache.hadoop.conf.Configuration source, org.apache.hadoop.conf.Configuration target)
source
- source configuration.target
- target configuration.public XConfiguration trim()
public XConfiguration resolve()
public String toXmlString()
public String toXmlString(boolean prolog)
public String[] getTrimmedStrings(String name)
getTrimmedStrings
in class org.apache.hadoop.conf.Configuration
name
- property name.Copyright © 2018 Apache Software Foundation. All rights reserved.