edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate
Class ExportData

java.lang.Object
  |
  +--edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.ExportData

public class ExportData
extends java.lang.Object

Export data from relational database to an XML document User ResultSet directly to increase the performance, without first dump the table to the table object.


Field Summary
(package private)  java.util.Hashtable all_nodes
          Hashtable for all the elements for the exportTo().
(package private)  JDBCClient client
          It's database connection of where to get the data.
(package private)  edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.DocumentImpl document
          The document implementation for the creation of the DOM document.
(package private)  long num_of_nodes
          used to keep process of the printNode.
(package private)  long num_of_tuples
          Use to report number of tuples exported.
(package private)  java.util.Hashtable positions
          Hashtable for get the position of a specific node.
(package private)  java.util.Hashtable roots
          Hashtable of Vectors for all the roots.
 
Constructor Summary
ExportData(JDBCClient client)
          Construct the export object that connects to the database.
 
Method Summary
 void exportTo(java.io.PrintStream out)
          Dump the xmldata in the database out to a printstream.
 void exportTo(java.lang.String filename)
          Dump the XML data to a file.
(package private)  edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node exportTuple(java.lang.String table_name, java.lang.String iid, java.lang.String pid, java.lang.String position, java.sql.ResultSet tuples, Table attribute_names)
          This one will export one tuple out.
(package private)  java.lang.String indent(int level)
          Indent is a function to generate number of spaces based on the the input level.
(package private)  void init()
           
(package private)  void insertChild(edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node parent_node, edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node child_node, java.lang.String child_position)
          This will insert the child_node into the parent_node with specific position.
(package private)  void printDOM(java.io.PrintStream out)
          This will print out all the dom trees start from the roots.
(package private)  void printNode(java.io.PrintStream out, edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node cur, int level)
          Recursive function to visit each node and print it out.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

client

JDBCClient client
It's database connection of where to get the data.

all_nodes

java.util.Hashtable all_nodes
Hashtable for all the elements for the exportTo(). It has the structure like: (iid, (position, noderef));

roots

java.util.Hashtable roots
Hashtable of Vectors for all the roots. It has the structure like: (pid, v[(position, noderef)]); It is hashed by the pid. v[...] means a vector.

positions

java.util.Hashtable positions
Hashtable for get the position of a specific node.

document

edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.DocumentImpl document
The document implementation for the creation of the DOM document.

num_of_nodes

long num_of_nodes
used to keep process of the printNode.

num_of_tuples

long num_of_tuples
Use to report number of tuples exported.
Constructor Detail

ExportData

public ExportData(JDBCClient client)
Construct the export object that connects to the database.
Method Detail

init

void init()

exportTo

public void exportTo(java.lang.String filename)
              throws java.io.IOException
Dump the XML data to a file.

exportTo

public void exportTo(java.io.PrintStream out)
Dump the xmldata in the database out to a printstream. The printstream could connect to the system out or an file output stream. The algorithm will first create a DOM tree, then dump it out.

printDOM

void printDOM(java.io.PrintStream out)
This will print out all the dom trees start from the roots.

indent

java.lang.String indent(int level)
Indent is a function to generate number of spaces based on the the input level.

printNode

void printNode(java.io.PrintStream out,
               edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node cur,
               int level)
Recursive function to visit each node and print it out.
Parameters:
level - This is the nesting level of how many time the printNode function is recursived called. The real value will be start from 0, means the first level of calling.

insertChild

void insertChild(edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node parent_node,
                 edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node child_node,
                 java.lang.String child_position)
This will insert the child_node into the parent_node with specific position. First, it will get all the children of the parent_node. Second, it will get their position from the all_nodes. Third, it will insert before the first node that has bigger position than the child_node.

exportTuple

edu.wpi.cs.DSRG.xmldb.XMLRDBMSUpdate.Node exportTuple(java.lang.String table_name,
                                                      java.lang.String iid,
                                                      java.lang.String pid,
                                                      java.lang.String position,
                                                      java.sql.ResultSet tuples,
                                                      Table attribute_names)
                                                throws java.sql.SQLException
This one will export one tuple out. It will use the class variable all_nodes and roots.