Class MongoFeatureSource
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,,SimpleFeature> SimpleFeatureSource
-
Field Summary
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction -
Constructor Summary
ConstructorsConstructorDescriptionMongoFeatureSource(ContentEntry entry, Query query, DBCollection collection) -
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleFeatureTypeCreates the feature type or schema for the feature source.protected QueryCapabilitiesBuilds the query capabilities for this feature source.protected booleanDetermines if the datastore can natively perform a filtering.protected booleanDetermines if the datastore can natively limit the number of features returned in a query.protected booleanDetermines if the datastore can natively skip the firstoffsetnumber of features returned in a query.protected booleanDetermines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesprotected booleanDetermines if the datastore can natively perform sorting.protected ReferencedEnvelopegetBoundsInternal(Query query) Calculates the bounds of a specified query.DBCollectionprotected intgetCountInternal(Query query) Calculates the number of features of a specified query.The datastore that this feature source originated from.protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) Subclass method for returning a native reader from the datastore.protected booleanhandleVisitor(Query query, FeatureVisitor visitor) Subclass method which allows subclasses to natively handle a visitor.voidsetMapper(CollectionMapper mapper) Methods inherited from class ContentFeatureSource
accepts, addFeatureListener, addHints, canEvent, canFilter, canLimit, canLock, canOffset, canReproject, canRetype, canSort, canTransact, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getEntry, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getReader, getReader, getReader, getSchema, getState, getSupportedHints, getTransaction, getView, getView, isView, joinQuery, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, resolvePropertyNames, resolvePropertyNames, setFeatureLock, setTransaction, unLockFeatures, unLockFeatures, unLockFeatures
-
Constructor Details
-
MongoFeatureSource
-
-
Method Details
-
getCollection
public DBCollection getCollection() -
getMapper
-
setMapper
-
buildFeatureType
Description copied from class:ContentFeatureSourceCreates the feature type or schema for the feature source.Implementations should use
SimpleFeatureTypeBuilderto build the feature type. Also, the builder should be injected with the feature factory which has been set on the DataStore (seeContentDataStore.getFeatureFactory(). Example:SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setFeatureTypeFactory( getDataStore().getFeatureTypeFactory() ); //build the feature type ...
- Specified by:
buildFeatureTypein classContentFeatureSource- Throws:
IOException
-
getDataStore
Description copied from class:ContentFeatureSourceThe datastore that this feature source originated from.Subclasses may wish to extend this method in order to type narrow its return type.
- Specified by:
getDataStorein interfaceFeatureSource<SimpleFeatureType,SimpleFeature> - Overrides:
getDataStorein classContentFeatureSource- Returns:
- the data source providing this
FeatureSource
-
getBoundsInternal
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
Description copied from class:ContentFeatureSourceCalculates the number of features of a specified query. Subclasses must implement this method. If the computation is not fast, it's possible to return -1.- 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.</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:
getReaderInternalin classContentFeatureSource- Throws:
IOException
-
handleVisitor
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
-
canOffset
Description copied from class:ContentFeatureSourceDetermines if the datastore can natively skip the firstoffsetnumber of features returned in a query.If the subclass can handle a map feature cap natively then it should override this method to return
true. In this case it must do the cap or throw an exception.Not overriding this method or returning
falsewill case the feature reader created by the subclass to be accessed offset times before being returned to the caller.- Overrides:
canOffsetin classContentFeatureSource
-
canLimit
Description copied from class:ContentFeatureSourceDetermines if the datastore can natively limit the number of features returned in a query.If the subclass can handle a map feature cap natively then it should override this method to return
true. In this case it must do the cap or throw an exception.Not overriding this method or returning
falsewill case the feature reader created by the subclass to be wrapped in a max feature capping decorator when the query specifies a max feature cap.- Overrides:
canLimitin classContentFeatureSource- See Also:
-
canRetype
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:
-
canSort
Description copied from class:ContentFeatureSourceDetermines if the datastore can natively perform sorting.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
falsewill cause an exception to be thrown when the query specifies sorting.- Overrides:
canSortin classContentFeatureSource- See Also:
-
canFilter
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
-
buildQueryCapabilities
Description copied from class:ContentFeatureSourceBuilds the query capabilities for this feature source. The default implementation returns a newly built QueryCapabilities, subclasses are advised to build their own.- Overrides:
buildQueryCapabilitiesin classContentFeatureSource
-