Class VectorMosaicFeatureSource
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,
,SimpleFeature> SimpleFeatureSource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FilterTracker
protected GranuleStoreFinder
protected ContentState
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction
-
Constructor Summary
ConstructorsConstructorDescriptionVectorMosaicFeatureSource
(ContentEntry contentEntry, VectorMosaicStore store) VectorMosaicFeatureSource constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleFeatureType
Uses first granule to build a schema for the target feature typeprotected boolean
Determines if the datastore can natively perform a filtering.protected boolean
Determines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesgetAttributeNamesForType
(SimpleFeatureType featureType) protected ReferencedEnvelope
getBoundsInternal
(Query query) Calculates the bounds of a specified query.protected int
getCountInternal
(Query query) Counts the matching granules by delegating to the underlying granule stores.protected SimpleFeatureType
getFeatureType
(SimpleFeatureType indexFeatureType, SimpleFeatureType granuleFeatureType) Builds a feature type for the target feature source by merging the index feature type with the granule feature typeprotected SimpleFeatureType
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 Filter
getSplitFilter
(Query query, DataStore dataStore, String typeName, boolean isDelegate) getState()
The current state for the feature source.getStore()
Get the FeatureStore for the feature source.protected boolean
handleVisitor
(Query query, FeatureVisitor visitor) Subclass method which allows subclasses to natively handle a visitor.initGranule
(VectorMosaicGranule granule, boolean isSampleForType) Initializes the granule by setting the data store and granule type nameprotected boolean
isNotMandatoryIndexType
(AttributeDescriptor descriptor) Checks if the attribute descriptor is not a mandatory index typeprotected void
populateGranuleTypeName
(VectorMosaicGranule granule, DataStore dataStore) Validates and loads the connection string propertiesMethods 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 Details
-
state
-
filterTracker
-
finder
-
-
Constructor Details
-
VectorMosaicFeatureSource
VectorMosaicFeatureSource constructor.- Parameters:
contentEntry
- The content entry for the feature source.store
- The data store for the feature source.
-
-
Method Details
-
getStore
Get the FeatureStore for the feature source.- Returns:
- The FeatureStore for the feature source.
-
getSplitFilter
-
getBoundsInternal
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 returnnull
.- Specified by:
getBoundsInternal
in classContentFeatureSource
- Throws:
IOException
-
getCountInternal
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 classContentFeatureSource
- Throws:
IOException
-
getReaderInternal
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException Description copied from class:ContentFeatureSource
Subclass 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.</li> <li>{@link #canLimit(Query)} - handles {@link Query#getMaxFeatures()} and {@link Query#getStartIndex()} internally.</li> <li>{@link #canSort(Query)} - handles {@link Query#getSortBy()} natively.</li> <li>{@link #canRetype(Query)} - handles {@link Query#getProperties()} natively. Example would be only parsing the properties the user asks for from an XML file</li> <li>{@link #canLock()} - handles read-locks natively</li> <li>{@link #canTransact()} - handles transactions natively</li> </ul> </p>
- Specified by:
getReaderInternal
in classContentFeatureSource
- Throws:
IOException
-
buildFeatureType
Uses first granule to build a schema for the target feature type- Specified by:
buildFeatureType
in classContentFeatureSource
- Returns:
- the schema
- Throws:
IOException
- If feature type can't be built or found
-
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 classContentFeatureSource
-
getGranuleType
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
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
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 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
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 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
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 classContentFeatureSource
- See Also:
-
canFilter
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. SeeFilteringFeatureReader
.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. SeeFilteringFeatureReader
.- Overrides:
canFilter
in classContentFeatureSource
-