Class CombinedConfigurationBuilder.ConfigurationSourceData

java.lang.Object
org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.ConfigurationSourceData
Enclosing class:
CombinedConfigurationBuilder

private class CombinedConfigurationBuilder.ConfigurationSourceData extends Object
A data class for storing information about all configuration sources defined for a combined builder.
  • Field Details

  • Constructor Details

    • ConfigurationSourceData

      public ConfigurationSourceData()
      Creates a new instance of ConfigurationSourceData.
  • 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 configuration
      srcDecl - 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

      public Collection<ConfigurationBuilder<? extends Configuration>> getChildBuilders()
      Gets a collection containing the builders for all child configuration sources.
      Returns:
      the child configuration builders
    • getOverrideSources

      public List<ConfigurationDeclaration> getOverrideSources()
      Gets a collection with all configuration source declarations defined in the override section.
      Returns:
      the override configuration builders
    • getUnionSources

      public List<ConfigurationDeclaration> getUnionSources()
      Gets a collection with all configuration source declarations defined in the union section.
      Returns:
      the union configuration builders
    • getNamedBuilder

      public ConfigurationBuilder<? extends Configuration> getNamedBuilder(String name)
      Gets the ConfigurationBuilder 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

      public Set<String> 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 current ConfigurationDeclaration
      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 configuration
      decl - the current ConfigurationDeclaration
      builder - the configuration builder
      Throws:
      ConfigurationException - if an error occurs
    • createBuilderChangeListener

      private EventListener<ConfigurationBuilderEvent> 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