org.geotools.data.jdbc
Class WKTAttributeIO

java.lang.Object
  extended byorg.geotools.data.AbstractAttributeIO
      extended byorg.geotools.data.jdbc.WKTAttributeIO
All Implemented Interfaces:
AttributeReader, AttributeWriter, QueryDataListener

public class WKTAttributeIO
extends AbstractAttributeIO
implements QueryDataListener, AttributeWriter, AttributeReader

An attribute reader/writer for well known text. For now this just reads well known text in result sets, but if there are other cases of wkt that are not in databases we can rethink or adapt this class to them. Result sets should call AsText() when requesting the results, to put it into wkt.

Inserts will not work, should be overriden by the FeatureWriter using this, to make the sql call directly, since right now we can not get resultSet.updateString/Object to work on a geometry.

Version:
$Id: WKTAttributeIO.java,v 1.5 2003/11/24 00:19:32 cholmesny Exp $
Author:
Chris Holmes

Field Summary
 
Fields inherited from class org.geotools.data.AbstractAttributeIO
metaData
 
Constructor Summary
WKTAttributeIO(JDBCDataStore.QueryData queryData, AttributeType metadata, int columnIndex)
           
 
Method Summary
 void close()
          Release any resources associated with this reader
protected  java.lang.String formatValue(java.lang.Object value)
           
 boolean hasNext()
          Query whether there are other rows in the attribute writer.
 void next()
          Advance the AttributeWriter, all calls to write will correspond to the same set of attributes until next is called again.
 void queryDataClosed(JDBCDataStore.QueryData queryData)
           
 java.lang.Object read(int i)
          Read the attribute at the given index.
 void rowDeleted(JDBCDataStore.QueryData queryData)
           
 void write(int position, java.lang.Object attribute)
          Write the given attribute value at the position indicated.
 
Methods inherited from class org.geotools.data.AbstractAttributeIO
copy, getAttributeCount, getAttributeType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.AttributeWriter
getAttributeCount, getAttributeType
 
Methods inherited from interface org.geotools.data.AttributeReader
getAttributeCount, getAttributeType
 

Constructor Detail

WKTAttributeIO

public WKTAttributeIO(JDBCDataStore.QueryData queryData,
                      AttributeType metadata,
                      int columnIndex)
Method Detail

close

public void close()
           throws java.io.IOException
Description copied from interface: AttributeReader
Release any resources associated with this reader

Specified by:
close in interface AttributeWriter
Throws:
java.io.IOException

hasNext

public boolean hasNext()
                throws java.io.IOException
Description copied from interface: AttributeWriter
Query whether there are other rows in the attribute writer.

Specified by:
hasNext in interface AttributeWriter
Returns:
Throws:
java.io.IOException
See Also:
FeatureWriter.hasNext()

next

public void next()
          throws java.io.IOException
Description copied from interface: AttributeWriter
Advance the AttributeWriter, all calls to write will correspond to the same set of attributes until next is called again.

Specified by:
next in interface AttributeWriter
Throws:
java.io.IOException

read

public java.lang.Object read(int i)
                      throws java.io.IOException,
                             java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: AttributeReader
Read the attribute at the given index.

Specified by:
read in interface AttributeReader
Returns:
Object Attribute at given index
Throws:
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException

write

public void write(int position,
                  java.lang.Object attribute)
           throws java.io.IOException
Description copied from interface: AttributeWriter
Write the given attribute value at the position indicated. Implementations can choose to immediately flush the write or buffer it.

Specified by:
write in interface AttributeWriter
Throws:
java.io.IOException

formatValue

protected java.lang.String formatValue(java.lang.Object value)

queryDataClosed

public void queryDataClosed(JDBCDataStore.QueryData queryData)
Specified by:
queryDataClosed in interface QueryDataListener

rowDeleted

public void rowDeleted(JDBCDataStore.QueryData queryData)
Specified by:
rowDeleted in interface QueryDataListener
Parameters:
queryData -
See Also:
QueryDataListener.rowDeleted(org.geotools.data.jdbc.JDBCDataStore.QueryData)


Copyright © 1996-2003 GeoTools. All Rights Reserved.