com.ontimize.util.gis.client.defaultimplementations.cache
Class CacheNewElementVectorialData

java.lang.Object
  extended by com.ontimize.util.gis.client.defaultimplementations.cache.CacheNewElementVectorialData
All Implemented Interfaces:
ICacheElement

public class CacheNewElementVectorialData
extends java.lang.Object
implements ICacheElement

Cache element specific for vectorial data use


Field Summary
(package private)  com.vividsolutions.jts.geom.Geometry cachedArea
           
(package private)  org.geotools.index.Data data
           
(package private)  org.geotools.index.DataDefinition dataDef
           
(package private)  java.util.List<org.geotools.index.rtree.RTree> dataIndex
           
(package private)  java.util.List<java.util.HashMap<java.lang.Number,java.lang.Object>> dataMap
           
(package private)  org.opengis.filter.FilterFactory ff
           
(package private) static java.lang.String GEO_OBJECT_ID
           
(package private)  java.util.Vector<java.lang.Number> idsVector
           
(package private)  java.lang.String[] keys
           
(package private)  int lastInsertedIndex
           
(package private)  org.geotools.index.rtree.memory.MemoryPageStore pageStore
           
(package private)  java.util.List<java.lang.Double> scales
           
(package private)  java.lang.Object sourceId
           
 
Fields inherited from interface com.ontimize.util.gis.client.defaultimplementations.cache.ICacheElement
BYTE_ARRAYS, CACHE_ON_DISK, DEBUG_MESSAGES, FOLDER_NAME, IMAGE_FORMAT, MAX_CACHE_SIZE, MAX_EXPIRATION_PERIOD
 
Constructor Summary
CacheNewElementVectorialData()
           
 
Method Summary
 void clearCache()
           
 void deleteData(java.lang.Object deletedKeys)
          Delete the data identified by deletedKeys from the cache
 void deleteDataFromFilters(java.lang.Object appliedFilters)
          Delete the data related to the given filters
 com.vividsolutions.jts.geom.Geometry getIntersectedArea(com.vividsolutions.jts.geom.Envelope interestBoundingBox)
          Gets the area resulting from the intersection of the total cache data area and the interest area.
protected  int getScaleIndex(java.lang.Object appliedFilters)
           
protected  void insertCacheElement(java.util.Hashtable recordValues, com.vividsolutions.jts.geom.Envelope recordBBox, int scaleIndex)
           
 java.lang.Object insertData(java.lang.Object insertedValues, java.lang.Object appliedFilters)
          Insert new data to the actual cache element
 boolean isAreaInCache(java.lang.Object appliedFilters)
          Check if the interest area has all its data stored in cache
 java.lang.Object queryData(java.lang.Object appliedFilters)
          Request data that fits with the applied filters
 void setConfigurationParameters(java.lang.Object parameters)
          Set the initial configuration parameters.
 void setDataKeys(java.lang.String[] keys)
          Set the name of the actual data key columns
 void setId(java.lang.Object cacheId)
           
 void updateData(java.lang.Object updatedKeys, java.lang.Object newValues)
          Update the data identified by updatedKeys with the values newValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GEO_OBJECT_ID

static final java.lang.String GEO_OBJECT_ID
See Also:
Constant Field Values

ff

org.opengis.filter.FilterFactory ff

scales

java.util.List<java.lang.Double> scales

dataIndex

java.util.List<org.geotools.index.rtree.RTree> dataIndex

pageStore

org.geotools.index.rtree.memory.MemoryPageStore pageStore

dataDef

org.geotools.index.DataDefinition dataDef

sourceId

java.lang.Object sourceId

keys

java.lang.String[] keys

data

org.geotools.index.Data data

idsVector

java.util.Vector<java.lang.Number> idsVector

dataMap

java.util.List<java.util.HashMap<java.lang.Number,java.lang.Object>> dataMap

lastInsertedIndex

int lastInsertedIndex

cachedArea

com.vividsolutions.jts.geom.Geometry cachedArea
Constructor Detail

CacheNewElementVectorialData

public CacheNewElementVectorialData()
Method Detail

deleteData

public void deleteData(java.lang.Object deletedKeys)
                throws java.lang.Exception
Description copied from interface: ICacheElement
Delete the data identified by deletedKeys from the cache

Specified by:
deleteData in interface ICacheElement
Parameters:
deletedKeys - Indentifiers of the data to delete
Throws:
java.lang.Exception

insertData

public java.lang.Object insertData(java.lang.Object insertedValues,
                                   java.lang.Object appliedFilters)
                            throws java.lang.Exception
Description copied from interface: ICacheElement
Insert new data to the actual cache element

Specified by:
insertData in interface ICacheElement
Parameters:
insertedValues - Values to save in cache
appliedFilters - Filters applied in the request of the data to insert
Returns:
Inserted data with the local cache identifiers added
Throws:
java.lang.Exception

queryData

public java.lang.Object queryData(java.lang.Object appliedFilters)
                           throws java.lang.Exception
Description copied from interface: ICacheElement
Request data that fits with the applied filters

Specified by:
queryData in interface ICacheElement
Parameters:
appliedFilters - Filters applied on request
Returns:
Requested data
Throws:
java.lang.Exception

getScaleIndex

protected int getScaleIndex(java.lang.Object appliedFilters)
                     throws java.lang.Exception
Throws:
java.lang.Exception

updateData

public void updateData(java.lang.Object updatedKeys,
                       java.lang.Object newValues)
                throws java.lang.Exception
Description copied from interface: ICacheElement
Update the data identified by updatedKeys with the values newValues

Specified by:
updateData in interface ICacheElement
Parameters:
updatedKeys - Indentifiers of the data to update
newValues - Updated values for the given identifiers
Throws:
java.lang.Exception

getIntersectedArea

public com.vividsolutions.jts.geom.Geometry getIntersectedArea(com.vividsolutions.jts.geom.Envelope interestBoundingBox)
Description copied from interface: ICacheElement
Gets the area resulting from the intersection of the total cache data area and the interest area.

If the interest area is totally on cache the resulting area will be an empty bounding box.

Specified by:
getIntersectedArea in interface ICacheElement
Parameters:
interestBoundingBox - Interest area bounding box
Returns:
Geometry obtained from the intersection

isAreaInCache

public boolean isAreaInCache(java.lang.Object appliedFilters)
Description copied from interface: ICacheElement
Check if the interest area has all its data stored in cache

Specified by:
isAreaInCache in interface ICacheElement
Parameters:
appliedFilters - Request filters
Returns:
If area is totally contained in cache -> true.

setId

public void setId(java.lang.Object cacheId)
Specified by:
setId in interface ICacheElement

setDataKeys

public void setDataKeys(java.lang.String[] keys)
Description copied from interface: ICacheElement
Set the name of the actual data key columns

Specified by:
setDataKeys in interface ICacheElement
Parameters:
keys - String array of the key columns identifiers

deleteDataFromFilters

public void deleteDataFromFilters(java.lang.Object appliedFilters)
                           throws java.lang.Exception
Description copied from interface: ICacheElement
Delete the data related to the given filters

Specified by:
deleteDataFromFilters in interface ICacheElement
Parameters:
appliedFilters - Filters applied on deletion
Throws:
java.lang.Exception

setConfigurationParameters

public void setConfigurationParameters(java.lang.Object parameters)
Description copied from interface: ICacheElement
Set the initial configuration parameters. Usually these will be a Hashtable with the
related data provider definition parameters

Specified by:
setConfigurationParameters in interface ICacheElement
Parameters:
parameters - Cache class configuration parameters

clearCache

public void clearCache()
Specified by:
clearCache in interface ICacheElement

insertCacheElement

protected void insertCacheElement(java.util.Hashtable recordValues,
                                  com.vividsolutions.jts.geom.Envelope recordBBox,
                                  int scaleIndex)