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

public abstract class AbstractFeatureSet extends AbstractResource implements FeatureSet
Default implementations of several methods for classes that want to implement the FeatureSet interface. Subclasses should override the following methods:

Thread safety

Default methods of this abstract class are thread-safe. Synchronization, when needed, uses AbstractResource.getSynchronizationLock().
Since:
1.2
Version:
1.2
  • Constructor Details

    • AbstractFeatureSet

      protected AbstractFeatureSet(StoreListeners parentListeners, boolean hidden)
      Creates a new resource which can send notifications to the given set of listeners. If hidden is false (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 if hidden is true, 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 hidden is true or indirectly if hidden is false.

      Parameters:
      parentListeners - listeners of the parent resource, or null if none. This is usually the listeners of the DataStore that created this resource.
      hidden - false if this resource shall use its own StoreListeners with the specified parent, or true for using parentListeners directly.
  • Method Details

    • getIdentifier

      public Optional<org.opengis.util.GenericName> getIdentifier() throws DataStoreException
      Returns the feature type name as the identifier for this resource. Subclasses should override if they can provide a more specific identifier.
      Specified by:
      getIdentifier in interface Resource
      Overrides:
      getIdentifier in class AbstractResource
      Returns:
      the resource identifier inferred from feature type.
      Throws:
      DataStoreException - if an error occurred while fetching the identifier.
      See Also:
    • getFeatureCount

      public OptionalLong 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

      protected org.opengis.metadata.Metadata createMetadata() throws DataStoreException
      Invoked in a synchronized block the first time that getMetadata() is invoked. The default implementation populates metadata based on information provided by getIdentifier(), getEnvelope(), getType() and getFeatureCount(). Subclasses should override if they can provide more information. The default value can be completed by casting to DefaultMetadata.
      Overrides:
      createMetadata in class AbstractResource
      Returns:
      the newly created metadata, or null if unknown.
      Throws:
      DataStoreException - if an error occurred while reading metadata from this resource.