Package org.apache.sis.storage
Class AbstractFeatureSet
java.lang.Object
org.apache.sis.storage.AbstractResource
org.apache.sis.storage.AbstractFeatureSet
- All Implemented Interfaces:
DataSet,FeatureSet,Resource
- Direct Known Subclasses:
AggregatedFeatureSet,FeatureSubset,MemoryFeatureSet,Table
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
- Version:
- 1.2
-
Field Summary
Fields inherited from class org.apache.sis.storage.AbstractResource
listeners -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFeatureSet(StoreListeners parentListeners, boolean hidden) Creates a new resource which can send notifications to the given set of listeners. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.opengis.metadata.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.Optional<org.opengis.util.GenericName>Returns the feature type name as the identifier for this resource.Methods inherited from class org.apache.sis.storage.AbstractResource
addListener, clearCache, createExceptionMessage, getEnvelope, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sis.storage.DataSet
getEnvelopeMethods inherited from interface org.apache.sis.storage.FeatureSet
features, getType, subsetMethods inherited from interface org.apache.sis.storage.Resource
addListener, getMetadata, removeListener
-
Constructor Details
-
AbstractFeatureSet
Creates a new resource which can send notifications to the given set of listeners. Ifhiddenisfalse(the recommended value), then this resource will have its own set of listeners with this resource declared as the source of events. It will be possible to add and remove listeners independently from the set of parent listeners. Conversely ifhiddenistrue, then the given listeners will be used directly and this resource will not appear as the source of any event.In any cases, the listeners of all parents (ultimately the data store that created this resource) will always be notified, either directly if
hiddenistrueor indirectly ifhiddenisfalse.- 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- Overrides:
getIdentifierin classAbstractResource- 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.
-
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.
-