1 /*
2 Bloof - visualize the evolution of your software project
3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de>
4 http://bloof.sf.net/
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 $RCSfile: MetricRunner.java,v $
19 Created on $Date: 2003/09/06 08:35:09 $
20 */
21 package net.sf.bloof.metrics;
22
23 import java.sql.SQLException;
24
25 import net.sf.bloof.Bloof;
26 import net.sf.bloof.db.Database;
27 import net.sf.bloof.events.BloofEvent;
28 import net.sf.bloof.util.ProgressEvent;
29 import net.sf.bloof.util.intl.Messages;
30 import net.sf.bloof.util.intl.Text;
31
32 /***
33 *
34 * @author Lukasz Pekacki <pekacki@users.sourceforge.net>
35 * @version $Id: MetricRunner.java,v 1.3 2003/09/06 08:35:09 pekacki Exp $
36 */
37 public class MetricRunner implements Runnable {
38
39 /***
40 * Metric Runner
41 * @param aMetric metric to run
42 * @param aDb Database for running the metric
43 */
44 public MetricRunner(Metric aMetric, Database aDb) {
45 mMetric = aMetric;
46 mDatabase = aDb;
47 }
48
49 /***
50 * @see java.lang.Runnable#run()
51 */
52 public void run() {
53 try {
54 mMetric.runMetric(mDatabase);
55 } catch (SQLException e) {
56 Bloof.fail("Could not run metric:" + mMetric.getName() + "Reason:" + e.toString());
57 Bloof.propagateProgressEvent(new ProgressEvent(Messages.getString(Text.ERROR), 100));
58 return;
59 }
60 BloofEvent metricRunFinished =
61 new BloofEvent(BloofEvent.METRIC_RUN_FINISHED, BloofEvent.PARAM_OBJECT, mMetric);
62 Bloof.propagateProgressEvent(new ProgressEvent(Messages.getString(Text.FINISHED), 100));
63 Bloof.propagateBloofEvent(metricRunFinished);
64
65 }
66
67 private Metric mMetric;
68 private Database mDatabase;
69
70 }
This page was automatically generated by Maven