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

java.lang.Object
  |
  +--uk.org.ogsadai.converters.csv.resultset.CSVToResultSet

public class CSVToResultSet
extends java.lang.Object

Converts a CSV formatted document into a java.sql.ResultSet object.

The default type of ResultSet is ResultSet.TYPE_FORWARD_ONLY but this can be changed via the setResultSetType() method.

CSV file format can be set via the setConfigurator() method.

Author:
The OGSA-DAI Team.
See Also:
CSVConfigurator

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private  CSVConfigurator mConfigurator
           
private  java.io.Reader mInput
           
private  int mType
           
 
Constructor Summary
CSVToResultSet(java.io.Reader reader)
          Construct a new converter from the given input reader.
 
Method Summary
 java.sql.ResultSet getResultSet()
          Return the ResultSet that has been created from the CSV document provided by the input reader.
 void setConfigurator(CSVConfigurator configurator)
          Set the Configurator describing CSV format.
 void setResultSetType(int type)
          Set the ResultSet type to scrollable or forward-only.
 
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

mType

private int mType

mInput

private java.io.Reader mInput

mConfigurator

private CSVConfigurator mConfigurator
Constructor Detail

CSVToResultSet

public CSVToResultSet(java.io.Reader reader)
Construct a new converter from the given input reader.

Parameters:
reader - An input reader.
Method Detail

setConfigurator

public void setConfigurator(CSVConfigurator configurator)
Set the Configurator describing CSV format.

Parameters:
configurator -

setResultSetType

public void setResultSetType(int type)
                      throws java.lang.IllegalArgumentException
Set the ResultSet type to scrollable or forward-only.

Parameters:
type - one of ResultSet.TYPE_SCROLL_INSENSITIVE or ResultSet.TYPE_FORWARD_ONLY.
Throws:
java.lang.IllegalArgumentException - if the type is not one of the two above.

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException,
                                       DAIIOException,
                                       CSVParseException
Return the ResultSet that has been created from the CSV document provided by the input reader.

Returns:
ResultSet
Throws:
DAIIOException - if there was a problem reading the input
java.sql.SQLException - if the result set could not be built
CSVParseException - if CSV file could not be paresed