org.geotools.caching.grid.featurecache
Class StreamingGridFeatureCache

java.lang.Object
  extended by org.geotools.caching.featurecache.AbstractFeatureCache
      extended by org.geotools.caching.grid.featurecache.GridFeatureCache
          extended by org.geotools.caching.grid.featurecache.StreamingGridFeatureCache
All Implemented Interfaces:
java.util.EventListener, FeatureCache, FeatureListener, FeatureSource

public class StreamingGridFeatureCache
extends GridFeatureCache

Implementation of a GridFeatureCache that uses streaming feature collections. Feature are streamed out of the cache and the feature source only when requested. Features streams out of the feature source are cached as they are read.

This is a read only implementation; you cannot add features to this cache.

This implementation of a feature cache locks the cache at the node level not the entire cache. So as long as you are accessing different nodes you should be able to write to and read from the cache at the same time.

Only supports SimpleFeatureType & SimpleFeature

Since:
1.2.0
Author:
Emily

Field Summary
 
Fields inherited from class org.geotools.caching.grid.featurecache.GridFeatureCache
capacity, max_tiles, tracker
 
Fields inherited from class org.geotools.caching.featurecache.AbstractFeatureCache
ff, fs, lock, logger, source_feature_reads, source_hits
 
Constructor Summary
StreamingGridFeatureCache(FeatureSource fs, int indexcapacity, int capacity, Storage store)
           
StreamingGridFeatureCache(FeatureSource fs, ReferencedEnvelope env, int indexcapacity, int capacity, Storage store)
           
 
Method Summary
 FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> get(com.vividsolutions.jts.geom.Envelope e)
          Gets all feature within a given envelope.
 FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(org.opengis.filter.Filter filter)
          Get all features that match given filter.
 FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(Query query)
          Gets all features that match a query.
 FeatureCollection peek(com.vividsolutions.jts.geom.Envelope e)
          Returns all features in the cache that match the given envelope.
 void put(FeatureCollection fc)
          Unsupported.
 void put(FeatureCollection fc, com.vividsolutions.jts.geom.Envelope e)
          Unsupported.
 void register(java.util.Collection<NodeIdentifier> nodes)
          Registers a collection of nodes as valid.
 void remove(com.vividsolutions.jts.geom.Envelope e)
          Removes all nodes from the cache that match the given envelope.
 void unregister(java.util.Collection<NodeIdentifier> nodes)
          Un-registers a collection of nodes.
 
Methods inherited from class org.geotools.caching.grid.featurecache.GridFeatureCache
clear, dispose, getBounds, getBounds, getCount, getFeatureBounds, getIndex, getSchema, getStats, getSupportedHints, isOversized, match, matchNodeIds, register, toString, unregister
 
Methods inherited from class org.geotools.caching.featurecache.AbstractFeatureCache
_getFeatures, addFeatureListener, changed, getDataStore, getFeatures, getInfo, getName, getQueryCapabilities, readLock, readUnLock, register, register, removeFeatureListener, sourceAccessStats, unregister, unregister, writeLock, writeUnLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamingGridFeatureCache

public StreamingGridFeatureCache(FeatureSource fs,
                                 int indexcapacity,
                                 int capacity,
                                 Storage store)
                          throws FeatureCacheException
Throws:
FeatureCacheException

StreamingGridFeatureCache

public StreamingGridFeatureCache(FeatureSource fs,
                                 ReferencedEnvelope env,
                                 int indexcapacity,
                                 int capacity,
                                 Storage store)
Method Detail

get

public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> get(com.vividsolutions.jts.geom.Envelope e)
                                                                                                             throws java.io.IOException
Gets all feature within a given envelope.

Specified by:
get in interface FeatureCache
Overrides:
get in class AbstractFeatureCache
Returns:
Collection of feature found in the given envelope (from the cache or feature source)
Throws:
java.io.IOException

getFeatures

public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(Query query)
                                                                                                                     throws java.io.IOException
Gets all features that match a query.

Currently the query handle is not supported.

Specified by:
getFeatures in interface FeatureSource
Overrides:
getFeatures in class AbstractFeatureCache
Parameters:
query - a datasource query object. It encapsulates requested information, such as typeName, maxFeatures and filter.
Returns:
Collection The collection to put the features into.
Throws:
java.io.IOException - For all data source errors.
See Also:
Query

getFeatures

public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(org.opengis.filter.Filter filter)
                                                                                                                     throws java.io.IOException
Get all features that match given filter.

Specified by:
getFeatures in interface FeatureSource
Overrides:
getFeatures in class AbstractFeatureCache
Parameters:
filter - An OpenGIS filter; specifies which features to retrieve. null is not allowed, use Filter.INCLUDE instead.
Returns:
Collection The collection to put the features into.
Throws:
java.io.IOException - For all data source errors.

peek

public FeatureCollection peek(com.vividsolutions.jts.geom.Envelope e)
Returns all features in the cache that match the given envelope.

Specified by:
peek in interface FeatureCache
Overrides:
peek in class GridFeatureCache
Returns:
Collection of features found in the cache.

put

public void put(FeatureCollection fc,
                com.vividsolutions.jts.geom.Envelope e)
         throws CacheOversizedException
Unsupported.

Specified by:
put in interface FeatureCache
Overrides:
put in class GridFeatureCache
Parameters:
fc - the feature collection to add to the cache
e - the envelope that encompasses the feature collection added
Throws:
CacheOversizedException

put

public void put(FeatureCollection fc)
         throws CacheOversizedException
Unsupported.

Specified by:
put in interface FeatureCache
Overrides:
put in class GridFeatureCache
Parameters:
fc - the feature collection to add to the cache
Throws:
CacheOversizedException - if the feature collection has too many features for the cache.

remove

public void remove(com.vividsolutions.jts.geom.Envelope e)
Removes all nodes from the cache that match the given envelope.

Specified by:
remove in interface FeatureCache
Overrides:
remove in class GridFeatureCache

register

public void register(java.util.Collection<NodeIdentifier> nodes)
Registers a collection of nodes as valid. This function assumes that the necessary nodes are locked so that synchronization problems don't occur.

Overrides:
register in class GridFeatureCache
Parameters:
nodes -

unregister

public void unregister(java.util.Collection<NodeIdentifier> nodes)
Un-registers a collection of nodes. This function assumes that the necessary nodes are locked so that synchronization problems don't occur.

Overrides:
unregister in class GridFeatureCache
Parameters:
nodes -


Copyright © 1996-2010 Geotools. All Rights Reserved.