Package org.apache.accumulo.core.util
Class ConfigurationImpl
- java.lang.Object
-
- org.apache.accumulo.core.util.ConfigurationImpl
-
- All Implemented Interfaces:
Iterable<Map.Entry<String,String>>
,PluginEnvironment.Configuration
,ServiceEnvironment.Configuration
public class ConfigurationImpl extends Object implements ServiceEnvironment.Configuration
The implementation class used for providing SPI configuration without exposing internal types.
-
-
Constructor Summary
Constructors Constructor Description ConfigurationImpl(AccumuloConfiguration acfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
get(String key)
Map<String,String>
getCustom()
Users can set arbitrary custom properties in Accumulo using the prefixgeneral.custom.
.String
getCustom(String keySuffix)
This method appends the prefixgeneral.custom
and gets the property.<T> Supplier<T>
getDerived(Function<PluginEnvironment.Configuration,T> computeDerivedValue)
Returns a derived value from this Configuration.Map<String,String>
getTableCustom()
Users can set arbitrary custom table properties in Accumulo using the prefixtable.custom.
.String
getTableCustom(String keySuffix)
This method appends the prefixtable.custom
and gets the property.Map<String,String>
getWithPrefix(String prefix)
Returns all properties with a given prefixboolean
isSet(String key)
Properties with a default value will always return something when callingPluginEnvironment.Configuration.get(String)
, even if a user never set the property.Iterator<Map.Entry<String,String>>
iterator()
Returns an iterator over all properties.-
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
-
-
-
-
Constructor Detail
-
ConfigurationImpl
public ConfigurationImpl(AccumuloConfiguration acfg)
-
-
Method Detail
-
isSet
public boolean isSet(String key)
Description copied from interface:PluginEnvironment.Configuration
Properties with a default value will always return something when callingPluginEnvironment.Configuration.get(String)
, even if a user never set the property. The method allows checking if a user set a property.- Specified by:
isSet
in interfacePluginEnvironment.Configuration
- Returns:
- true if a user set this property and false if a user did not set it.
-
get
public String get(String key)
- Specified by:
get
in interfacePluginEnvironment.Configuration
- Returns:
- The value for a single property or null if not present. Sensitive properties are intentionally not returned in order to prevent inadvertent logging of them. If your plugin needs sensitive properties a getSensitive method could be added.
-
getWithPrefix
public Map<String,String> getWithPrefix(String prefix)
Description copied from interface:PluginEnvironment.Configuration
Returns all properties with a given prefix- Specified by:
getWithPrefix
in interfacePluginEnvironment.Configuration
- Parameters:
prefix
- prefix of properties to be returned. Include the trailing '.' in the prefix.- Returns:
- all properties with a given prefix
-
getCustom
public Map<String,String> getCustom()
Description copied from interface:PluginEnvironment.Configuration
Users can set arbitrary custom properties in Accumulo using the prefixgeneral.custom.
. This method will return all properties with that prefix, stripping the prefix. For example, assume the following properties were set :general.custom.prop1=123 general.custom.prop2=abc
[prop1=123,prop2=abc]
.- Specified by:
getCustom
in interfacePluginEnvironment.Configuration
-
getCustom
public String getCustom(String keySuffix)
Description copied from interface:PluginEnvironment.Configuration
This method appends the prefixgeneral.custom
and gets the property.- Specified by:
getCustom
in interfacePluginEnvironment.Configuration
- Returns:
- The same as calling
getCustom().get(keySuffix)
ORget("general.custom."+keySuffix)
-
getTableCustom
public Map<String,String> getTableCustom()
Description copied from interface:PluginEnvironment.Configuration
Users can set arbitrary custom table properties in Accumulo using the prefixtable.custom.
. This method will return all properties with that prefix, stripping the prefix. For example, assume the following properties were set :table.custom.tp1=ch1 table.custom.tp2=bh2
[tp1=ch1,tp2=bh2]
.- Specified by:
getTableCustom
in interfacePluginEnvironment.Configuration
-
getTableCustom
public String getTableCustom(String keySuffix)
Description copied from interface:PluginEnvironment.Configuration
This method appends the prefixtable.custom
and gets the property.- Specified by:
getTableCustom
in interfacePluginEnvironment.Configuration
- Returns:
- The same as calling
getTableCustom().get(keySuffix)
ORget("table.custom."+keySuffix)
-
iterator
public Iterator<Map.Entry<String,String>> iterator()
Description copied from interface:PluginEnvironment.Configuration
Returns an iterator over all properties. This may be inefficient, consider opening an issue if you have a use case that is only satisfied by this. Sensitive properties are intentionally suppressed in order to prevent inadvertent logging of them.
-
getDerived
public <T> Supplier<T> getDerived(Function<PluginEnvironment.Configuration,T> computeDerivedValue)
Description copied from interface:PluginEnvironment.Configuration
Returns a derived value from this Configuration. The returned value supplier is thread-safe and attempts to avoid re-computation of the response. The intended use for a derived value is to ensure that configuration changes that may be made in Zookeeper, for example, are always reflected in the returned value.- Specified by:
getDerived
in interfacePluginEnvironment.Configuration
-
-