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.io;
018
019/**
020 * <p>
021 * A listener interface for receiving notifications about updates of a {@code FileHandler}.
022 * </p>
023 * <p>
024 * Objects implementing this interface are notified when properties of a {@code FileHandler} change or when a load or
025 * save operation is performed. This can be useful for various use cases, e.g. when monitoring file-based
026 * configurations.
027 * </p>
028 *
029 * @since 2.0
030 */
031public interface FileHandlerListener {
032    /**
033     * Notification that the associated file is about to be loaded. This method is called immediately before the load
034     * operation.
035     *
036     * @param handler the file handler
037     */
038    void loading(FileHandler handler);
039
040    /**
041     * Notification that the associated file has been loaded. This method is called directly after the load operation.
042     *
043     * @param handler the file handler
044     */
045    void loaded(FileHandler handler);
046
047    /**
048     * Notification that the associated file is about to be saved. This method is called immediately before the save
049     * operation.
050     *
051     * @param handler the file handler
052     */
053    void saving(FileHandler handler);
054
055    /**
056     * Notification that the associated file has been saved. This method is called directly after the save operation.
057     *
058     * @param handler the file handler
059     */
060    void saved(FileHandler handler);
061
062    /**
063     * Notification that a property of the monitored {@code FileHandler} has changed.
064     *
065     * @param handler the file handler
066     */
067    void locationChanged(FileHandler handler);
068}