    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 *     https://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;
    018
    019import org.apache.commons.configuration2.ex.ConfigurationException;
    020import org.apache.commons.configuration2.io.FileHandler;
    021import org.apache.commons.configuration2.reloading.ReloadingDetector;
    022
    023/**
    024 * <p>
    025 * Definition of an interface for objects which can create a {@link ReloadingDetector}.
    026 * </p>
    027 * <p>
    028 * This interface is used by {@link ReloadingFileBasedConfigurationBuilder} to create detector objects for configuration
    029 * sources supporting reloading.
    030 * </p>
    031 *
    032 * @since 2.0
    033 */
    034public interface ReloadingDetectorFactory {
    035
    036    /**
    037     * Creates a new {@code ReloadingDetector} object based on the passed in parameters. The {@code FileHandler} points to
    038     * the file to be monitored. (It may be different from the {@code FileHandler} managed by the parameters object.) The
    039     * {@code FileBasedBuilderParametersImpl} object may contain additional information for configuring the detector, for example a
    040     * refresh delay.
    041     *
    042     * @param handler the handler of the file to be monitored
    043     * @param params parameters related to file-based configurations
    044     * @return the newly created {@code ReloadingDetector}
    045     * @throws ConfigurationException if an error occurs
    046     */
    047    ReloadingDetector createReloadingDetector(FileHandler handler, FileBasedBuilderParametersImpl params) throws ConfigurationException;
    048}