Class VectorMosaicFeatureSource

Object
ContentFeatureSource
VectorMosaicFeatureSource
All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>, SimpleFeatureSource

public class VectorMosaicFeatureSource extends ContentFeatureSource
FeatureSource for a vector mosaic.
  • Field Details

  • Constructor Details

    • VectorMosaicFeatureSource

      public VectorMosaicFeatureSource(ContentEntry contentEntry, VectorMosaicStore store)
      VectorMosaicFeatureSource constructor.
      Parameters:
      contentEntry - The content entry for the feature source.
      store - The data store for the feature source.
  • Method Details

    • getStore

      public VectorMosaicStore getStore()
      Get the FeatureStore for the feature source.
      Returns:
      The FeatureStore for the feature source.
    • getSplitFilter

      protected Filter getSplitFilter(Query query, DataStore dataStore, String typeName, boolean isDelegate)
    • getBoundsInternal

      protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException
      Description copied from class: ContentFeatureSource
      Calculates the bounds of a specified query. Subclasses must implement this method. If the computation is not fast, subclasses can return null.
      Specified by:
      getBoundsInternal in class ContentFeatureSource
      Throws:
      IOException
    • getCountInternal

      protected int getCountInternal(Query query) throws IOException
      Counts the matching granules by delegating to the underlying granule stores. The stores could potentially return a mix of "-1" and actual counts, the current implementation assumes that the it's convenient to grab the count forcefully when it's not available from the fast count, should still be better than counting all features after they got merged with the delegate ones.

      A take that a single "-1" would make this method also return "-1" could also be reasoable, we might want to make the behavior configurable in the future. Currently most code really wants the actual count, not an estimate, hence the current implementation.

      Specified by:
      getCountInternal in class ContentFeatureSource
      Throws:
      IOException
    • getReaderInternal

      protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
      Reads the features of the mosaic in the order of the query:
      • no sort, or a lone NATURAL_ORDER: the index order, then the order of each granule;
      • a sort on index attributes only: the index store sorts the granules;
      • any other sort: the index store sorts the granules on the leading index attributes, and GroupSortingReader sorts each group of granules on the full sort. Without leading index attributes the whole mosaic is one group, and rejectFullScanSort rejects the query.
      Specified by:
      getReaderInternal in class ContentFeatureSource
      Throws:
      IOException
    • canSort

      protected boolean canSort(Query query)
      The mosaic sorts every query itself, see getReaderInternal(org.geotools.api.data.Query)
      Overrides:
      canSort in class ContentFeatureSource
      See Also:
    • getQueryCapabilities

      public QueryCapabilities getQueryCapabilities()
      With rejectFullScanSort set, the capabilities report only the sorts the mosaic does itself
      Specified by:
      getQueryCapabilities in interface FeatureSource<SimpleFeatureType,SimpleFeature>
      Overrides:
      getQueryCapabilities in class ContentFeatureSource
      Returns:
      readonly access
    • buildFeatureType

      protected SimpleFeatureType buildFeatureType() throws IOException
      Uses first granule to build a schema for the target feature type
      Specified by:
      buildFeatureType in class ContentFeatureSource
      Returns:
      the schema
      Throws:
      IOException - If feature type can't be built or found
    • getState

      public ContentState getState()
      Description copied from class: ContentFeatureSource
      The current state for the feature source.

      This value is derived from current transaction of the feature source.

      Overrides:
      getState in class ContentFeatureSource
    • getGranuleType

      protected SimpleFeatureType getGranuleType() throws IOException
      Get the feature type for the granules.
      Returns:
      the feature type for the granules.
      Throws:
      IOException - if the feature type can't be found.
    • getFeatureType

      protected SimpleFeatureType getFeatureType(SimpleFeatureType indexFeatureType, SimpleFeatureType granuleFeatureType) throws IOException
      Builds a feature type for the target feature source by merging the index feature type with the granule feature type
      Parameters:
      indexFeatureType - the index feature type
      granuleFeatureType - the granule feature type
      Returns:
      the merged feature type
      Throws:
      IOException - if feature type can't be built
    • isNotMandatoryIndexType

      protected boolean isNotMandatoryIndexType(AttributeDescriptor descriptor)
      Checks if the attribute descriptor is not a mandatory index type
      Parameters:
      descriptor - the attribute descriptor
      Returns:
      true if not mandatory index type
    • initGranule

      public DataStore initGranule(VectorMosaicGranule granule, boolean isSampleForType) throws IOException
      Initializes the granule by setting the data store and granule type name
      Parameters:
      granule - the granule
      Throws:
      IOException - if data store can't be found
    • getAttributeNamesForType

      public static Set<String> getAttributeNamesForType(SimpleFeatureType featureType) throws IOException
      Throws:
      IOException
    • handleVisitor

      protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException
      Description copied from class: ContentFeatureSource
      Subclass method which allows subclasses to natively handle a visitor.

      Subclasses would override this method and return true in cases where the specific visitor could be handled without iterating over the entire result set of query. An example would be handling visitors that calculate aggregate values.

      Overrides:
      handleVisitor in class ContentFeatureSource
      Parameters:
      query - The query being made.
      visitor - The visitor to
      Returns:
      true if the visitor can be handled natively, otherwise false.
      Throws:
      IOException
    • populateGranuleTypeName

      protected void populateGranuleTypeName(VectorMosaicGranule granule, DataStore dataStore) throws IOException
      Validates and loads the connection string properties
      Parameters:
      granule - the granule
      Throws:
      IOException - if connection string properties can't be loaded
    • canRetype

      protected boolean canRetype(Query query)
      Description copied from class: ContentFeatureSource
      Determines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributes

      If the subclass can handle retyping natively it should override this method to return true. In this case it must do the retyping or throw an exception.

      Not overriding this method or returning false will cause the feature reader created by the subclass to be wrapped in a retyping feature reader when the query specifies a retype.

      Overrides:
      canRetype in class ContentFeatureSource
      See Also:
    • canFilter

      protected boolean canFilter(Query query)
      Description copied from class: ContentFeatureSource
      Determines if the datastore can natively perform a filtering.

      If the subclass can handle filtering natively it should override this method to return true. In this case it must do the filtering or throw an exception. This includes the case of partial native filtering where the datastore can only handle part of the filter natively. In these cases it is up to the subclass to apply a decorator to the reader it returns which will handle any part of the filter can was not applied natively. See FilteringFeatureReader.

      Not overriding this method or returning false will cause the feature reader created by the subclass to be wrapped in a filtering feature reader when the query specifies a filter. See FilteringFeatureReader.

      Overrides:
      canFilter in class ContentFeatureSource