01: package jimm.datavision.gui.sql;
02:
03: import jimm.datavision.Report;
04: import jimm.datavision.ReportReader;
05: import org.xml.sax.*;
06:
07: /**
08: * A database connection reader opens an existing report XML file and
09: * reads the database connection information. It is opened when the
10: * user clicks "Copy Settings..." from within a database connection
11: * window.
12: *
13: * @see DbConnWin
14: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
15: */
16: public class DbConnReader extends ReportReader {
17:
18: protected String driverClassName;
19: protected String connInfo;
20: protected String dbName;
21: protected String username;
22:
23: public DbConnReader() {
24: super (new Report());
25: }
26:
27: public String getDriverClassName() {
28: return driverClassName;
29: }
30:
31: public String getConnectionInfo() {
32: return connInfo;
33: }
34:
35: public String getDbName() {
36: return dbName;
37: }
38:
39: public String getUserName() {
40: return username;
41: }
42:
43: /**
44: * Reads the database tag and grabs the attributes we want.
45: */
46: public void startElement(final String namespaceURI,
47: final String localName, final String qName,
48: final Attributes attributes) {
49: String tagName = localName;
50: if (tagName == null || tagName.length() == 0)
51: tagName = qName;
52:
53: if ("database".equals(tagName)) {
54: driverClassName = attributes.getValue("driverClassName");
55: connInfo = attributes.getValue("connInfo");
56: dbName = attributes.getValue("name");
57: username = attributes.getValue("username");
58: }
59: }
60:
61: public void endElement(final String namespaceURI,
62: final String localName, final String qName) {
63: }
64:
65: public void characters(char ch[], int start, int length) {
66: }
67:
68: }
|