org.geotools.jdbc
Class JDBCUpdateFeatureWriter

Object
  extended by JDBCFeatureReader
      extended by JDBCUpdateFeatureWriter
All Implemented Interfaces:
FeatureReader<SimpleFeatureType,SimpleFeature>, FeatureWriter<SimpleFeatureType,SimpleFeature>
Direct Known Subclasses:
JDBCUpdateInsertFeatureWriter

public class JDBCUpdateFeatureWriter
extends JDBCFeatureReader
implements FeatureWriter<SimpleFeatureType,SimpleFeature>


Nested Class Summary
 
Nested classes/interfaces inherited from class JDBCFeatureReader
JDBCFeatureReader.ResultSetFeature
 
Field Summary
 
Fields inherited from class JDBCFeatureReader
builder, columnNames, cx, dataStore, featureSource, featureType, geometryFactory, hints, LOGGER, next, pkey, rs, st, TRACE_ENABLED, tracer, tx
 
Constructor Summary
JDBCUpdateFeatureWriter(PreparedStatement ps, Connection cx, JDBCFeatureSource featureSource, Hints hints)
           
JDBCUpdateFeatureWriter(String sql, Connection cx, JDBCFeatureSource featureSource, Hints hints)
           
 
Method Summary
 void close()
          Release the underlying resources associated with this stream.
 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 JDBCFeatureReader
cleanup, ensureNext, ensureOpen, finalize, getFeatureType, hasNext, init
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface FeatureWriter
getFeatureType, hasNext
 

Constructor Detail

JDBCUpdateFeatureWriter

public JDBCUpdateFeatureWriter(String sql,
                               Connection cx,
                               JDBCFeatureSource featureSource,
                               Hints hints)
                        throws SQLException,
                               IOException
Throws:
SQLException
IOException

JDBCUpdateFeatureWriter

public JDBCUpdateFeatureWriter(PreparedStatement ps,
                               Connection cx,
                               JDBCFeatureSource featureSource,
                               Hints hints)
                        throws SQLException,
                               IOException
Throws:
SQLException
IOException
Method Detail

next

public SimpleFeature next()
                   throws IOException,
                          IllegalArgumentException,
                          NoSuchElementException
Description copied from interface: FeatureReader
Reads the next Feature in the FeatureReader.

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

remove

public void remove()
            throws 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<SimpleFeatureType,SimpleFeature>
Throws:
IOException - DOCUMENT ME!

write

public void write()
           throws 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<SimpleFeatureType,SimpleFeature>
Throws:
IOException

close

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

Specified by:
close in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Specified by:
close in interface FeatureWriter<SimpleFeatureType,SimpleFeature>
Overrides:
close in class JDBCFeatureReader
Throws:
IOException - DOCUMENT ME!


Copyright © 1996-2009 Geotools. All Rights Reserved.