Package org.apache.accumulo.core.conf
Class AccumuloConfiguration
- java.lang.Object
-
- org.apache.accumulo.core.conf.AccumuloConfiguration
-
- Direct Known Subclasses:
ConfigurationCopy
,DefaultConfiguration
,SiteConfiguration
public abstract class AccumuloConfiguration extends Object implements Iterable<Map.Entry<String,String>>
A configuration object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AccumuloConfiguration.Deriver<T>
Automatically regenerates an object whenever configuration changes.class
AccumuloConfiguration.ScanExecutorConfig
-
Constructor Summary
Constructors Constructor Description AccumuloConfiguration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
get(String property)
Gets a property value from this configuration.abstract String
get(Property property)
Gets a property value from this configuration.Map<String,String>
getAllCryptoProperties()
Map<String,String>
getAllPropertiesWithPrefix(Property property)
Gets all properties under the given prefix in this configuration.Map<String,String>
getAllPropertiesWithPrefixStripped(Property prefix)
long
getAsBytes(Property property)
Gets a property of typePropertyType.BYTES
orPropertyType.MEMORY
, interpreting the value properly.boolean
getBoolean(Property property)
Gets a property of typePropertyType.BOOLEAN
, interpreting the value properly (usingBoolean.parseBoolean()
).int
getCount(Property property)
Gets a property of typePropertyType.COUNT
, interpreting the value properly (as an integer).double
getFraction(Property property)
Gets a property of typePropertyType.FRACTION
, interpreting the value properly.int
getMaxFilesPerTablet()
Gets the maximum number of files per tablet from this configuration.AccumuloConfiguration
getParent()
get a parent configuration or null if it does not exist.String
getPath(Property property)
Gets a property of typePropertyType.PATH
.int[]
getPort(Property property)
Gets a property of typePropertyType.PORT
, interpreting the value properly (as an integer within the range of non-privileged ports).IntStream
getPortStream(Property property)
Same asgetPort(Property)
, but as anIntStream
.abstract void
getProperties(Map<String,String> props, Predicate<String> filter)
Returns property key/value pairs in this configuration.Collection<AccumuloConfiguration.ScanExecutorConfig>
getScanExecutors(boolean isScanServer)
long
getTimeInMillis(Property property)
Gets a property of typePropertyType.TIMEDURATION
, interpreting the value properly.long
getUpdateCount()
Each time configuration changes, this counter should increase.void
invalidateCache()
Invalidates theZooCache
used for storage and quick retrieval of properties for this configuration.abstract boolean
isPropertySet(Property prop)
Iterator<Map.Entry<String,String>>
iterator()
Returns an iterator over property key/value pairs in this configuration.<T> AccumuloConfiguration.Deriver<T>
newDeriver(Function<AccumuloConfiguration,T> converter)
Enables deriving an object from configuration and automatically deriving a new object any time configuration changes.Property
resolve(Property property, Property... deprecated)
Given a property that is not deprecated and an ordered list of deprecated properties, determine which one to use based on which is set by the user in the configuration.Stream<Map.Entry<String,String>>
stream()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
public String get(String property)
Gets a property value from this configuration.Note: this is inefficient for values that are not a
Property
. For retrieving multiple properties, usegetProperties(Map, Predicate)
with a custom filter.- Parameters:
property
- property to get- Returns:
- property value
-
get
public abstract String get(Property property)
Gets a property value from this configuration.- Parameters:
property
- property to get- Returns:
- property value
-
resolve
public Property resolve(Property property, Property... deprecated)
Given a property that is not deprecated and an ordered list of deprecated properties, determine which one to use based on which is set by the user in the configuration. If the non-deprecated property is set, use that. Otherwise, use the first deprecated property that is set. If no deprecated properties are set, use the non-deprecated property by default, even though it is not set (since it is not set, it will resolve to its default value). Since the deprecated properties are checked in order, newer properties should be on the left, replacing older properties on the right, so if a newer property is set, it will be selected over any older property that may also be set.
-
getProperties
public abstract void getProperties(Map<String,String> props, Predicate<String> filter)
Returns property key/value pairs in this configuration. The pairs include those defined in this configuration which pass the given filter, and those supplied from the parent configuration which are not included from here.- Parameters:
props
- properties object to populatefilter
- filter for accepting properties from this configuration
-
iterator
public Iterator<Map.Entry<String,String>> iterator()
Returns an iterator over property key/value pairs in this configuration. Some implementations may elect to omit properties.
-
getUpdateCount
public long getUpdateCount()
Each time configuration changes, this counter should increase. Anything that caches information that is derived from configuration can use this method to know when to update.
-
getAllPropertiesWithPrefix
public Map<String,String> getAllPropertiesWithPrefix(Property property)
Gets all properties under the given prefix in this configuration.- Parameters:
property
- prefix property, must be of type PropertyType.PREFIX- Returns:
- a map of property keys to values
- Throws:
IllegalArgumentException
- if property is not a prefix
-
getAllPropertiesWithPrefixStripped
public Map<String,String> getAllPropertiesWithPrefixStripped(Property prefix)
-
getAsBytes
public long getAsBytes(Property property)
Gets a property of typePropertyType.BYTES
orPropertyType.MEMORY
, interpreting the value properly.- Parameters:
property
- Property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getTimeInMillis
public long getTimeInMillis(Property property)
Gets a property of typePropertyType.TIMEDURATION
, interpreting the value properly.- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getBoolean
public boolean getBoolean(Property property)
Gets a property of typePropertyType.BOOLEAN
, interpreting the value properly (usingBoolean.parseBoolean()
).- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getFraction
public double getFraction(Property property)
Gets a property of typePropertyType.FRACTION
, interpreting the value properly.- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getPort
public int[] getPort(Property property)
Gets a property of typePropertyType.PORT
, interpreting the value properly (as an integer within the range of non-privileged ports). Consider usinggetPortStream(Property)
, if an array is not needed.- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getPortStream
public IntStream getPortStream(Property property)
Same asgetPort(Property)
, but as anIntStream
.
-
getCount
public int getCount(Property property)
Gets a property of typePropertyType.COUNT
, interpreting the value properly (as an integer).- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getPath
public String getPath(Property property)
Gets a property of typePropertyType.PATH
.- Parameters:
property
- property to get- Returns:
- property value
- Throws:
IllegalArgumentException
- if the property is of the wrong type
-
getMaxFilesPerTablet
public int getMaxFilesPerTablet()
Gets the maximum number of files per tablet from this configuration.- Returns:
- maximum number of files per tablet
- See Also:
Property.TABLE_FILE_MAX
,Property.TSERV_SCAN_MAX_OPENFILES
-
isPropertySet
public abstract boolean isPropertySet(Property prop)
-
newDeriver
public <T> AccumuloConfiguration.Deriver<T> newDeriver(Function<AccumuloConfiguration,T> converter)
Enables deriving an object from configuration and automatically deriving a new object any time configuration changes.- Parameters:
converter
- This functions is used to create an object from configuration. A reference to this function will be kept and called by the returned deriver.- Returns:
- The returned supplier will automatically re-derive the object any time this configuration changes. When configuration is not changing, the same object is returned.
-
getScanExecutors
public Collection<AccumuloConfiguration.ScanExecutorConfig> getScanExecutors(boolean isScanServer)
-
invalidateCache
public void invalidateCache()
Invalidates theZooCache
used for storage and quick retrieval of properties for this configuration.
-
getParent
public AccumuloConfiguration getParent()
get a parent configuration or null if it does not exist.- Since:
- 2.1.0
-
-