edu.ucsb.nceas.metacat
Class DBWriter

java.lang.Object
  |
  +--edu.ucsb.nceas.metacat.DBWriter

public class DBWriter
extends java.lang.Object

A Class that reads in an XML text document and write its contents to a database connection using SAX


Constructor Summary
DBWriter(java.sql.Connection conn, java.lang.String parserName)
          construct a new instance of the class to write an XML file to the database
 
Method Summary
 void delete(java.lang.String docid)
          Delete an XML file from the database (actually, just make it a revision in the xml_revisions table)
static void main(java.lang.String[] args)
          the main routine used to test the DBWriter utility.
 java.lang.String write(java.io.Reader xml, java.lang.String action, java.lang.String docid)
          Insert XML stream to the database
 java.lang.String write(java.lang.String filename, java.lang.String action, java.lang.String docid)
          Insert an XML file to the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBWriter

public DBWriter(java.sql.Connection conn,
                java.lang.String parserName)
construct a new instance of the class to write an XML file to the database
Parameters:
conn - the database connection to which to write the XML file
parserName - the name of a SAX2 compliant parser class
Method Detail

main

public static void main(java.lang.String[] args)
the main routine used to test the DBWriter utility.

Usage: java DBWriter <-f filename -a action -d docid>

Parameters:
filename - the filename to be loaded into the database

write

public java.lang.String write(java.io.Reader xml,
                              java.lang.String action,
                              java.lang.String docid)
                       throws java.lang.Exception,
                              java.io.IOException,
                              java.sql.SQLException,
                              java.lang.ClassNotFoundException,
                              org.xml.sax.SAXException,
                              org.xml.sax.SAXParseException
Insert XML stream to the database
Parameters:
xml - the xml stream to be loaded into the database

write

public java.lang.String write(java.lang.String filename,
                              java.lang.String action,
                              java.lang.String docid)
                       throws java.lang.Exception,
                              java.io.IOException,
                              java.sql.SQLException,
                              java.lang.ClassNotFoundException,
                              org.xml.sax.SAXException,
                              org.xml.sax.SAXParseException
Insert an XML file to the database
Parameters:
filename - the filename to be loaded into the database

delete

public void delete(java.lang.String docid)
            throws java.io.IOException,
                   java.sql.SQLException,
                   java.lang.ClassNotFoundException,
                   AccessionNumberException
Delete an XML file from the database (actually, just make it a revision in the xml_revisions table)
Parameters:
docid - the ID of the document to be deleted from the database


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.