Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.media.datastore.sepengine.util
Class DBWriter  view DBWriter download DBWriter.java

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.media.datastore.sepengine.util.DBWriter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class DBWriter
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ext.LexicalHandler

Version:
$Revision: 1.24 $ $Date: 2001/08/21 15:00:00

Field Summary
private  java.sql.Connection con
           
private  int docID
           
private  java.lang.String errorMsg
           
private  org.media.datastore.sepengine.RDBInfo info
           
private  java.util.Vector parents
           
private static java.lang.String TABLEPREFIX
           
private  int treeID
           
 
Constructor Summary
  DBWriter()
           
protected DBWriter(java.sql.Connection con, int tID, int dID, org.media.datastore.sepengine.RDBInfo info)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data inside an element.
 void comment(char[] ch, int start, int length)
          Report an XML comment anywhere in the document.
 void endCDATA()
          Report the end of a CDATA section.
 void endDTD()
          Report the end of DTD declarations.
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qname)
          Receive notification of the end of an element.
 void endEntity(java.lang.String name)
          Report the end of an entity.
private  int getPathID(int pID, java.lang.String name, java.lang.String type)
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
private  int nextID(java.lang.String name)
           
private  java.lang.String removeIgnorableKeys(java.lang.String str, java.util.Vector keys)
           
private  java.lang.String removeSpecialIgnorableKeys(java.lang.String str, java.util.Vector keys)
           
 void startCDATA()
          Report the start of a CDATA section.
 void startDocument()
          Receive notification of the beginning of the document.
 void startDTD(java.lang.String name, java.lang.String pId, java.lang.String sId)
          Report the start of DTD declarations, if any.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes attrs)
          Receive notification of the start of an element.
 void startEntity(java.lang.String name)
          Report the beginning of some internal and external XML entities.
 java.lang.String write(java.sql.Connection con, java.io.InputStream istream, int tID, int dID, org.media.datastore.sepengine.RDBInfo info)
           
private  void writeToLexicon(java.lang.String str, int sID, int dID, int tID)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLEPREFIX

private static final java.lang.String TABLEPREFIX
See Also:
Constant Field Values

con

private java.sql.Connection con

info

private org.media.datastore.sepengine.RDBInfo info

treeID

private int treeID

docID

private int docID

parents

private java.util.Vector parents

errorMsg

private java.lang.String errorMsg
Constructor Detail

DBWriter

public DBWriter()

DBWriter

protected DBWriter(java.sql.Connection con,
                   int tID,
                   int dID,
                   org.media.datastore.sepengine.RDBInfo info)
            throws java.lang.Exception
Method Detail

write

public java.lang.String write(java.sql.Connection con,
                              java.io.InputStream istream,
                              int tID,
                              int dID,
                              org.media.datastore.sepengine.RDBInfo info)

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the beginning of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).

Specified by:
startDocument in interface org.xml.sax.ContentHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qname)
                throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Specified by:
endElement in interface org.xml.sax.ContentHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Specified by:
startElement in interface org.xml.sax.ContentHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Specified by:
characters in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of ignorable whitespace in element content.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the start of a CDATA section.

The contents of the CDATA section will be reported through the regular characters 55 event; this event is intended only to report the boundary.

Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the end of a CDATA section.

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String pId,
                     java.lang.String sId)
              throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the start of DTD declarations, if any.

This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

All declarations reported through DTDHandler or DeclHandler events must appear between the startDTD and endDTD 55 events. Declarations are assumed to belong to the internal DTD subset unless they appear between startEntity 55 and endEntity 55 events. Comments and processing instructions from the DTD should also be reported between the startDTD and endDTD events, in their original order of (logical) occurrence; they are not required to appear in their correct locations relative to DTDHandler or DeclHandler events, however.

Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement 55 event.

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the end of DTD declarations.

This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the beginning of some internal and external XML entities.

The reporting of parameter entities (including the external DTD subset) is optional, and SAX2 drivers that report LexicalHandler events may not implement it; you can use the http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control the reporting of parameter entities.

General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".

When a SAX2 driver is providing these events, all other events must be properly nested within start/end entity events. There is no additional requirement that events from DeclHandler or DTDHandler be properly ordered.

Note that skipped entities will be reported through the skippedEntity 55 event, which is part of the ContentHandler interface.

Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:

  • general entities within attribute values
  • parameter entities within declarations

These will be silently expanded, with no indication of where the original entity boundaries were.

Note also that the boundaries of character references (which are not really entities anyway) are not reported.

All start/endEntity events must be properly nested.

Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ext.LexicalHandler
Report the end of an entity.

Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler

getPathID

private int getPathID(int pID,
                      java.lang.String name,
                      java.lang.String type)

nextID

private int nextID(java.lang.String name)
            throws java.lang.Exception

writeToLexicon

private void writeToLexicon(java.lang.String str,
                            int sID,
                            int dID,
                            int tID)
                     throws org.xml.sax.SAXException

removeIgnorableKeys

private java.lang.String removeIgnorableKeys(java.lang.String str,
                                             java.util.Vector keys)

removeSpecialIgnorableKeys

private java.lang.String removeSpecialIgnorableKeys(java.lang.String str,
                                                    java.util.Vector keys)