View Javadoc
1   package org.apache.maven.plugin.checkstyle;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.ByteArrayOutputStream;
23  import java.io.File;
24  import java.util.List;
25  
26  import org.apache.maven.artifact.Artifact;
27  import org.apache.maven.model.Resource;
28  import org.apache.maven.plugin.logging.Log;
29  import org.apache.maven.project.MavenProject;
30  
31  import com.puppycrawl.tools.checkstyle.DefaultLogger;
32  import com.puppycrawl.tools.checkstyle.api.AuditListener;
33  
34  /**
35   * @author Olivier Lamy
36   * @since 2.5
37   * @version $Id: CheckstyleExecutorRequest.java 1586844 2014-04-12 09:53:39Z rfscholte $
38   */
39  public class CheckstyleExecutorRequest
40  {
41  
42      /**
43       * Specifies the names filter of the source files to be used for Checkstyle.
44       */
45      private String includes;
46  
47      /**
48       * Specifies the names filter of the source files to be excluded for Checkstyle.
49       */
50      private String excludes;
51  
52      /**
53       * Specifies names filter for resources.
54       */
55      private String resourceIncludes;
56  
57      /**
58       * Specifies names filter for resources.
59       */
60      private String resourceExcludes;
61  
62      private MavenProject project;
63  
64      private Log log;
65  
66      private String suppressionsLocation;
67  
68      private boolean includeTestSourceDirectory;
69  
70      private File testSourceDirectory;
71  
72      private File sourceDirectory;
73  
74      private boolean includeResources;
75  
76      private boolean includeTestResources;
77  
78      private List<Resource> resources;
79  
80      private List<Resource> testResources;
81  
82      private boolean failsOnError;
83  
84      private AuditListener listener;
85  
86      private boolean consoleOutput;
87  
88      private DefaultLogger defaultLogger;
89  
90      private ByteArrayOutputStream stringOutputStream;
91  
92      private String propertiesLocation;
93  
94      //
95  
96      private String configLocation;
97  
98      private String propertyExpansion;
99  
100     private String headerLocation;
101 
102     private String cacheFile;
103 
104     private String suppressionsFileExpression;
105 
106     private String encoding;
107 
108     /**
109      * @since 2.8
110      */
111     private boolean aggregate = false;
112 
113     /**
114      * @since 2.8
115      */
116     private List<MavenProject> reactorProjects;
117     
118     /**
119      * @since 2.12.1
120      */
121     private List<Artifact> licenseArtifacts;
122 
123     /**
124      * @since 2.12.1
125      */
126     private List<Artifact> configurationArtifacts;
127     
128     /**
129      * Constructor.
130      */
131     public CheckstyleExecutorRequest( )
132     {
133         //nothing
134     }
135 
136     /**
137      * Returns the includes parameter.
138      *
139      * @return The includes parameter.
140      */
141     public String getIncludes()
142     {
143         return includes;
144     }
145 
146     public CheckstyleExecutorRequest setIncludes( String includes )
147     {
148         this.includes = includes;
149         return this;
150     }
151 
152     public String getExcludes()
153     {
154         return excludes;
155     }
156 
157     public CheckstyleExecutorRequest setExcludes( String excludes )
158     {
159         this.excludes = excludes;
160         return this;
161     }
162 
163     public String getResourceIncludes()
164     {
165         return resourceIncludes;
166     }
167 
168     public CheckstyleExecutorRequest setResourceIncludes( String resourceIncludes )
169     {
170         this.resourceIncludes = resourceIncludes;
171         return this;
172     }
173 
174     public String getResourceExcludes()
175     {
176         return resourceExcludes;
177     }
178 
179     public CheckstyleExecutorRequest setResourceExcludes( String resourceExcludes )
180     {
181         this.resourceExcludes = resourceExcludes;
182         return this;
183     }
184 
185     public MavenProject getProject()
186     {
187         return project;
188     }
189 
190     public CheckstyleExecutorRequest setProject( MavenProject project )
191     {
192         this.project = project;
193         return this;
194     }
195 
196     public Log getLog()
197     {
198         return log;
199     }
200 
201     public CheckstyleExecutorRequest setLog( Log log )
202     {
203         this.log = log;
204         return this;
205     }
206 
207     public String getSuppressionsLocation()
208     {
209         return suppressionsLocation;
210     }
211 
212     public CheckstyleExecutorRequest setSuppressionsLocation( String suppressionsLocation )
213     {
214         this.suppressionsLocation = suppressionsLocation;
215         return this;
216     }
217 
218     public boolean isIncludeTestSourceDirectory()
219     {
220         return includeTestSourceDirectory;
221     }
222 
223     public CheckstyleExecutorRequest setIncludeTestSourceDirectory( boolean includeTestSourceDirectory )
224     {
225         this.includeTestSourceDirectory = includeTestSourceDirectory;
226         return this;
227     }
228 
229     public File getTestSourceDirectory()
230     {
231         return testSourceDirectory;
232     }
233 
234     public CheckstyleExecutorRequest setTestSourceDirectory( File testSourceDirectory )
235     {
236         this.testSourceDirectory = testSourceDirectory;
237         return this;
238     }
239 
240     public File getSourceDirectory()
241     {
242         return sourceDirectory;
243     }
244 
245     public CheckstyleExecutorRequest setSourceDirectory( File sourceDirectory )
246     {
247         this.sourceDirectory = sourceDirectory;
248         return this;
249     }
250 
251     public List<Resource> getResources()
252     {
253         return resources;
254     }
255 
256     public CheckstyleExecutorRequest setResources( List<Resource> resources )
257     {
258         this.resources = resources;
259         return this;
260     }
261 
262     public List<Resource> getTestResources()
263     {
264         return testResources;
265     }
266 
267     public CheckstyleExecutorRequest setTestResources( List<Resource> testResources )
268     {
269         this.testResources = testResources;
270         return this;
271     }
272 
273     public boolean isFailsOnError()
274     {
275         return failsOnError;
276     }
277 
278     public CheckstyleExecutorRequest setFailsOnError( boolean failsOnError )
279     {
280         this.failsOnError = failsOnError;
281         return this;
282     }
283 
284     public AuditListener getListener()
285     {
286         return listener;
287     }
288 
289     public CheckstyleExecutorRequest setListener( AuditListener listener )
290     {
291         this.listener = listener;
292         return this;
293     }
294 
295     public boolean isConsoleOutput()
296     {
297         return consoleOutput;
298     }
299 
300     public CheckstyleExecutorRequest setConsoleOutput( boolean consoleOutput )
301     {
302         this.consoleOutput = consoleOutput;
303         return this;
304     }
305 
306     public CheckstyleExecutorRequest setConsoleListener( DefaultLogger defaultLogger )
307     {
308         this.defaultLogger = defaultLogger;
309         return this;
310     }
311 
312     public DefaultLogger getConsoleListener()
313     {
314         return this.defaultLogger;
315     }
316 
317     public ByteArrayOutputStream getStringOutputStream()
318     {
319         return stringOutputStream;
320     }
321 
322     public CheckstyleExecutorRequest setStringOutputStream( ByteArrayOutputStream stringOutputStream )
323     {
324         this.stringOutputStream = stringOutputStream;
325         return this;
326     }
327 
328     public String getConfigLocation()
329     {
330         return configLocation;
331     }
332 
333     public CheckstyleExecutorRequest setConfigLocation( String configLocation )
334     {
335         this.configLocation = configLocation;
336         return this;
337     }
338 
339     public String getPropertyExpansion()
340     {
341         return propertyExpansion;
342     }
343 
344     public CheckstyleExecutorRequest setPropertyExpansion( String propertyExpansion )
345     {
346         this.propertyExpansion = propertyExpansion;
347         return this;
348     }
349 
350     public String getHeaderLocation()
351     {
352         return headerLocation;
353     }
354 
355     public CheckstyleExecutorRequest setHeaderLocation( String headerLocation )
356     {
357         this.headerLocation = headerLocation;
358         return this;
359     }
360 
361     public String getCacheFile()
362     {
363         return cacheFile;
364     }
365 
366     public CheckstyleExecutorRequest setCacheFile( String cacheFile )
367     {
368         this.cacheFile = cacheFile;
369         return this;
370     }
371 
372     public String getSuppressionsFileExpression()
373     {
374         return suppressionsFileExpression;
375     }
376 
377     public CheckstyleExecutorRequest setSuppressionsFileExpression( String suppressionsFileExpression )
378     {
379         this.suppressionsFileExpression = suppressionsFileExpression;
380         return this;
381     }
382 
383     public String getEncoding()
384     {
385         return encoding;
386     }
387 
388     public CheckstyleExecutorRequest setEncoding( String encoding )
389     {
390         this.encoding = encoding;
391         return this;
392     }
393 
394     public String getPropertiesLocation()
395     {
396         return propertiesLocation;
397     }
398 
399     public void setPropertiesLocation( String propertiesLocation )
400     {
401         this.propertiesLocation = propertiesLocation;
402     }
403 
404     /**
405      * Returns true if the report is aggregated.
406      *
407      * @return <code>true</code> if the report is aggregated.
408      */
409     public boolean isAggregate()
410     {
411         return aggregate;
412     }
413 
414     /**
415      * Sets the aggregate parameter.
416      *
417      * @param pAggregate <code>true</code> if an aggregated report is desidered.
418      * @return This object.
419      */
420     public CheckstyleExecutorRequest setAggregate( boolean pAggregate )
421     {
422         this.aggregate = pAggregate;
423         return this;
424     }
425 
426     /**
427      * Returns the list of reactor projects.
428      *
429      * @return The reactor projects.
430      */
431     public List<MavenProject> getReactorProjects()
432     {
433         return reactorProjects;
434     }
435 
436     /**
437      * Sets the list of reactor projects.
438      *
439      * @param pReactorProjects The reactor projects.
440      * @return This object.
441      */
442     public CheckstyleExecutorRequest setReactorProjects( List<MavenProject> pReactorProjects )
443     {
444         this.reactorProjects = pReactorProjects;
445         return this;
446     }
447 
448     /**
449      * Returns a list of license artifacts, which may contain the license.
450      * 
451      * @return the license artifacts
452      */
453     public List<Artifact> getLicenseArtifacts()
454     {
455         return licenseArtifacts;
456     }
457 
458     /**
459      * Sets a list of license artifacts, which may contain the license.
460      * 
461      * @param licenseArtifacts
462      * @return This object.
463      */
464     public CheckstyleExecutorRequest setLicenseArtifacts( List<Artifact> licenseArtifacts )
465     {
466         this.licenseArtifacts = licenseArtifacts;
467         return this;
468     }
469     
470     /**
471      * Returns a list of artifacts, which may contain the checkstyle configuration.
472      * 
473      * @return the license artifacts
474      */
475     public List<Artifact> getConfigurationArtifacts()
476     {
477         return configurationArtifacts;
478     }
479 
480     /**
481      * Sets a list of artifacts, which may contain the checkstyle configuration.
482      * 
483      * @param configArtifacts
484      * @return This object.
485      */
486     public CheckstyleExecutorRequest setConfigurationArtifacts( List<Artifact> configArtifacts )
487     {
488         this.configurationArtifacts = configArtifacts;
489         return this;
490     }
491     
492     public boolean isIncludeResources()
493     {
494         return includeResources;
495     }
496 
497     /**
498      * @param includeResources whether to include the resource directories in the checks.
499      * @return This object.
500      */
501     public CheckstyleExecutorRequest setIncludeResources( boolean includeResources )
502     {
503         this.includeResources = includeResources;
504         return this;
505     }
506 
507     public boolean isIncludeTestResources()
508     {
509         return includeTestResources;
510     }
511 
512     /**
513      * @param includeTestResources whether to set the test resource directories in the checks.
514      * @return This object.
515      */
516     public CheckstyleExecutorRequest setIncludeTestResources( boolean includeTestResources )
517     {
518         this.includeTestResources = includeTestResources;
519         return this;
520     }
521 }