Package org.apache.hadoop.hbase
Class CompoundConfiguration
java.lang.Object
org.apache.hadoop.conf.Configuration
org.apache.hadoop.hbase.CompoundConfiguration
Do a shallow merge of multiple KV configuration pools. This is a very useful utility class to
easily add per-object configurations in addition to wider scope settings. This is different from
Configuration.addResource() functionality, which performs a deep merge and mutates the common
data structure.
The iterator on CompoundConfiguration is unmodifiable. Obtaining iterator is an expensive operation.
For clarity: the shallow merge allows the user to mutate either of the configuration objects and have changes reflected everywhere. In contrast to a deep merge, that requires you to explicitly know all applicable copies to propagate changes. WARNING: The values set in the CompoundConfiguration are do not handle Property variable substitution. However, if they are set in the underlying configuration substitutions are done.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static interface
(package private) static class
Nested classes/interfaces inherited from class org.apache.hadoop.conf.Configuration
org.apache.hadoop.conf.Configuration.DeprecationDelta, org.apache.hadoop.conf.Configuration.IntegerRanges
-
Field Summary
Modifier and TypeFieldDescriptionprivate final List<CompoundConfiguration.ImmutableConfigMap>
private org.apache.hadoop.conf.Configuration
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(org.apache.hadoop.conf.Configuration conf) Add Hadoop Configuration object to config list.addBytesMap
(Map<Bytes, Bytes> map) Add Bytes map to config list.addStringMap
(Map<String, String> map) Add String map to config list.void
clear()
These methods are unsupported, and no code using CompoundConfiguration depend upon them.(package private) void
If set has been called, it will create a mutableConf.Get the value of thename
.Class<?>
getClassByName
(String name) iterator()
void
int
size()
toString()
void
write
(DataOutput out) void
writeXml
(OutputStream out) Methods inherited from class org.apache.hadoop.conf.Configuration
addDefaultResource, addDeprecation, addDeprecation, addDeprecation, addDeprecation, addDeprecations, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addTags, dumpConfiguration, dumpConfiguration, dumpDeprecatedKeys, getAllPropertiesByTag, getAllPropertiesByTags, getBoolean, getClass, getClass, getClassByNameOrNull, getClasses, getClassLoader, getConfResourceAsInputStream, getConfResourceAsReader, getDouble, getEnum, getEnumSet, getFile, getFinalParameters, getFloat, getInstances, getInt, getInts, getLocalPath, getLong, getLongBytes, getPassword, getPasswordFromConfig, getPasswordFromCredentialProviders, getPattern, getPropertySources, getProps, getPropsWithPrefix, getRange, getResource, getSocketAddr, getSocketAddr, getStorageSize, getStorageSize, getStringCollection, getStrings, getStrings, getTimeDuration, getTimeDuration, getTimeDuration, getTimeDuration, getTimeDurationHelper, getTimeDurations, getTrimmed, getTrimmed, getTrimmedStringCollection, getTrimmedStrings, getTrimmedStrings, getValByRegex, hasWarnedDeprecation, isDeprecated, isPropertyTag, main, onlyKeyExists, readFields, reloadConfiguration, reloadExistingConfigurations, set, setAllowNullValueProperties, setBoolean, setBooleanIfUnset, setClass, setClassLoader, setDeprecatedProperties, setDouble, setEnum, setFloat, setIfUnset, setInt, setLong, setPattern, setQuietMode, setRestrictSystemProperties, setRestrictSystemPropertiesDefault, setRestrictSystemProps, setSocketAddr, setStorageSize, setStrings, setTimeDuration, substituteCommonVariables, unset, updateConnectAddr, updateConnectAddr, writeXml, writeXml, writeXml
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
mutableConf
-
configs
-
-
Constructor Details
-
CompoundConfiguration
public CompoundConfiguration()Default Constructor. Initializes empty configuration
-
-
Method Details
-
freezeMutableConf
void freezeMutableConf()If set has been called, it will create a mutableConf. This converts the mutableConf to an immutable one and resets it to allow a new mutable conf. This is used when a new map or conf is added to the compound configuration to preserve proper override semantics. -
add
Add Hadoop Configuration object to config list. The added configuration overrides the previous ones if there are name collisions.- Parameters:
conf
- configuration object- Returns:
- this, for builder pattern
-
addBytesMap
Add Bytes map to config list. This map is generally created by HTableDescriptor or HColumnDescriptor, but can be abstractly used. The added configuration overrides the previous ones if there are name collisions. Bytes map- Returns:
- this, for builder pattern
-
addStringMap
Add String map to config list. This map is generally created by HTableDescriptor or HColumnDescriptor, but can be abstractly used. The added configuration overrides the previous ones if there are name collisions.- Returns:
- this, for builder pattern
-
toString
- Overrides:
toString
in classorg.apache.hadoop.conf.Configuration
-
get
- Overrides:
get
in classorg.apache.hadoop.conf.Configuration
-
getRaw
- Overrides:
getRaw
in classorg.apache.hadoop.conf.Configuration
-
getClassByName
- Overrides:
getClassByName
in classorg.apache.hadoop.conf.Configuration
- Throws:
ClassNotFoundException
-
size
- Overrides:
size
in classorg.apache.hadoop.conf.Configuration
-
get
Get the value of thename
. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. If no such property exists, thendefaultValue
is returned. The CompooundConfiguration does not do property substitution. To do so we need Configuration.getProps to be protected or package visible. Though in hadoop2 it is protected, in hadoop1 the method is private and not accessible. All of the get* methods call this overridden get method.- Overrides:
get
in classorg.apache.hadoop.conf.Configuration
- Parameters:
name
- property name.defaultValue
- default value.- Returns:
- property value, or
defaultValue
if the property doesn't exist.
-
iterator
-
set
- Overrides:
set
in classorg.apache.hadoop.conf.Configuration
-
clear
These methods are unsupported, and no code using CompoundConfiguration depend upon them. Quickly abort upon any attempts to use them.- Overrides:
clear
in classorg.apache.hadoop.conf.Configuration
-
write
- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Overrides:
write
in classorg.apache.hadoop.conf.Configuration
- Throws:
IOException
-
writeXml
- Overrides:
writeXml
in classorg.apache.hadoop.conf.Configuration
- Throws:
IOException
-