01: /*
02: $Id: ConfigurationManagerTest.java,v 1.3 2005/02/14 12:12:22 vauclair Exp $
03:
04: Copyright (C) 2002-2005 Sebastien Vauclair
05:
06: This file is part of Extensible Java Profiler.
07:
08: Extensible Java Profiler is free software; you can redistribute it and/or
09: modify it under the terms of the GNU General Public License as published by
10: the Free Software Foundation; either version 2 of the License, or
11: (at your option) any later version.
12:
13: Extensible Java Profiler is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with Extensible Java Profiler; if not, write to the Free Software
20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: */
22:
23: package ejp.presenter.xml;
24:
25: import java.io.File;
26:
27: import org.xml.sax.SAXParseException;
28:
29: import ejp.presenter.api.util.CustomLogger;
30: import ejp.presenter.gui.RunProgramDialog;
31:
32: /**
33: * TODOC
34: *
35: * @author Sebastien Vauclair
36: * @version <code>$Revision: 1.3 $<br>$Date: 2005/02/14 12:12:22 $</code>
37: */
38: public class ConfigurationManagerTest {
39: /**
40: * Convenience method for testing purpose.
41: */
42: public static void main(String[] aArgs) throws Exception {
43: try {
44: FiltersRepository.createInstance(new File(
45: "../../../../etc/filters/default.xml"));
46: } catch (SAXParseException saxpe) {
47: System.out.println(saxpe);
48:
49: // copied and modified from MainFrame.java
50: CustomLogger.INSTANCE.severe("unable to parse XML file - "
51: + saxpe.getMessage() + " @ line "
52: + saxpe.getLineNumber() + ", column "
53: + saxpe.getColumnNumber() + ", id = "
54: + saxpe.getPublicId() + ";" + saxpe.getSystemId());
55: }
56:
57: try {
58: ConfigurationManager.createInstance(new File(
59: "../../../../etc/settings/default.xml"));
60: } catch (Exception e) {
61: System.out.println("FATAL EXCEPTION - " + e);
62: return;
63: }
64:
65: if (ConfigurationManager.getInstance().exception != null)
66: System.out.println("warning: "
67: + ConfigurationManager.getInstance().exception);
68:
69: RunProgramDialog rpd = new RunProgramDialog(
70: new javax.swing.JFrame());
71: rpd.showDialog(null, -1);
72:
73: System.exit(0);
74: }
75: }
|