KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openidex > search > FileObjectFilter


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 2004 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.openidex.search;
21
22 import org.openide.filesystems.FileObject;
23
24 /**
25  * Implementations of this interface define which files and folders should be
26  * searched and which should be skipped during search over a directory
27  * structure.
28  *
29  * @since org.openidex.util/3 3.3
30  * @author Marian Petras
31  */

32 public interface FileObjectFilter {
33
34     /** constant representing answer "do not traverse the folder" */
35     public static final int DO_NOT_TRAVERSE = 0;
36     /** constant representing answer "traverse the folder" */
37     public static final int TRAVERSE = 1;
38     /**
39      * constant representing answer "traverse the folder and all its direct
40      * and indirect children (both files and subfolders)"
41      */

42     public static final int TRAVERSE_ALL_SUBFOLDERS = 2;
43
44     /**
45      * Answers a question whether a given file should be searched.
46      * The file must be a plain file (not folder).
47      *
48      * @return <code>true</code> if the given file should be searched;
49      * <code>false</code> if not
50      * @exception java.lang.IllegalArgumentException
51      * if the passed <code>FileObject</code> is a folder
52      */

53     public boolean searchFile(FileObject file)
54             throws IllegalArgumentException JavaDoc;
55
56     /**
57      * Answers a questions whether a given folder should be traversed
58      * (its contents searched).
59      * The passed argument must be a folder.
60      *
61      * @return one of constants {@link #DO_NOT_TRAVERSE},
62      * {@link #TRAVERSE},
63      * {@link #TRAVERSE_ALL_SUBFOLDERS};
64      * if <code>TRAVERSE_ALL_SUBFOLDERS</code> is returned,
65      * this filter will not be applied on the folder's children
66      * (both direct and indirect, both files and folders)
67      * @exception java.lang.IllegalArgumentException
68      * if the passed <code>FileObject</code> is not a folder
69      */

70     public int traverseFolder(FileObject folder)
71             throws IllegalArgumentException JavaDoc;
72
73 }
74
Popular Tags