KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > firstpartners > nounit > report > AbstractReport


1 package net.firstpartners.nounit.report;
2
3 /**
4  * Title: NoUnit - Identify Classes that are not being unit Tested
5  *
6  * Copyright (C) 2001 Paul Browne , FirstPartners.net
7  *
8  *
9  * 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 JavaDoc;
28 import java.io.FileNotFoundException JavaDoc;
29 import java.io.IOException JavaDoc;
30
31 import javax.xml.transform.TransformerConfigurationException JavaDoc;
32 import javax.xml.transform.TransformerException JavaDoc;
33
34 import net.firstpartners.nounit.ui.common.CommandPackage;
35 import net.firstpartners.nounit.utility.NoUnitException;
36
37
38 /**
39  * Generate the report from the XML describing the Java. Provides Common functions
40  * that can be re-used or overwritten
41  */

42 abstract public class AbstractReport
43 implements IReport {
44
45 /**
46  * Transform the XML into the required reports
47  * @param inPackage - CommandPackage with required parameters
48  * @exception TransformerException
49  * @exception TransformerConfigurationException
50  * @exception IOException
51  * @exception FileNotFoundException
52  * @exception NoUnitException
53  */

54  abstract public void makeReport(CommandPackage inPackage)
55   throws TransformerException JavaDoc, TransformerConfigurationException JavaDoc,
56         IOException JavaDoc , FileNotFoundException JavaDoc , NoUnitException ;
57
58
59 /**
60  * Use the TraX interface to perform a transformation in the simplest manner possible
61  * (Calls the main method of org.apache.xalan.xslt.Process - mimics calling the
62  * transfromer from the command-line where the xslt has been tested)
63  * @param xmlFile - the xml to transform
64  * @param xslFile - the stylesheet to apply
65  * @param outFile - tmp file , showing how to move tmp names to actual names
66  */

67  protected void transformFile( File JavaDoc xmlFile, File JavaDoc xslFile , File JavaDoc outFile)
68   {
69
70       //Build up the String to pass to the transformer
71
String JavaDoc args[] = new String JavaDoc[6];
72       args[0]="-IN";
73       args[1]=xmlFile.toString();
74       args[2]="-xsl";
75       args[3]=xslFile.toString();
76       args[4]="-OUT";
77       args[5]=outFile.toString();
78
79       //Call the main method on the transformer to carry out
80
org.apache.xalan.xslt.Process.main(args);
81
82   }
83
84 }
85
Popular Tags