1 | |
package org.apache.torque.util; |
2 | |
|
3 | |
import java.io.File; |
4 | |
import java.util.ArrayList; |
5 | |
import java.util.List; |
6 | |
|
7 | |
import org.codehaus.plexus.util.DirectoryScanner; |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
public class SimpleScanner extends DirectoryScanner { |
13 | 0 | private static final String FS = System.getProperty("file.separator"); |
14 | |
|
15 | |
public SimpleScanner() { |
16 | 0 | this(null, null, null); |
17 | 0 | } |
18 | |
|
19 | |
public SimpleScanner(File baseDir, String include, String exclude) { |
20 | 0 | super(); |
21 | 0 | if (baseDir != null) { |
22 | 0 | setBasedir(baseDir); |
23 | |
} |
24 | 0 | if (include != null) { |
25 | 0 | setIncludes(new String[] { include }); |
26 | |
} |
27 | 0 | if (exclude != null) { |
28 | 0 | setExcludes(new String[] { exclude }); |
29 | |
} |
30 | 0 | } |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public List<File> getFiles() { |
36 | 0 | scan(); |
37 | 0 | String[] includedFiles = getIncludedFiles(); |
38 | 0 | List<File> files = new ArrayList<File>(); |
39 | 0 | for (String includedFile : includedFiles) { |
40 | 0 | String filename = getBasedir().getAbsolutePath() + FS + includedFile; |
41 | 0 | File file = new File(filename); |
42 | 0 | files.add(file); |
43 | |
} |
44 | 0 | return files; |
45 | |
} |
46 | |
} |