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 * @version $Id: FileBasedBuilderProperties.java 1624601 2014-09-12 18:04:36Z oheger $
035 * @param <T> the type of the result of all set methods for method chaining
036 */
037public interface FileBasedBuilderProperties<T>
038{
039    /**
040     * Sets the refresh delay for reloading support
041     *
042     * @param reloadingRefreshDelay the refresh delay (in milliseconds)
043     * @return a reference to this object for method chaining
044     */
045    T setReloadingRefreshDelay(Long reloadingRefreshDelay);
046
047    /**
048     * Sets the factory for creating {@code ReloadingDetector} objects. With
049     * this method a custom factory for reloading detectors can be installed.
050     * Per default, a factory creating {@code FileHandlerReloadingDetector}
051     * objects is used.
052     *
053     * @param factory the {@code ReloadingDetectorFactory}
054     * @return a reference to this object for method chaining
055     */
056    T setReloadingDetectorFactory(ReloadingDetectorFactory factory);
057
058    /**
059     * Sets the location of the associated {@code FileHandler} as a {@code File}
060     * object.
061     *
062     * @param file the {@code File} location
063     * @return a reference to this object for method chaining
064     */
065    T setFile(File file);
066
067    /**
068     * Sets the location of the associated {@code FileHandler} as a {@code URL}
069     * object.
070     *
071     * @param url the {@code URL} location
072     * @return a reference to this object for method chaining
073     */
074    T setURL(URL url);
075
076    /**
077     * Sets the location of the associated {@code FileHandler} as an absolute
078     * file path.
079     *
080     * @param path the path location
081     * @return a reference to this object for method chaining
082     */
083    T setPath(String path);
084
085    /**
086     * Sets the file name of the associated {@code FileHandler}.
087     *
088     * @param name the file name
089     * @return a reference to this object for method chaining
090     */
091    T setFileName(String name);
092
093    /**
094     * Sets the base path of the associated {@code FileHandler}.
095     *
096     * @param path the base path
097     * @return a reference to this object for method chaining
098     */
099    T setBasePath(String path);
100
101    /**
102     * Sets the {@code FileSystem} of the associated {@code FileHandler}.
103     *
104     * @param fs the {@code FileSystem}
105     * @return a reference to this object for method chaining
106     */
107    T setFileSystem(FileSystem fs);
108
109    /**
110     * Sets the {@code FileLocationStrategy} for resolving the referenced file.
111     *
112     * @param strategy the {@code FileLocationStrategy}
113     * @return a reference to this object for method chaining
114     */
115    T setLocationStrategy(FileLocationStrategy strategy);
116
117    /**
118     * Sets the encoding of the associated {@code FileHandler}.
119     *
120     * @param enc the encoding
121     * @return a reference to this object for method chaining
122     */
123    T setEncoding(String enc);
124}