View Javadoc
1   package org.apache.maven.plugins.pmd.exec;
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.File;
23  import java.io.Serializable;
24  import java.util.ArrayList;
25  import java.util.Collection;
26  import java.util.List;
27  import java.util.Properties;
28  
29  /**
30   * Data object to store all configuration options needed to execute CPD
31   * as a separate process.
32   * 
33   * <p>This class is intended to be serialized and read back.
34   * 
35   * <p>Some properties might be optional and can be <code>null</code>.
36   */
37  public class CpdRequest implements Serializable
38  {
39      private static final long serialVersionUID = -7585852992660240668L;
40  
41      private String javaExecutable;
42  
43      private int minimumTokens;
44      private String language;
45      private Properties languageProperties;
46      private String sourceEncoding;
47      private List<File> files = new ArrayList<>();
48  
49      private boolean showPmdLog;
50      private boolean colorizedLog;
51      private String logLevel;
52  
53      private String excludeFromFailureFile;
54      private String targetDirectory;
55      private String outputEncoding;
56      private String format;
57      private boolean includeXmlInSite;
58      private String reportOutputDirectory;
59  
60      public void setJavaExecutable( String javaExecutable )
61      {
62          this.javaExecutable = javaExecutable;
63      }
64  
65      public void setMinimumTokens( int minimumTokens )
66      {
67          this.minimumTokens = minimumTokens;
68      }
69  
70      public void setLanguage( String language )
71      {
72          this.language = language;
73      }
74  
75      public void setLanguageProperties( Properties languageProperties )
76      {
77          this.languageProperties = languageProperties;
78      }
79  
80      public void setSourceEncoding( String sourceEncoding )
81      {
82          this.sourceEncoding = sourceEncoding;
83      }
84  
85      public void addFiles( Collection<File> files )
86      {
87          this.files.addAll( files );
88      }
89  
90      public void setExcludeFromFailureFile( String excludeFromFailureFile )
91      {
92          this.excludeFromFailureFile = excludeFromFailureFile;
93      }
94  
95      public void setTargetDirectory( String targetDirectory )
96      {
97          this.targetDirectory = targetDirectory;
98      }
99  
100     public void setOutputEncoding( String outputEncoding )
101     {
102         this.outputEncoding = outputEncoding;
103     }
104 
105     public void setFormat( String format )
106     {
107         this.format = format;
108     }
109 
110     public void setIncludeXmlInSite( boolean includeXmlInSite )
111     {
112         this.includeXmlInSite = includeXmlInSite;
113     }
114 
115     public void setReportOutputDirectory( String reportOutputDirectory )
116     {
117         this.reportOutputDirectory = reportOutputDirectory;
118     }
119 
120     public void setShowPmdLog( boolean showPmdLog )
121     {
122         this.showPmdLog = showPmdLog;
123     }
124 
125     public void setColorizedLog( boolean colorizedLog )
126     {
127         this.colorizedLog = colorizedLog;
128     }
129 
130     public void setLogLevel( String logLevel )
131     {
132         this.logLevel = logLevel;
133     }
134 
135     public String getJavaExecutable()
136     {
137         return javaExecutable;
138     }
139 
140     public int getMinimumTokens()
141     {
142         return minimumTokens;
143     }
144 
145     public String getLanguage()
146     {
147         return language;
148     }
149 
150     public Properties getLanguageProperties()
151     {
152         return languageProperties;
153     }
154 
155     public String getSourceEncoding()
156     {
157         return sourceEncoding;
158     }
159 
160     public List<File> getFiles()
161     {
162         return files;
163     }
164 
165     public String getExcludeFromFailureFile()
166     {
167         return excludeFromFailureFile;
168     }
169 
170     public String getTargetDirectory()
171     {
172         return targetDirectory;
173     }
174 
175     public String getOutputEncoding()
176     {
177         return outputEncoding;
178     }
179 
180     public String getFormat()
181     {
182         return format;
183     }
184 
185     public boolean isIncludeXmlInSite()
186     {
187         return includeXmlInSite;
188     }
189 
190     public String getReportOutputDirectory()
191     {
192         return reportOutputDirectory;
193     }
194 
195     public boolean isShowPmdLog()
196     {
197         return showPmdLog;
198     }
199 
200     public boolean isColorizedLog()
201     {
202         return colorizedLog;
203     }
204 
205     public String getLogLevel()
206     {
207         return logLevel;
208     }
209 }