KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jimm > datavision > gui > sql > DbConnReader


1 package jimm.datavision.gui.sql;
2 import jimm.datavision.ReportReader;
3 import org.xml.sax.*;
4
5
6 /**
7  * A database connection reader opens an existing report XML file and
8  * reads the database connection information. It is opened when the
9  * user clicks "Copy Settings..." from within a database connection
10  * window.
11  *
12  * @see DbConnWin
13  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
14  */

15 public class DbConnReader extends ReportReader {
16
17 protected String JavaDoc driverClassName;
18 protected String JavaDoc connInfo;
19 protected String JavaDoc dbName;
20 protected String JavaDoc username;
21
22 public DbConnReader() {
23     super(null);
24 }
25
26 public String JavaDoc getDriverClassName() { return driverClassName; }
27 public String JavaDoc getConnectionInfo() { return connInfo; }
28 public String JavaDoc getDbName() { return dbName; }
29 public String JavaDoc getUserName() { return username; }
30
31 /**
32  * Reads the database tag and grabs the attributes we want.
33  */

34 public void startElement(final String JavaDoc namespaceURI, final String JavaDoc localName,
35              final String JavaDoc qName, final Attributes attributes)
36 {
37     String JavaDoc tagName = localName;
38     if (tagName == null || tagName.length() == 0)
39         tagName = qName;
40
41     if ("database".equals(tagName)) {
42     driverClassName = attributes.getValue("driverClassName");
43     connInfo = attributes.getValue("connInfo");
44     dbName = attributes.getValue("name");
45     username = attributes.getValue("username");
46     }
47 }
48
49 public void endElement(final String JavaDoc namespaceURI, final String JavaDoc localName,
50                final String JavaDoc qName) {}
51 public void characters(char ch[], int start, int length) {}
52
53 }
54
Popular Tags