KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > cvsclient > admin > AdminHandler


1 /*****************************************************************************
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is the CVS Client Library.
16  * The Initial Developer of the Original Software is Robert Greig.
17  * Portions created by Robert Greig are Copyright (C) 2000.
18  * All Rights Reserved.
19  *
20  * Contributor(s): Robert Greig.
21  *****************************************************************************/

22 package org.netbeans.lib.cvsclient.admin;
23
24 import java.io.*;
25 import java.util.*;
26
27 import org.netbeans.lib.cvsclient.command.*;
28
29 /**
30  * Handles the maintaining and reading of administration information on the
31  * local machine. The standard CVS client does this by putting various files in
32  * a CVS directory underneath each checked-out directory. How the files are
33  * laid out and managed is not specified by the protocol document. <P>Hence it
34  * is envisaged that, eventually, a client could add additional files for
35  * higher performance or even change the mechanism for storing the information
36  * completely.
37  * @author Robert Greig
38  */

39 public interface AdminHandler {
40     /**
41      * Create or update the administration files for a particular file.
42      * This will create the CVS directory if necessary, and the
43      * Root and Repository files if necessary. It will also update
44      * the Entries file with the new entry
45      * @param localDirectory the local directory where the file in question
46      * lives (the absolute path). Must not end with a slash.
47      * @param repositoryPath the path of the file in the repository
48      * @param entry the entry object for that file
49      * @param globalOptions the global command options
50      */

51     void updateAdminData(String JavaDoc localDirectory, String JavaDoc repositoryPath,
52                          Entry entry, GlobalOptions globalOptions)
53             throws IOException;
54
55     /**
56      * Get the Entry for the specified file, if one exists
57      * @param file the file
58      * @throws IOException if the Entries file cannot be read
59      */

60     Entry getEntry(File file) throws IOException;
61
62     /**
63      * Get the entries for a specified directory.
64      * @param directory the directory for which to get the entries
65      * @return an iterator of Entry objects
66      */

67     Iterator getEntries(File directory) throws IOException;
68
69     /**
70      * Set the Entry for the specified file
71      * @param file the file
72      * @param entry the new entry
73      * @throws IOException if an error occurs writing the details
74      */

75     void setEntry(File file, Entry entry) throws IOException;
76
77     /**
78      * Get the repository path for a given directory, for example in
79      * the directory /home/project/foo/bar, the repository directory
80      * might be /usr/cvs/foo/bar. The repository directory is commonly
81      * stored in the file <pre>Repository</pre> in the CVS directory on
82      * the client. (This is the case in the standard CVS command-line tool)
83      * @param directory the directory
84      * @param the repository path on the server, e.g. /home/bob/cvs. Must not
85      * end with a slash.
86      */

87     String JavaDoc getRepositoryForDirectory(String JavaDoc directory, String JavaDoc repository)
88             throws IOException;
89
90     /**
91      * Remove the Entry for the specified file
92      * @param file the file whose entry is to be removed
93      * @throws IOException if an error occurs writing the Entries file
94      */

95     void removeEntry(File file) throws IOException;
96
97     /**
98      * Get all the files contained within a given
99      * directory that are <b>known to CVS</b>.
100      * @param directory the directory to look in
101      * @return a set of all files.
102      */

103     Set getAllFiles(File directory) throws IOException;
104
105     /**
106      * Checks for presence of CVS/Tag file and returns it's value.
107      * @return the value of CVS/Tag file for the specified directory (including leading "T")
108      * null if file doesn't exist
109      */

110     String JavaDoc getStickyTagForDirectory(File directory);
111
112     /**
113      * Tests for existence of the given file. Normally this method
114      * delegates to File.exists() but it may also return true for files
115      * that exists only virtually (in memory). Is such case the file/directory
116      * will not exist on disk but its metadata will be available via getEntries() methods.
117      *
118      * @param file file to test for existence
119      * @return true if the file exists, false otherwise
120      */

121     boolean exists(File file);
122 }
Popular Tags