uk.org.ogsadai.converters.resultset
Class StrategicResultSetHandler

java.lang.Object
  |
  +--uk.org.ogsadai.converters.resultset.StrategicResultSetHandler
All Implemented Interfaces:
ResultSetHandler
Direct Known Subclasses:
CSVResultSetHandler, WebRowSetResultSetHandler

public abstract class StrategicResultSetHandler
extends java.lang.Object
implements ResultSetHandler

A ResultSet handler that uses strategy objects to handle the SQL column types occurring within a ResultSet. The handling of other aspects of a ResultSet is deferred to a sub-class.

The class is constructed using a ResultSet object and a ColumnStrategyFactory object. During this process, the ResultSet meta-data is analysed to determine which SQL column types are present. The factory is then used to create an appropriate ColumnStrategy objects for each column, and these strategies are used for processing the ResultSet data during the conversion process.

This class makes use of the strategy and abstract factory design patterns.

Author:
The OGSA-DAI Project Team
See Also:
ColumnStrategy, ColumnStrategyFactory

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement.
private  ColumnStrategy[] mStrategies
          Column strategies for each column.
 
Constructor Summary
StrategicResultSetHandler(java.sql.ResultSet rs, ColumnStrategyFactory factory)
          Creates a new result set handler that will use strategies for handling the result set fields.
 
Method Summary
 void field(java.lang.StringBuffer output, java.sql.ResultSet resultSet, int column)
          Write the data contained in the specified field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.org.ogsadai.converters.resultset.ResultSetHandler
columnEnd, columnStart, footer, header, rowEnd, rowStart
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement.

See Also:
Constant Field Values

mStrategies

private final ColumnStrategy[] mStrategies
Column strategies for each column.

Constructor Detail

StrategicResultSetHandler

public StrategicResultSetHandler(java.sql.ResultSet rs,
                                 ColumnStrategyFactory factory)
                          throws ResultSetHandlerException
Creates a new result set handler that will use strategies for handling the result set fields.

Parameters:
rs - ResultSet to handle
factory - Factory to use for creating column strategies.
Throws:
ResultSetHandlerException - If a problem occurs when accessing the ResultSet.
Method Detail

field

public final void field(java.lang.StringBuffer output,
                        java.sql.ResultSet resultSet,
                        int column)
                 throws ResultSetHandlerException
Description copied from interface: ResultSetHandler
Write the data contained in the specified field.

Specified by:
field in interface ResultSetHandler
Parameters:
output - Output string buffer to append data to.
resultSet - ResultSet from which to extract column information.
column - The column number of the field.
Throws:
ResultSetHandlerException - If a problem occurs when accessing the ResultSet.