1 | /*
|
---|
2 | * Copyright 2000-2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant;
|
---|
18 |
|
---|
19 | import java.io.File;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * An interface used to describe the actions required of any type of
|
---|
23 | * directory scanner.
|
---|
24 | *
|
---|
25 | */
|
---|
26 | public interface FileScanner {
|
---|
27 | /**
|
---|
28 | * Adds default exclusions to the current exclusions set.
|
---|
29 | */
|
---|
30 | void addDefaultExcludes();
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Returns the base directory to be scanned.
|
---|
34 | * This is the directory which is scanned recursively.
|
---|
35 | *
|
---|
36 | * @return the base directory to be scanned
|
---|
37 | */
|
---|
38 | File getBasedir();
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Returns the names of the directories which matched at least one of the
|
---|
42 | * include patterns and at least one of the exclude patterns.
|
---|
43 | * The names are relative to the base directory.
|
---|
44 | *
|
---|
45 | * @return the names of the directories which matched at least one of the
|
---|
46 | * include patterns and at least one of the exclude patterns.
|
---|
47 | */
|
---|
48 | String[] getExcludedDirectories();
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Returns the names of the files which matched at least one of the
|
---|
52 | * include patterns and at least one of the exclude patterns.
|
---|
53 | * The names are relative to the base directory.
|
---|
54 | *
|
---|
55 | * @return the names of the files which matched at least one of the
|
---|
56 | * include patterns and at least one of the exclude patterns.
|
---|
57 | *
|
---|
58 | */
|
---|
59 | String[] getExcludedFiles();
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Returns the names of the directories which matched at least one of the
|
---|
63 | * include patterns and none of the exclude patterns.
|
---|
64 | * The names are relative to the base directory.
|
---|
65 | *
|
---|
66 | * @return the names of the directories which matched at least one of the
|
---|
67 | * include patterns and none of the exclude patterns.
|
---|
68 | */
|
---|
69 | String[] getIncludedDirectories();
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Returns the names of the files which matched at least one of the
|
---|
73 | * include patterns and none of the exclude patterns.
|
---|
74 | * The names are relative to the base directory.
|
---|
75 | *
|
---|
76 | * @return the names of the files which matched at least one of the
|
---|
77 | * include patterns and none of the exclude patterns.
|
---|
78 | */
|
---|
79 | String[] getIncludedFiles();
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Returns the names of the directories which matched none of the include
|
---|
83 | * patterns. The names are relative to the base directory.
|
---|
84 | *
|
---|
85 | * @return the names of the directories which matched none of the include
|
---|
86 | * patterns.
|
---|
87 | */
|
---|
88 | String[] getNotIncludedDirectories();
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Returns the names of the files which matched none of the include
|
---|
92 | * patterns. The names are relative to the base directory.
|
---|
93 | *
|
---|
94 | * @return the names of the files which matched none of the include
|
---|
95 | * patterns.
|
---|
96 | */
|
---|
97 | String[] getNotIncludedFiles();
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Scans the base directory for files which match at least one include
|
---|
101 | * pattern and don't match any exclude patterns.
|
---|
102 | *
|
---|
103 | * @exception IllegalStateException if the base directory was set
|
---|
104 | * incorrectly (i.e. if it is <code>null</code>, doesn't exist,
|
---|
105 | * or isn't a directory).
|
---|
106 | */
|
---|
107 | void scan() throws IllegalStateException;
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * Sets the base directory to be scanned. This is the directory which is
|
---|
111 | * scanned recursively. All '/' and '\' characters should be replaced by
|
---|
112 | * <code>File.separatorChar</code>, so the separator used need not match
|
---|
113 | * <code>File.separatorChar</code>.
|
---|
114 | *
|
---|
115 | * @param basedir The base directory to scan.
|
---|
116 | * Must not be <code>null</code>.
|
---|
117 | */
|
---|
118 | void setBasedir(String basedir);
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * Sets the base directory to be scanned. This is the directory which is
|
---|
122 | * scanned recursively.
|
---|
123 | *
|
---|
124 | * @param basedir The base directory for scanning.
|
---|
125 | * Should not be <code>null</code>.
|
---|
126 | */
|
---|
127 | void setBasedir(File basedir);
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Sets the list of exclude patterns to use.
|
---|
131 | *
|
---|
132 | * @param excludes A list of exclude patterns.
|
---|
133 | * May be <code>null</code>, indicating that no files
|
---|
134 | * should be excluded. If a non-<code>null</code> list is
|
---|
135 | * given, all elements must be non-<code>null</code>.
|
---|
136 | */
|
---|
137 | void setExcludes(String[] excludes);
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * Sets the list of include patterns to use.
|
---|
141 | *
|
---|
142 | * @param includes A list of include patterns.
|
---|
143 | * May be <code>null</code>, indicating that all files
|
---|
144 | * should be included. If a non-<code>null</code>
|
---|
145 | * list is given, all elements must be
|
---|
146 | * non-<code>null</code>.
|
---|
147 | */
|
---|
148 | void setIncludes(String[] includes);
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Sets whether or not the file system should be regarded as case sensitive.
|
---|
152 | *
|
---|
153 | * @param isCaseSensitive whether or not the file system should be
|
---|
154 | * regarded as a case sensitive one
|
---|
155 | */
|
---|
156 | void setCaseSensitive(boolean isCaseSensitive);
|
---|
157 | }
|
---|