Class DiffFeatureWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,FeatureWriter<SimpleFeatureType,SimpleFeature>
You will eventually need to write out the differences, later.
The api has been implemented in terms of FeatureReader<SimpleFeatureType, SimpleFeature> to make explicit that no Features are writen out by this Class.
- Author:
- Jody Garnett, Refractions Research
- See Also:
-
TransactionStateDiff
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Diffprotected FeatureReader<SimpleFeatureType,SimpleFeature> -
Constructor Summary
ConstructorsConstructorDescriptionDiffFeatureWriter(FeatureReader<SimpleFeatureType, SimpleFeature> reader, Diff diff) DiffFeatureWriter construction.DiffFeatureWriter(FeatureReader<SimpleFeatureType, SimpleFeature> reader, Diff diff, Filter filter) DiffFeatureWriter construction. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Clean up resources associated with this writer.protected abstract voidfireNotification(int eventType, ReferencedEnvelope bounds) Subclass must provide the notification.Supplys FeatureTypeFrom readerbooleanhasNext()Query for more content.next()Next Feature from reader or new content.voidremove()Removes current Feature, must be called before hasNext.voidwrite()Writes out the current feature.
-
Field Details
-
reader
-
diff
-
-
Constructor Details
-
DiffFeatureWriter
DiffFeatureWriter construction. -
DiffFeatureWriter
public DiffFeatureWriter(FeatureReader<SimpleFeatureType, SimpleFeature> reader, Diff diff, Filter filter) DiffFeatureWriter construction.
-
-
Method Details
-
getFeatureType
Supplys FeatureTypeFrom reader- Specified by:
getFeatureTypein interfaceFeatureWriter<SimpleFeatureType,SimpleFeature> - Returns:
- FeatureType this writer has been configured to create.
- See Also:
-
next
Next Feature from reader or new content.- Specified by:
nextin interfaceFeatureWriter<SimpleFeatureType,SimpleFeature> - Returns:
- Feature from Query, or newly appended Feature
- Throws:
IOException- if the writer has been closed or an I/O error occurs reading the nextFeature.- See Also:
-
remove
Description copied from interface:FeatureWriterRemoves 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_REMOVEDwhen 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:
removein interfaceFeatureWriter<SimpleFeatureType,SimpleFeature> - Throws:
IOException- See Also:
-
write
Writes out the current feature.- Specified by:
writein interfaceFeatureWriter<SimpleFeatureType,SimpleFeature> - Throws:
IOException- See Also:
-
hasNext
Query for more content.- Specified by:
hasNextin interfaceFeatureWriter<SimpleFeatureType,SimpleFeature> - Returns:
trueif an additionalFeatureis available,falseif not.- Throws:
IOException- if an I/O error occurs.- See Also:
-
close
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceFeatureWriter<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:
-
fireNotification
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
-