Revision 747
Added by bojilova almost 23 years ago
DBSAXNode.java | ||
---|---|---|
34 | 34 |
import oracle.jdbc.driver.*; |
35 | 35 |
import org.xml.sax.SAXException; |
36 | 36 |
|
37 |
import edu.ucsb.nceas.dbadapter.DBAdapter; |
|
38 |
|
|
37 | 39 |
/** |
38 | 40 |
* A Class that represents an XML node and its contents and |
39 | 41 |
* can write its own representation to a database connection |
... | ... | |
42 | 44 |
|
43 | 45 |
private Connection conn; |
44 | 46 |
private DBSAXNode parentNode; |
47 |
private static final DBAdapter dbAdapter = MetaCatUtil.dbAdapter; |
|
45 | 48 |
|
46 | 49 |
/** |
47 | 50 |
* Construct a new node instance for DOCUMENT nodes |
... | ... | |
49 | 52 |
* @param conn the JDBC Connection to which all information is written |
50 | 53 |
*/ |
51 | 54 |
public DBSAXNode (Connection conn, String docid) throws SAXException { |
55 |
|
|
52 | 56 |
super(); |
53 | 57 |
this.conn = conn; |
54 | 58 |
this.parentNode = null; |
... | ... | |
67 | 71 |
throws SAXException { |
68 | 72 |
|
69 | 73 |
super(tagname); |
74 |
this.conn = conn; |
|
75 |
this.parentNode = parentNode; |
|
70 | 76 |
setParentID(parentNode.getNodeID()); |
71 | 77 |
setRootNodeID(rootnodeid); |
72 | 78 |
setDocID(docid); |
73 | 79 |
setNodeIndex(parentNode.incChildNum()); |
74 |
this.conn = conn; |
|
75 |
this.parentNode = parentNode; |
|
76 | 80 |
writeChildNodeToDB("ELEMENT", getTagName(), null, docid); |
77 | 81 |
//No writing XML Index from here. New Thread used instead. |
78 | 82 |
//updateNodeIndex(docid, doctype); |
... | ... | |
99 | 103 |
} |
100 | 104 |
|
101 | 105 |
// Bind the values to the query |
102 |
long nid = generateNodeID(); |
|
106 |
// NOT USED; USED DBAdapter.getUniqueID() instead |
|
107 |
//long nid = generateNodeID(); |
|
108 |
long nid = dbAdapter.getUniqueID(conn, "xml_nodes"); |
|
103 | 109 |
pstmt.setLong(1, nid); |
104 | 110 |
pstmt.setString(2, nodetype); |
105 | 111 |
pstmt.setString(3, nodename); |
Also available in: Unified diff
- changed to use the DBAdapter uniform interface for all apperance of "sysdate"
and uniqueid generation from sequence
MetaCatUtil:
- reads from metacat.properties the dbadapter class implemented the interface
and creates an instance of that class (in static public variable named dbAdapter) for use.
So all the classes in the application can access the dbadapter obj by:
MetaCatUtil.dbAdapter