uk.org.ogsadai.converters.csv.resultset
Class ResultSetForwardOnly

java.lang.Object
  |
  +--uk.org.ogsadai.converters.csv.resultset.AbstractResultSet
        |
        +--uk.org.ogsadai.converters.csv.resultset.ResultSetForwardOnly
All Implemented Interfaces:
CSVHandler, java.sql.ResultSet

public class ResultSetForwardOnly
extends AbstractResultSet

A forward-only implementation of a java.sql.ResultSet. This implementation is suitable for larger result sets as the data is made available when scrolling through the results.

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private  java.util.LinkedList mBuffer
           
private  int mBufferSize
           
private  boolean mClosed
           
private  java.util.Vector mCurrentRow
           
private  int mCursor
           
private  java.lang.Throwable mError
           
 
Fields inherited from class uk.org.ogsadai.converters.csv.resultset.AbstractResultSet
mMetaData
 
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
ResultSetForwardOnly()
           
 
Method Summary
 boolean absolute(int arg0)
           
 void afterLast()
           
 void beforeFirst()
           
 boolean first()
           
 int getBufferSize()
          Returns the current size of the buffer.
protected  java.lang.String getColumn(int column)
          Returns the data of a column,
protected  java.util.Vector getCurrentRow()
          Returns the current row vector.
 java.lang.Throwable getError()
          Gets the current error state
 java.sql.ResultSetMetaData getMetaData()
           
 int getRow()
           
 int getType()
           
 boolean isAfterLast()
           
 boolean isBeforeFirst()
           
 boolean isFirst()
           
 boolean isLast()
           
 boolean last()
           
 boolean next()
           
 boolean previous()
           
 void putMetaData(java.sql.ResultSetMetaData metadata)
          Associates java.sql.ResultSetMetaData object with ResultSet.
 void putRow(java.util.Vector row)
          Process or store a row of a CSV file.
 boolean relative(int arg0)
           
 void setBufferSize(int size)
          Set the size of the buffer (the maximum number of rows that are being stored).
 void setError(java.lang.Throwable error)
          Sets an error when there was a problem at the input provider.
 
Methods inherited from class uk.org.ogsadai.converters.csv.resultset.AbstractResultSet
cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getBytes64, getBytes64, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getShort, getShort, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, moveToCurrentRow, moveToInsertRow, refreshRow, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

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

mBufferSize

private int mBufferSize

mBuffer

private java.util.LinkedList mBuffer

mClosed

private boolean mClosed

mCurrentRow

private java.util.Vector mCurrentRow

mCursor

private int mCursor

mError

private java.lang.Throwable mError
Constructor Detail

ResultSetForwardOnly

public ResultSetForwardOnly()
Method Detail

setError

public void setError(java.lang.Throwable error)
Sets an error when there was a problem at the input provider.

Parameters:
error - Problem at input provider.

getError

public java.lang.Throwable getError()
Gets the current error state

Returns:
current error or null if there is no error.

putMetaData

public void putMetaData(java.sql.ResultSetMetaData metadata)
                 throws java.sql.SQLException
Description copied from class: AbstractResultSet
Associates java.sql.ResultSetMetaData object with ResultSet.

Specified by:
putMetaData in interface CSVHandler
Overrides:
putMetaData in class AbstractResultSet
Parameters:
metadata -
java.sql.SQLException
See Also:
CSVHandler.putMetaData(java.sql.ResultSetMetaData)

putRow

public void putRow(java.util.Vector row)
Description copied from interface: CSVHandler
Process or store a row of a CSV file.

Specified by:
putRow in interface CSVHandler
Specified by:
putRow in class AbstractResultSet
Parameters:
row - A Vector of objects each representing a column value.

next

public boolean next()
             throws java.sql.SQLException
Specified by:
next in interface java.sql.ResultSet
Specified by:
next in class AbstractResultSet
java.sql.SQLException

setBufferSize

public void setBufferSize(int size)
Set the size of the buffer (the maximum number of rows that are being stored).

Parameters:
size - Number of rows to buffer.

getBufferSize

public int getBufferSize()
Returns the current size of the buffer.

Returns:
maximum number of rows that are being stored.

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.ResultSet
Overrides:
getMetaData in class AbstractResultSet
java.sql.SQLException

getCurrentRow

protected java.util.Vector getCurrentRow()
Returns the current row vector.

Returns:
current row

getColumn

protected java.lang.String getColumn(int column)
Description copied from class: AbstractResultSet
Returns the data of a column,

Specified by:
getColumn in class AbstractResultSet
Parameters:
column - Column index.
Returns:
data

getRow

public int getRow()
           throws java.sql.SQLException
Specified by:
getRow in interface java.sql.ResultSet
Specified by:
getRow in class AbstractResultSet
java.sql.SQLException

getType

public int getType()
            throws java.sql.SQLException
Specified by:
getType in interface java.sql.ResultSet
Specified by:
getType in class AbstractResultSet
java.sql.SQLException

afterLast

public void afterLast()
               throws java.sql.SQLException
Specified by:
afterLast in interface java.sql.ResultSet
Specified by:
afterLast in class AbstractResultSet
java.sql.SQLException

beforeFirst

public void beforeFirst()
                 throws java.sql.SQLException
Specified by:
beforeFirst in interface java.sql.ResultSet
Specified by:
beforeFirst in class AbstractResultSet
java.sql.SQLException

first

public boolean first()
              throws java.sql.SQLException
Specified by:
first in interface java.sql.ResultSet
Specified by:
first in class AbstractResultSet
java.sql.SQLException

isAfterLast

public boolean isAfterLast()
                    throws java.sql.SQLException
Specified by:
isAfterLast in interface java.sql.ResultSet
Specified by:
isAfterLast in class AbstractResultSet
java.sql.SQLException

isBeforeFirst

public boolean isBeforeFirst()
                      throws java.sql.SQLException
Specified by:
isBeforeFirst in interface java.sql.ResultSet
Specified by:
isBeforeFirst in class AbstractResultSet
java.sql.SQLException

isFirst

public boolean isFirst()
                throws java.sql.SQLException
Specified by:
isFirst in interface java.sql.ResultSet
Specified by:
isFirst in class AbstractResultSet
java.sql.SQLException

isLast

public boolean isLast()
               throws java.sql.SQLException
Specified by:
isLast in interface java.sql.ResultSet
Specified by:
isLast in class AbstractResultSet
java.sql.SQLException

last

public boolean last()
             throws java.sql.SQLException
Specified by:
last in interface java.sql.ResultSet
Specified by:
last in class AbstractResultSet
java.sql.SQLException

previous

public boolean previous()
                 throws java.sql.SQLException
Specified by:
previous in interface java.sql.ResultSet
Specified by:
previous in class AbstractResultSet
java.sql.SQLException

absolute

public boolean absolute(int arg0)
                 throws java.sql.SQLException
Specified by:
absolute in interface java.sql.ResultSet
Specified by:
absolute in class AbstractResultSet
java.sql.SQLException

relative

public boolean relative(int arg0)
                 throws java.sql.SQLException
Specified by:
relative in interface java.sql.ResultSet
Specified by:
relative in class AbstractResultSet
java.sql.SQLException