Class DiffFeatureWriter

  • All Implemented Interfaces:
    Closeable, AutoCloseable, FeatureWriter<SimpleFeatureType,​SimpleFeature>

    public abstract class DiffFeatureWriter
    extends Object
    implements FeatureWriter<SimpleFeatureType,​SimpleFeature>
    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
    • Method Detail

      • 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
        See Also:
        FeatureWriter.remove()
      • close

        public void close()
                   throws 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 AutoCloseable
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface FeatureWriter<SimpleFeatureType,​SimpleFeature>
        Throws:
        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,
                                                 ReferencedEnvelope bounds)
        Subclass must provide the notification.

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

        Other SimpleFeatureSource 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