1   package org.apache.maven.plugin.checkstyle.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.ByteArrayOutputStream;
23  import java.io.File;
24  import java.util.Collection;
25  import java.util.Collections;
26  import java.util.List;
27  
28  import org.apache.maven.artifact.Artifact;
29  import org.apache.maven.model.Resource;
30  import org.apache.maven.project.MavenProject;
31  
32  import com.puppycrawl.tools.checkstyle.DefaultLogger;
33  import com.puppycrawl.tools.checkstyle.api.AuditListener;
34  
35  
36  
37  
38  
39  
40  public class CheckstyleExecutorRequest
41  {
42  
43      
44  
45  
46      private String includes;
47  
48      
49  
50  
51      private String excludes;
52  
53      
54  
55  
56      private String resourceIncludes;
57  
58      
59  
60  
61      private String resourceExcludes;
62  
63      private MavenProject project;
64  
65      private String suppressionsLocation;
66  
67      private boolean includeTestSourceDirectory;
68  
69      private Collection<File> testSourceDirectories;
70  
71      private Collection<File> sourceDirectories;
72  
73      private boolean includeResources;
74  
75      private boolean includeTestResources;
76  
77      private List<Resource> resources;
78  
79      private List<Resource> testResources;
80  
81      private boolean failsOnError;
82  
83      private AuditListener listener;
84  
85      private boolean consoleOutput;
86  
87      private DefaultLogger defaultLogger;
88  
89      private ByteArrayOutputStream stringOutputStream;
90  
91      private String propertiesLocation;
92  
93      
94  
95      private String configLocation;
96  
97      private String propertyExpansion;
98  
99      private String headerLocation;
100 
101     private String cacheFile;
102 
103     private String suppressionsFileExpression;
104 
105     private String encoding;
106 
107     
108 
109 
110     private boolean aggregate = false;
111 
112     
113 
114 
115     private List<MavenProject> reactorProjects;
116     
117     
118 
119 
120     private List<Artifact> licenseArtifacts;
121 
122     
123 
124 
125     private List<Artifact> configurationArtifacts;
126     
127     
128 
129 
130     public CheckstyleExecutorRequest( )
131     {
132         
133     }
134 
135     
136 
137 
138 
139 
140     public String getIncludes()
141     {
142         return includes;
143     }
144 
145     public CheckstyleExecutorRequest setIncludes( String includes )
146     {
147         this.includes = includes;
148         return this;
149     }
150 
151     public String getExcludes()
152     {
153         return excludes;
154     }
155 
156     public CheckstyleExecutorRequest setExcludes( String excludes )
157     {
158         this.excludes = excludes;
159         return this;
160     }
161 
162     public String getResourceIncludes()
163     {
164         return resourceIncludes;
165     }
166 
167     public CheckstyleExecutorRequest setResourceIncludes( String resourceIncludes )
168     {
169         this.resourceIncludes = resourceIncludes;
170         return this;
171     }
172 
173     public String getResourceExcludes()
174     {
175         return resourceExcludes;
176     }
177 
178     public CheckstyleExecutorRequest setResourceExcludes( String resourceExcludes )
179     {
180         this.resourceExcludes = resourceExcludes;
181         return this;
182     }
183 
184     public MavenProject getProject()
185     {
186         return project;
187     }
188 
189     public CheckstyleExecutorRequest setProject( MavenProject project )
190     {
191         this.project = project;
192         return this;
193     }
194 
195     public String getSuppressionsLocation()
196     {
197         return suppressionsLocation;
198     }
199 
200     public CheckstyleExecutorRequest setSuppressionsLocation( String suppressionsLocation )
201     {
202         this.suppressionsLocation = suppressionsLocation;
203         return this;
204     }
205 
206     public boolean isIncludeTestSourceDirectory()
207     {
208         return includeTestSourceDirectory;
209     }
210 
211     public CheckstyleExecutorRequest setIncludeTestSourceDirectory( boolean includeTestSourceDirectory )
212     {
213         this.includeTestSourceDirectory = includeTestSourceDirectory;
214         return this;
215     }
216 
217     
218 
219 
220 
221 
222     @Deprecated
223     public File getTestSourceDirectory()
224     {
225         if ( testSourceDirectories == null || testSourceDirectories.size() == 0 )
226         {
227             return null;
228         }
229         else
230         {
231             return testSourceDirectories.iterator().next();
232         }
233     }
234 
235     
236 
237 
238 
239 
240 
241     @Deprecated
242     public CheckstyleExecutorRequest setTestSourceDirectory( File testSourceDirectory )
243     {
244         this.testSourceDirectories = Collections.singletonList( testSourceDirectory );
245         return this;
246     }
247     
248     public Collection<File> getTestSourceDirectories()
249     {
250         return testSourceDirectories;
251     }
252     
253     public CheckstyleExecutorRequest setTestSourceDirectories( Collection<File> testSourceDirectories )
254     {
255         this.testSourceDirectories = testSourceDirectories;
256         return this;
257     }
258     
259     
260 
261 
262 
263     @Deprecated
264     public File getSourceDirectory()
265     {
266         if ( sourceDirectories == null || sourceDirectories.size() == 0 )
267         {
268             return null;
269         }
270         else
271         {
272             return sourceDirectories.iterator().next();
273         }
274     }
275 
276     
277 
278 
279 
280 
281 
282     @Deprecated
283     public CheckstyleExecutorRequest setSourceDirectory( File sourceDirectory )
284     {
285         this.sourceDirectories = Collections.singletonList( sourceDirectory );
286         return this;
287     }
288     
289     public Collection<File> getSourceDirectories()
290     {
291         return sourceDirectories;
292     }
293     
294     public CheckstyleExecutorRequest setSourceDirectories( Collection<File> sourceDirectories )
295     {
296         this.sourceDirectories = sourceDirectories;
297         return this;
298     }
299 
300     public List<Resource> getResources()
301     {
302         return resources;
303     }
304 
305     public CheckstyleExecutorRequest setResources( List<Resource> resources )
306     {
307         this.resources = resources;
308         return this;
309     }
310 
311     public List<Resource> getTestResources()
312     {
313         return testResources;
314     }
315 
316     public CheckstyleExecutorRequest setTestResources( List<Resource> testResources )
317     {
318         this.testResources = testResources;
319         return this;
320     }
321 
322     public boolean isFailsOnError()
323     {
324         return failsOnError;
325     }
326 
327     public CheckstyleExecutorRequest setFailsOnError( boolean failsOnError )
328     {
329         this.failsOnError = failsOnError;
330         return this;
331     }
332 
333     public AuditListener getListener()
334     {
335         return listener;
336     }
337 
338     public CheckstyleExecutorRequest setListener( AuditListener listener )
339     {
340         this.listener = listener;
341         return this;
342     }
343 
344     public boolean isConsoleOutput()
345     {
346         return consoleOutput;
347     }
348 
349     public CheckstyleExecutorRequest setConsoleOutput( boolean consoleOutput )
350     {
351         this.consoleOutput = consoleOutput;
352         return this;
353     }
354 
355     public CheckstyleExecutorRequest setConsoleListener( DefaultLogger defaultLogger )
356     {
357         this.defaultLogger = defaultLogger;
358         return this;
359     }
360 
361     public DefaultLogger getConsoleListener()
362     {
363         return this.defaultLogger;
364     }
365 
366     public ByteArrayOutputStream getStringOutputStream()
367     {
368         return stringOutputStream;
369     }
370 
371     public CheckstyleExecutorRequest setStringOutputStream( ByteArrayOutputStream stringOutputStream )
372     {
373         this.stringOutputStream = stringOutputStream;
374         return this;
375     }
376 
377     public String getConfigLocation()
378     {
379         return configLocation;
380     }
381 
382     public CheckstyleExecutorRequest setConfigLocation( String configLocation )
383     {
384         this.configLocation = configLocation;
385         return this;
386     }
387 
388     public String getPropertyExpansion()
389     {
390         return propertyExpansion;
391     }
392 
393     public CheckstyleExecutorRequest setPropertyExpansion( String propertyExpansion )
394     {
395         this.propertyExpansion = propertyExpansion;
396         return this;
397     }
398 
399     public String getHeaderLocation()
400     {
401         return headerLocation;
402     }
403 
404     public CheckstyleExecutorRequest setHeaderLocation( String headerLocation )
405     {
406         this.headerLocation = headerLocation;
407         return this;
408     }
409 
410     public String getCacheFile()
411     {
412         return cacheFile;
413     }
414 
415     public CheckstyleExecutorRequest setCacheFile( String cacheFile )
416     {
417         this.cacheFile = cacheFile;
418         return this;
419     }
420 
421     public String getSuppressionsFileExpression()
422     {
423         return suppressionsFileExpression;
424     }
425 
426     public CheckstyleExecutorRequest setSuppressionsFileExpression( String suppressionsFileExpression )
427     {
428         this.suppressionsFileExpression = suppressionsFileExpression;
429         return this;
430     }
431 
432     public String getEncoding()
433     {
434         return encoding;
435     }
436 
437     public CheckstyleExecutorRequest setEncoding( String encoding )
438     {
439         this.encoding = encoding;
440         return this;
441     }
442 
443     public String getPropertiesLocation()
444     {
445         return propertiesLocation;
446     }
447 
448     public void setPropertiesLocation( String propertiesLocation )
449     {
450         this.propertiesLocation = propertiesLocation;
451     }
452 
453     
454 
455 
456 
457 
458     public boolean isAggregate()
459     {
460         return aggregate;
461     }
462 
463     
464 
465 
466 
467 
468 
469     public CheckstyleExecutorRequest setAggregate( boolean pAggregate )
470     {
471         this.aggregate = pAggregate;
472         return this;
473     }
474 
475     
476 
477 
478 
479 
480     public List<MavenProject> getReactorProjects()
481     {
482         return reactorProjects;
483     }
484 
485     
486 
487 
488 
489 
490 
491     public CheckstyleExecutorRequest setReactorProjects( List<MavenProject> pReactorProjects )
492     {
493         this.reactorProjects = pReactorProjects;
494         return this;
495     }
496 
497     
498 
499 
500 
501 
502     public List<Artifact> getLicenseArtifacts()
503     {
504         return licenseArtifacts;
505     }
506 
507     
508 
509 
510 
511 
512 
513     public CheckstyleExecutorRequest setLicenseArtifacts( List<Artifact> licenseArtifacts )
514     {
515         this.licenseArtifacts = licenseArtifacts;
516         return this;
517     }
518     
519     
520 
521 
522 
523 
524     public List<Artifact> getConfigurationArtifacts()
525     {
526         return configurationArtifacts;
527     }
528 
529     
530 
531 
532 
533 
534 
535     public CheckstyleExecutorRequest setConfigurationArtifacts( List<Artifact> configArtifacts )
536     {
537         this.configurationArtifacts = configArtifacts;
538         return this;
539     }
540     
541     public boolean isIncludeResources()
542     {
543         return includeResources;
544     }
545 
546     
547 
548 
549 
550     public CheckstyleExecutorRequest setIncludeResources( boolean includeResources )
551     {
552         this.includeResources = includeResources;
553         return this;
554     }
555 
556     public boolean isIncludeTestResources()
557     {
558         return includeTestResources;
559     }
560 
561     
562 
563 
564 
565     public CheckstyleExecutorRequest setIncludeTestResources( boolean includeTestResources )
566     {
567         this.includeTestResources = includeTestResources;
568         return this;
569     }
570 }