KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > queries > CollocationQueryImplementation


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 NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.queries;
21
22 import java.io.File JavaDoc;
23
24 /**
25  * A query which should typically be provided by a VCS to give information
26  * about whether some files can be considered part of one logical directory tree.
27  * <p>
28  * This should be treated as a heuristic, useful when deciding whether to use
29  * absolute or relative links between path locations.
30  * </p>
31  * <p>
32  * The file names might refer to nonexistent files. A provider may or may not
33  * be able to say anything useful about them in this case.
34  * </p>
35  * <p>
36  * File names passed to this query will already have been normalized according to
37  * the semantics of {@link org.openide.filesystems.FileUtil#normalizeFile}.
38  * </p>
39  * <p>
40  * Threading note: implementors should avoid acquiring locks that might be held
41  * by other threads. Generally treat this interface similarly to SPIs in
42  * {@link org.openide.filesystems} with respect to threading semantics.
43  * </p>
44  * @see org.netbeans.api.queries.CollocationQuery
45  * @author Jesse Glick
46  */

47 public interface CollocationQueryImplementation {
48     
49     /**
50      * Check whether two files are logically part of one directory tree.
51      * For example, if both files are stored in CVS, with the same server
52      * (<code>CVSROOT</code>) they might be considered collocated.
53      * If they are to be collocated their absolute paths must share a
54      * prefix directory, i.e. they must be located in the same filesystem root.
55      * If nothing is known about them, return false.
56      * @param file1 one file
57      * @param file2 another file
58      * @return true if they are probably part of one logical tree
59      */

60     boolean areCollocated(File JavaDoc file1, File JavaDoc file2);
61     
62     /**
63      * Find a root of a logical tree containing this file, if any.
64      * The path of the root (if there is one) must be a prefix of the path of the file.
65      * @param file a file on disk (must be an absolute URI)
66      * @return an ancestor directory which is the root of a logical tree,
67      * if any (else null) (must be an absolute URI)
68      */

69     File JavaDoc findRoot(File JavaDoc file);
70     
71 }
72
Popular Tags