001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.configuration2.builder.combined;
018
019import org.apache.commons.configuration2.Configuration;
020import org.apache.commons.configuration2.builder.ConfigurationBuilder;
021import org.apache.commons.configuration2.ex.ConfigurationException;
022
023/**
024 * <p>
025 * An interface for creating builders for configuration sources of a
026 * {@link CombinedConfigurationBuilder}.
027 * </p>
028 * <p>
029 * When processing its definition file {@code CombinedConfigurationBuilder}
030 * scans for tags declaring configuration sources and maps them to
031 * implementations of this interface. The instances are then used to obtain
032 * builder objects to create the corresponding configuration sources. Parameters
033 * of the builders are provided as {@link ConfigurationDeclaration} objects.
034 * </p>
035 *
036 * @since 2.0
037 */
038public interface ConfigurationBuilderProvider
039{
040    /**
041     * Returns the builder for the configuration source managed by this
042     * provider. This method is called during processing of the combined
043     * configuration definition file.
044     *
045     * @param decl the bean declaration with initialization parameters for the
046     *        configuration builder
047     * @return the {@code ConfigurationBuilder} object created by this provider
048     * @throws ConfigurationException if an error occurs
049     */
050    ConfigurationBuilder<? extends Configuration> getConfigurationBuilder(
051            ConfigurationDeclaration decl)
052            throws ConfigurationException;
053}