org.cdlib.xtf.textEngine
Class ConfigCache

Object
  extended by Cache<K,V>
      extended by GeneratingCache
          extended by ConfigCache

public class ConfigCache
extends GeneratingCache

Used to maintain a simple cache of config files, so we don't have to keep loading the same one over and over.


Nested Class Summary
private static class ConfigCache.ConfigCacheKey
          A key in the ConfigCache.
 
Nested classes/interfaces inherited from class Cache
Cache.ListEntry, Cache.NullIterator
 
Field Summary
 
Fields inherited from class Cache
ageList, keyMap
 
Constructor Summary
ConfigCache()
          Default constructor - defines the default cache size and expiration time.
 
Method Summary
 IndexerConfig find(File configFile, String indexName)
          Find or load the configuration given its File
protected  Object generate(Object key)
          Load a configuration given its path
 
Methods inherited from class GeneratingCache
addDependency, find
 
Methods inherited from class Cache
cleanup, clear, dependenciesValid, getDependencies, has, lastSet, logAction, remove, size
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigCache

public ConfigCache()
Default constructor - defines the default cache size and expiration time. These should probably be configurable in some file somewhere, but does anyone really care?

Method Detail

find

public IndexerConfig find(File configFile,
                          String indexName)
                   throws Exception
Find or load the configuration given its File

Throws:
Exception

generate

protected Object generate(Object key)
                   throws Exception
Load a configuration given its path

Specified by:
generate in class GeneratingCache
Parameters:
key - The key to generate a value for.
Returns:
The value for that key
Throws:
Exception - If a value cannot be generated for any reason.