Class MultiFileConfigurationBuilderProvider

  • All Implemented Interfaces:
    ConfigurationBuilderProvider

    public class MultiFileConfigurationBuilderProvider
    extends BaseConfigurationBuilderProvider

    A specialized ConfigurationBuilderProvider implementation for integrating MultiFileConfigurationBuilder with CombinedConfigurationBuilder.

    When using a configuration source managed by MultiFileConfigurationBuilder it is not sufficient to store the configuration once obtained from the builder in the resulting combined configuration. Rather, it has to be ensured that each access to this configuration queries the builder anew so that it can evaluate its file pattern and return a different configuration if necessary. Therefore, this class returns a specialized wrapper over a MultiFileConfigurationBuilder which returns a configuration wrapping the builder; so accessing the configuration's properties actually calls back to the builder. This constellation is compatible with the way DynamicCombinedConfiguration manages its data.

    Since:
    2.0
    • Field Detail

      • BUILDER_CLASS

        private static final java.lang.String BUILDER_CLASS
        Constant for the name of the builder class.
        See Also:
        Constant Field Values
      • RELOADING_BUILDER_CLASS

        private static final java.lang.String RELOADING_BUILDER_CLASS
        Constant for the name of the reloading builder class.
        See Also:
        Constant Field Values
      • PARAM_CLASS

        private static final java.lang.String PARAM_CLASS
        Constant for the name of the parameters class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MultiFileConfigurationBuilderProvider

        public MultiFileConfigurationBuilderProvider​(java.lang.String configCls,
                                                     java.lang.String paramCls)
        Creates a new instance of MultiFileConfigurationBuilderProvider and sets the name of the configuration class to be returned by MultiFileConfigurationBuilder.
        Parameters:
        configCls - the name of the managed configuration class
        paramCls - the name of the class of the parameters object to configure the managed configuration
    • Method Detail

      • createWrapperBuilder

        private static ConfigurationBuilder<? extends Configuration> createWrapperBuilder​(ConfigurationBuilder<? extends Configuration> multiBuilder,
                                                                                          Configuration wrapConfig)
        Creates the ConfigurationBuilder to be returned by this provider. This is a very simple implementation which always returns the same wrapper configuration instance. The handling of builder listeners is delegated to the wrapped MultiFileConfigurationBuilder. If reloading is support, the builder returned by this method also implements the ReloadingControllerSupport interface.
        Parameters:
        multiBuilder - the MultiFileConfigurationBuilder
        wrapConfig - the configuration to be returned
        Returns:
        the wrapper builder
      • createWrapperConfiguration

        private Configuration createWrapperConfiguration​(ConfigurationBuilder builder)
        Creates a configuration which wraps the specified builder.
        Parameters:
        builder - the builder
        Returns:
        the wrapping configuration