org.makumba.analyser
Class PageCache

java.lang.Object
  extended by org.makumba.analyser.PageCache

public class PageCache
extends Object

Cache for the page analysis. It is passed along during analysis and holds useful caches. This class provides two methods to add/retrieve caches throughout the analysis process.

Version:
$Id: PageCache.java 5156 2010-05-18 22:14:06Z rosso_nero $
Author:
Cristian Bogdan, Manuel Gay, Rudolf Mayer

Constructor Summary
PageCache()
           
 
Method Summary
 void cache(String cacheName, Object key, Object value)
          Caches an object in a specific cache
 void cacheMultiple(String cacheName, Object key, Object value)
          Caches an object in a cache capable of handling multiple unique values for one key
 void cacheNeededResources(Object[] value)
           
 void cacheSetValues(String cacheName, Object[] value)
          Caches several objects in a specific cache, using sets, i.e. not keeping duplicate values.
 Object retrieve(String cacheName, Object key)
          Retrieves an object of a specific cache
 Map<Object,Object> retrieveCache(String cacheName)
          Gets a whole cache of simple values (does not apply for multi-value caches)
 org.apache.commons.collections.map.MultiValueMap retrieveMultiCache(String cacheName)
          Gets a whole multivalue cache
 Collection<Object> retrieveMultiple(String cacheName, Object key)
          Retrieves the values of a multivalue cache
 org.apache.commons.collections.set.ListOrderedSet retrieveSetValues(String cacheName)
          Retrieves a set from a specific set cache.
 String toString()
           
 String toString(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageCache

public PageCache()
Method Detail

cache

public void cache(String cacheName,
                  Object key,
                  Object value)
Caches an object in a specific cache

Parameters:
cacheName - the name of the cache we want to work with
key - the key of the object in this cache
value - the value of the object to be cached

retrieve

public Object retrieve(String cacheName,
                       Object key)
Retrieves an object of a specific cache

Parameters:
cacheName - the name of the cache we want to work with
key - the key of the object in this cache
Returns:
the object corresponding to the cache entry, null if no entry exists

retrieveCache

public Map<Object,Object> retrieveCache(String cacheName)
Gets a whole cache of simple values (does not apply for multi-value caches)

Parameters:
cacheName - the name of the cache
Returns:
a Map with the content of the cache

cacheMultiple

public void cacheMultiple(String cacheName,
                          Object key,
                          Object value)
Caches an object in a cache capable of handling multiple unique values for one key

Parameters:
cacheName - the name of the cache
key - the key of the object to cache
value - the value of the object to cache, can be a single value or a collection

retrieveMultiple

public Collection<Object> retrieveMultiple(String cacheName,
                                           Object key)
Retrieves the values of a multivalue cache

Parameters:
cacheName - the name of the cache
key - the key of the object to retrieve
Returns:
a Collection of values

retrieveMultiCache

public org.apache.commons.collections.map.MultiValueMap retrieveMultiCache(String cacheName)
Gets a whole multivalue cache

Parameters:
cacheName - the name of the cache
Returns:
a MultiValueMap with the content of the cache

cacheSetValues

public void cacheSetValues(String cacheName,
                           Object[] value)
Caches several objects in a specific cache, using sets, i.e. not keeping duplicate values.


cacheNeededResources

public void cacheNeededResources(Object[] value)

retrieveSetValues

public org.apache.commons.collections.set.ListOrderedSet retrieveSetValues(String cacheName)
Retrieves a set from a specific set cache.


toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(String key)