Class VectorMosaicFeatureSource
- Object
-
- ContentFeatureSource
-
- VectorMosaicFeatureSource
-
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>,SimpleFeatureSource
public class VectorMosaicFeatureSource extends ContentFeatureSource
FeatureSource for a vector mosaic.
-
-
Field Summary
Fields Modifier and Type Field Description protected FilterTrackerfilterTrackerprotected GranuleStoreFinderfinderprotected ContentStatestate-
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction
-
-
Constructor Summary
Constructors Constructor Description VectorMosaicFeatureSource(ContentEntry contentEntry, VectorMosaicStore store)VectorMosaicFeatureSource constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleFeatureTypebuildFeatureType()Uses first granule to build a schema for the target feature typeprotected booleancanFilter(Query query)Determines if the datastore can natively perform a filtering.protected booleancanRetype(Query query)Determines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesstatic Set<String>getAttributeNamesForType(SimpleFeatureType featureType)protected ReferencedEnvelopegetBoundsInternal(Query query)Calculates the bounds of a specified query.protected intgetCountInternal(Query query)Counts the matching granules by delegating to the underlying granule stores.protected SimpleFeatureTypegetFeatureType(SimpleFeatureType indexFeatureType, SimpleFeatureType granuleFeatureType)Builds a feature type for the target feature source by merging the index feature type with the granule feature typeprotected SimpleFeatureTypegetGranuleType()Get the feature type for the granules.protected FeatureReader<SimpleFeatureType,SimpleFeature>getReaderInternal(Query query)Subclass method for returning a native reader from the datastore.protected FiltergetSplitFilter(Query query, DataStore dataStore, String typeName, boolean isDelegate)ContentStategetState()The current state for the feature source.VectorMosaicStoregetStore()Get the FeatureStore for the feature source.protected booleanhandleVisitor(Query query, FeatureVisitor visitor)Subclass method which allows subclasses to natively handle a visitor.DataStoreinitGranule(VectorMosaicGranule granule, boolean isSampleForType)Initializes the granule by setting the data store and granule type nameprotected booleanisNotMandatoryIndexType(AttributeDescriptor descriptor)Checks if the attribute descriptor is not a mandatory index typeprotected voidpopulateGranuleTypeName(VectorMosaicGranule granule, DataStore dataStore)Validates and loads the connection string properties-
Methods inherited from class ContentFeatureSource
accepts, addFeatureListener, addHints, buildQueryCapabilities, canEvent, canFilter, canLimit, canLimit, canLock, canOffset, canOffset, canReproject, canRetype, canSort, canSort, canTransact, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getDataStore, getEntry, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getReader, getReader, getReader, getSchema, getSupportedHints, getTransaction, getView, getView, isView, joinQuery, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, resolvePropertyNames, resolvePropertyNames, setFeatureLock, setTransaction, unLockFeatures, unLockFeatures, unLockFeatures
-
-
-
-
Field Detail
-
state
protected ContentState state
-
filterTracker
protected FilterTracker filterTracker
-
finder
protected GranuleStoreFinder finder
-
-
Constructor Detail
-
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 Detail
-
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:ContentFeatureSourceCalculates the bounds of a specified query. Subclasses must implement this method. If the computation is not fast, subclasses can returnnull.- Specified by:
getBoundsInternalin classContentFeatureSource- 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:
getCountInternalin classContentFeatureSource- Throws:
IOException
-
getReaderInternal
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
Description copied from class:ContentFeatureSourceSubclass method for returning a native reader from the datastore.It is important to note that if the native reader intends to handle any of the following natively:
- reprojection
- filtering
- max feature limiting
- sorting
- locking
- transactions
true:ContentFeatureSource.canReproject()- handlesQuery.getCoordinateSystemReproject()internally. Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter(Query)- handlesinternally.- {@link #canLimit(Query)} - handles {@link Query#getMaxFeatures()} and {@link Query#getStartIndex()} internally.
- {@link #canSort(Query)} - handles {@link Query#getSortBy()} natively.
- {@link #canRetype(Query)} - handles {@link Query#getProperties()} natively. Example would be only parsing the properties the user asks for from an XML file
- {@link #canLock()} - handles read-locks natively
- {@link #canTransact()} - handles transactions natively
- Specified by:
getReaderInternalin classContentFeatureSource- Throws:
IOException
-
buildFeatureType
protected SimpleFeatureType buildFeatureType() throws IOException
Uses first granule to build a schema for the target feature type- Specified by:
buildFeatureTypein classContentFeatureSource- Returns:
- the schema
- Throws:
IOException- If feature type can't be built or found
-
getState
public ContentState getState()
Description copied from class:ContentFeatureSourceThe current state for the feature source.This value is derived from current transaction of the feature source.
- Overrides:
getStatein classContentFeatureSource
-
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 typegranuleFeatureType- 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:ContentFeatureSourceSubclass 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:
handleVisitorin classContentFeatureSource- 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:ContentFeatureSourceDetermines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesIf 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
falsewill cause the feature reader created by the subclass to be wrapped in a retyping feature reader when the query specifies a retype.- Overrides:
canRetypein classContentFeatureSource- See Also:
ReTypeFeatureReader
-
canFilter
protected boolean canFilter(Query query)
Description copied from class:ContentFeatureSourceDetermines 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. SeeFilteringFeatureReader.Not overriding this method or returning
falsewill cause the feature reader created by the subclass to be wrapped in a filtering feature reader when the query specifies a filter. SeeFilteringFeatureReader.- Overrides:
canFilterin classContentFeatureSource
-
-