org.geotools.data.postgis
Class PostgisFeatureWriter

Object
  extended by JDBCFeatureWriter
      extended by JDBCTextFeatureWriter
          extended by PostgisFeatureWriter
All Implemented Interfaces:
FeatureWriter<SimpleFeatureType,SimpleFeature>

public class PostgisFeatureWriter
extends JDBCTextFeatureWriter

An implementation of FeatureWriter that will work over a result set.

Module:
modules/plugin/postgis (gt-postgis.jar)

Field Summary
protected static WKTWriter geometryWriter
          Well Known Text writer (from JTS).
 
Fields inherited from class JDBCTextFeatureWriter
mapper
 
Fields inherited from class JDBCFeatureWriter
closed, current, fidAttributes, live, queryData, reader
 
Constructor Summary
PostgisFeatureWriter(FeatureReader<SimpleFeatureType,SimpleFeature> fReader, QueryData queryData, boolean WKBEnabled, boolean byteaWKB, PostgisSQLBuilder sqlBuilder)
           
 
Method Summary
protected  String encodeColumnName(String colName)
          Encodes the colName, default just calls JDBCFeatureWriter.encodeName(String).
protected  String encodeName(String tableName)
          DJB: this is the javadoc from the superclass, but this wasnt being done.
protected  String getGeometryInsertText(Geometry geom, int srid)
          Turns a geometry into the textual version needed for the sql statement
protected  String getGeometryInsertText(Geometry geom, int srid, int dimension)
          Turns a geometry into the textual version needed for the sql statement
 boolean isWKBEnabled()
          Returns true if the WKB format is used to transfer geometries, false otherwise
protected  String makeSelectForUpdateSql(SimpleFeature current)
          For postgres >= 8.1 NOWAIT is used (meaning you get a response).
 void setWKBEnabled(boolean enabled)
          If turned on, WKB will be used to transfer geometry data instead of WKT
 
Methods inherited from class JDBCTextFeatureWriter
addQuotes, doInsert, doUpdate, makeDeleteSql, makeInsertSql, makeUpdateSql, remove, useQueryDataForInsert
 
Methods inherited from class JDBCFeatureWriter
close, getFeatureType, hasNext, next, write
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

geometryWriter

protected static WKTWriter geometryWriter
Well Known Text writer (from JTS).

Constructor Detail

PostgisFeatureWriter

public PostgisFeatureWriter(FeatureReader<SimpleFeatureType,SimpleFeature> fReader,
                            QueryData queryData,
                            boolean WKBEnabled,
                            boolean byteaWKB,
                            PostgisSQLBuilder sqlBuilder)
                     throws IOException
Parameters:
fReader -
queryData -
WKBEnabled -
byteaWKB - -- true if you're using postgis 1.0+. they changed how to do wkb writing.
Throws:
IOException
Method Detail

getGeometryInsertText

protected String getGeometryInsertText(Geometry geom,
                                       int srid)
                                throws IOException
Description copied from class: JDBCTextFeatureWriter
Turns a geometry into the textual version needed for the sql statement

Specified by:
getGeometryInsertText in class JDBCTextFeatureWriter
Throws:
IOException

getGeometryInsertText

protected String getGeometryInsertText(Geometry geom,
                                       int srid,
                                       int dimension)
                                throws IOException
Description copied from class: JDBCTextFeatureWriter
Turns a geometry into the textual version needed for the sql statement

Overrides:
getGeometryInsertText in class JDBCTextFeatureWriter
Throws:
IOException

isWKBEnabled

public boolean isWKBEnabled()
Returns true if the WKB format is used to transfer geometries, false otherwise


setWKBEnabled

public void setWKBEnabled(boolean enabled)
If turned on, WKB will be used to transfer geometry data instead of WKT

Parameters:
enabled -

encodeName

protected String encodeName(String tableName)
DJB: this is the javadoc from the superclass, but this wasnt being done. Encodes the tableName, default is to do nothing, but postgis will override and put double quotes around the tablename.

Overrides:
encodeName in class JDBCFeatureWriter

encodeColumnName

protected String encodeColumnName(String colName)
Description copied from class: JDBCFeatureWriter
Encodes the colName, default just calls JDBCFeatureWriter.encodeName(String).

Overrides:
encodeColumnName in class JDBCFeatureWriter

makeSelectForUpdateSql

protected String makeSelectForUpdateSql(SimpleFeature current)
For postgres >= 8.1 NOWAIT is used (meaning you get a response). Prior versions will block during concurrent editing.

Overrides:
makeSelectForUpdateSql in class JDBCTextFeatureWriter
Returns:
sql string or null


Copyright © 1996-2010 Geotools. All Rights Reserved.