org.geotools.data.jdbc
Class JDBCTextFeatureWriter

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

Deprecated. scheduled for removal in 2.7, use classes in org.geotools.jdbc

public abstract class JDBCTextFeatureWriter
extends JDBCFeatureWriter

An abstract class that uses sql statements to insert, update and delete features from the database. Useful when the resultset got from the database is not updatable, for example.

Version:
$Id: JDBCTextFeatureWriter.java 33484 2009-07-06 02:17:34Z jdeolive $
Author:
Andrea Aime, chorner

Field Summary
protected  FIDMapper mapper
          Deprecated.  
 
Fields inherited from class org.geotools.data.jdbc.JDBCFeatureWriter
closed, current, fidAttributes, live, queryData, reader
 
Constructor Summary
JDBCTextFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader, QueryData queryData)
          Deprecated. Creates a new instance of JDBCFeatureWriter
 
Method Summary
protected  java.lang.String addQuotes(java.lang.Object value)
          Deprecated. Adds quotes to an object for storage in postgis.
protected  void doInsert(MutableFIDFeature current)
          Deprecated. Override that uses sql statements to perform the operation.
protected  void doUpdate(org.opengis.feature.simple.SimpleFeature live, org.opengis.feature.simple.SimpleFeature current)
          Deprecated. Override that uses sql statements to perform the operation.
protected abstract  java.lang.String getGeometryInsertText(com.vividsolutions.jts.geom.Geometry geom, int srid)
          Deprecated. 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)
          Deprecated. Turns a geometry into the textual version needed for the sql statement
protected  java.lang.String makeDeleteSql(org.opengis.feature.simple.SimpleFeature feature)
          Deprecated. Generates the query for the sql delete statement
protected  java.lang.String makeInsertSql(org.opengis.feature.simple.SimpleFeature feature)
          Deprecated. Creates a sql insert statement.
protected  java.lang.String makeSelectForUpdateSql(org.opengis.feature.simple.SimpleFeature current)
          Deprecated. Generate the select for update statement, which will attempt to lock features for update.
protected  java.lang.String makeUpdateSql(org.opengis.feature.simple.SimpleFeature live, org.opengis.feature.simple.SimpleFeature current)
          Deprecated. Generate the update sql statement
 void remove()
          Deprecated. Override that uses sql statements to perform the operation.
protected  boolean useQueryDataForInsert()
          Deprecated. This version does not use QueryData udpate/insert/remove methods, but uses separate queries instead
 
Methods inherited from class org.geotools.data.jdbc.JDBCFeatureWriter
close, encodeColumnName, encodeName, getFeatureType, hasNext, next, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapper

protected FIDMapper mapper
Deprecated. 
Constructor Detail

JDBCTextFeatureWriter

public JDBCTextFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader,
                             QueryData queryData)
                      throws java.io.IOException
Deprecated. 
Creates a new instance of JDBCFeatureWriter

Parameters:
fReader -
queryData -
Throws:
java.io.IOException
Method Detail

doInsert

protected void doInsert(MutableFIDFeature current)
                 throws java.io.IOException,
                        java.sql.SQLException
Deprecated. 
Override that uses sql statements to perform the operation.

Overrides:
doInsert in class JDBCFeatureWriter
Throws:
java.io.IOException
java.sql.SQLException
See Also:
JDBCFeatureWriter.doInsert(org.geotools.data.jdbc.MutableFIDFeature)

makeInsertSql

protected java.lang.String makeInsertSql(org.opengis.feature.simple.SimpleFeature feature)
                                  throws java.io.IOException
Deprecated. 
Creates a sql insert statement. Uses each feature's schema, which makes it possible to insert out of order, as well as inserting less than all features.

Parameters:
feature - the feature to add.
Returns:
an insert sql statement.
Throws:
java.io.IOException

addQuotes

protected java.lang.String addQuotes(java.lang.Object value)
Deprecated. 
Adds quotes to an object for storage in postgis. The object should be a string or a number. To perform an insert strings need quotes around them, and numbers work fine with quotes, so this method can be called on unknown objects.

Parameters:
value - The object to add quotes to.
Returns:
a string representation of the object with quotes.

getGeometryInsertText

protected abstract java.lang.String getGeometryInsertText(com.vividsolutions.jts.geom.Geometry geom,
                                                          int srid)
                                                   throws java.io.IOException
Deprecated. 
Turns a geometry into the textual version needed for the sql statement

Parameters:
geom -
srid -
Throws:
java.io.IOException

getGeometryInsertText

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

Parameters:
geom -
srid -
dimension -
Throws:
java.io.IOException

remove

public void remove()
            throws java.io.IOException
Deprecated. 
Override that uses sql statements to perform the operation.

Specified by:
remove in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
remove in class JDBCFeatureWriter
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
FeatureWriter.remove()

makeDeleteSql

protected java.lang.String makeDeleteSql(org.opengis.feature.simple.SimpleFeature feature)
                                  throws java.io.IOException
Deprecated. 
Generates the query for the sql delete statement

Parameters:
feature -
Throws:
java.io.IOException

doUpdate

protected void doUpdate(org.opengis.feature.simple.SimpleFeature live,
                        org.opengis.feature.simple.SimpleFeature current)
                 throws java.io.IOException,
                        java.sql.SQLException
Deprecated. 
Override that uses sql statements to perform the operation.

Overrides:
doUpdate in class JDBCFeatureWriter
Throws:
java.io.IOException
java.sql.SQLException
See Also:
org.geotools.data.jdbc.JDBCFeatureWriter#doUpdate(org.geotools.feature.Feature, org.geotools.feature.Feature)

makeSelectForUpdateSql

protected java.lang.String makeSelectForUpdateSql(org.opengis.feature.simple.SimpleFeature current)
Deprecated. 
Generate the select for update statement, which will attempt to lock features for update. This should be overwritten by databases which want to take advantage of this method. This method is called in a timer thread, to prevent blocking.

Parameters:
current -
Returns:
sql string or null
Since:
2.2.0

makeUpdateSql

protected java.lang.String makeUpdateSql(org.opengis.feature.simple.SimpleFeature live,
                                         org.opengis.feature.simple.SimpleFeature current)
                                  throws java.io.IOException
Deprecated. 
Generate the update sql statement

Parameters:
live -
current -
Throws:
java.io.IOException

useQueryDataForInsert

protected boolean useQueryDataForInsert()
Deprecated. 
This version does not use QueryData udpate/insert/remove methods, but uses separate queries instead

Overrides:
useQueryDataForInsert in class JDBCFeatureWriter
See Also:
JDBCFeatureWriter.useQueryDataForInsert()


Copyright © 1996-2010 Geotools. All Rights Reserved.