public class FeatureEvent extends EventObject
The "Source" for FeatureEvents is taken to be a FeatureSource
, rather than
DataStore
. The is due to SimpleFeatureSource having a hold of Transaction information.
DataStore implementations will actually keep the list listeners sorted by TypeName, and can report FeatureWriter modifications as required (by filtering the Listener list by typeName and Transaction).
The Transaction.commit() operation will also need to provide notification, this shows up as a CHANGE event; with a bit more detail being available in the subclass BatchFeatureEvent.
Modifier and Type | Class and Description |
---|---|
static class |
FeatureEvent.Type |
Modifier and Type | Field and Description |
---|---|
protected ReferencedEnvelope |
bounds
Indicates the bounds in which the modification occurred.
|
static int |
FEATURES_ADDED
Deprecated.
Please use FeatureEvent.getType() == Type.ADDED
|
static int |
FEATURES_CHANGED
Deprecated.
Please use FeatureEvent.getType() == Type.CHANGED
|
static int |
FEATURES_REMOVED
Deprecated.
Please use FeatureEvent.getType() == Type.REMOVED
|
protected FeatureSource |
featureSource
The FeatureSource broadcasting the event.
|
protected Filter |
filter
Filter used to indicate what content has changed.
|
protected FeatureEvent.Type |
type
Indicates one of Type.ADDED, Type.REMOVED, Type.CHANGED
|
source
Constructor and Description |
---|
FeatureEvent(FeatureEvent origional)
Makes a deep copy of the provided event.
|
FeatureEvent(FeatureSource<? extends FeatureType,? extends Feature> featureSource,
int eventType,
Envelope bounds)
Deprecated.
Please use FeatureEvent( FeatureSource, Type, Envelope )
|
FeatureEvent(Object source,
FeatureEvent.Type type,
ReferencedEnvelope bounds,
Filter filter)
Constructs a new FeatureEvent.
|
Modifier and Type | Method and Description |
---|---|
ReferencedEnvelope |
getBounds()
Provides access to the area modified (if known).
|
int |
getEventType()
Provides information on the type of change that has occured.
|
FeatureSource<? extends FeatureType,? extends Feature> |
getFeatureSource()
Provides access to the SimpleFeatureSource which fired the event.
|
Filter |
getFilter()
Filter describing the content that was changed.
|
FeatureEvent.Type |
getType()
Provides information on the type of change that has occurred.
|
void |
setFeatureSource(FeatureSource featureSource) |
getSource, toString
public static final int FEATURES_ADDED
This EventType is used when FeatureWriter.write() is called when
FeatureWriter.hasNext()
has previously returned false
. This action
represents a newly create Feature being passed to the DataStore.
The FeatureWriter making the modification will need to check that typeName
it
is modifing matches the FeatureSource.getSchema().getTypeName()
before sending
notification to any listeners on the FeatureSource.
If the FeatureWriter is opperating against a Transaction it will need ensure that to check the FeatureSource.getTransaction() for a match before sending notification to any listeners on the FeatureSource.
FeatureEvent.getBounds() should reflect the the Bounding Box of the newly created Features.
public static final int FEATURES_CHANGED
This EventType is used when a FeatureWriter.write() is called when
FeatureWriter.hasNext()
returns true
and the current Feature has been
changed. This EventType is also used when a Transaction commit()
or
rolledback
is called.
The FeatureWriter making the modification will need to check that typeName
it
is modifing matches the FeatureSource.getSchema().getTypeName()
before sending
notification to any listeners on the FeatureSource.
If the FeatureWriter is opperating against a Transaction it will need ensure that to check
the FeatureSource.getTransaction() for a match before sending notification to any listeners
on the FeatureSource. All FeatureSources of the same typename will need to be informed of a
commit
, except ones in the same Transaction, and only FeatureSources in the same
Transaction will need to be informed of a rollback.
FeatureEvent.getBounds() should reflect the the BoundingBox of the FeatureWriter modified
Features. This may not be possible during a commit()
or rollback()
opperation.
public static final int FEATURES_REMOVED
This EventType is used when FeatureWriter.remove() is called. This action represents a Feature being removed from the DataStore.
The FeatureWriter making the modification will need to check that typeName
it
is modifing matches the FeatureSource.getSchema().getTypeName()
before sending
notification to any listeners on the FeatureSource.
If the FeatureWriter is opperating against a Transaction it will need ensure that to check the FeatureSource.getTransaction() for a match before sending notification to any listeners on the FeatureSource.
FeatureEvent.getBounds() should reflect the the Bounding Box of the removed Features.
protected FeatureEvent.Type type
protected ReferencedEnvelope bounds
This value is allowed to by null
if this information is not known.
protected FeatureSource featureSource
Please note when several FeatureSources are operating on different Transactions this value will not always line up with original FeatureSource represented by Event.getSource().
protected Filter filter
This is often an Id filter.
public FeatureEvent(FeatureEvent origional)
public FeatureEvent(Object source, FeatureEvent.Type type, ReferencedEnvelope bounds, Filter filter)
source
- The writer or feature store that fired the eventeventType
- One of FEATURE_CHANGED, FEATURE_REMOVED or FEATURE_ADDEDbounds
- The area modified by this changepublic FeatureEvent(FeatureSource<? extends FeatureType,? extends Feature> featureSource, int eventType, Envelope bounds)
SimpleFeatureSource
- The DataStore that fired the eventeventType
- One of FEATURE_CHANGED, FEATURE_REMOVED or FEATURE_ADDEDbounds
- The area modified by this changepublic FeatureSource<? extends FeatureType,? extends Feature> getFeatureSource()
public void setFeatureSource(FeatureSource featureSource)
public int getEventType()
public FeatureEvent.Type getType()
public ReferencedEnvelope getBounds()
null
if unknown.public Filter getFilter()
Copyright © 1996–2019 Geotools. All rights reserved.