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; 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 * Creates a new {@code ReloadingDetector} object based on the passed in parameters. The {@code FileHandler} points to 037 * the file to be monitored. (It may be different from the {@code FileHandler} managed by the parameters object.) The 038 * {@code FileBasedBuilderParametersImpl} object may contain additional information for configuring the detector, e.g. a 039 * refresh delay. 040 * 041 * @param handler the handler of the file to be monitored 042 * @param params parameters related to file-based configurations 043 * @return the newly created {@code ReloadingDetector} 044 * @throws ConfigurationException if an error occurs 045 */ 046 ReloadingDetector createReloadingDetector(FileHandler handler, FileBasedBuilderParametersImpl params) throws ConfigurationException; 047}