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 */
017 package org.apache.commons.io.monitor;
018 import java.io.File;
019
020 /**
021 * A listener that receives events of file system modifications.
022 * <p>
023 * Register {@link FileAlterationListener}s with a {@link FileAlterationObserver}.
024 *
025 * @see FileAlterationObserver
026 * @version $Id: FileAlterationListener.java 1022311 2010-10-13 22:08:56Z niallp $
027 * @since Commons IO 2.0
028 */
029 public interface FileAlterationListener {
030
031 /**
032 * File system observer started checking event.
033 *
034 * @param observer The file system observer
035 */
036 void onStart(final FileAlterationObserver observer);
037
038 /**
039 * Directory created Event.
040 *
041 * @param directory The directory created
042 */
043 void onDirectoryCreate(final File directory);
044
045 /**
046 * Directory changed Event.
047 *
048 * @param directory The directory changed
049 */
050 void onDirectoryChange(final File directory);
051
052 /**
053 * Directory deleted Event.
054 *
055 * @param directory The directory deleted
056 */
057 void onDirectoryDelete(final File directory);
058
059 /**
060 * File created Event.
061 *
062 * @param file The file created
063 */
064 void onFileCreate(final File file);
065
066 /**
067 * File changed Event.
068 *
069 * @param file The file changed
070 */
071 void onFileChange(final File file);
072
073 /**
074 * File deleted Event.
075 *
076 * @param file The file deleted
077 */
078 void onFileDelete(final File file);
079
080 /**
081 * File system observer finished checking event.
082 *
083 * @param observer The file system observer
084 */
085 void onStop(final FileAlterationObserver observer);
086 }