View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.pmd.exec;
20  
21  import java.io.File;
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.Collection;
25  import java.util.List;
26  import java.util.Properties;
27  
28  /**
29   * Data object to store all configuration options needed to execute CPD
30   * as a separate process.
31   *
32   * <p>This class is intended to be serialized and read back.
33   *
34   * <p>Some properties might be optional and can be <code>null</code>.
35   */
36  public class CpdRequest implements Serializable {
37      private static final long serialVersionUID = -7585852992660240668L;
38  
39      private String javaExecutable;
40  
41      private int minimumTokens;
42      private String language;
43      private Properties languageProperties;
44      private String sourceEncoding;
45      private List<File> files = new ArrayList<>();
46  
47      private boolean showPmdLog;
48      private String logLevel;
49  
50      private String excludeFromFailureFile;
51      private String targetDirectory;
52      private String outputEncoding;
53      private String format;
54      private boolean includeXmlInSite;
55      private String reportOutputDirectory;
56  
57      public void setJavaExecutable(String javaExecutable) {
58          this.javaExecutable = javaExecutable;
59      }
60  
61      public void setMinimumTokens(int minimumTokens) {
62          this.minimumTokens = minimumTokens;
63      }
64  
65      public void setLanguage(String language) {
66          this.language = language;
67      }
68  
69      public void setLanguageProperties(Properties languageProperties) {
70          this.languageProperties = languageProperties;
71      }
72  
73      public void setSourceEncoding(String sourceEncoding) {
74          this.sourceEncoding = sourceEncoding;
75      }
76  
77      public void addFiles(Collection<File> files) {
78          this.files.addAll(files);
79      }
80  
81      public void setExcludeFromFailureFile(String excludeFromFailureFile) {
82          this.excludeFromFailureFile = excludeFromFailureFile;
83      }
84  
85      public void setTargetDirectory(String targetDirectory) {
86          this.targetDirectory = targetDirectory;
87      }
88  
89      public void setOutputEncoding(String outputEncoding) {
90          this.outputEncoding = outputEncoding;
91      }
92  
93      public void setFormat(String format) {
94          this.format = format;
95      }
96  
97      public void setIncludeXmlInSite(boolean includeXmlInSite) {
98          this.includeXmlInSite = includeXmlInSite;
99      }
100 
101     public void setReportOutputDirectory(String reportOutputDirectory) {
102         this.reportOutputDirectory = reportOutputDirectory;
103     }
104 
105     public void setShowPmdLog(boolean showPmdLog) {
106         this.showPmdLog = showPmdLog;
107     }
108 
109     public void setLogLevel(String logLevel) {
110         this.logLevel = logLevel;
111     }
112 
113     public String getJavaExecutable() {
114         return javaExecutable;
115     }
116 
117     public int getMinimumTokens() {
118         return minimumTokens;
119     }
120 
121     public String getLanguage() {
122         return language;
123     }
124 
125     public Properties getLanguageProperties() {
126         return languageProperties;
127     }
128 
129     public String getSourceEncoding() {
130         return sourceEncoding;
131     }
132 
133     public List<File> getFiles() {
134         return files;
135     }
136 
137     public String getExcludeFromFailureFile() {
138         return excludeFromFailureFile;
139     }
140 
141     public String getTargetDirectory() {
142         return targetDirectory;
143     }
144 
145     public String getOutputEncoding() {
146         return outputEncoding;
147     }
148 
149     public String getFormat() {
150         return format;
151     }
152 
153     public boolean isIncludeXmlInSite() {
154         return includeXmlInSite;
155     }
156 
157     public String getReportOutputDirectory() {
158         return reportOutputDirectory;
159     }
160 
161     public boolean isShowPmdLog() {
162         return showPmdLog;
163     }
164 
165     public String getLogLevel() {
166         return logLevel;
167     }
168 }