1 package org.apache.maven.plugins.pmd.exec;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27
28
29
30
31
32
33
34
35
36 public class PmdRequest implements Serializable
37 {
38 private static final long serialVersionUID = -6324416880563476455L;
39
40 private String javaExecutable;
41
42 private String language;
43 private String languageVersion;
44 private int minimumPriority;
45 private String auxClasspath;
46 private String suppressMarker;
47 private String analysisCacheLocation;
48 private List<String> rulesets;
49 private String sourceEncoding;
50 private List<File> files = new ArrayList<>();
51
52 private boolean showPmdLog;
53 private String logLevel;
54 private boolean skipPmdError;
55
56 private String excludeFromFailureFile;
57 private String targetDirectory;
58 private String outputEncoding;
59 private String format;
60 private String benchmarkOutputLocation;
61 private boolean includeXmlInSite;
62 private String reportOutputDirectory;
63
64
65
66
67
68
69
70 public void setLanguageAndVersion( String language, String targetJdk )
71 {
72 if ( "java".equals( language ) || null == language )
73 {
74 this.language = "java";
75 this.languageVersion = targetJdk;
76 }
77 else if ( "javascript".equals( language ) || "ecmascript".equals( language ) )
78 {
79 this.language = "ecmascript";
80 }
81 else if ( "jsp".equals( language ) )
82 {
83 this.language = "jsp";
84 }
85 else
86 {
87 this.language = language;
88 }
89 }
90
91 public void setJavaExecutable( String javaExecutable )
92 {
93 this.javaExecutable = javaExecutable;
94 }
95
96 public void setMinimumPriority( int minimumPriority )
97 {
98 this.minimumPriority = minimumPriority;
99 }
100
101 public void setAuxClasspath( String auxClasspath )
102 {
103 this.auxClasspath = auxClasspath;
104 }
105
106 public void setSuppressMarker( String suppressMarker )
107 {
108 this.suppressMarker = suppressMarker;
109 }
110
111 public void setAnalysisCacheLocation( String analysisCacheLocation )
112 {
113 this.analysisCacheLocation = analysisCacheLocation;
114 }
115
116 public void setRulesets( List<String> rulesets )
117 {
118 this.rulesets = rulesets;
119 }
120
121 public void setSourceEncoding( String sourceEncoding )
122 {
123 this.sourceEncoding = sourceEncoding;
124 }
125
126 public void addFiles( Collection<File> files )
127 {
128 this.files.addAll( files );
129 }
130
131 public void setBenchmarkOutputLocation( String benchmarkOutputLocation )
132 {
133 this.benchmarkOutputLocation = benchmarkOutputLocation;
134 }
135
136 public void setTargetDirectory( String targetDirectory )
137 {
138 this.targetDirectory = targetDirectory;
139 }
140
141 public void setOutputEncoding( String outputEncoding )
142 {
143 this.outputEncoding = outputEncoding;
144 }
145
146 public void setFormat( String format )
147 {
148 this.format = format;
149 }
150
151 public void setShowPmdLog( boolean showPmdLog )
152 {
153 this.showPmdLog = showPmdLog;
154 }
155
156 public void setLogLevel( String logLevel )
157 {
158 this.logLevel = logLevel;
159 }
160
161 public void setSkipPmdError( boolean skipPmdError )
162 {
163 this.skipPmdError = skipPmdError;
164 }
165
166 public void setIncludeXmlInSite( boolean includeXmlInSite )
167 {
168 this.includeXmlInSite = includeXmlInSite;
169 }
170
171 public void setReportOutputDirectory( String reportOutputDirectory )
172 {
173 this.reportOutputDirectory = reportOutputDirectory;
174 }
175
176 public void setExcludeFromFailureFile( String excludeFromFailureFile )
177 {
178 this.excludeFromFailureFile = excludeFromFailureFile;
179 }
180
181
182
183
184
185 public String getJavaExecutable()
186 {
187 return javaExecutable;
188 }
189
190 public String getLanguage()
191 {
192 return language;
193 }
194
195 public String getLanguageVersion()
196 {
197 return languageVersion;
198 }
199
200 public int getMinimumPriority()
201 {
202 return minimumPriority;
203 }
204
205 public String getAuxClasspath()
206 {
207 return auxClasspath;
208 }
209
210 public String getSuppressMarker()
211 {
212 return suppressMarker;
213 }
214
215 public String getAnalysisCacheLocation()
216 {
217 return analysisCacheLocation;
218 }
219
220 public List<String> getRulesets()
221 {
222 return rulesets;
223 }
224
225 public String getSourceEncoding()
226 {
227 return sourceEncoding;
228 }
229
230 public List<File> getFiles()
231 {
232 return files;
233 }
234
235 public String getBenchmarkOutputLocation()
236 {
237 return benchmarkOutputLocation;
238 }
239
240 public String getTargetDirectory()
241 {
242 return targetDirectory;
243 }
244
245 public String getOutputEncoding()
246 {
247 return outputEncoding;
248 }
249
250 public String getFormat()
251 {
252 return format;
253 }
254
255 public boolean isShowPmdLog()
256 {
257 return showPmdLog;
258 }
259
260 public String getLogLevel()
261 {
262 return logLevel;
263 }
264
265 public boolean isDebugEnabled()
266 {
267 return "debug".equals( logLevel );
268 }
269
270 public boolean isSkipPmdError()
271 {
272 return skipPmdError;
273 }
274
275 public boolean isIncludeXmlInSite()
276 {
277 return includeXmlInSite;
278 }
279
280 public String getReportOutputDirectory()
281 {
282 return reportOutputDirectory;
283 }
284
285 public String getExcludeFromFailureFile()
286 {
287 return excludeFromFailureFile;
288 }
289 }