org.geotools.data
Class FeatureEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.geotools.data.FeatureEvent
All Implemented Interfaces:
java.io.Serializable

public class FeatureEvent
extends java.util.EventObject

A simple event object to represent all events triggered by DataStore instances (typically change events).

The "Source" FeatureEvents is taken to be a FeatureSource, rather than DataStore. The is due to FeatureSource having a a hold of Transaction information.

DataStore implementations will actually keep the list listeners by DataSource, and can report FeatureWriter modifications as required (by filtering the Listener list by typeName and Transaction).

The commit opperation will also need to provide notification.

Since:
GeoTools 2.0
See Also:
Serialized Form

Field Summary
static int FEATURES_ADDED
          Event type constant denoting the adding of a feature.
static int FEATURES_CHANGED
          Event type constant denoting that features in the collection has been modified.
static int FEATURES_REMOVED
          Event type constant denoting the removal of a feature.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
FeatureEvent(FeatureSource featureSource, int eventType, com.vividsolutions.jts.geom.Envelope bounds)
          Constructs a new FeatureEvent.
 
Method Summary
 com.vividsolutions.jts.geom.Envelope getBounds()
          Provides access to the area modified (if known).
 int getEventType()
          Provides information on the type of change that has occured.
 FeatureSource getFeatureSource()
          Provides access to the FeatureSource which fired the event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FEATURES_ADDED

public static final int FEATURES_ADDED
Event type constant denoting the adding of a feature.

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.

See Also:
Constant Field Values

FEATURES_CHANGED

public static final int FEATURES_CHANGED
Event type constant denoting that features in the collection has been modified.

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.

See Also:
Constant Field Values

FEATURES_REMOVED

public static final int FEATURES_REMOVED
Event type constant denoting the removal of a feature.

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.

See Also:
Constant Field Values
Constructor Detail

FeatureEvent

public FeatureEvent(FeatureSource featureSource,
                    int eventType,
                    com.vividsolutions.jts.geom.Envelope bounds)
Constructs a new FeatureEvent.

Parameters:
featureSource - The DataStore that fired the event
eventType - One of FEATURE_CHANGED, FEATURE_REMOVED or FEATURE_ADDED
bounds - The area modified by this change
Method Detail

getFeatureSource

public FeatureSource getFeatureSource()
Provides access to the FeatureSource which fired the event.

Returns:
The FeatureSource which was the event's source.

getEventType

public int getEventType()
Provides information on the type of change that has occured. Possible types are: add, remove, change

Returns:
an int which must be one of FEATURES_ADDED, FEATURES_REMOVED, FEATURES_CHANGED

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
Provides access to the area modified (if known).

Returns:
A bounding box of the modifications or null if unknown.


Copyright © GeoTools. All Rights Reserved.