Class Overview
This is the Cache of configuration files. To read the settings from a configuration
file, clients create a class that implements ConfigurationFile
capable of loading
and parsing the file contents, and pass a ConfigurationFilesCache.ConfigurationFileCacheHint
to this cache
with their class and file location information, for example:
CacheHint hint = new ConfigurationFileCacheHint("/WEB-INF/xml/myConfigFile.xml", MyConfigClass.class);
MyConfigClass config = ConfigurationFilesCache.getInstance().get(hint);
It provides a static helper method to accomplish the same:
MyConfigClass config = ConfigurationFilesCache.getConfiguration("/WEB-INF/xml/myConfigFile.xml", MyConfigClass.class);
Typically the configuration class simply extends AbstractConfigurationElement
, which already
provides the logic to parse the structure of an xml-based configuration file.
Summary
[Expand]
Inherited Constants |
From class
com.microstrategy.utils.cache.CacheBase
int |
DEFAULT_FILE_REFRESH_TIME |
Refresh time constant indicating that default file refreshing time from the CacheRegistry
shall be used for this cache. |
int |
DEFAULT_REFRESH_TIME |
Refresh time constant indicating that default refresh time from the CacheRegistry
shall be used for this cache. |
int |
DEFAULT_STATISTIC_TIME |
Statistic time constant indicating that default statistic time from the CacheRegistry
shall be used for this cache. |
int |
DEFAULT_SYS_TIMEOUT |
|
int |
DEFAULT_USER_TIMEOUT |
Timeout constant indicating that default timeout value from the CacheRegistry
shall be used for this cache. |
int |
NO_REFRESH |
Refresh time constant indicating that cache members are never automatically reloaded. |
int |
NO_STATISTIC |
Statistic time constant indicating that cache shall not automatically log statistic. |
int |
NO_TIMEOUT |
Timeout constant indicating that cache members shall never timeout. |
|
[Expand]
Inherited Methods |
From class
com.microstrategy.utils.cache.CustomizationsAwareCache
void
|
update(Observable o, Object arg)
When the observer changes, this method simply clears the cache.
|
|
From class
com.microstrategy.utils.cache.CacheBase
boolean
|
canUpdate(CacheHint hint)
Overridable.
|
synchronized
void
|
clear()
Clears the cache - all entries are removed.
|
void
|
close()
Un-register cache from the cache registry.
|
synchronized
void
|
configure(Properties prop)
|
boolean
|
contains(CacheHint hint)
|
void
|
delete(CacheHint hint)
Removes object from the cache and persistent storage
|
Object
|
get(CacheHint hint)
Finds and returns cached object based on the hint.
|
abstract
Object
|
getKey(CacheHint hint)
Overridable.
|
String
|
getName()
Returns cache name.
|
synchronized
int
|
getRefreshTime()
Returns cache refresh time in seconds.
|
synchronized
int
|
getStatisticTime()
Returns the statistic frequency in seconds.
|
synchronized
int
|
getTimeout()
Returns cache timeout in seconds.
|
abstract
Object
|
load(CacheHint hint)
Overridable.
|
void
|
logStatistic()
Writes cache statistic message to the log.
|
void
|
onHintClose(CacheHint hint)
This method is supposed to be called by the hint object when it is closed.
|
void
|
onTimer()
This method is periodically called by the cache registry.
|
void
|
put(CacheHint hint, Object ob)
Puts the object in the cache.
|
Object
|
reLoad(CacheHint hint, Object ob)
Overridable.
|
Object
|
refresh(CacheHint hint)
Re-loads object from the persistent storage
|
void
|
remove(CacheHint hint)
Removes an object from the cache.
|
void
|
save(CacheHint hint, Object ob)
Puts the object in the cache and stores it in the memory.
|
synchronized
void
|
setRefreshTime(int value)
Sets cache refresh time in seconds.
|
synchronized
void
|
setStatisticTime(int value)
Sets the statistic frequency in seconds.
|
synchronized
void
|
setTimeout(int value)
Sets cache timeout in seconds.
|
synchronized
int
|
size()
Returns cache size.
|
void
|
store(CacheHint hint, Object ob)
Overridable.
|
void
|
unLoad(CacheHint hint)
Overridable.
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
com.microstrategy.utils.cache.Cache
abstract
void
|
clear()
Clears the cache - all entries are removed.
|
abstract
void
|
close()
Un-register cache from the cache registry.
|
abstract
boolean
|
contains(CacheHint hint)
|
abstract
void
|
delete(CacheHint hint)
Removes object from the cache and persistent storage
|
abstract
Object
|
get(CacheHint hint)
Finds and returns cached object based on the hint.
|
abstract
String
|
getName()
Returns cache name.
|
abstract
void
|
onHintClose(CacheHint hint)
This method is supposed to be called by the hint object when it is closed.
|
abstract
void
|
put(CacheHint hint, Object ob)
Puts the object in the cache.
|
abstract
Object
|
refresh(CacheHint hint)
Re-loads object from the persistent storage
|
abstract
void
|
remove(CacheHint hint)
Removes an object from the cache.
|
abstract
void
|
save(CacheHint hint, Object ob)
Puts the object in the cache and stores it in the memory.
|
|
From interface
java.util.Observer
abstract
void
|
update(Observable arg0, Object arg1)
|
|
Public Methods
public
static
ConfigurationFile
getConfiguration
(String filePath, Class configClass)
public
static
void
removeConfiguration
(String filePath, Class configClass)
This method when called will remove the ConfigurationFileCacheHint from the ConfigurationFileCache
Protected Methods
protected
Object
getKey
(CacheHint hint)
Overridable.
Extracts from the hint object the key that shall be used to identify the cached object.
protected
Object
load
(CacheHint hint)
Overridable.
Creates a new cached object instance and populates it with data from the
persistent storage. In case the object not found in the persistent storage
the implementation can return either null or a dummy object.
protected
Object
reLoad
(CacheHint hint, Object ob)
Overridable.
Re-populates cached object with data from persistent storage.
Implementation of this method can re-load the object in-place or it can
create another object.