org.geotools.jdbc
Class JDBCInsertFeatureWriter

Object
  extended by JDBCFeatureReader
      extended by JDBCInsertFeatureWriter
All Implemented Interfaces:
FeatureReader<SimpleFeatureType,SimpleFeature>, FeatureWriter<SimpleFeatureType,SimpleFeature>

public class JDBCInsertFeatureWriter
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
JDBCInsertFeatureWriter(JDBCUpdateFeatureWriter other)
           
JDBCInsertFeatureWriter(PreparedStatement ps, Connection cx, JDBCFeatureSource featureSource, Hints hints)
           
JDBCInsertFeatureWriter(String 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.
 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, init
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface FeatureWriter
getFeatureType
 

Constructor Detail

JDBCInsertFeatureWriter

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

JDBCInsertFeatureWriter

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

JDBCInsertFeatureWriter

public JDBCInsertFeatureWriter(JDBCUpdateFeatureWriter other)
Method Detail

hasNext

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

Specified by:
hasNext in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Specified by:
hasNext in interface FeatureWriter<SimpleFeatureType,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:
IOException - If an error occurs determining if there are more Features.

next

public SimpleFeature next()
                   throws IOException
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.

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.