1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.maven.plugins.externals;
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, getArray(null), getArray(null));
32 }
33
34 public SimpleScanner(File baseDir, String include, String exclude) {
35 this(baseDir, getArray(include), getArray(exclude));
36 }
37
38 public SimpleScanner(File baseDir, String[] includes, String[] excludes) {
39 super();
40 setBasedir(baseDir);
41 setIncludes(includes);
42 setExcludes(excludes);
43 }
44
45 protected static final String[] getArray(String s) {
46 if (s == null) {
47 return null;
48 } else {
49 return new String[] { s };
50 }
51 }
52
53
54
55
56 public List<File> getFiles() {
57 scan();
58 String[] includedFiles = getIncludedFiles();
59 List<File> files = new ArrayList<File>();
60 for (String includedFile : includedFiles) {
61 String filename = getBasedir().getAbsolutePath() + FS + includedFile;
62 File file = new File(filename);
63 files.add(file);
64 }
65 return files;
66 }
67 }