01: package net.firstpartners.nounit.report;
02:
03: /**
04: * Title: NoUnit - Identify Classes that are not being unit Tested
05: *
06: * Copyright (C) 2001 Paul Browne , FirstPartners.net
07: *
08: *
09: * This program is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU General Public License
11: * as published by the Free Software Foundation; either version 2
12: * of the License, or (at your option) any later version.
13: *
14: * This program is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: * GNU General Public License for more details.
18: *
19: * You should have received a copy of the GNU General Public License
20: * along with this program; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22: *
23: * @author Paul Browne
24: * @version 0.7
25: */
26:
27: import java.io.File;
28: import java.io.FileNotFoundException;
29: import java.io.IOException;
30:
31: import javax.xml.transform.TransformerConfigurationException;
32: import javax.xml.transform.TransformerException;
33:
34: import net.firstpartners.nounit.ui.common.CommandPackage;
35: import net.firstpartners.nounit.utility.NoUnitException;
36:
37: /**
38: * Generate the report from the XML describing the Java. Provides Common functions
39: * that can be re-used or overwritten
40: */
41: abstract public class AbstractReport implements IReport {
42:
43: /**
44: * Transform the XML into the required reports
45: * @param inPackage - CommandPackage with required parameters
46: * @exception TransformerException
47: * @exception TransformerConfigurationException
48: * @exception IOException
49: * @exception FileNotFoundException
50: * @exception NoUnitException
51: */
52: abstract public void makeReport(CommandPackage inPackage)
53: throws TransformerException,
54: TransformerConfigurationException, IOException,
55: FileNotFoundException, NoUnitException;
56:
57: /**
58: * Use the TraX interface to perform a transformation in the simplest manner possible
59: * (Calls the main method of org.apache.xalan.xslt.Process - mimics calling the
60: * transfromer from the command-line where the xslt has been tested)
61: * @param xmlFile - the xml to transform
62: * @param xslFile - the stylesheet to apply
63: * @param outFile - tmp file , showing how to move tmp names to actual names
64: */
65: protected void transformFile(File xmlFile, File xslFile,
66: File outFile) {
67:
68: //Build up the String to pass to the transformer
69: String args[] = new String[6];
70: args[0] = "-IN";
71: args[1] = xmlFile.toString();
72: args[2] = "-xsl";
73: args[3] = xslFile.toString();
74: args[4] = "-OUT";
75: args[5] = outFile.toString();
76:
77: //Call the main method on the transformer to carry out
78: org.apache.xalan.xslt.Process.main(args);
79:
80: }
81:
82: }
|