org.geotools.data
Class DiffFeatureWriter

java.lang.Object
  extended byorg.geotools.data.DiffFeatureWriter
All Implemented Interfaces:
FeatureWriter

public abstract class DiffFeatureWriter
extends java.lang.Object
implements FeatureWriter

A FeatureWriter that captures modifications against a FeatureReader.

You will eventually need to write out the differences, later.

The api has been implemented in terms of FeatureReader to make explicit that no Features are writen out by this Class.

Author:
Jody Garnett, Refractions Research
See Also:
TransactionStateDiff

Field Summary
protected  java.util.Map diff
           
protected  FeatureReader reader
           
 
Constructor Summary
DiffFeatureWriter(FeatureReader reader, java.util.Map diff)
          DiffFeatureWriter construction.
DiffFeatureWriter(FeatureReader reader, java.util.Map diff, Filter filter)
          DiffFeatureWriter construction.
 
Method Summary
 void close()
          Clean up resources associated with this writer.
protected abstract  void fireNotification(int eventType, com.vividsolutions.jts.geom.Envelope bounds)
          Subclass must provide the notification.
 FeatureType getFeatureType()
          Supplys FeatureTypeFrom reader
 boolean hasNext()
          Query for more content.
 Feature next()
          Next Feature from reader or new content.
 void remove()
          Removes current Feature, must be called before hasNext.
 void write()
          Writes out the current feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected FeatureReader reader

diff

protected java.util.Map diff
Constructor Detail

DiffFeatureWriter

public DiffFeatureWriter(FeatureReader reader,
                         java.util.Map diff)
DiffFeatureWriter construction.

Parameters:
reader -
diff -

DiffFeatureWriter

public DiffFeatureWriter(FeatureReader reader,
                         java.util.Map diff,
                         Filter filter)
DiffFeatureWriter construction.

Parameters:
reader -
diff -
Method Detail

getFeatureType

public FeatureType getFeatureType()
Supplys FeatureTypeFrom reader

Specified by:
getFeatureType in interface FeatureWriter
Returns:
FeatureType this writer has been configured to create.
See Also:
FeatureWriter.getFeatureType()

next

public Feature next()
             throws java.io.IOException
Next Feature from reader or new content.

Specified by:
next in interface FeatureWriter
Returns:
Feature from Query, or newly appended Feature
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
FeatureWriter.next()

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
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
FeatureWriter.remove()

write

public void write()
           throws java.io.IOException
Writes out the current feature.

Specified by:
write in interface FeatureWriter
Throws:
java.io.IOException
See Also:
FeatureWriter.write()

hasNext

public boolean hasNext()
                throws java.io.IOException
Query for more content.

Specified by:
hasNext in interface FeatureWriter
Returns:
true if an additional Feature is available.
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
FeatureWriter.hasNext()

close

public void close()
           throws java.io.IOException
Clean up resources associated with this writer.

Diff is not clear()ed as it is assumed that it belongs to a Transaction.State object and may yet be written out.

Specified by:
close in interface FeatureWriter
Throws:
java.io.IOException - if there there are problems releasing underlying resources, or possibly if close has been called (up to the implementation).
See Also:
FeatureWriter.close()

fireNotification

protected abstract void fireNotification(int eventType,
                                         com.vividsolutions.jts.geom.Envelope bounds)
Subclass must provide the notification.

Notification requirements for modifications against a Transaction should only be issued to FeatureSource instances that opperate against the same typeName and Transaction.

Other FeatureSource instances with the same typeName will be notified when the Transaction is committed.

Parameters:
eventType - One of FeatureType.FEATURES_ADDED, FeatureType.CHANGED, FeatureType.FEATURES_REMOVED
bounds -


Copyright © GeoTools. All Rights Reserved.