KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > IFindBugsEngine


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2006, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs;
21
22 import java.io.IOException JavaDoc;
23
24 import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
25 import edu.umd.cs.findbugs.classfile.IClassObserver;
26 import edu.umd.cs.findbugs.config.AnalysisFeatureSetting;
27 import edu.umd.cs.findbugs.config.UserPreferences;
28 import edu.umd.cs.findbugs.filter.FilterException;
29
30 /**
31  * Interface for a FindBugs engine class.
32  * An instance of this interface takes a project, user configuration
33  * options, orchestrates the analysis of the classes
34  * in the project, and reports the results to the
35  * configured BugReporter.
36  *
37  * @author David Hovemeyer
38  */

39 public interface IFindBugsEngine {
40
41     /**
42      * Get the BugReporter.
43      *
44      * @return the BugReporter
45      */

46     public BugReporter getBugReporter();
47
48     /**
49      * Set the BugReporter.
50      *
51      * @param bugReporter The BugReporter to set
52      */

53     public void setBugReporter(BugReporter bugReporter);
54
55     /**
56      * Set the Project.
57      *
58      * @param project The Project to set
59      */

60     public void setProject(Project project);
61     
62     /**
63      * Get the Project.
64      *
65      * @return the Project
66      */

67     public Project getProject();
68
69     /**
70      * Set the progress callback that will be used to keep track
71      * of the progress of the analysis.
72      *
73      * @param progressCallback the progress callback
74      */

75     public void setProgressCallback(FindBugsProgress progressCallback);
76
77     /**
78      * Set filter of bug instances to include or exclude.
79      *
80      * @param filterFileName the name of the filter file
81      * @param include true if the filter specifies bug instances to include,
82      * false if it specifies bug instances to exclude
83      */

84     public void addFilter(String JavaDoc filterFileName, boolean include)
85             throws IOException JavaDoc, FilterException;
86
87     /**
88      * Set the UserPreferences representing which Detectors
89      * should be used. If UserPreferences are not set explicitly,
90      * the default set of Detectors will be used.
91      *
92      * @param userPreferences the UserPreferences
93      */

94     public void setUserPreferences(UserPreferences userPreferences);
95
96     /**
97      * Add an IClassObserver.
98      *
99      * @param classObserver the IClassObserver
100      */

101     public void addClassObserver(IClassObserver classObserver);
102
103     /**
104      * Set the ClassScreener.
105      * This object chooses which individual classes to analyze.
106      * By default, all classes are analyzed.
107      *
108      * @param classScreener the ClassScreener to use
109      */

110     public void setClassScreener(IClassScreener classScreener);
111
112     /**
113      * Set relaxed reporting mode.
114      *
115      * @param relaxedReportingMode true if relaxed reporting mode should be enabled,
116      * false if not
117      */

118     public void setRelaxedReportingMode(boolean relaxedReportingMode);
119
120     /**
121      * Set whether or not training output should be emitted.
122      *
123      * @param trainingOutputDir directory to save training output in
124      */

125     public void enableTrainingOutput(String JavaDoc trainingOutputDir);
126
127     /**
128      * Set whether or not training input should be used to
129      * make the analysis more precise.
130      *
131      * @param trainingInputDir directory to load training input from
132      */

133     public void enableTrainingInput(String JavaDoc trainingInputDir);
134
135     /**
136      * Set analysis feature settings.
137      *
138      * @param settingList list of analysis feature settings
139      */

140     public void setAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList);
141
142     /**
143      * @return Returns the releaseName.
144      */

145     public String JavaDoc getReleaseName();
146
147     /**
148      * @param releaseName The releaseName to set.
149      */

150     public void setReleaseName(String JavaDoc releaseName);
151
152     /**
153      * Set the filename of the source info file containing line numbers for fields
154      * and classes.
155      *
156      * @param sourceInfoFile the source info filename
157      */

158     public void setSourceInfoFile(String JavaDoc sourceInfoFile);
159
160     /**
161      * Execute FindBugs on the Project.
162      * All bugs found are reported to the BugReporter object which was set
163      * when this object was constructed.
164      *
165      * @throws java.io.IOException if an I/O exception occurs analyzing one of the files
166      * @throws InterruptedException if the thread is interrupted while conducting the analysis
167      * @throws CheckedAnalysisException if a fatal exception occurs
168      */

169     public void execute() throws java.io.IOException JavaDoc, InterruptedException JavaDoc/*, CheckedAnalysisException*/;
170
171     /**
172      * Get the name of the most recent class to be analyzed.
173      * This is useful for diagnosing an unexpected exception.
174      * Returns null if no class has been analyzed.
175      */

176     public String JavaDoc getCurrentClass();
177
178     /**
179      * Get the number of bug instances that were reported during analysis.
180      */

181     public int getBugCount();
182
183     /**
184      * Get the number of errors that occurred during analysis.
185      */

186     public int getErrorCount();
187
188     /**
189      * Get the number of time missing classes were reported during analysis.
190      */

191     public int getMissingClassCount();
192
193     /**
194      * Get the UserPreferences.
195      *
196      * @return the UserPreferences
197      */

198     public UserPreferences getUserPreferences();
199
200     /**
201      * Return whether or not training output should be emitted
202      * after analysis completes.
203      *
204      * @return true if training output should be emitted, false if not
205      */

206     public boolean emitTrainingOutput();
207
208     /**
209      * Get the training output directory.
210      *
211      * @return the training output directory
212      */

213     public String JavaDoc getTrainingOutputDir();
214
215     /**
216      * Return whether or not we should make use of
217      * training data.
218      *
219      * @return true if training data should be used, false if not
220      */

221     public boolean useTrainingInput();
222
223     /**
224      * Get the training input database directory.
225      *
226      * @return the training input database directory
227      */

228     public String JavaDoc getTrainingInputDir();
229
230     /**
231      * Set whether or not nested archives should be scanned.
232      *
233      * @param scanNestedArchives true if nested archives should be scanned, false if not
234      */

235     public void setScanNestedArchives(boolean scanNestedArchives);
236
237     /**
238      * Set the DetectorFactoryCollection from which plugins/detectors
239      * may be accessed.
240      *
241      * @param detectorFactoryCollection the DetectorFactoryCollection
242      */

243     public void setDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection);
244 }
245
Popular Tags