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 has been loaded. This method is called directly after the load operation.
034     *
035     * @param handler the file handler
036     */
037    void loaded(FileHandler handler);
038
039    /**
040     * Notification that the associated file is about to be loaded. This method is called immediately before the load
041     * operation.
042     *
043     * @param handler the file handler
044     */
045    void loading(FileHandler handler);
046
047    /**
048     * Notification that a property of the monitored {@code FileHandler} has changed.
049     *
050     * @param handler the file handler
051     */
052    void locationChanged(FileHandler handler);
053
054    /**
055     * Notification that the associated file has been saved. This method is called directly after the save operation.
056     *
057     * @param handler the file handler
058     */
059    void saved(FileHandler handler);
060
061    /**
062     * Notification that the associated file is about to be saved. This method is called immediately before the save
063     * operation.
064     *
065     * @param handler the file handler
066     */
067    void saving(FileHandler handler);
068}