KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > filemonitor > FileObserver


1 /*
2   The contents of this file are subject to the Mozilla Public License Version 1.1
3   (the "License"); you may not use this file except in compliance with the
4   License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5   
6   Software distributed under the License is distributed on an "AS IS" basis,
7   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8   for the specific language governing rights and
9   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 JavaDoc;
21
22 /**
23  * @author Celso Pinto <cpinto@yimports.com>
24  */

25 public interface FileObserver
26 {
27
28   /**
29     The changeCode is FILE_CHANGED when a file that is being observed (or
30     a file contained in an observed directory) has been changed
31   */

32   public static final int FILE_CHANGED = 1 << 0;
33
34   /**
35     The changeCode is FILE_ADDED when a new file was added to an observed
36     directory
37   */

38   public static final int FILE_ADDED = 1 << 1;
39
40   /**
41     The changeCode is FILE_REMOVED when an observedFile has been removed
42     or a file contained in an observed directory has been removed.
43   */

44   public static final int FILE_REMOVED = 1 << 2;
45
46   /**
47      Notify an observer that a monitored file has changed, was deleted or
48      created. This is a synchronous call so implementations must either be fast
49      or handle the changes in a separate thread
50      @param file the file path
51      @param changeCode can be one of FILE_CHANGED,FILE_ADDED,FILE_REMOVED
52    */

53   public void fileChanged(File JavaDoc file,int changeCode);
54
55
56   /**
57      Notify the observer that the FileMonitorService is being interrupted.
58      If the FileMonitorService comes back up at a latter time, it's the
59      observer's responsability to attach to it again
60    */

61   public void stoppingService();
62
63 }
64
Popular Tags