com.ontimize.util.gis.extension.google
Class CacheElementGoogleTiles

java.lang.Object
  extended by com.ontimize.util.gis.extension.google.CacheElementGoogleTiles
All Implemented Interfaces:
ICacheElement

public class CacheElementGoogleTiles
extends java.lang.Object
implements ICacheElement


Field Summary
protected static java.lang.String BASE_FOLDER
           
(package private)  java.awt.image.BufferedImage buffImage
           
protected  java.util.Map<java.lang.String,java.lang.Object> cachedData
           
protected  java.sql.Connection conn
           
static java.lang.String DATABASE_NAME
           
static java.lang.String DATABASE_TYPE
           
protected  java.io.File directory
           
static java.lang.String DIRECTORY_KEY
           
protected  java.lang.String directoryPath
           
protected static java.lang.String FILE_LOCATION
           
protected  java.lang.String FOLDER
           
protected static java.lang.String GEOMETRY
           
protected  boolean hsqlDB
           
protected  int insertsCounter
           
protected static java.lang.String[] keys
           
protected  boolean localDiskCacheEnabled
           
protected  int maxCacheSize
           
protected static java.lang.String RASTER
           
protected  com.vividsolutions.jts.io.WKTReader reader
           
protected  java.lang.Object sourceId
           
protected  java.lang.StringBuilder sqlBuilder
           
protected  java.sql.Statement st
           
protected static java.lang.String THE_STRING
           
protected  boolean useByteArrays
           
protected  com.vividsolutions.jts.io.WKTWriter writer
           
 
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
CacheElementGoogleTiles()
           
 
Method Summary
protected  boolean checkRecordExistence(java.lang.String recordKey)
           
 void clearCache()
           
 void deleteData(java.lang.Object deletedKeys)
          Delete the data identified by deletedKeys from the cache
protected  void deleteDatabase()
           
 void deleteDataFromFilters(java.lang.Object appliedFilters)
          Delete the data related to the given filters
protected  void deleteFirstRecords(int totalRecordsToDelete)
           
 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 insertCacheRecord(java.util.Hashtable recordValues)
           
 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
protected  void loadRecordIntoCache(java.lang.String recordKey)
           
 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

THE_STRING

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

GEOMETRY

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

FILE_LOCATION

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

BASE_FOLDER

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

DATABASE_TYPE

public static java.lang.String DATABASE_TYPE

RASTER

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

keys

protected static final java.lang.String[] keys

DIRECTORY_KEY

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

DATABASE_NAME

public static java.lang.String DATABASE_NAME

FOLDER

protected java.lang.String FOLDER

hsqlDB

protected boolean hsqlDB

useByteArrays

protected boolean useByteArrays

insertsCounter

protected int insertsCounter

localDiskCacheEnabled

protected boolean localDiskCacheEnabled

maxCacheSize

protected int maxCacheSize

conn

protected java.sql.Connection conn

st

protected java.sql.Statement st

buffImage

java.awt.image.BufferedImage buffImage

directory

protected java.io.File directory

sqlBuilder

protected final java.lang.StringBuilder sqlBuilder

writer

protected final com.vividsolutions.jts.io.WKTWriter writer

reader

protected final com.vividsolutions.jts.io.WKTReader reader

directoryPath

protected java.lang.String directoryPath

sourceId

protected java.lang.Object sourceId

cachedData

protected java.util.Map<java.lang.String,java.lang.Object> cachedData
Constructor Detail

CacheElementGoogleTiles

public CacheElementGoogleTiles()
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

insertCacheRecord

protected void insertCacheRecord(java.util.Hashtable recordValues)

checkRecordExistence

protected boolean checkRecordExistence(java.lang.String recordKey)

loadRecordIntoCache

protected void loadRecordIntoCache(java.lang.String recordKey)

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

deleteFirstRecords

protected void deleteFirstRecords(int totalRecordsToDelete)

clearCache

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

deleteDatabase

protected void deleteDatabase()