DODS 7.3 API

org.enhydra.dods.cache
Class QueryCacheImpl

java.lang.Object
  extended by org.enhydra.dods.cache.ConfigurationAdministration
      extended by org.enhydra.dods.cache.DataStructCache
          extended by org.enhydra.dods.cache.QueryCache
              extended by org.enhydra.dods.cache.QueryCacheImpl

public class QueryCacheImpl
extends QueryCache

This class contains data and mechanisms needed for caching data objects (or DataStruct objects) and queries and provides cache configuration and administration.

Version:
2.0 15.06.2003.
Author:
Tanja Jovanovic, Nenad Vico, Zorica Suvajdzin

Field Summary
protected  DODSCache cache
          LRU cache for storing data (or DataStruct) objects.
protected  CacheAdministration[] cacheAdministration
          Attribute cacheAdministration is array of three objects of the class CacheAdministration.
protected  boolean completeCachingOn
          This attribute is true if the cache is complete, otherwise false.
protected  DODSCache complexQCache
          LRU cache for storing complex queries.
protected  boolean fullCachingOn
          This attribute is true if the cache is full, otherwise false.
protected  java.lang.String initialQueryCache
          Initial query statement.
protected  boolean multi
          This attribute contains information if multi databases are used.
protected  DODSCache multiJoinQCache
          LRU cache for storing multi join queries.
protected  java.util.HashMap nonVisibleList
          List of objects that are unvisible in the cache at the moment.
protected  int oldComplexMaxCacheSize
          Old max complex cache size.
protected  int oldMultiJoinMaxCacheSize
          Old max multi join cache size.
protected  int oldSimpleMaxCacheSize
          Old max simple cache size.
protected  double reserveFactor
          This attribute is used in query caching.
protected  DODSCache simpleQCache
          LRU cache for storing simple queries.
protected  Statistics statistics
          Table and cache statictics.
protected  TableConfiguration tableConf
          TableConfiguration attribute handles configuration settings about table of this cache.
 
Constructor Summary
QueryCacheImpl()
          Constructor().
QueryCacheImpl(int maxCSize)
          Constructor(int).
 
Method Summary
 QueryCacheItem addComplexQuery(QueryCacheItem queryItem)
          Adds complex query to complex query cache.
 CoreDataStruct addDataStruct(CoreDataStruct newDS)
          Adds DataStruct object to the cache.
 QueryCacheItem addMultiJoinQuery(QueryCacheItem queryItem)
          Adds multi join query to multi join query cache.
 QueryCacheItem addSimpleQuery(QueryCacheItem queryItem)
          Adds simple query to simple query cache.
 void checkFull()
          Returns information if data object (or DataStruct object) cache if "full".
 CoreDataStruct deleteDataStruct(CoreDataStruct data)
          Deletes DataStruct object from the cache.
 void emptyEntries()
           
 void emptyEntries(java.util.Vector vec, boolean incrementVersion)
           
 int getAsynchLoadPriority()
          Returns priority of asynchronous cache initialization.
 CacheAdministration getCacheAdministration(int cacheType)
          Returns CacheAdministration for data object (or DataStruct object) cache, simple, or complex query cache.
 java.util.Map getCacheContent()
          Returns cache (data or DataStruct) content.
 double getCachePercentage()
          Read cache configuration from application's configuration file.
 java.lang.String getCacheType()
          Returns data object (or DataStruct object) cache type.
 QueryCacheItem getComplexQueryCacheItem(java.lang.String dbName, java.lang.String query)
          Returns QueryCacheItem object for specified database and complex query, if exists, otherwise null.
 QueryResult getComplexQueryResults(java.lang.String dbName, java.lang.String query)
          Returns query results from complex query cache.
 QueryResult getComplexQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb)
          Returns query results from complex query cache.
 QueryResult getComplexQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb, boolean unique)
          Returns query results from complex query cache.
 CoreDataStruct getDataStructByHandle(java.lang.String cacheHandle)
          Returns DataStruct object whose String representation of OID is parameter handle.
 int getInitialCacheFetchSize()
           
 int getInitialDSCacheSize()
           
 java.lang.String getInitialQueryCache()
          Returns initialQueryCache.
 int getLevelOfCaching()
          Returns caching level.
 int getMaxExecuteTimeCacheInit()
          Returns the max time for which the query is not printed in application's log file durung the cache initialization.
 QueryCacheItem getMultiJoinQueryCacheItem(java.lang.String dbName, java.lang.String query)
          Returns QueryCacheItem object for specified database and multi join query, if exists, otherwise null.
 QueryResult getMultiJoinQueryResults(java.lang.String dbName, java.lang.String query)
          Returns query results from multi join query cache.
 QueryResult getMultiJoinQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb)
          Returns query results from multi join query cache.
 QueryResult getMultiJoinQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb, boolean unique)
          Returns query results from multi join query cache.
 QueryResult getQueryResults(java.lang.String dbName, java.lang.String query)
          Returns query results from simple, complex or multi join query cache.
 int getQueryTimeLimitCacheInit()
          Returns max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet.
 int getQueryTimeoutCacheInit()
          Returns max number of seconds for which the query for cache initialization should be executed.
 double getReserveFactor()
          Returns reserveFactor.
 int getSimpleCacheRowCountLimit()
          Returns max number of rows in the table for which is simple cache still used.
 QueryCacheItem getSimpleQueryCacheItem(java.lang.String dbName, java.lang.String query)
          Returns QueryCacheItem object for specified database and simple query, if exists, otherwise null.
 QueryResult getSimpleQueryResults(java.lang.String dbName, java.lang.String query)
          Returns query results from simple query cache.
 QueryResult getSimpleQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb)
          Returns query results from simple query cache.
 QueryResult getSimpleQueryResults(java.lang.String dbName, java.lang.String query, int limit, int maxdb, boolean unique)
          Returns query results from simple query cache.
 Statistics getStatistics()
          Returns statistics of used table and caches.
 int getSynchLoadRowCountLimit()
          Returns the max number of rows in the table for which the synchronous cache load is performed if defined by configuration.
 TableConfiguration getTableConfiguration()
          Returns object TableConfiguration.
protected  void init()
          Creates array of three CacheAdministration objects.
 boolean isComplete()
          Returns information if data object (or DataStruct object) cache if "complete".
 boolean isCompleteCachingOn()
          Returns information if data object (or DataStruct object) cache was in last check (call of isComplete() method) "complete".
 boolean isDisabled()
          Returns information whether caching is disabled.
 boolean isFull()
          Returns information if data object (or DataStruct object) cache if "full".
 boolean isMulti()
          Returns information if multi databases are supported.
 void loadCache(java.lang.Class DOClass, java.lang.Class QueryClass, java.lang.String root)
           
 void makeInvisible(java.lang.String cacheHandle)
           
 void makeVisible(java.lang.String cacheHandle)
           
 DataStructCache newInstance()
          Creates QueryCacheImpl instance.
 QueryCacheItem newQueryCacheItemInstance(java.lang.String dbName)
          Creates new QueryCacheItem instance.
 void readConfiguration(Config tableConfig, Config cacheConfig, java.lang.String dbName)
          Reads table and cache configuration from application's configuration file.
 void refreshStatistics()
          Refreshes statistics.
 QueryCacheItem removeComplexQuery(QueryCacheItem queryItem)
          Removes complex query from complex query cache.
 CoreDataStruct removeDataStruct(CoreDataStruct data)
          Removes DataStruct object from the cache.
 CoreDataStruct removeDataStruct(java.lang.String handle)
          Removes DataStruct object from the cache.
 void removeEntries()
           
 void removeEntries(java.util.Vector vec)
           
 QueryCacheItem removeMultiJoinQuery(QueryCacheItem queryItem)
          Removes multi join query from multi join query cache.
 QueryCacheItem removeSimpleQuery(QueryCacheItem queryItem)
          Removes simple query from simple query cache.
 void saveCache(java.lang.Class DOClass, java.lang.String root)
           
protected  void setAsynchLoadPriority(int priority)
          Sets priority of asynchronous cache initialization.
protected  void setCachePercentage(double percent)
           
 void setInitialCacheFetchSize(int i)
           
 void setInitialDSCacheSize(int i)
           
protected  void setInitialQueryCache(java.lang.String initQ)
          Sets initialQueryCache attribute.
protected  void setMaxExecuteTimeCacheInit(int maxExeTime)
          Sets the max time for which the query is not printed in application's log file durung the cache initialization.
protected  void setQueryTimeLimitCacheInit(int timeLimit)
          Sets max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet.
protected  void setQueryTimeoutCacheInit(int timeout)
          Sets max number of seconds for which the query for cache initialization should be executed.
protected  void setReserveFactor(double res)
          Sets reserveFactor.
protected  void setSimpleCacheRowCountLimit(int rowCount)
          Sets the max number of rows in the table for which is simple cache still used.
protected  void setSynchLoadRowCountLimit(int rowCount)
          Sets the max number of rows in the table for which the synchronous cache load is performed if defined by configuration.
 boolean toReconfigure()
          Checks wheather cache reconfiguration needs to be done.
 java.lang.String toString()
          Shows content of this class.
 CoreDataStruct updateDataStruct(CoreDataStruct data)
          Updates cached DataStruct object, or inserts it in the cache if it didn't exist in the cache.
 
Methods inherited from class org.enhydra.dods.cache.QueryCache
isLockedMultiJoinQCache, isLockedSimpleComplexQCache
 
Methods inherited from class org.enhydra.dods.cache.DataStructCache
isLocked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cache

protected DODSCache cache
LRU cache for storing data (or DataStruct) objects. LRU cache keys are cache handles (String " . "), and LRU cache values are data (or DataStruct) objects.


simpleQCache

protected DODSCache simpleQCache
LRU cache for storing simple queries. LRU cache keys are Strings in form of " . ", and LRU cache values are objects of org.enhydra.dods.cache.QueryCacheItem class. QueryCacheItem class stores one query and its necessary data.


complexQCache

protected DODSCache complexQCache
LRU cache for storing complex queries. LRU cache keys are Strings in form of " . ", and LRU cache values are objects of org.enhydra.dods.cache.QueryCacheItem class. QueryCacheItem class stores one query and its necessary data.


multiJoinQCache

protected DODSCache multiJoinQCache
LRU cache for storing multi join queries. LRU cache keys are Strings in form of " . ", and LRU cache values are objects of org.enhydra.dods.cache.QueryCacheItem class. QueryCacheItem class stores one query and its necessary data.


cacheAdministration

protected CacheAdministration[] cacheAdministration
Attribute cacheAdministration is array of three objects of the class CacheAdministration. CacheAdministration[0] handles configuration settings about data (or DataStruct object) cache. CacheAdministration[1] handles configuration settings about simple query cache. CacheAdministration[2] handles configuration settings about complex query cache. CacheAdministration[3] handles configuration settings about multi join query cache.


tableConf

protected TableConfiguration tableConf
TableConfiguration attribute handles configuration settings about table of this cache.


initialQueryCache

protected java.lang.String initialQueryCache
Initial query statement. This attribute contains "where" clause which is used during data (or DataStruct) object cache initialization. If this attribute is set to "*", all rows from the table (in database) will be put in the cache.


multi

protected boolean multi
This attribute contains information if multi databases are used.


fullCachingOn

protected boolean fullCachingOn
This attribute is true if the cache is full, otherwise false.


completeCachingOn

protected boolean completeCachingOn
This attribute is true if the cache is complete, otherwise false.


statistics

protected Statistics statistics
Table and cache statictics.


nonVisibleList

protected java.util.HashMap nonVisibleList
List of objects that are unvisible in the cache at the moment. Keys of this map sre cache handles (String " . "), and values are counters of how many transactions have made object with that cache handle invisible.


oldSimpleMaxCacheSize

protected int oldSimpleMaxCacheSize
Old max simple cache size. When data (or DataStruct) cache's maxCacheSize is set to zero, so is simple query's. This attribute is needed for retrieving max simple cache size after data (or DataStruct) cache's maxCacheSize has been set again to any value different from zero.


oldComplexMaxCacheSize

protected int oldComplexMaxCacheSize
Old max complex cache size. When data (or DataStruct) cache's maxCacheSize is set to zero, so is complex query's. This attribute is needed for retrieving max complex cache size after data (or DataStruct) cache's maxCacheSize has been set again to any value different from zero.


oldMultiJoinMaxCacheSize

protected int oldMultiJoinMaxCacheSize
Old max multi join cache size. When data (or DataStruct) cache's maxCacheSize is set to zero, so is multi join query's. This attribute is needed for retrieving max multi join cache size after data (or DataStruct) cache's maxCacheSize has been set again to any value different from zero.


reserveFactor

protected double reserveFactor
This attribute is used in query caching. It is percent of how many more object are taken for evaluation. If num is number of needed results, then it is used num+ DEFAULT_RESERVE_FACTOR *num of objects for estimating what is quicker: go to database for all object that are not in the cache, or run again query on database. This value is given in percents, as number between 0 and 1 (0.25 means 25%). For example, if DEFAULT_RESERVE_FACTOR is 0.5, and wanted number of results is 50, the estimation will be done on 75 (50 + 0.5 * 50) objects. The value of CacheConstants.DEFAULT_RESERVE_FACTOR is 0.5.

Constructor Detail

QueryCacheImpl

public QueryCacheImpl(int maxCSize)
               throws CacheObjectException
Constructor(int). Creates data (or DataStruct) object cache with maximal size maxCSize and simple and complex query caches with their default maximal sizes. The value of CacheConstants.DEFAULT_MAX_SIMPLE_QUERY_CACHE_SIZE is 0. The value of CacheConstants.DEFAULT_MAX_COMPLEX_QUERY_CACHE_SIZE is 0.

Parameters:
maxCSize - maximal data (or DataStruct) object cache size.
Throws:
CacheObjectException

QueryCacheImpl

public QueryCacheImpl()
               throws CacheObjectException
Constructor(). Creates data (or DataStruct) object cache with its default maximal size and simple and complex query caches with their default maximal sizes. The value of CacheConstants.DEFAULT_MAX_CACHE_SIZE is 0. The value of CacheConstants.DEFAULT_MAX_SIMPLE_QUERY_CACHE_SIZE is 0. The value of CacheConstants.DEFAULT_MAX_COMPLEX_QUERY_CACHE_SIZE is 0.

Throws:
CacheObjectException
Method Detail

getCacheAdministration

public CacheAdministration getCacheAdministration(int cacheType)
Returns CacheAdministration for data object (or DataStruct object) cache, simple, or complex query cache. Object CacheAdministration handles configuration settings about these caches. Parameter cacheType can have one of these values: 0 - for CacheAdministration of data object (or DataStruct object) cache 1 - for CacheAdministration of simple query cache 2 - for CacheAdministration of complex query cache 3 - for CacheAdministration of multi join query cache

Specified by:
getCacheAdministration in class QueryCache
Parameters:
cacheType - 0 - for data object (or DataStruct object), 1 for simple query, 2 for complex query cache and 3 for complex query cache.

getInitialQueryCache

public java.lang.String getInitialQueryCache()
Returns initialQueryCache. This attribute contains "where" clause which is used during data object (or DataStruct object) cache initialization.

Specified by:
getInitialQueryCache in class ConfigurationAdministration
Returns:
initialQueryCache.

setInitialQueryCache

protected void setInitialQueryCache(java.lang.String initQ)
Sets initialQueryCache attribute. This attribute contains "where" clause which is used during data object (or DataStruct object) cache initialization.

Specified by:
setInitialQueryCache in class ConfigurationAdministration
Parameters:
initQ - New value of initialQueryCache attribute.

makeInvisible

public void makeInvisible(java.lang.String cacheHandle)
Specified by:
makeInvisible in class QueryCache

makeVisible

public void makeVisible(java.lang.String cacheHandle)
Specified by:
makeVisible in class QueryCache

getStatistics

public Statistics getStatistics()
Returns statistics of used table and caches.

Specified by:
getStatistics in class ConfigurationAdministration
Returns:
statistics of used table and caches.

refreshStatistics

public void refreshStatistics()
Refreshes statistics.

Specified by:
refreshStatistics in class ConfigurationAdministration

checkFull

public void checkFull()
Returns information if data object (or DataStruct object) cache if "full". "Full" cache contains all data objects (or DataStruct objects) from the table. The cache is "full", if data (or DataStruct) object cache is unbounded, and if initialQueryCache attribute is set to "*".

Specified by:
checkFull in class ConfigurationAdministration

isFull

public boolean isFull()
Returns information if data object (or DataStruct object) cache if "full". "Full" cache contains all data objects (or DataStruct objects) from the table. The cache is "full", if data (or DataStruct) object cache is unbounded, and if initialQueryCache attribute is set to "*".

Specified by:
isFull in class ConfigurationAdministration
Returns:
true if data object (or DataStruct object) cache if "full", otherwise false.

isComplete

public boolean isComplete()
Returns information if data object (or DataStruct object) cache if "complete". "Complete" cache can contain all data objects (or DataStruct objects) from the table. The cache is "complete", if data (or DataStruct) object cache is unbounded. If cache was complete, but not any more, the cache is created again, but as LRU cache.

Specified by:
isComplete in class ConfigurationAdministration
Returns:
true if data object (or DataStruct object) cache if "complete", otherwise false.

isCompleteCachingOn

public boolean isCompleteCachingOn()
Returns information if data object (or DataStruct object) cache was in last check (call of isComplete() method) "complete". "Complete" cache can contain all data objects (or DataStruct objects) from the table. The cache is "complete", if data (or DataStruct) object cache is unbounded.

Returns:
true if data object (or DataStruct object) cache was in last check "complete", otherwise false.

getCacheType

public java.lang.String getCacheType()
Returns data object (or DataStruct object) cache type. Possible values are: "none" - no caching available "lru" - cache with LRU (least-recently used) algorithm "full" - special case of LRU cache - the whole table is cached "complete" - special case of cache - the cache is a map in which the whole table can be cached (unbounded cache with initial condition other than "*"

Specified by:
getCacheType in class ConfigurationAdministration
Returns:
data object (or DataStruct object) cache type.

getLevelOfCaching

public int getLevelOfCaching()
Returns caching level. Possible values: org.enhydra.dods.cache.CacheConstants.DATA_CACHING (value 1) for data object (or DataStruct object) caching without query caching, and org.enhydra.dods.cache.CacheConstants.QUERY_CACHING (value 2) for data object (or DataStruct object) caching with query caching.

Specified by:
getLevelOfCaching in class ConfigurationAdministration
Returns:
Value 2 (org.enhydra.dods.cache.CacheConstants.QUERY_CACHING).

getTableConfiguration

public TableConfiguration getTableConfiguration()
Returns object TableConfiguration. TableConfiguration contains parameters (and their set and get methods) for table configuration.

Specified by:
getTableConfiguration in class ConfigurationAdministration
Returns:
TableConfiguration.

getReserveFactor

public double getReserveFactor()
Returns reserveFactor. This attribute is used in query caching. It defines how many more (exept needed) objects are taken for evaluation. If num is number of needed results, then it is used num+ DEFAULT_RESERVE_FACTOR *num of objects for estimating what is quicker: go to database for all object that are not in the cache, or run again query on database. This value is given in percents, as number between 0 and 1 (0.25 means 25%). For example, if DEFAULT_RESERVE_FACTOR is 0.5, and wanted number of results is 50, the estimation will be done on 75 (50 + 0.5 * 50) objects.

Specified by:
getReserveFactor in class ConfigurationAdministration
Returns:
reserveFactor.

setReserveFactor

protected void setReserveFactor(double res)
Sets reserveFactor. This attribute is used in query caching. It defines how many more (exept needed) objects are taken for evaluation. If num is number of needed results, then it is used num+ DEFAULT_RESERVE_FACTOR *num of objects for estimating what is quicker: go to database for all object that are not in the cache, or run again query on database. This value is given in percents, as number between 0 and 1 (0.25 means 25%). For example, if DEFAULT_RESERVE_FACTOR is 0.5, and wanted number of results is 50, the estimation will be done on 75 (50 + 0.5 * 50) objects.

Specified by:
setReserveFactor in class ConfigurationAdministration
Parameters:
res - New reserveFactor.

setCachePercentage

protected void setCachePercentage(double percent)
Specified by:
setCachePercentage in class ConfigurationAdministration

getCachePercentage

public double getCachePercentage()
Description copied from class: ConfigurationAdministration
Read cache configuration from application's configuration file.

Specified by:
getCachePercentage in class ConfigurationAdministration

isDisabled

public boolean isDisabled()
Returns information whether caching is disabled.

Specified by:
isDisabled in class ConfigurationAdministration
Returns:
true is caching is disabled, otherwise false.

readConfiguration

public void readConfiguration(Config tableConfig,
                              Config cacheConfig,
                              java.lang.String dbName)
                       throws CacheObjectException
Reads table and cache configuration from application's configuration file.

Specified by:
readConfiguration in class ConfigurationAdministration
Parameters:
tableConfig - configuration for table of this cache.
cacheConfig - configuration for this cache.
Throws:
CacheObjectException

newInstance

public DataStructCache newInstance()
                            throws CacheObjectException
Creates QueryCacheImpl instance.

Specified by:
newInstance in class DataStructCache
Returns:
created QueryCacheImpl instance as DataStructCache.
Throws:
CacheObjectException

init

protected void init()
Creates array of three CacheAdministration objects. CacheAdministration[0] handles configuration settings about data (or DataStruct) object cache. CacheAdministration[1] handles configuration settings about simple query cache. CacheAdministration[2] handles configuration settings about complex query cache.


getCacheContent

public java.util.Map getCacheContent()
Returns cache (data or DataStruct) content.

Specified by:
getCacheContent in class DataStructCache
Returns:
Cache content as Map of data (or DataStruct) objects.

isMulti

public boolean isMulti()
Returns information if multi databases are supported.

Specified by:
isMulti in class DataStructCache
Returns:
true if multi databases are used, otherwise false.

toReconfigure

public boolean toReconfigure()
Checks wheather cache reconfiguration needs to be done.

Specified by:
toReconfigure in class DataStructCache
Returns:
true if cache reconfiguration needs to be done, otherwise false.

addDataStruct

public CoreDataStruct addDataStruct(CoreDataStruct newDS)
Adds DataStruct object to the cache.

Specified by:
addDataStruct in class DataStructCache
Parameters:
newDS - DataStruct object that will be added to the cache.
Returns:
Added DataStruct object.

removeDataStruct

public CoreDataStruct removeDataStruct(CoreDataStruct data)
Removes DataStruct object from the cache.

Specified by:
removeDataStruct in class DataStructCache
Parameters:
data - DataStruct object that will be removed from the cache.
Returns:
Removed DataStruct object, or null if there was no object removed from the cache.

removeDataStruct

public CoreDataStruct removeDataStruct(java.lang.String handle)
Removes DataStruct object from the cache.

Specified by:
removeDataStruct in class DataStructCache
Parameters:
handle - Cache handle of DataStruct object that will be removed from the cache. The form of cache handle is: " . ".
Returns:
Removed DataStruct object, or null if there was no object removed from the cache.

updateDataStruct

public CoreDataStruct updateDataStruct(CoreDataStruct data)
Updates cached DataStruct object, or inserts it in the cache if it didn't exist in the cache.

Specified by:
updateDataStruct in class DataStructCache
Parameters:
data - DataStruct object that will be updated (or inserted if didn't exist in the cache).
Returns:
Updated or inserted DataStruct object.

deleteDataStruct

public CoreDataStruct deleteDataStruct(CoreDataStruct data)
Deletes DataStruct object from the cache.

Specified by:
deleteDataStruct in class DataStructCache
Parameters:
data - DataStruct object that will be deleted from the cache.
Returns:
Deleted DataStruct object, or null if there was no object deleted from the cache.

getDataStructByHandle

public CoreDataStruct getDataStructByHandle(java.lang.String cacheHandle)
Returns DataStruct object whose String representation of OID is parameter handle.

Specified by:
getDataStructByHandle in class DataStructCache
Parameters:
cacheHandle - String representation of OID of DataStruct object that is being searched in the cache.
Returns:
DataStruct object whose String representation of OID is handle.

newQueryCacheItemInstance

public QueryCacheItem newQueryCacheItemInstance(java.lang.String dbName)
Creates new QueryCacheItem instance.

Specified by:
newQueryCacheItemInstance in class QueryCache
Parameters:
dbName - Database name.
Returns:
Created QueryCacheItem instance.

getSimpleQueryCacheItem

public QueryCacheItem getSimpleQueryCacheItem(java.lang.String dbName,
                                              java.lang.String query)
Returns QueryCacheItem object for specified database and simple query, if exists, otherwise null.

Specified by:
getSimpleQueryCacheItem in class QueryCache
Parameters:
dbName - Database name.
query - Query in form of String.
Returns:
QueryCacheItem object.

getComplexQueryCacheItem

public QueryCacheItem getComplexQueryCacheItem(java.lang.String dbName,
                                               java.lang.String query)
Returns QueryCacheItem object for specified database and complex query, if exists, otherwise null.

Specified by:
getComplexQueryCacheItem in class QueryCache
Parameters:
dbName - Database name.
query - Query in form of String.
Returns:
QueryCacheItem object.

getMultiJoinQueryCacheItem

public QueryCacheItem getMultiJoinQueryCacheItem(java.lang.String dbName,
                                                 java.lang.String query)
Returns QueryCacheItem object for specified database and multi join query, if exists, otherwise null.

Specified by:
getMultiJoinQueryCacheItem in class QueryCache
Parameters:
dbName - Database name.
query - Query in form of String.
Returns:
QueryCacheItem object.

addSimpleQuery

public QueryCacheItem addSimpleQuery(QueryCacheItem queryItem)
Adds simple query to simple query cache.

Specified by:
addSimpleQuery in class QueryCache
Parameters:
queryItem - Query that will be added to simple query cache.
Returns:
Query added to simple query cache.

removeSimpleQuery

public QueryCacheItem removeSimpleQuery(QueryCacheItem queryItem)
Removes simple query from simple query cache.

Specified by:
removeSimpleQuery in class QueryCache
Parameters:
queryItem - Query that will be removed from simple query cache.
Returns:
Query removed from simple query cache.

addComplexQuery

public QueryCacheItem addComplexQuery(QueryCacheItem queryItem)
Adds complex query to complex query cache.

Specified by:
addComplexQuery in class QueryCache
Parameters:
queryItem - Query that will be added to complex query cache.
Returns:
Query added to complex query cache.

removeComplexQuery

public QueryCacheItem removeComplexQuery(QueryCacheItem queryItem)
Removes complex query from complex query cache.

Specified by:
removeComplexQuery in class QueryCache
Parameters:
queryItem - Query that will be removed from complex query cache.
Returns:
Query removed from complex query cache.

addMultiJoinQuery

public QueryCacheItem addMultiJoinQuery(QueryCacheItem queryItem)
Adds multi join query to multi join query cache.

Specified by:
addMultiJoinQuery in class QueryCache
Parameters:
queryItem - Query that will be added to multi join query cache.
Returns:
Query added to multi join query cache.

removeMultiJoinQuery

public QueryCacheItem removeMultiJoinQuery(QueryCacheItem queryItem)
Removes multi join query from multi join query cache.

Specified by:
removeMultiJoinQuery in class QueryCache
Parameters:
queryItem - Query that will be removed from multi join query cache.
Returns:
Query removed from multi join query cache.

getSimpleQueryResults

public QueryResult getSimpleQueryResults(java.lang.String dbName,
                                         java.lang.String query)
Returns query results from simple query cache.

Specified by:
getSimpleQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in simple query cache.
Returns:
Query results retrieved from simple cache, or null, if there are no results retrieved from simple query cache.

getSimpleQueryResults

public QueryResult getSimpleQueryResults(java.lang.String dbName,
                                         java.lang.String query,
                                         int limit,
                                         int maxdb)
Returns query results from simple query cache.

Specified by:
getSimpleQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in simple query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
Returns:
Query results retrieved from simple cache, or null, if there are no results retrieved from simple query cache.

getSimpleQueryResults

public QueryResult getSimpleQueryResults(java.lang.String dbName,
                                         java.lang.String query,
                                         int limit,
                                         int maxdb,
                                         boolean unique)
Returns query results from simple query cache.

Specified by:
getSimpleQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in simple query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
unique - If true, only unique results are returned.
Returns:
Query results retrieved from simple cache, or null, if there are no results retrieved from simple query cache.

getComplexQueryResults

public QueryResult getComplexQueryResults(java.lang.String dbName,
                                          java.lang.String query)
Returns query results from complex query cache.

Specified by:
getComplexQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in complex query cache.
Returns:
Query results retrieved from complex cache, or null, if there are no results retrieved from complex query cache.

getComplexQueryResults

public QueryResult getComplexQueryResults(java.lang.String dbName,
                                          java.lang.String query,
                                          int limit,
                                          int maxdb)
Returns query results from complex query cache.

Specified by:
getComplexQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in complex query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
Returns:
Query results retrieved from complex cache, or null, if there are no results retrieved from complex query cache.

getComplexQueryResults

public QueryResult getComplexQueryResults(java.lang.String dbName,
                                          java.lang.String query,
                                          int limit,
                                          int maxdb,
                                          boolean unique)
Returns query results from complex query cache.

Specified by:
getComplexQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in complex query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
unique - If true, only unique results are returned.
Returns:
Query results retrieved from complex cache, or null, if there are no results retrieved from complex query cache.

getMultiJoinQueryResults

public QueryResult getMultiJoinQueryResults(java.lang.String dbName,
                                            java.lang.String query)
Returns query results from multi join query cache.

Specified by:
getMultiJoinQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in multi join query cache.
Returns:
Query results retrieved from multi join cache, or null, if there are no results retrieved from multi join query cache.

getMultiJoinQueryResults

public QueryResult getMultiJoinQueryResults(java.lang.String dbName,
                                            java.lang.String query,
                                            int limit,
                                            int maxdb)
Returns query results from multi join query cache.

Specified by:
getMultiJoinQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in multi join query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
Returns:
Query results retrieved from multi join cache, or null, if there are no results retrieved from multi join query cache.

getMultiJoinQueryResults

public QueryResult getMultiJoinQueryResults(java.lang.String dbName,
                                            java.lang.String query,
                                            int limit,
                                            int maxdb,
                                            boolean unique)
Returns query results from multi join query cache.

Specified by:
getMultiJoinQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in multi join query cache.
limit - Specified number of results (database limit and read skip).
maxdb - Number of rows retrieved from database (or cache).
unique - If true, only unique results are returned.
Returns:
Query results retrieved from multi join cache, or null, if there are no results retrieved from multi join query cache.

getQueryResults

public QueryResult getQueryResults(java.lang.String dbName,
                                   java.lang.String query)
Returns query results from simple, complex or multi join query cache.

Specified by:
getQueryResults in class QueryCache
Parameters:
dbName - Database name.
query - Query for which are results searched in simple, complex or multi join query cache.
Returns:
Query results retrieved from simple, complex or multi join cache, or null, if there are no results retrieved from simple, complex or multi join query cache.

toString

public java.lang.String toString()
Shows content of this class. Can be used for debugging.

Overrides:
toString in class java.lang.Object

removeEntries

public void removeEntries(java.util.Vector vec)
Specified by:
removeEntries in class QueryCache

removeEntries

public void removeEntries()
Specified by:
removeEntries in class QueryCache

emptyEntries

public void emptyEntries(java.util.Vector vec,
                         boolean incrementVersion)
Specified by:
emptyEntries in class QueryCache

emptyEntries

public void emptyEntries()
Specified by:
emptyEntries in class QueryCache

getInitialCacheFetchSize

public int getInitialCacheFetchSize()
Specified by:
getInitialCacheFetchSize in class ConfigurationAdministration
Returns:
initial cache fetch size

getInitialDSCacheSize

public int getInitialDSCacheSize()
Specified by:
getInitialDSCacheSize in class ConfigurationAdministration
Returns:
initial DataStruct cache size

setInitialCacheFetchSize

public void setInitialCacheFetchSize(int i)
Specified by:
setInitialCacheFetchSize in class ConfigurationAdministration
Parameters:
i -

setInitialDSCacheSize

public void setInitialDSCacheSize(int i)
Specified by:
setInitialDSCacheSize in class ConfigurationAdministration
Parameters:
i -

getAsynchLoadPriority

public int getAsynchLoadPriority()
Returns priority of asynchronous cache initialization. The priority can have value 0 or positive value. The lower the value, the higher priority. The default value is -1 (cache initialization is done synchronous).

Specified by:
getAsynchLoadPriority in class ConfigurationAdministration
Returns:
priority of asynchronous cache initialization.

setAsynchLoadPriority

protected void setAsynchLoadPriority(int priority)
Sets priority of asynchronous cache initialization. The priority can have value 0 or positive value. The lower the value, the higher priority. The value -1 means that cache initialization is done synchronous.

Specified by:
setAsynchLoadPriority in class ConfigurationAdministration
Parameters:
priority - priority of asynchronous cache initialization.

getSimpleCacheRowCountLimit

public int getSimpleCacheRowCountLimit()
Returns max number of rows in the table for which is simple cache still used. If the table has more rows, complex cache is used for simple queries. The default value is 0 (simple cache is used for all simple queries).

Specified by:
getSimpleCacheRowCountLimit in class ConfigurationAdministration
Returns:
the max number of rows in the table until which the simple cache is used.

setSimpleCacheRowCountLimit

protected void setSimpleCacheRowCountLimit(int rowCount)
Sets the max number of rows in the table for which is simple cache still used. If the table has more rows, complex cache is used for simple queries.

Specified by:
setSimpleCacheRowCountLimit in class ConfigurationAdministration
Parameters:
rowCount - max number of rows in the table for which is simple cache still used.

getSynchLoadRowCountLimit

public int getSynchLoadRowCountLimit()
Returns the max number of rows in the table for which the synchronous cache load is performed if defined by configuration. The default value is 0 (asynch cache load is not performed if configuration parameters for asynch cache load are not defined).

Specified by:
getSynchLoadRowCountLimit in class ConfigurationAdministration
Returns:
max number of rows in the table above which the asynch cache load is performed.

setSynchLoadRowCountLimit

protected void setSynchLoadRowCountLimit(int rowCount)
Sets the max number of rows in the table for which the synchronous cache load is performed if defined by configuration.

Specified by:
setSynchLoadRowCountLimit in class ConfigurationAdministration
Parameters:
rowCount - the max number of rows in the table for which the synchronous cache load is performed if defined by configuration.

getMaxExecuteTimeCacheInit

public int getMaxExecuteTimeCacheInit()
Returns the max time for which the query is not printed in application's log file durung the cache initialization. If the time is greater, query (SQL statement, execution time and maxExecutionTime) is printed. The default value is 0 (nothing is printed).

Specified by:
getMaxExecuteTimeCacheInit in class ConfigurationAdministration
Returns:
max time for which the query is not printed in application's log file durung the cache initialization.

setMaxExecuteTimeCacheInit

protected void setMaxExecuteTimeCacheInit(int maxExeTime)
Sets the max time for which the query is not printed in application's log file durung the cache initialization. If the time is greater, query (SQL statement, execution time and maxExecutionTime) is printed.

Specified by:
setMaxExecuteTimeCacheInit in class ConfigurationAdministration
Parameters:
maxExeTime - new value for max execution time for the cache initialization.

getQueryTimeLimitCacheInit

public int getQueryTimeLimitCacheInit()
Returns max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet. If the limit is exceeded, an Exception is thrown. Value 0 means that there is no limit.

Specified by:
getQueryTimeLimitCacheInit in class ConfigurationAdministration
Returns:
max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet.

setQueryTimeLimitCacheInit

protected void setQueryTimeLimitCacheInit(int timeLimit)
Sets max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet. If the limit is exceeded, an Exception is thrown.

Specified by:
setQueryTimeLimitCacheInit in class ConfigurationAdministration
Parameters:
timeLimit - new value for time limit for cache initialization.

getQueryTimeoutCacheInit

public int getQueryTimeoutCacheInit()
Returns max number of seconds for which the query for cache initialization should be executed. If the limit is exceeded, an exception is thrown. Value 0 means that there is no limit.

Specified by:
getQueryTimeoutCacheInit in class ConfigurationAdministration
Returns:
the number of seconds for which the query for cache initialization should be executed.

setQueryTimeoutCacheInit

protected void setQueryTimeoutCacheInit(int timeout)
Sets max number of seconds for which the query for cache initialization should be executed. If the limit is exceeded, an exception is thrown.

Specified by:
setQueryTimeoutCacheInit in class ConfigurationAdministration
Parameters:
timeout - new value for query timeout for cache initialization.

saveCache

public void saveCache(java.lang.Class DOClass,
                      java.lang.String root)

loadCache

public void loadCache(java.lang.Class DOClass,
                      java.lang.Class QueryClass,
                      java.lang.String root)

DODS 7.3 API