public class Configuration extends Object
Constructor and Description |
---|
Configuration(Map<String,Map<String,String>> properties,
Map<String,Map<String,Map<String,String>>> attributes)
Configuration.
|
Configuration(Map<String,Map<String,String>> properties,
Map<String,Map<String,Map<String,String>>> attributes,
Configuration parentConfiguration)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
applyUpdatesToStackDefaultProperties(Configuration stackDefaultConfig,
Map<String,Map<String,String>> existingConfigurations,
Map<String,Map<String,String>> updatedConfigs)
Apply configuration changes from
updatedConfigs to config , but only
change properties that are either absent in the existing config, or have values that
match the stack default config. |
org.apache.commons.lang3.tuple.Pair<Map<String,Map<String,String>>,Map<String,Map<String,Map<String,String>>>> |
asPair() |
boolean |
containsConfig(String configType,
String propertyName) |
boolean |
containsConfigType(String configType) |
Configuration |
copy() |
boolean |
equals(Object obj) |
Collection<String> |
getAllConfigTypes()
Get the complete set of configuration types represented in both full properties and full attributes.
|
Map<String,Map<String,Map<String,String>>> |
getAttributes()
Get the attributes for this instance only; parent attributes aren't included.
|
String |
getAttributeValue(String configType,
String propertyName,
String attributeName)
Get the requested attribute value from the full merged set of attributes.
|
Map<String,Map<String,Map<String,String>>> |
getFullAttributes()
Get a complete merged map of attributes including this instance and the entire parent hierarchy.
|
Map<String,Map<String,String>> |
getFullProperties()
Get a complete merged map of properties including this instance and the entire parent hierarchy.
|
Map<String,Map<String,String>> |
getFullProperties(int depthLimit)
Get a merged map of properties including this instance and n levels of the parent hierarchy.
|
Configuration |
getParentConfiguration()
Get the parent configuration.
|
Map<String,Map<String,String>> |
getProperties()
Get the properties for this instance only; parent properties are not included.
|
String |
getPropertyValue(String configType,
String propertyName)
Get the requested property value from the full merged set of properties.
|
boolean |
isPropertySet(String configType,
String propertyName)
General convenience method to determine if a given property has been set in the cluster configuration
|
Set<String> |
moveProperties(String sourceConfigType,
String targetConfigType,
Set<String> propertiesToMove)
Moves the given properties from
sourceConfigType to targetConfigType . |
static Configuration |
newEmpty() |
static Configuration |
of(org.apache.commons.lang3.tuple.Pair<Map<String,Map<String,String>>,Map<String,Map<String,Map<String,String>>>> propertiesAndAttributes)
Create a new
Configuration based on a pair of maps. |
void |
removeConfigType(String configType)
Remove all occurrences of a config type
|
String |
removeProperty(String configType,
String propertyName)
Remove a property from the configuration hierarchy.
|
String |
setAttribute(String configType,
String propertyName,
String attributeName,
String attributeValue)
Set an attribute on the hierarchy.
|
void |
setParentConfiguration(Configuration parent)
Set the parent configuration.
|
String |
setProperty(String configType,
String propertyName,
String value)
Set a property on the configuration.
|
public Configuration(Map<String,Map<String,String>> properties, Map<String,Map<String,Map<String,String>>> attributes, Configuration parentConfiguration)
properties
- propertiesattributes
- attributesparentConfiguration
- parent configurationpublic Configuration(Map<String,Map<String,String>> properties, Map<String,Map<String,Map<String,String>>> attributes)
properties
- properties in configType -> propertyName -> value formatattributes
- attributes in configType -> attributeName -> propertyName -> attributeValue formatpublic static Configuration newEmpty()
public Set<String> applyUpdatesToStackDefaultProperties(Configuration stackDefaultConfig, Map<String,Map<String,String>> existingConfigurations, Map<String,Map<String,String>> updatedConfigs)
updatedConfigs
to config
, but only
change properties that are either absent in the existing config, or have values that
match the stack default config.public Configuration copy()
public Map<String,Map<String,String>> getProperties()
public Map<String,Map<String,String>> getFullProperties()
public Map<String,Map<String,String>> getFullProperties(int depthLimit)
depthLimit
- the number of parent levels to include in the results. Specifying 0 is the same
as calling getProperties()
public Map<String,Map<String,Map<String,String>>> getAttributes()
public Map<String,Map<String,Map<String,String>>> getFullAttributes()
public String getPropertyValue(String configType, String propertyName)
configType
- configuration typepropertyName
- property namepublic String getAttributeValue(String configType, String propertyName, String attributeName)
configType
- configuration typepropertyName
- attribute property nameattributeName
- attribute namepublic String setProperty(String configType, String propertyName, String value)
configType
- configuration typepropertyName
- property namevalue
- property valuepublic String removeProperty(String configType, String propertyName)
configType
- configuration typepropertyName
- property namepublic Set<String> moveProperties(String sourceConfigType, String targetConfigType, Set<String> propertiesToMove)
sourceConfigType
to targetConfigType
.
If a property is already present in the target, it will be removed from the source, but not overwritten in the target.sourceConfigType
- the config type to move properties fromtargetConfigType
- the config type to move properties topropertiesToMove
- names of properties to be movedpublic boolean isPropertySet(String configType, String propertyName)
configType
- the config type to checkpropertyName
- the property name to checkpublic String setAttribute(String configType, String propertyName, String attributeName, String attributeValue)
configType
- configuration typepropertyName
- attribute property nameattributeName
- attribute nameattributeValue
- attribute property valuepublic Collection<String> getAllConfigTypes()
public boolean containsConfigType(String configType)
public Configuration getParentConfiguration()
public void setParentConfiguration(Configuration parent)
parent
- parent configuration to setpublic void removeConfigType(String configType)
public static Configuration of(org.apache.commons.lang3.tuple.Pair<Map<String,Map<String,String>>,Map<String,Map<String,Map<String,String>>>> propertiesAndAttributes)
Configuration
based on a pair of maps.
(This is just a convenience method to be able to avoid local variables in a few places.)public org.apache.commons.lang3.tuple.Pair<Map<String,Map<String,String>>,Map<String,Map<String,Map<String,String>>>> asPair()
Copyright © 2022 Apache Software Foundation. All rights reserved.