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