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