1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package net.sf.infrared.tools.weaving; |
23 |
|
|
24 |
|
import java.io.File; |
25 |
|
import java.util.Arrays; |
26 |
|
import java.util.Collection; |
27 |
|
import java.util.HashSet; |
28 |
|
import java.util.Iterator; |
29 |
|
import java.util.Set; |
30 |
|
import net.sf.infrared.tools.ant.Logger; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
0 |
public abstract class AbstractAspectSystem implements AspectSystem { |
37 |
0 |
private Set classpath = new HashSet(); |
38 |
|
|
39 |
0 |
private Set aspectpath = new HashSet(); |
40 |
|
|
41 |
|
private Logger log; |
42 |
|
|
43 |
|
public void setLogger(Logger log) { |
44 |
0 |
this.log = log; |
45 |
0 |
} |
46 |
|
|
47 |
|
public Logger getLogger() { |
48 |
0 |
return this.log; |
49 |
|
} |
50 |
|
|
51 |
|
public void addClassPath(java.io.File[] classpath) { |
52 |
0 |
this.classpath.addAll(Arrays.asList(classpath)); |
53 |
0 |
} |
54 |
|
|
55 |
|
public void addAspectPath(java.io.File[] aspects) { |
56 |
0 |
this.aspectpath.addAll(Arrays.asList(aspects)); |
57 |
0 |
} |
58 |
|
|
59 |
|
public void resetClassPath() { |
60 |
0 |
classpath.clear(); |
61 |
0 |
} |
62 |
|
|
63 |
|
public void resetAspectPath() { |
64 |
0 |
aspectpath.clear(); |
65 |
0 |
} |
66 |
|
|
67 |
|
public void addClassPath(String[] classpath) { |
68 |
0 |
File[] classes = new File[classpath.length]; |
69 |
0 |
for (int i = 0; i < classpath.length; i++) { |
70 |
0 |
classes[i] = new File(classpath[i]); |
71 |
|
} |
72 |
0 |
addClassPath(classes); |
73 |
0 |
} |
74 |
|
|
75 |
|
public void addAspectPath(String[] aspects) { |
76 |
0 |
File[] aspectFiles = new File[aspects.length]; |
77 |
0 |
for (int i = 0; i < aspects.length; i++) { |
78 |
0 |
aspectFiles[i] = new File(aspects[i]); |
79 |
|
} |
80 |
0 |
addAspectPath(aspectFiles); |
81 |
0 |
} |
82 |
|
|
83 |
|
protected Set getClassPath() { |
84 |
0 |
return this.classpath; |
85 |
|
} |
86 |
|
|
87 |
|
protected Set getAspectPath() { |
88 |
0 |
return this.aspectpath; |
89 |
|
} |
90 |
|
|
91 |
|
String getAspectPathAsString() { |
92 |
0 |
return getPathAsString(getAspectPath()); |
93 |
|
} |
94 |
|
|
95 |
|
String getClassPathAsString() { |
96 |
0 |
String cp = getPathAsString(getClassPath()); |
97 |
0 |
return cp; |
98 |
|
} |
99 |
|
|
100 |
|
String getPathAsString(Collection path) { |
101 |
0 |
String s = ""; |
102 |
0 |
for (Iterator it = path.iterator(); it.hasNext(); ) { |
103 |
0 |
File f = (File) it.next(); |
104 |
0 |
s += f.getAbsolutePath() + File.pathSeparator; |
105 |
|
} |
106 |
0 |
return s + File.pathSeparator; |
107 |
|
} |
108 |
|
} |