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 026 * {@link ReloadingDetector}. 027 * </p> 028 * <p> 029 * This interface is used by {@link ReloadingFileBasedConfigurationBuilder} to 030 * create detector objects for configuration sources supporting reloading. 031 * </p> 032 * 033 * @since 2.0 034 */ 035public interface ReloadingDetectorFactory 036{ 037 /** 038 * Creates a new {@code ReloadingDetector} object based on the passed in 039 * parameters. The {@code FileHandler} points to the file to be monitored. 040 * (It may be different from the {@code FileHandler} managed by the 041 * parameters object.) The {@code FileBasedBuilderParametersImpl} object may 042 * contain additional information for configuring the detector, e.g. a 043 * refresh delay. 044 * 045 * @param handler the handler of the file to be monitored 046 * @param params parameters related to file-based configurations 047 * @return the newly created {@code ReloadingDetector} 048 * @throws ConfigurationException if an error occurs 049 */ 050 ReloadingDetector createReloadingDetector(FileHandler handler, 051 FileBasedBuilderParametersImpl params) 052 throws ConfigurationException; 053}