Class CombinedConfigurationBuilder.ConfigurationSourceData
java.lang.Object
org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.ConfigurationSourceData
- Enclosing class:
CombinedConfigurationBuilder
A data class for storing information about all configuration sources defined for a combined builder.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Collection
<ConfigurationBuilder<? extends Configuration>> A collection with all child builders.private final EventListener
<ConfigurationBuilderEvent> A listener for reacting on changes of sub builders.private final Map
<String, ConfigurationBuilder<? extends Configuration>> A map for direct access to a builder by its name.private final List
<ConfigurationBuilder<? extends Configuration>> A list with the builders for override configurations.private final List
<ConfigurationDeclaration> A list with data for all builders for override configurations.private final List
<ConfigurationBuilder<? extends Configuration>> A list with the builders for union configurations.private final List
<ConfigurationDeclaration> A list with data for all builders for union configurations. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofConfigurationSourceData
. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addChildConfiguration
(CombinedConfiguration ccResult, ConfigurationDeclaration decl, ConfigurationBuilder<? extends Configuration> builder) Creates a new configuration using the specified builder and adds it to the resulting combined configuration.Returns a set with the names of all known named builders.void
cleanUp()
Frees resources used by this object and performs clean up.List
<ConfigurationBuilder<? extends Configuration>> createAndAddConfigurations
(CombinedConfiguration ccResult, List<ConfigurationDeclaration> srcDecl, List<ConfigurationBuilder<? extends Configuration>> builders) Processes the declaration of configuration builder providers, creates the corresponding builder if necessary, obtains configurations, and adds them to the specified result configuration.private EventListener
<ConfigurationBuilderEvent> Creates a listener for builder change events.private ConfigurationBuilder
<? extends Configuration> Creates a configuration builder based on a source declaration in the definition configuration.private List
<? extends HierarchicalConfiguration<?>> Finds the override configurations that are defined as top level elements in the configuration definition file.Collection
<ConfigurationBuilder<? extends Configuration>> Gets a collection containing the builders for all child configuration sources.ConfigurationBuilder
<? extends Configuration> getNamedBuilder
(String name) Gets theConfigurationBuilder
with the given name.Gets a collection with all configuration source declarations defined in the override section.Gets a collection with all configuration source declarations defined in the union section.void
Initializes this object from the specified definition configuration.
-
Field Details
-
overrideDeclarations
A list with data for all builders for override configurations. -
unionDeclarations
A list with data for all builders for union configurations. -
overrideBuilders
A list with the builders for override configurations. -
unionBuilders
A list with the builders for union configurations. -
namedBuilders
A map for direct access to a builder by its name. -
allBuilders
A collection with all child builders. -
changeListener
A listener for reacting on changes of sub builders.
-
-
Constructor Details
-
ConfigurationSourceData
public ConfigurationSourceData()Creates a new instance ofConfigurationSourceData
.
-
-
Method Details
-
initFromDefinitionConfiguration
public void initFromDefinitionConfiguration(HierarchicalConfiguration<?> config) throws ConfigurationException Initializes this object from the specified definition configuration.- Parameters:
config
- the definition configuration- Throws:
ConfigurationException
- if an error occurs
-
createAndAddConfigurations
public List<ConfigurationBuilder<? extends Configuration>> createAndAddConfigurations(CombinedConfiguration ccResult, List<ConfigurationDeclaration> srcDecl, List<ConfigurationBuilder<? extends Configuration>> builders) throws ConfigurationException Processes the declaration of configuration builder providers, creates the corresponding builder if necessary, obtains configurations, and adds them to the specified result configuration.- Parameters:
ccResult
- the result configurationsrcDecl
- the collection with the declarations of configuration sources to process- Returns:
- a list with configuration builders
- Throws:
ConfigurationException
- if an error occurs
-
cleanUp
public void cleanUp()Frees resources used by this object and performs clean up. This method is called when the owning builder is reset. -
getChildBuilders
Gets a collection containing the builders for all child configuration sources.- Returns:
- the child configuration builders
-
getOverrideSources
Gets a collection with all configuration source declarations defined in the override section.- Returns:
- the override configuration builders
-
getUnionSources
Gets a collection with all configuration source declarations defined in the union section.- Returns:
- the union configuration builders
-
getNamedBuilder
Gets theConfigurationBuilder
with the given name. If no such builder is defined in the definition configuration, result is null.- Parameters:
name
- the name of the builder in question- Returns:
- the builder with this name or null
-
builderNames
Returns a set with the names of all known named builders.- Returns:
- the names of the available sub builders
-
createConfigurationBuilder
private ConfigurationBuilder<? extends Configuration> createConfigurationBuilder(ConfigurationDeclaration decl) throws ConfigurationException Creates a configuration builder based on a source declaration in the definition configuration.- Parameters:
decl
- the currentConfigurationDeclaration
- Returns:
- the newly created builder
- Throws:
ConfigurationException
- if an error occurs
-
addChildConfiguration
private void addChildConfiguration(CombinedConfiguration ccResult, ConfigurationDeclaration decl, ConfigurationBuilder<? extends Configuration> builder) throws ConfigurationException Creates a new configuration using the specified builder and adds it to the resulting combined configuration.- Parameters:
ccResult
- the resulting combined configurationdecl
- the currentConfigurationDeclaration
builder
- the configuration builder- Throws:
ConfigurationException
- if an error occurs
-
createBuilderChangeListener
Creates a listener for builder change events. This listener is registered at all builders for child configurations. -
fetchTopLevelOverrideConfigs
private List<? extends HierarchicalConfiguration<?>> fetchTopLevelOverrideConfigs(HierarchicalConfiguration<?> config) Finds the override configurations that are defined as top level elements in the configuration definition file. This method fetches the child elements of the root node and removes the nodes that represent other configuration sections. The remaining nodes are treated as definitions for override configurations.- Parameters:
config
- the definition configuration- Returns:
- a list with sub configurations for the top level override configurations
-