Class AbstractFeatureSet
Object
AbstractResource
AbstractFeatureSet
- All Implemented Interfaces:
DataSet, FeatureSet, Resource
- Direct Known Subclasses:
ConcatenatedFeatureSet, JoinFeatureSet, MemoryFeatureSet
Default implementations of several methods for classes that want to implement the
FeatureSet interface.
Subclasses should override the following methods:
FeatureSet.getType()(mandatory)FeatureSet.features(boolean parallel)(mandatory)getFeatureCount()(recommended)AbstractResource.getEnvelope()(recommended)createMetadata()(optional)
Thread safety
Default methods of this abstract class are thread-safe. Synchronization, when needed, usesAbstractResource.getSynchronizationLock().- Since:
- 1.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface Resource
Resource.FileSet -
Field Summary
Fields inherited from class AbstractResource
listeners -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFeatureSet(StoreListeners parentListeners, boolean hidden) Creates a new resource which can send notifications to the given set of listeners.protectedAbstractFeatureSet(Resource parent) Creates a new resource, potentially as a child of another resource. -
Method Summary
Modifier and TypeMethodDescriptionprotected MetadataInvoked in a synchronized block the first time thatgetMetadata()is invoked.Returns an estimation of the number of features in this set, or empty if unknown.Returns the feature type name as the identifier for this resource.protected voidprepareQueryOptimization(FeatureQuery query, Optimization optimizer) Configures the optimization of a query to be applied on thisFeatureSet.Methods inherited from class AbstractResource
addListener, clearCache, getEnvelope, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataSet
getEnvelopeMethods inherited from interface FeatureSet
features, getTypeMethods inherited from interface Resource
addListener, getFileSet, getMetadata, removeListener
-
Constructor Details
-
AbstractFeatureSet
-
AbstractFeatureSet
Creates a new resource which can send notifications to the given set of listeners. Thehiddenargument specifies whether the new resource should be invisible in the tree of resources. See the parent constructor for more information.- Parameters:
parentListeners- listeners of the parent resource, ornullif none. This is usually the listeners of theDataStorethat created this resource.hidden-falseif this resource shall use its ownStoreListenerswith the specified parent, ortruefor usingparentListenersdirectly.
-
-
Method Details
-
getIdentifier
Returns the feature type name as the identifier for this resource. Subclasses should override if they can provide a more specific identifier.- Specified by:
getIdentifierin interfaceResource- Returns:
- the resource identifier inferred from feature type.
- Throws:
DataStoreException- if an error occurred while fetching the identifier.- See Also:
-
getFeatureCount
Returns an estimation of the number of features in this set, or empty if unknown. The default implementation returns an empty value.- Returns:
- estimation of the number of features.
-
prepareQueryOptimization
protected void prepareQueryOptimization(FeatureQuery query, Optimization optimizer) throws DataStoreException Configures the optimization of a query to be applied on thisFeatureSet. This method is invoked indirectly by the default implementation ofsubset(Query). The default implementation of this method does nothing.Recommendation
Subclasses should override this method as below if they can guarantee that the feature type returned byFeatureSet.getType()is final, i.e. that the result of the query will not contain any feature which (before projection) is an instance of some subtype:@Override protected void prepareQueryOptimization(FeatureQuery query, Optimization optimizer) throws DataStoreException { optimizer.setFinalFeatureType(getType()); }- Parameters:
query- definition of feature and feature properties filtering applied at reading time.optimizer- the optimization to configure.- Throws:
DataStoreException- if an error occurred during the configuration of the optimizer.- Since:
- 1.6
-
createMetadata
Invoked in a synchronized block the first time thatgetMetadata()is invoked. The default implementation populates metadata based on information provided bygetIdentifier(),getEnvelope(),getType()andgetFeatureCount(). Subclasses should override if they can provide more information. The default value can be completed by casting toDefaultMetadata.- Overrides:
createMetadatain classAbstractResource- Returns:
- the newly created metadata, or
nullif unknown. - Throws:
DataStoreException- if an error occurred while reading metadata from this resource.
-