View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.configuration2.builder;
18  
19  import org.apache.commons.configuration2.ex.ConfigurationException;
20  import org.apache.commons.configuration2.io.FileHandler;
21  import org.apache.commons.configuration2.reloading.ReloadingDetector;
22  
23  /**
24   * <p>
25   * Definition of an interface for objects which can create a {@link ReloadingDetector}.
26   * </p>
27   * <p>
28   * This interface is used by {@link ReloadingFileBasedConfigurationBuilder} to create detector objects for configuration
29   * sources supporting reloading.
30   * </p>
31   *
32   * @since 2.0
33   */
34  public interface ReloadingDetectorFactory {
35      /**
36       * Creates a new {@code ReloadingDetector} object based on the passed in parameters. The {@code FileHandler} points to
37       * the file to be monitored. (It may be different from the {@code FileHandler} managed by the parameters object.) The
38       * {@code FileBasedBuilderParametersImpl} object may contain additional information for configuring the detector, e.g. a
39       * refresh delay.
40       *
41       * @param handler the handler of the file to be monitored
42       * @param params parameters related to file-based configurations
43       * @return the newly created {@code ReloadingDetector}
44       * @throws ConfigurationException if an error occurs
45       */
46      ReloadingDetector createReloadingDetector(FileHandler handler, FileBasedBuilderParametersImpl params) throws ConfigurationException;
47  }