Class DiffContentFeatureWriter
- Object
-
- DiffContentFeatureWriter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,FeatureWriter<SimpleFeatureType,SimpleFeature>
- Direct Known Subclasses:
WFSFeatureWriter
public class DiffContentFeatureWriter 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 written out by this Class. - Author:
- Jody Garnett (Refractions Research)
- See Also:
DiffContentState
-
-
Field Summary
Fields Modifier and Type Field Description protected Diff
diff
protected FeatureReader<SimpleFeatureType,SimpleFeature>
reader
-
Constructor Summary
Constructors Constructor Description DiffContentFeatureWriter(ContentFeatureStore store, Diff diff, FeatureReader<SimpleFeatureType,SimpleFeature> reader)
DiffFeatureWriter construction.DiffContentFeatureWriter(ContentFeatureStore store, Diff diff, FeatureReader<SimpleFeatureType,SimpleFeature> reader, SimpleFeatureBuilder builder)
DiffFeatureWriter construction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Clean up resources associated with this writer.SimpleFeatureType
getFeatureType()
Supplys FeatureTypeFrom readerboolean
hasNext()
Query for more content.SimpleFeature
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.
-
-
-
Field Detail
-
reader
protected FeatureReader<SimpleFeatureType,SimpleFeature> reader
-
diff
protected Diff diff
-
-
Constructor Detail
-
DiffContentFeatureWriter
public DiffContentFeatureWriter(ContentFeatureStore store, Diff diff, FeatureReader<SimpleFeatureType,SimpleFeature> reader)
DiffFeatureWriter construction.
-
DiffContentFeatureWriter
public DiffContentFeatureWriter(ContentFeatureStore store, Diff diff, FeatureReader<SimpleFeatureType,SimpleFeature> reader, SimpleFeatureBuilder builder)
DiffFeatureWriter construction.
-
-
Method Detail
-
getFeatureType
public SimpleFeatureType getFeatureType()
Supplys FeatureTypeFrom reader- Specified by:
getFeatureType
in 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:
next
in 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 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 interfaceFeatureWriter<SimpleFeatureType,SimpleFeature>
- Throws:
IOException
- See Also:
FeatureWriter.remove()
-
write
public void write() throws IOException
Writes out the current feature.- Specified by:
write
in interfaceFeatureWriter<SimpleFeatureType,SimpleFeature>
- Throws:
IOException
- See Also:
FeatureWriter.write()
-
hasNext
public boolean hasNext() throws IOException
Query for more content.- Specified by:
hasNext
in interfaceFeatureWriter<SimpleFeatureType,SimpleFeature>
- Returns:
true
if an additionalFeature
is available,false
if not.- Throws:
IOException
- if an I/O error occurs.- See Also:
FeatureWriter.hasNext()
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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()
-
-