edu.ucsb.nceas.metacat
Class DBReader
java.lang.Object
|
+--edu.ucsb.nceas.metacat.DBReader
- public class DBReader
- extends java.lang.Object
A Class that creates an XML text document
from a query to a relational DB containing a DOM representation
Inner Class Summary |
class |
DBReader.DoctypeInfo
A utility class that encapsulates document type information |
Constructor Summary |
DBReader(java.sql.Connection conn)
construct a DBReader instance. |
Method Summary |
DBReader.DoctypeInfo |
getDoctypeInfo(long docid)
Look up the document type information from the database |
long |
getRootNode(long docid)
Get the root node id for an XML document given a document id |
static void |
main(java.lang.String[] args)
main routine used for testing. |
java.lang.String |
readXMLDocument(long docid)
Create an XML document from the database starting with the element
having element_id nodeid |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
DBReader
public DBReader(java.sql.Connection conn)
throws java.io.IOException,
java.sql.SQLException,
java.lang.ClassNotFoundException
- construct a DBReader instance.
Generally, one calls readXMLDocument() after constructing the instance
- Parameters:
conn
- the database connection from which to read the document
main
public static void main(java.lang.String[] args)
- main routine used for testing.
Usage: java DBReader [dbstring]
- Parameters:
nodeid
- the id number of the root of the subtree to displayuser
- the username to use for the database connectionpassword
- the password to use for the database connectiondbstring
- the connection info to use for the database connection
getRootNode
public long getRootNode(long docid)
- Get the root node id for an XML document given a document id
- Parameters:
docid
- the document node contains the root of the document
readXMLDocument
public java.lang.String readXMLDocument(long docid)
- Create an XML document from the database starting with the element
having element_id nodeid
- Parameters:
docid
- the document that we want retrieved
getDoctypeInfo
public DBReader.DoctypeInfo getDoctypeInfo(long docid)
- Look up the document type information from the database
- Parameters:
docid
- the id of the document to look up