|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--uk.org.ogsadai.common.WebRowSetXMLStreamToResultSet
|
+--uk.org.ogsadai.common.WebRowSetXMLStreamToResultSetForwardOnly
This is a "Forward Only" implementation of the
WebRowSetXMLStreamToResultSet adapter class. Thus, the previous(),
beforeFirst(), afterLast(), first()
and last() methods are unsupported.
This implementation can handle arbitrarily large WebRowSet XML
documents. This is achieved by parsing the XML document in a
streaming fashion as demanded by calls to the next()
method.
Note that this requires an extra thread to be created and all the inter-thread communication means that the time to parse an entire WebRowSet is roughly double the time that the alternative scrollable implementation takes. However, the disadvantage of using the scrollable implementation is that it can only cope with relatively small result sets.
Since this implementation uses a separate thread to parse
the WebRowSet XML document, it is important that clients call
the terminate() method to perform the necessary
clean-up if the ResultSet is no longer required after having
only partially parsed the WebRowSet.
| Field Summary |
| Fields inherited from class uk.org.ogsadai.common.WebRowSetXMLStreamToResultSet |
BASE_STATE, COL, COL_OLD, COL_STATE, COLCOUNT, COLCOUNT_STATE, COLDEFN, COLDEFN_STATE, DATA, DATA_STATE, EMPTY_BLOB, EMPTY_STRING, mCharDataBuffer, mColumnCount, mCommencedParsing, mCurrentColumn, mCurrentElement, mCurrentRow, mCursor, mDataInput, METADATA, METADATA_STATE, mLastColumnRead, mMetaData, mParser, mState, NULL, NULL_STATE, PROPERTIES, PROPERTIES_STATE, ROW, ROW_OLD, ROW_STATE, ROWSET, ROWSET_OLD, ROWSET_STATE |
| Fields inherited from interface java.sql.ResultSet |
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE |
| Constructor Summary | |
WebRowSetXMLStreamToResultSetForwardOnly(BlockReader reader)
Constructor which initialises but does not commence parsing. |
|
WebRowSetXMLStreamToResultSetForwardOnly(BlockReader reader,
boolean parseNow)
Constructor with an option to start parsing now. |
|
| Method Summary | |
boolean |
absolute(int row)
|
void |
afterLast()
|
void |
beforeFirst()
|
void |
characters(char[] ch,
int start,
int length)
|
void |
close()
Implementation of the ResultSet.close() method. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Note that this method is called from within the parser thread. |
void |
finalize()
Calls terminate() to perform the necessary clean-up. |
boolean |
first()
|
protected java.lang.String |
getColumnString(int columnIndex)
|
int |
getRow()
|
int |
getType()
|
boolean |
isAfterLast()
|
boolean |
isBeforeFirst()
|
boolean |
isFirst()
|
boolean |
isLast()
|
boolean |
last()
|
boolean |
next()
|
void |
parse()
Method parse. |
boolean |
previous()
|
boolean |
relative(int row)
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attr)
|
void |
terminate()
Kill the parser thread by interrupting it. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WebRowSetXMLStreamToResultSetForwardOnly(BlockReader reader)
parse()
method in order to commence parsing of the WebRowSet XML data.
reader - the WebRowSet XML data stream
public WebRowSetXMLStreamToResultSetForwardOnly(BlockReader reader,
boolean parseNow)
throws org.xml.sax.SAXException,
java.io.IOException
parse() method after initialisation
iff parseNow is true.
reader - the WebRowSet XML data streamparseNow - true iff the parse() should be invoked after initialisation
org.xml.sax.SAXException - if parseNow is true and if there is a problem whilst parsing the XML data
java.io.IOException - if parseNow is true and any IO error occurs| Method Detail |
public void finalize()
throws java.lang.Throwable
terminate() to perform the necessary clean-up.
finalize in class java.lang.Objectjava.lang.Throwable
public void close()
throws java.sql.SQLException
close in interface java.sql.ResultSetclose in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionWebRowSetXMLStreamToResultSet.close()
public void parse()
throws org.xml.sax.SAXException,
java.io.IOException
parse in class WebRowSetXMLStreamToResultSetjava.io.IOException - if any IO error occurs
org.xml.sax.SAXException - if there is a problem whilst parsing the XML datapublic void terminate()
PausableInputStream will catch the
InterruptedException and cease its parsing.
terminate in class WebRowSetXMLStreamToResultSet
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attr)
startElement in interface org.xml.sax.ContentHandlerstartElement in class WebRowSetXMLStreamToResultSetContentHandler.startElement(String, String, String, Attributes)
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class WebRowSetXMLStreamToResultSetorg.xml.sax.SAXExceptionContentHandler.endElement(String, String, String)
public void characters(char[] ch,
int start,
int length)
characters in interface org.xml.sax.ContentHandlercharacters in class WebRowSetXMLStreamToResultSetContentHandler.characters(char[], int, int)
protected java.lang.String getColumnString(int columnIndex)
throws java.sql.SQLException
getColumnString in class WebRowSetXMLStreamToResultSetjava.sql.SQLException
public int getType()
throws java.sql.SQLException
getType in interface java.sql.ResultSetgetType in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.getType()
public boolean next()
throws java.sql.SQLException
next in interface java.sql.ResultSetnext in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.next()
public boolean previous()
throws java.sql.SQLException
previous in interface java.sql.ResultSetprevious in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.previous()
public boolean absolute(int row)
throws java.sql.SQLException
absolute in interface java.sql.ResultSetabsolute in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.absolute(int)
public boolean relative(int row)
throws java.sql.SQLException
relative in interface java.sql.ResultSetrelative in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.relative(int)
public void beforeFirst()
throws java.sql.SQLException
beforeFirst in interface java.sql.ResultSetbeforeFirst in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.beforeFirst()
public void afterLast()
throws java.sql.SQLException
afterLast in interface java.sql.ResultSetafterLast in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.afterLast()
public boolean first()
throws java.sql.SQLException
first in interface java.sql.ResultSetfirst in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.first()
public boolean last()
throws java.sql.SQLException
last in interface java.sql.ResultSetlast in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.last()
public boolean isBeforeFirst()
throws java.sql.SQLException
isBeforeFirst in interface java.sql.ResultSetisBeforeFirst in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.isBeforeFirst()
public boolean isAfterLast()
throws java.sql.SQLException
isAfterLast in interface java.sql.ResultSetisAfterLast in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.isAfterLast()
public boolean isFirst()
throws java.sql.SQLException
isFirst in interface java.sql.ResultSetisFirst in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.isFirst()
public boolean isLast()
throws java.sql.SQLException
isLast in interface java.sql.ResultSetisLast in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.isLast()
public int getRow()
throws java.sql.SQLException
getRow in interface java.sql.ResultSetgetRow in class WebRowSetXMLStreamToResultSetjava.sql.SQLExceptionResultSet.getRow()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||