Package alluxio.conf
Class InstancedConfiguration
- java.lang.Object
-
- alluxio.conf.InstancedConfiguration
-
- All Implemented Interfaces:
AlluxioConfiguration
public class InstancedConfiguration extends java.lang.Object implements AlluxioConfiguration
Alluxio configuration. WARNING: This API is not intended to be used outside of internal Alluxio code and may be changed or removed in a future minor release. Application code should use APIsConfiguration
.
-
-
Field Summary
Fields Modifier and Type Field Description protected AlluxioProperties
mProperties
Source of the truth of all property values (default or customized).
-
Constructor Summary
Constructors Constructor Description InstancedConfiguration(AlluxioProperties properties)
Creates a new instance ofInstancedConfiguration
.InstancedConfiguration(AlluxioProperties properties, boolean clusterDefaultsLoaded)
Creates a new instance ofInstancedConfiguration
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
clusterDefaultsLoaded()
AlluxioProperties
copyProperties()
Gets a copy of theAlluxioProperties
which back theAlluxioConfiguration
.java.lang.Object
get(PropertyKey key)
Gets the value for the given key in theProperties
; if this key is not found, a RuntimeException is thrown.java.lang.Object
get(PropertyKey key, ConfigurationValueOptions options)
Gets the value for the given key in theProperties
; if this key is not found, a RuntimeException is thrown.boolean
getBoolean(PropertyKey key)
Gets the boolean representation of the value for the given key.long
getBytes(PropertyKey key)
Gets the bytes of the value for the given key.<T> java.lang.Class<T>
getClass(PropertyKey key)
Gets the value for the given key as a class.double
getDouble(PropertyKey key)
Gets the double representation of the value for the given key.java.time.Duration
getDuration(PropertyKey key)
Gets the time of the key as a duration.<T extends java.lang.Enum<T>>
TgetEnum(PropertyKey key, java.lang.Class<T> enumType)
Gets the value for the given key as an enum value.int
getInt(PropertyKey key)
Gets the integer representation of the value for the given key.java.util.List<java.lang.String>
getList(PropertyKey key)
Gets the value for the given key as a list.long
getLong(PropertyKey key)
Gets the long integer representation of the value for the given key.long
getMs(PropertyKey key)
Gets the time of key in millisecond unit.java.util.Map<java.lang.String,java.lang.Object>
getNestedProperties(PropertyKey prefixKey)
Gets a set of properties that share a given common prefix key as a map.AlluxioProperties
getProperties()
Return reference to mProperties.Source
getSource(PropertyKey key)
java.lang.String
getString(PropertyKey key)
Gets the String value for the given key.java.lang.String
hash()
boolean
isSet(PropertyKey key)
Checks if the configuration contains a value for the given key.boolean
isSetByUser(PropertyKey key)
java.util.Set<PropertyKey>
keySet()
void
merge(java.util.Map<?,?> properties, Source source)
Merges map of properties into the current alluxio properties.void
set(PropertyKey key, java.lang.Object value)
Sets the value for the appropriate key in theProperties
.void
set(PropertyKey key, java.lang.Object value, Source source)
Sets the value for the appropriate key in theProperties
by source.void
set(PropertyKey key, java.lang.String value)
Deprecated.API to aid property key type transitionjava.util.Map<java.lang.String,java.lang.Object>
toMap(ConfigurationValueOptions opts)
void
unset(PropertyKey key)
Unsets the value for the appropriate key in theProperties
.java.util.Set<PropertyKey>
userKeySet()
void
validate()
Validates the configuration.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface alluxio.conf.AlluxioConfiguration
getOrDefault, getOrDefault, toMap
-
-
-
-
Field Detail
-
mProperties
protected final AlluxioProperties mProperties
Source of the truth of all property values (default or customized).
-
-
Constructor Detail
-
InstancedConfiguration
public InstancedConfiguration(AlluxioProperties properties)
Creates a new instance ofInstancedConfiguration
. WARNING: This API is not intended to be used outside of internal Alluxio code and may be changed or removed in a future minor release. Application code should useConfiguration.global()
.- Parameters:
properties
- alluxio properties underlying this configuration
-
InstancedConfiguration
public InstancedConfiguration(AlluxioProperties properties, boolean clusterDefaultsLoaded)
Creates a new instance ofInstancedConfiguration
. WARNING: This API is not intended to be used outside of internal Alluxio code and may be changed or removed in a future minor release. Application code should useConfiguration.global()
.- Parameters:
properties
- alluxio properties underlying this configurationclusterDefaultsLoaded
- Whether or not the properties represent the cluster defaults
-
-
Method Detail
-
getProperties
public AlluxioProperties getProperties()
Return reference to mProperties.- Returns:
- mProperties
-
copyProperties
public AlluxioProperties copyProperties()
Description copied from interface:AlluxioConfiguration
Gets a copy of theAlluxioProperties
which back theAlluxioConfiguration
.- Specified by:
copyProperties
in interfaceAlluxioConfiguration
- Returns:
- A copy of AlluxioProperties representing the configuration
-
get
public java.lang.Object get(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the value for the given key in theProperties
; if this key is not found, a RuntimeException is thrown.- Specified by:
get
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key
-
get
public java.lang.Object get(PropertyKey key, ConfigurationValueOptions options)
Description copied from interface:AlluxioConfiguration
Gets the value for the given key in theProperties
; if this key is not found, a RuntimeException is thrown.- Specified by:
get
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value foroptions
- options for getting configuration value- Returns:
- the value for the given key
-
isSet
public boolean isSet(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Checks if the configuration contains a value for the given key.- Specified by:
isSet
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to check- Returns:
- true if there is value for the key, false otherwise
-
isSetByUser
public boolean isSetByUser(PropertyKey key)
- Specified by:
isSetByUser
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to check- Returns:
- true if there is value for the key set by user, false otherwise even when there is a default value for the key
-
set
public void set(PropertyKey key, java.lang.Object value)
Sets the value for the appropriate key in theProperties
.- Parameters:
key
- the key to setvalue
- the value for the key
-
set
@Deprecated public void set(@Nonnull PropertyKey key, @Nonnull java.lang.String value)
Deprecated.API to aid property key type transitionSets the value for the appropriate key in theProperties
.- Parameters:
key
- the key to setvalue
- the value for the key
-
set
public void set(@Nonnull PropertyKey key, @Nonnull java.lang.Object value, @Nonnull Source source)
Sets the value for the appropriate key in theProperties
by source.- Parameters:
key
- the key to setvalue
- the value for the keysource
- the source of the the properties (e.g., system property, default and etc)
-
unset
public void unset(PropertyKey key)
Unsets the value for the appropriate key in theProperties
. If thePropertyKey
has a default value, it will still be considered set after executing this method.- Parameters:
key
- the key to unset
-
merge
public void merge(java.util.Map<?,?> properties, Source source)
Merges map of properties into the current alluxio properties.- Parameters:
properties
- map of keys to valuessource
- the source type for these properties
-
keySet
public java.util.Set<PropertyKey> keySet()
- Specified by:
keySet
in interfaceAlluxioConfiguration
- Returns:
- the keys configured by the configuration
-
userKeySet
public java.util.Set<PropertyKey> userKeySet()
- Specified by:
userKeySet
in interfaceAlluxioConfiguration
- Returns:
- the keys set by user
-
getString
public java.lang.String getString(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the String value for the given key.- Specified by:
getString
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as an
String
-
getInt
public int getInt(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the integer representation of the value for the given key.- Specified by:
getInt
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as an
int
-
getLong
public long getLong(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the long integer representation of the value for the given key.- Specified by:
getLong
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as a
long
-
getDouble
public double getDouble(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the double representation of the value for the given key.- Specified by:
getDouble
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as a
double
-
getBoolean
public boolean getBoolean(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the boolean representation of the value for the given key.- Specified by:
getBoolean
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as a
boolean
-
getList
public java.util.List<java.lang.String> getList(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the value for the given key as a list.- Specified by:
getList
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the list of values for the given key
-
getEnum
public <T extends java.lang.Enum<T>> T getEnum(PropertyKey key, java.lang.Class<T> enumType)
Description copied from interface:AlluxioConfiguration
Gets the value for the given key as an enum value.- Specified by:
getEnum
in interfaceAlluxioConfiguration
- Type Parameters:
T
- the type of the enum- Parameters:
key
- the key to get the value forenumType
- the type of the enum- Returns:
- the value for the given key as an enum value
-
getBytes
public long getBytes(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the bytes of the value for the given key.- Specified by:
getBytes
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the bytes of the value for the given key
-
getMs
public long getMs(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the time of key in millisecond unit.- Specified by:
getMs
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the time of key in millisecond unit
-
getDuration
public java.time.Duration getDuration(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the time of the key as a duration.- Specified by:
getDuration
in interfaceAlluxioConfiguration
- Parameters:
key
- the key to get the value for- Returns:
- the value of the key represented as a duration
-
getClass
public <T> java.lang.Class<T> getClass(PropertyKey key)
Description copied from interface:AlluxioConfiguration
Gets the value for the given key as a class.- Specified by:
getClass
in interfaceAlluxioConfiguration
- Type Parameters:
T
- the type of the class- Parameters:
key
- the key to get the value for- Returns:
- the value for the given key as a class
-
getNestedProperties
public java.util.Map<java.lang.String,java.lang.Object> getNestedProperties(PropertyKey prefixKey)
Description copied from interface:AlluxioConfiguration
Gets a set of properties that share a given common prefix key as a map. E.g., if A.B=V1 and A.C=V2, calling this method with prefixKey=A returns a map of {B=V1, C=V2}, where B and C are also valid properties. If no property shares the prefix, an empty map is returned.- Specified by:
getNestedProperties
in interfaceAlluxioConfiguration
- Parameters:
prefixKey
- the prefix key- Returns:
- a map from nested properties aggregated by the prefix
-
getSource
public Source getSource(PropertyKey key)
- Specified by:
getSource
in interfaceAlluxioConfiguration
- Parameters:
key
- the property key- Returns:
- the source for the given key
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap(ConfigurationValueOptions opts)
- Specified by:
toMap
in interfaceAlluxioConfiguration
- Parameters:
opts
- options for formatting the configuration values- Returns:
- a map from all configuration property names to their values; values may potentially be null
-
validate
public void validate()
Description copied from interface:AlluxioConfiguration
Validates the configuration.- Specified by:
validate
in interfaceAlluxioConfiguration
-
clusterDefaultsLoaded
public boolean clusterDefaultsLoaded()
- Specified by:
clusterDefaultsLoaded
in interfaceAlluxioConfiguration
- Returns:
- whether the configuration has been merged with cluster defaults
-
hash
public java.lang.String hash()
- Specified by:
hash
in interfaceAlluxioConfiguration
- Returns:
- hash of properties, if hashing is not supported, return empty string
-
-