01: /*
02: The contents of this file are subject to the Mozilla Public License Version 1.1
03: (the "License"); you may not use this file except in compliance with the
04: License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05:
06: Software distributed under the License is distributed on an "AS IS" basis,
07: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: for the specific language governing rights and
09: limitations under the License.
10:
11: The Original Code is "The Columba Project"
12:
13: The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
14: Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
15:
16: All Rights Reserved.
17: */
18: package org.columba.core.filemonitor;
19:
20: import java.io.File;
21:
22: /**
23: * @author Celso Pinto <cpinto@yimports.com>
24: */
25: public interface FileObserver {
26:
27: /**
28: The changeCode is FILE_CHANGED when a file that is being observed (or
29: a file contained in an observed directory) has been changed
30: */
31: public static final int FILE_CHANGED = 1 << 0;
32:
33: /**
34: The changeCode is FILE_ADDED when a new file was added to an observed
35: directory
36: */
37: public static final int FILE_ADDED = 1 << 1;
38:
39: /**
40: The changeCode is FILE_REMOVED when an observedFile has been removed
41: or a file contained in an observed directory has been removed.
42: */
43: public static final int FILE_REMOVED = 1 << 2;
44:
45: /**
46: Notify an observer that a monitored file has changed, was deleted or
47: created. This is a synchronous call so implementations must either be fast
48: or handle the changes in a separate thread
49: @param file the file path
50: @param changeCode can be one of FILE_CHANGED,FILE_ADDED,FILE_REMOVED
51: */
52: public void fileChanged(File file, int changeCode);
53:
54: /**
55: Notify the observer that the FileMonitorService is being interrupted.
56: If the FileMonitorService comes back up at a latter time, it's the
57: observer's responsability to attach to it again
58: */
59: public void stoppingService();
60:
61: }
|