01: // LoadUpdateHandler.java
02: // $Id: LoadUpdateHandler.java,v 1.4 2000/08/16 21:37:26 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1997.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.cvs;
07:
08: import java.io.File;
09: import java.io.FilenameFilter;
10:
11: class LoadUpdateHandler extends UpdateHandler implements CVS {
12: CvsDirectory cvs = null;
13: String files[] = null;
14: long stamp = -1;
15:
16: void notifyEnd() {
17: // All remaining files in directory are in sync with rep:
18: for (int i = 0; i < files.length; i++) {
19: if (files[i] != null)
20: cvs.createFileEntry(stamp, files[i], FILE_OK);
21: }
22: }
23:
24: void notifyEntry(String filename, int status) {
25: // We're only interested in knowing about files here:
26: File file = new File(cvs.getDirectory(), filename);
27: if (file.isDirectory())
28: return;
29: // We are not really performing the update, so...
30: if (status == FILE_OK)
31: status = file.exists() ? FILE_U : FILE_NCO;
32: // Add an entry for the file:
33: cvs.createFileEntry(stamp, filename, status);
34: // Remove the file from the directory listing (it's handled now)
35: for (int i = 0; i < files.length; i++) {
36: if (files[i] == null)
37: continue;
38: if (files[i].equals(filename)) {
39: files[i] = null;
40: return;
41: }
42: }
43: }
44:
45: LoadUpdateHandler(CvsDirectory cvs) {
46: this .cvs = cvs;
47: this .files = cvs.getDirectory().list(new FileFilter());
48: this.stamp = System.currentTimeMillis();
49: }
50: }
|