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