DODS 7.6 API

org.enhydra.dods.cache
Class ConfigurationAdministration

java.lang.Object
  extended by org.enhydra.dods.cache.ConfigurationAdministration
Direct Known Subclasses:
DataStructCache, DOCache

public abstract class ConfigurationAdministration
extends java.lang.Object

This interface contains part of caches' (data object (or DataStruct object) and query) mechanisms needed for cache administration.

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

Constructor Summary
ConfigurationAdministration()
           
 
Method Summary
abstract  void checkFull()
          Checks if cache is full or not and updates apropriate internal variables.
abstract  int getAsynchLoadPriority()
          Returns priority of asynchronous cache initialization.
abstract  CacheAdministration getCacheAdministration(int cacheType)
          Returns CacheAdministration for data object (or DataStruct object) cache, simple, or complex query cache.
abstract  double getCachePercentage()
          Read cache configuration from application's configuration file.
abstract  java.lang.String getCacheType()
          Returns data object (or DataStruct object) cache type.
abstract  int getInitialCacheFetchSize()
           
abstract  int getInitialDSCacheSize()
           
abstract  java.lang.String getInitialQueryCache()
          Returns initialQueryCache.
abstract  int getLevelOfCaching()
          Returns caching level.
abstract  int getMaxExecuteTimeCacheInit()
          Returns the max time for which the query is not printed in application's log file durung the cache initialization.
abstract  int getQueryTimeLimitCacheInit()
          Returns max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet.
abstract  int getQueryTimeoutCacheInit()
          Returns max number of seconds for which the query for cache initialization should be executed.
abstract  double getReserveFactor()
          Returns reserveFactor.
abstract  int getSimpleCacheRowCountLimit()
          Returns max number of rows in the table for which is simple cache still used.
abstract  Statistics getStatistics()
          Returns statistics of used table (and of the caches, if exist).
abstract  int getSynchLoadRowCountLimit()
          Returns the max number of rows in the table for which the synchronous cache load is performed if defined by configuration.
abstract  TableConfiguration getTableConfiguration()
          Returns object TableConfiguration.
abstract  boolean isComplete()
          Returns information if data object (or DataStruct object) cache if "complete".
abstract  boolean isDisabled()
          Returns information whether caching is disabled.
abstract  boolean isFull()
          Returns information if data object (or DataStruct object) cache if "full".
abstract  void readConfiguration(Config tableConfig, Config cacheConfig, java.lang.String dbName)
           
abstract  void refreshStatistics()
          Refreshes statistics.
protected abstract  void setAsynchLoadPriority(int priority)
          Sets priority of asynchronous cache initialization.
protected abstract  void setCachePercentage(double cp)
           
abstract  void setInitialCacheFetchSize(int i)
           
abstract  void setInitialDSCacheSize(int i)
           
protected abstract  void setInitialQueryCache(java.lang.String initQ)
          Sets initialQueryCache attribute.
protected abstract  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 abstract  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 abstract  void setQueryTimeoutCacheInit(int timeout)
          Sets max number of seconds for which the query for cache initialization should be executed.
protected abstract  void setReserveFactor(double res)
          Sets reserveFactor.
protected abstract  void setSimpleCacheRowCountLimit(int rowCount)
          Sets the max number of rows in the table for which is simple cache still used.
protected abstract  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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationAdministration

public ConfigurationAdministration()
Method Detail

getCacheAdministration

public abstract 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

Parameters:
cacheType - 0 - for data object (or DataStruct object), 1 for simple query and 2 for complex query cache.

getInitialQueryCache

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

Returns:
Attribute initialQueryCache.

setInitialQueryCache

protected abstract 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.

Parameters:
initQ - New value of initialQueryCache attribute.

getStatistics

public abstract Statistics getStatistics()
Returns statistics of used table (and of the caches, if exist).

Returns:
statistics of used table (and of the caches, if exist).

refreshStatistics

public abstract void refreshStatistics()
Refreshes statistics.


checkFull

public abstract void checkFull()
Checks if cache is full or not and updates apropriate internal variables.


isFull

public abstract 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 "*".

Returns:
true if data object (or DataStruct object) cache if "full", otherwise false.

isComplete

public abstract 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.

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

getCacheType

public abstract 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 "*"

Returns:
data object (or DataStruct object) cache type.

getLevelOfCaching

public abstract 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.

Returns:
Caching level (1 or 2).

getTableConfiguration

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

Returns:
TableConfiguration.

getReserveFactor

public abstract double getReserveFactor()
Returns reserveFactor. reserveFactor 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.

Returns:
reserveFactor.

setReserveFactor

protected abstract void setReserveFactor(double res)
Sets reserveFactor. reserveFactor 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.

Parameters:
res - New reserveFactor.

isDisabled

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

Returns:
true is caching is disabled, otherwise false.

getCachePercentage

public abstract double getCachePercentage()
Read cache configuration from application's configuration file.


setCachePercentage

protected abstract void setCachePercentage(double cp)

getInitialCacheFetchSize

public abstract int getInitialCacheFetchSize()

getInitialDSCacheSize

public abstract int getInitialDSCacheSize()

setInitialCacheFetchSize

public abstract void setInitialCacheFetchSize(int i)
Parameters:
i -

setInitialDSCacheSize

public abstract void setInitialDSCacheSize(int i)
Parameters:
i -

getAsynchLoadPriority

public abstract 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).

Returns:
priority of asynchronous cache initialization.

setAsynchLoadPriority

protected abstract 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.

Parameters:
priority - priority of asynchronous cache initialization.

getSimpleCacheRowCountLimit

public abstract 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).

Returns:
the max number of rows in the table until which the simple cache is used.

setSimpleCacheRowCountLimit

protected abstract 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.

Parameters:
rowCount - max number of rows in the table for which is simple cache still used.

getSynchLoadRowCountLimit

public abstract 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).

Returns:
max number of rows in the table above which the asynch cache load is performed.

setSynchLoadRowCountLimit

protected abstract 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.

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

getMaxExecuteTimeCacheInit

public abstract 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).

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

setMaxExecuteTimeCacheInit

protected abstract 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.

Parameters:
maxExeTime - new value for max execution time for the cache initialization.

getQueryTimeLimitCacheInit

public abstract 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.

Returns:
max number of milliseconds for which the query for cache initialization should be executed and the resulset read from ResultSet.

setQueryTimeLimitCacheInit

protected abstract 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.

Parameters:
timeLimit - new value for time limit for cache initialization.

getQueryTimeoutCacheInit

public abstract 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.

Returns:
the number of seconds for which the query for cache initialization should be executed.

setQueryTimeoutCacheInit

protected abstract 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.

Parameters:
timeout - new value for query timeout for cache initialization.

readConfiguration

public abstract void readConfiguration(Config tableConfig,
                                       Config cacheConfig,
                                       java.lang.String dbName)
                                throws CacheObjectException
Throws:
CacheObjectException

DODS 7.6 API