org.geotools.data.postgis
Class PostgisFeatureWriter

java.lang.Object
  extended by org.geotools.data.jdbc.JDBCFeatureWriter
      extended by org.geotools.data.jdbc.JDBCTextFeatureWriter
          extended by org.geotools.data.postgis.PostgisFeatureWriter
All Implemented Interfaces:
FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

public class PostgisFeatureWriter
extends JDBCTextFeatureWriter

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


Field Summary
protected static com.vividsolutions.jts.io.WKTWriter geometryWriter
          Well Known Text writer (from JTS).
 
Fields inherited from class org.geotools.data.jdbc.JDBCTextFeatureWriter
mapper
 
Fields inherited from class org.geotools.data.jdbc.JDBCFeatureWriter
closed, current, fidAttributes, live, queryData, reader
 
Constructor Summary
PostgisFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader, QueryData queryData, boolean WKBEnabled, boolean byteaWKB, PostgisSQLBuilder sqlBuilder)
           
 
Method Summary
protected  java.lang.String encodeColumnName(java.lang.String colName)
          Encodes the colName, default just calls JDBCFeatureWriter.encodeName(String).
protected  java.lang.String encodeName(java.lang.String tableName)
          DJB: this is the javadoc from the superclass, but this wasnt being done.
protected  java.lang.String getGeometryInsertText(com.vividsolutions.jts.geom.Geometry geom, int srid)
          Turns a geometry into the textual version needed for the sql statement
protected  java.lang.String getGeometryInsertText(com.vividsolutions.jts.geom.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  java.lang.String makeSelectForUpdateSql(org.opengis.feature.simple.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 org.geotools.data.jdbc.JDBCTextFeatureWriter
addQuotes, doInsert, doUpdate, makeDeleteSql, makeInsertSql, makeUpdateSql, remove, useQueryDataForInsert
 
Methods inherited from class org.geotools.data.jdbc.JDBCFeatureWriter
close, getFeatureType, hasNext, next, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

geometryWriter

protected static com.vividsolutions.jts.io.WKTWriter geometryWriter
Well Known Text writer (from JTS).

Constructor Detail

PostgisFeatureWriter

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

getGeometryInsertText

protected java.lang.String getGeometryInsertText(com.vividsolutions.jts.geom.Geometry geom,
                                                 int srid)
                                          throws java.io.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:
java.io.IOException

getGeometryInsertText

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

Overrides:
getGeometryInsertText in class JDBCTextFeatureWriter
Throws:
java.io.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 java.lang.String encodeName(java.lang.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 java.lang.String encodeColumnName(java.lang.String colName)
Description copied from class: JDBCFeatureWriter
Encodes the colName, default just calls JDBCFeatureWriter.encodeName(String).

Overrides:
encodeColumnName in class JDBCFeatureWriter

makeSelectForUpdateSql

protected java.lang.String makeSelectForUpdateSql(org.opengis.feature.simple.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.