1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.io.monitor;
18 import java.io.File;
19
20 /**
21 * Receives events of file system modifications.
22 * <p>
23 * Register {@link FileAlterationListener}s with a {@link FileAlterationObserver}.
24 * </p>
25 *
26 * @see FileAlterationObserver
27 * @since 2.0
28 */
29 public interface FileAlterationListener {
30
31 /**
32 * Directory changed Event.
33 *
34 * @param directory The directory changed
35 */
36 void onDirectoryChange(File directory);
37
38 /**
39 * Directory created Event.
40 *
41 * @param directory The directory created
42 */
43 void onDirectoryCreate(File directory);
44
45 /**
46 * Directory deleted Event.
47 *
48 * @param directory The directory deleted
49 */
50 void onDirectoryDelete(File directory);
51
52 /**
53 * File changed Event.
54 *
55 * @param file The file changed
56 */
57 void onFileChange(File file);
58
59 /**
60 * File created Event.
61 *
62 * @param file The file created
63 */
64 void onFileCreate(File file);
65
66 /**
67 * File deleted Event.
68 *
69 * @param file The file deleted
70 */
71 void onFileDelete(File file);
72
73 /**
74 * File system observer started checking event.
75 *
76 * @param observer The file system observer
77 */
78 void onStart(FileAlterationObserver observer);
79
80 /**
81 * File system observer finished checking event.
82 *
83 * @param observer The file system observer
84 */
85 void onStop(FileAlterationObserver observer);
86 }