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 * @version $Id: ReloadingDetectorFactory.java 1624601 2014-09-12 18:04:36Z oheger $ 034 * @since 2.0 035 */ 036public interface ReloadingDetectorFactory 037{ 038 /** 039 * Creates a new {@code ReloadingDetector} object based on the passed in 040 * parameters. The {@code FileHandler} points to the file to be monitored. 041 * (It may be different from the {@code FileHandler} managed by the 042 * parameters object.) The {@code FileBasedBuilderParametersImpl} object may 043 * contain additional information for configuring the detector, e.g. a 044 * refresh delay. 045 * 046 * @param handler the handler of the file to be monitored 047 * @param params parameters related to file-based configurations 048 * @return the newly created {@code ReloadingDetector} 049 * @throws ConfigurationException if an error occurs 050 */ 051 ReloadingDetector createReloadingDetector(FileHandler handler, 052 FileBasedBuilderParametersImpl params) 053 throws ConfigurationException; 054}