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 java.io.File;
020import java.net.URL;
021
022import org.apache.commons.configuration2.io.FileLocationStrategy;
023import org.apache.commons.configuration2.io.FileSystem;
024
025/**
026 * <p>
027 * Definition of a properties interface for parameters of file-based configurations.
028 * </p>
029 * <p>
030 * This interface defines a set of properties which can be used to specify the
031 * location of a configuration source.
032 * </p>
033 *
034 * @param <T> the type of the result of all set methods for method chaining
035 */
036public interface FileBasedBuilderProperties<T>
037{
038    /**
039     * Sets the refresh delay for reloading support
040     *
041     * @param reloadingRefreshDelay the refresh delay (in milliseconds)
042     * @return a reference to this object for method chaining
043     */
044    T setReloadingRefreshDelay(Long reloadingRefreshDelay);
045
046    /**
047     * Sets the factory for creating {@code ReloadingDetector} objects. With
048     * this method a custom factory for reloading detectors can be installed.
049     * Per default, a factory creating {@code FileHandlerReloadingDetector}
050     * objects is used.
051     *
052     * @param factory the {@code ReloadingDetectorFactory}
053     * @return a reference to this object for method chaining
054     */
055    T setReloadingDetectorFactory(ReloadingDetectorFactory factory);
056
057    /**
058     * Sets the location of the associated {@code FileHandler} as a {@code File}
059     * object.
060     *
061     * @param file the {@code File} location
062     * @return a reference to this object for method chaining
063     */
064    T setFile(File file);
065
066    /**
067     * Sets the location of the associated {@code FileHandler} as a {@code URL}
068     * object.
069     *
070     * @param url the {@code URL} location
071     * @return a reference to this object for method chaining
072     */
073    T setURL(URL url);
074
075    /**
076     * Sets the location of the associated {@code FileHandler} as an absolute
077     * file path.
078     *
079     * @param path the path location
080     * @return a reference to this object for method chaining
081     */
082    T setPath(String path);
083
084    /**
085     * Sets the file name of the associated {@code FileHandler}.
086     *
087     * @param name the file name
088     * @return a reference to this object for method chaining
089     */
090    T setFileName(String name);
091
092    /**
093     * Sets the base path of the associated {@code FileHandler}.
094     *
095     * @param path the base path
096     * @return a reference to this object for method chaining
097     */
098    T setBasePath(String path);
099
100    /**
101     * Sets the {@code FileSystem} of the associated {@code FileHandler}.
102     *
103     * @param fs the {@code FileSystem}
104     * @return a reference to this object for method chaining
105     */
106    T setFileSystem(FileSystem fs);
107
108    /**
109     * Sets the {@code FileLocationStrategy} for resolving the referenced file.
110     *
111     * @param strategy the {@code FileLocationStrategy}
112     * @return a reference to this object for method chaining
113     */
114    T setLocationStrategy(FileLocationStrategy strategy);
115
116    /**
117     * Sets the encoding of the associated {@code FileHandler}.
118     *
119     * @param enc the encoding
120     * @return a reference to this object for method chaining
121     */
122    T setEncoding(String enc);
123}