org.geotools.jdbc
Class JDBCUpdateInsertFeatureWriter

java.lang.Object
  extended by org.geotools.jdbc.JDBCFeatureReader
      extended by org.geotools.jdbc.JDBCUpdateFeatureWriter
          extended by org.geotools.jdbc.JDBCUpdateInsertFeatureWriter
All Implemented Interfaces:
FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

public class JDBCUpdateInsertFeatureWriter
extends JDBCUpdateFeatureWriter


Nested Class Summary
 
Nested classes/interfaces inherited from class org.geotools.jdbc.JDBCFeatureReader
JDBCFeatureReader.ResultSetFeature
 
Field Summary
 
Fields inherited from class org.geotools.jdbc.JDBCFeatureReader
builder, columnNames, cx, dataStore, featureSource, featureType, geometryFactory, hints, LOGGER, next, pkey, rs, st, TRACE_ENABLED, tracer, tx
 
Constructor Summary
JDBCUpdateInsertFeatureWriter(java.sql.PreparedStatement ps, java.sql.Connection cx, JDBCFeatureSource featureSource, java.lang.String[] attributeNames, Hints hints)
           
JDBCUpdateInsertFeatureWriter(java.lang.String sql, java.sql.Connection cx, JDBCFeatureSource featureSource, Hints hints)
           
 
Method Summary
 void close()
          Release the underlying resources associated with this stream.
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
 org.opengis.feature.simple.SimpleFeature next()
          Reads the next Feature in the FeatureReader.
 void remove()
          Removes current Feature, must be called before hasNext.
 void write()
          Wrties the current Feature, must be called before hasNext.
 
Methods inherited from class org.geotools.jdbc.JDBCFeatureReader
cleanup, ensureNext, ensureOpen, finalize, getFeatureType, init
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.FeatureWriter
getFeatureType
 

Constructor Detail

JDBCUpdateInsertFeatureWriter

public JDBCUpdateInsertFeatureWriter(java.lang.String sql,
                                     java.sql.Connection cx,
                                     JDBCFeatureSource featureSource,
                                     Hints hints)
                              throws java.sql.SQLException,
                                     java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

JDBCUpdateInsertFeatureWriter

public JDBCUpdateInsertFeatureWriter(java.sql.PreparedStatement ps,
                                     java.sql.Connection cx,
                                     JDBCFeatureSource featureSource,
                                     java.lang.String[] attributeNames,
                                     Hints hints)
                              throws java.sql.SQLException,
                                     java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException
Method Detail

hasNext

public boolean hasNext()
                throws java.io.IOException
Description copied from interface: FeatureReader
Query whether this FeatureReader has another Feature.

Specified by:
hasNext in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Specified by:
hasNext in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
hasNext in class JDBCFeatureReader
Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
java.io.IOException - If an error occurs determining if there are more Features.

next

public org.opengis.feature.simple.SimpleFeature next()
                                              throws java.io.IOException,
                                                     java.lang.IllegalArgumentException,
                                                     java.util.NoSuchElementException
Description copied from interface: FeatureReader
Reads the next Feature in the FeatureReader.

Specified by:
next in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Specified by:
next in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
next in class JDBCUpdateFeatureWriter
Returns:
The next feature in the reader.
Throws:
java.io.IOException - If an error occurs reading the Feature.
java.util.NoSuchElementException - If there are no more Features in the Reader.
java.lang.IllegalArgumentException

remove

public void remove()
            throws java.io.IOException
Description copied from interface: FeatureWriter
Removes current Feature, must be called before hasNext.

FeatureWriters will need to allow all FeatureSources of the same typeName to issue a FeatureEvent event of type FeatureEvent.FEATURES_REMOVED when this method is called.

If this FeatureWriter is opperating against a Transaction FEATURES_REMOVED events should only be sent to FeatureSources operating on the same Transaction. When Transaction commit() is called other FeatureSources will be informed of the modifications.

When the current Feature has been provided as new content, this method "cancels" the add opperation (and notification needed).

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

write

public void write()
           throws java.io.IOException
Description copied from interface: FeatureWriter
Wrties the current Feature, must be called before hasNext.

FeautreWriters will need to allow FeatureSources of the same typeName to issue a FeatureEvent:

If this FeatureWriter is opperating against a Transaction the FEATURES_MODIFIED or FEATURES_ADDED events should only be sent to FeatureSources opperating on the same Transaction. When Transaction commit() is called other FeatureSources will be informed of the modifications.

If you have not called write() when you call hasNext() or next(), no modification will occur().

Specified by:
write in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
write in class JDBCUpdateFeatureWriter
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from interface: FeatureReader
Release the underlying resources associated with this stream.

Specified by:
close in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Specified by:
close in interface FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
close in class JDBCUpdateFeatureWriter
Throws:
java.io.IOException - DOCUMENT ME!


Copyright © 1996-2010 Geotools. All Rights Reserved.