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 String logLevel;
51  
52      private String excludeFromFailureFile;
53      private String targetDirectory;
54      private String outputEncoding;
55      private String format;
56      private boolean includeXmlInSite;
57      private String reportOutputDirectory;
58  
59      public void setJavaExecutable( String javaExecutable )
60      {
61          this.javaExecutable = javaExecutable;
62      }
63  
64      public void setMinimumTokens( int minimumTokens )
65      {
66          this.minimumTokens = minimumTokens;
67      }
68  
69      public void setLanguage( String language )
70      {
71          this.language = language;
72      }
73  
74      public void setLanguageProperties( Properties languageProperties )
75      {
76          this.languageProperties = languageProperties;
77      }
78  
79      public void setSourceEncoding( String sourceEncoding )
80      {
81          this.sourceEncoding = sourceEncoding;
82      }
83  
84      public void addFiles( Collection<File> files )
85      {
86          this.files.addAll( files );
87      }
88  
89      public void setExcludeFromFailureFile( String excludeFromFailureFile )
90      {
91          this.excludeFromFailureFile = excludeFromFailureFile;
92      }
93  
94      public void setTargetDirectory( String targetDirectory )
95      {
96          this.targetDirectory = targetDirectory;
97      }
98  
99      public void setOutputEncoding( String outputEncoding )
100     {
101         this.outputEncoding = outputEncoding;
102     }
103 
104     public void setFormat( String format )
105     {
106         this.format = format;
107     }
108 
109     public void setIncludeXmlInSite( boolean includeXmlInSite )
110     {
111         this.includeXmlInSite = includeXmlInSite;
112     }
113 
114     public void setReportOutputDirectory( String reportOutputDirectory )
115     {
116         this.reportOutputDirectory = reportOutputDirectory;
117     }
118 
119     public void setShowPmdLog( boolean showPmdLog )
120     {
121         this.showPmdLog = showPmdLog;
122     }
123 
124     public void setLogLevel( String logLevel )
125     {
126         this.logLevel = logLevel;
127     }
128 
129     public String getJavaExecutable()
130     {
131         return javaExecutable;
132     }
133 
134     public int getMinimumTokens()
135     {
136         return minimumTokens;
137     }
138 
139     public String getLanguage()
140     {
141         return language;
142     }
143 
144     public Properties getLanguageProperties()
145     {
146         return languageProperties;
147     }
148 
149     public String getSourceEncoding()
150     {
151         return sourceEncoding;
152     }
153 
154     public List<File> getFiles()
155     {
156         return files;
157     }
158 
159     public String getExcludeFromFailureFile()
160     {
161         return excludeFromFailureFile;
162     }
163 
164     public String getTargetDirectory()
165     {
166         return targetDirectory;
167     }
168 
169     public String getOutputEncoding()
170     {
171         return outputEncoding;
172     }
173 
174     public String getFormat()
175     {
176         return format;
177     }
178 
179     public boolean isIncludeXmlInSite()
180     {
181         return includeXmlInSite;
182     }
183 
184     public String getReportOutputDirectory()
185     {
186         return reportOutputDirectory;
187     }
188 
189     public boolean isShowPmdLog()
190     {
191         return showPmdLog;
192     }
193 
194     public String getLogLevel()
195     {
196         return logLevel;
197     }
198 }