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.model.Resource;
27  import org.apache.maven.plugin.logging.Log;
28  import org.apache.maven.project.MavenProject;
29  
30  import com.puppycrawl.tools.checkstyle.DefaultLogger;
31  import com.puppycrawl.tools.checkstyle.api.AuditListener;
32  
33  /**
34   * @author Olivier Lamy
35   * @since 2.5
36   * @version $Id: CheckstyleExecutorRequest.java 1540550 2013-11-10 21:04:52Z bimargulies $
37   */
38  public class CheckstyleExecutorRequest
39  {
40  
41      /**
42       * Specifies the names filter of the source files to be used for Checkstyle.
43       */
44      private String includes;
45  
46      /**
47       * Specifies the names filter of the source files to be excluded for Checkstyle.
48       */
49      private String excludes;
50  
51      /**
52       * Specifies names filter for resources.
53       */
54      private String resourceIncludes;
55  
56      /**
57       * Specifies names filter for resources.
58       */
59      private String resourceExcludes;
60  
61      private MavenProject project;
62  
63      private Log log;
64  
65      private String suppressionsLocation;
66  
67      private boolean includeTestSourceDirectory;
68  
69      private File testSourceDirectory;
70  
71      private File sourceDirectory;
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      * @since 2.8
109      */
110     private boolean aggregate = false;
111 
112     /**
113      * @since 2.8
114      */
115     private List<MavenProject> reactorProjects;
116 
117     /**
118      * Constructor.
119      */
120     public CheckstyleExecutorRequest( )
121     {
122         //nothing
123     }
124 
125     /**
126      * Returns the includes parameter.
127      *
128      * @return The includes parameter.
129      */
130     public String getIncludes()
131     {
132         return includes;
133     }
134 
135     public CheckstyleExecutorRequest setIncludes( String includes )
136     {
137         this.includes = includes;
138         return this;
139     }
140 
141     public String getExcludes()
142     {
143         return excludes;
144     }
145 
146     public CheckstyleExecutorRequest setExcludes( String excludes )
147     {
148         this.excludes = excludes;
149         return this;
150     }
151 
152     public String getResourceIncludes()
153     {
154         return resourceIncludes;
155     }
156 
157     public CheckstyleExecutorRequest setResourceIncludes( String resourceIncludes )
158     {
159         this.resourceIncludes = resourceIncludes;
160         return this;
161     }
162 
163     public String getResourceExcludes()
164     {
165         return resourceExcludes;
166     }
167 
168     public CheckstyleExecutorRequest setResourceExcludes( String resourceExcludes )
169     {
170         this.resourceExcludes = resourceExcludes;
171         return this;
172     }
173 
174     public MavenProject getProject()
175     {
176         return project;
177     }
178 
179     public CheckstyleExecutorRequest setProject( MavenProject project )
180     {
181         this.project = project;
182         return this;
183     }
184 
185     public Log getLog()
186     {
187         return log;
188     }
189 
190     public CheckstyleExecutorRequest setLog( Log log )
191     {
192         this.log = log;
193         return this;
194     }
195 
196     public String getSuppressionsLocation()
197     {
198         return suppressionsLocation;
199     }
200 
201     public CheckstyleExecutorRequest setSuppressionsLocation( String suppressionsLocation )
202     {
203         this.suppressionsLocation = suppressionsLocation;
204         return this;
205     }
206 
207     public boolean isIncludeTestSourceDirectory()
208     {
209         return includeTestSourceDirectory;
210     }
211 
212     public CheckstyleExecutorRequest setIncludeTestSourceDirectory( boolean includeTestSourceDirectory )
213     {
214         this.includeTestSourceDirectory = includeTestSourceDirectory;
215         return this;
216     }
217 
218     public File getTestSourceDirectory()
219     {
220         return testSourceDirectory;
221     }
222 
223     public CheckstyleExecutorRequest setTestSourceDirectory( File testSourceDirectory )
224     {
225         this.testSourceDirectory = testSourceDirectory;
226         return this;
227     }
228 
229     public File getSourceDirectory()
230     {
231         return sourceDirectory;
232     }
233 
234     public CheckstyleExecutorRequest setSourceDirectory( File sourceDirectory )
235     {
236         this.sourceDirectory = sourceDirectory;
237         return this;
238     }
239 
240     public List<Resource> getResources()
241     {
242         return resources;
243     }
244 
245     public CheckstyleExecutorRequest setResources( List<Resource> resources )
246     {
247         this.resources = resources;
248         return this;
249     }
250 
251     public List<Resource> getTestResources()
252     {
253         return testResources;
254     }
255 
256     public CheckstyleExecutorRequest setTestResources( List<Resource> testResources )
257     {
258         this.testResources = testResources;
259         return this;
260     }
261 
262     public boolean isFailsOnError()
263     {
264         return failsOnError;
265     }
266 
267     public CheckstyleExecutorRequest setFailsOnError( boolean failsOnError )
268     {
269         this.failsOnError = failsOnError;
270         return this;
271     }
272 
273     public AuditListener getListener()
274     {
275         return listener;
276     }
277 
278     public CheckstyleExecutorRequest setListener( AuditListener listener )
279     {
280         this.listener = listener;
281         return this;
282     }
283 
284     public boolean isConsoleOutput()
285     {
286         return consoleOutput;
287     }
288 
289     public CheckstyleExecutorRequest setConsoleOutput( boolean consoleOutput )
290     {
291         this.consoleOutput = consoleOutput;
292         return this;
293     }
294 
295     public CheckstyleExecutorRequest setConsoleListener( DefaultLogger defaultLogger )
296     {
297         this.defaultLogger = defaultLogger;
298         return this;
299     }
300 
301     public DefaultLogger getConsoleListener()
302     {
303         return this.defaultLogger;
304     }
305 
306     public ByteArrayOutputStream getStringOutputStream()
307     {
308         return stringOutputStream;
309     }
310 
311     public CheckstyleExecutorRequest setStringOutputStream( ByteArrayOutputStream stringOutputStream )
312     {
313         this.stringOutputStream = stringOutputStream;
314         return this;
315     }
316 
317     public String getConfigLocation()
318     {
319         return configLocation;
320     }
321 
322     public CheckstyleExecutorRequest setConfigLocation( String configLocation )
323     {
324         this.configLocation = configLocation;
325         return this;
326     }
327 
328     public String getPropertyExpansion()
329     {
330         return propertyExpansion;
331     }
332 
333     public CheckstyleExecutorRequest setPropertyExpansion( String propertyExpansion )
334     {
335         this.propertyExpansion = propertyExpansion;
336         return this;
337     }
338 
339     public String getHeaderLocation()
340     {
341         return headerLocation;
342     }
343 
344     public CheckstyleExecutorRequest setHeaderLocation( String headerLocation )
345     {
346         this.headerLocation = headerLocation;
347         return this;
348     }
349 
350     public String getCacheFile()
351     {
352         return cacheFile;
353     }
354 
355     public CheckstyleExecutorRequest setCacheFile( String cacheFile )
356     {
357         this.cacheFile = cacheFile;
358         return this;
359     }
360 
361     public String getSuppressionsFileExpression()
362     {
363         return suppressionsFileExpression;
364     }
365 
366     public CheckstyleExecutorRequest setSuppressionsFileExpression( String suppressionsFileExpression )
367     {
368         this.suppressionsFileExpression = suppressionsFileExpression;
369         return this;
370     }
371 
372     public String getEncoding()
373     {
374         return encoding;
375     }
376 
377     public CheckstyleExecutorRequest setEncoding( String encoding )
378     {
379         this.encoding = encoding;
380         return this;
381     }
382 
383     public String getPropertiesLocation()
384     {
385         return propertiesLocation;
386     }
387 
388     public void setPropertiesLocation( String propertiesLocation )
389     {
390         this.propertiesLocation = propertiesLocation;
391     }
392 
393     /**
394      * Returns true if the report is aggregated.
395      *
396      * @return <code>true</code> if the report is aggregated.
397      */
398     public boolean isAggregate()
399     {
400         return aggregate;
401     }
402 
403     /**
404      * Sets the aggregate parameter.
405      *
406      * @param pAggregate <code>true</code> if an aggregated report is desidered.
407      * @return This object.
408      */
409     public CheckstyleExecutorRequest setAggregate( boolean pAggregate )
410     {
411         this.aggregate = pAggregate;
412         return this;
413     }
414 
415     /**
416      * Returns the list of reactor projects.
417      *
418      * @return The reactor projects.
419      */
420     public List<MavenProject> getReactorProjects()
421     {
422         return reactorProjects;
423     }
424 
425     /**
426      * Sets the list of reactor projects.
427      *
428      * @param pReactorProjects The reactor projects.
429      * @return This object.
430      */
431     public CheckstyleExecutorRequest setReactorProjects( List<MavenProject> pReactorProjects )
432     {
433         this.reactorProjects = pReactorProjects;
434         return this;
435     }
436 
437     public boolean isIncludeResources()
438     {
439         return includeResources;
440     }
441 
442     /**
443      * @param includeResources whether to include the resource directories in the checks.
444      * @return This object.
445      */
446     public CheckstyleExecutorRequest setIncludeResources( boolean includeResources )
447     {
448         this.includeResources = includeResources;
449         return this;
450     }
451 
452     public boolean isIncludeTestResources()
453     {
454         return includeTestResources;
455     }
456 
457     /**
458      * @param includeTestResources whether to set the test resource directories in the checks.
459      * @return This object.
460      */
461     public CheckstyleExecutorRequest setIncludeTestResources( boolean includeTestResources )
462     {
463         this.includeTestResources = includeTestResources;
464         return this;
465     }
466 }