Class EventContentFeatureWriter
- Object
-
- EventContentFeatureWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,FeatureWriter<SimpleFeatureType,SimpleFeature>
public class EventContentFeatureWriter extends Object implements FeatureWriter<SimpleFeatureType,SimpleFeature>
FeatureWriter wrapper that issues events modifications as required.It is the responsibility of a FeatureStore to issue events to interested parties as content is modified. The
ContentStatekeeps track of the listeners, whileEventContentFeatureWriteris willing to fire the events as needed.Event generation happens in two passes:
- As features are modified events are sent out one at a time
- When commit() or rollback() is called a "batch" event is sent out
BatchFeatureEventmaintains a map of BEFORE/AFTER values allowing any interested party to update their seleciton.Please note that if you are using
DiffFeatureWriterit sends out events on its own.- Author:
- Jody Garnett (LISASoft)
-
-
Constructor Summary
Constructors Constructor Description EventContentFeatureWriter(ContentFeatureStore store, FeatureWriter<SimpleFeatureType,SimpleFeature> writer)EventContentFeatureWriter construction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Clean up resources associated with this writer.SimpleFeatureTypegetFeatureType()Supplys FeatureTypeFrom readerbooleanhasNext()Query for more content.SimpleFeaturenext()Next Feature from reader or new content.voidremove()Removes current Feature, must be called before hasNext.voidwrite()Writes out the current feature.
-
-
-
Constructor Detail
-
EventContentFeatureWriter
public EventContentFeatureWriter(ContentFeatureStore store, FeatureWriter<SimpleFeatureType,SimpleFeature> writer)
EventContentFeatureWriter construction.
-
-
Method Detail
-
getFeatureType
public SimpleFeatureType getFeatureType()
Supplys FeatureTypeFrom reader- Specified by:
getFeatureTypein interfaceFeatureWriter<SimpleFeatureType,SimpleFeature>- Returns:
- FeatureType this writer has been configured to create.
- See Also:
FeatureWriter.getFeatureType()
-
next
public SimpleFeature next() throws IOException
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:
FeatureWriter.next()
-
remove
public void remove() throws IOExceptionDescription 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:
FeatureWriter.remove()
-
write
public void write() throws IOExceptionWrites out the current feature.- Specified by:
writein interfaceFeatureWriter<SimpleFeatureType,SimpleFeature>- Throws:
IOException- See Also:
FeatureWriter.write()
-
hasNext
public boolean hasNext() throws IOExceptionQuery 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:
FeatureWriter.hasNext()
-
close
public void close() throws IOExceptionClean 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:
FeatureWriter.close()
-
-