org.sape.carbon.services.cache.total
Class WritableCache

java.lang.Object
  |
  +--org.sape.carbon.services.cache.total.AbstractTotalCache
        |
        +--org.sape.carbon.services.cache.total.WritableCache
All Implemented Interfaces:
Cache, Configurable, FunctionalInterface, Initializable, Map, Schedulable, Startable, Suspendable

public class WritableCache
extends AbstractTotalCache
implements Configurable, Initializable

The Total Cache implementation of the Cache interface is intended for access to data which expires periodically as a whole or which can be changed on the fly by clients.

This implementation uses a synchronized map to store all data. This means that all gets and puts are synchronized to ensure consistent results

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.15 $($Author: ghinkl $ / $Date: 2003/09/30 02:43:48 $)
Author:
Douglas Voet, March 2002

Field Summary
private  Map activeMap
          Map of the cached values.
private  TotalCacheDataLoader dataLoader
          Holds the dataloader for this cache.
private  org.apache.commons.logging.Log log
          The handle to Apache-commons logger
 
Constructor Summary
WritableCache()
           
 
Method Summary
 void configure(ComponentConfiguration configuration)
          Configure the component.
protected  Map getCacheMap()
          Returns a referench to the Map that contains all the cached data.
 void initialize(Component thisComponent)
          Initialize the component.
 void refreshAll()
          Refresh the contents of the cache.
 
Methods inherited from class org.sape.carbon.services.cache.total.AbstractTotalCache
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, resume, runScheduledTask, size, start, stop, suspend, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

log

private org.apache.commons.logging.Log log
The handle to Apache-commons logger


activeMap

private Map activeMap
Map of the cached values.


dataLoader

private TotalCacheDataLoader dataLoader
Holds the dataloader for this cache.

Constructor Detail

WritableCache

public WritableCache()
Method Detail

refreshAll

public void refreshAll()
                throws CacheLoadException
Refresh the contents of the cache. First, initialize a holding cache. Then load the holding cache with new data from the data loader. Finally, activate the holding cache.

Specified by:
refreshAll in interface Cache
Specified by:
refreshAll in class AbstractTotalCache
Throws:
CacheLoadException - when its data loader has failed to load data

configure

public void configure(ComponentConfiguration configuration)
Description copied from interface: Configurable
Configure the component. This is preceded and followed by the suspend and resume operations if they are available on the component.

Specified by:
configure in interface Configurable
Parameters:
configuration - the configuration for this component
See Also:
Configurable.configure(ComponentConfiguration)

initialize

public void initialize(Component thisComponent)
                throws Exception
Description copied from interface: Initializable
Initialize the component. Called immediately after the Component's constructor. On return, the container may start the component.

Specified by:
initialize in interface Initializable
Parameters:
thisComponent - the reference to the component that this object is a part of. Store this referece within your Functional Implementation for future use.
Throws:
Exception - when there is a failure to initialize the component
See Also:
Initializable.initialize(org.sape.carbon.core.component.Component)

getCacheMap

protected Map getCacheMap()
Description copied from class: AbstractTotalCache
Returns a referench to the Map that contains all the cached data. This is used by the Map interface methods of this class.

Specified by:
getCacheMap in class AbstractTotalCache
Returns:
Map containing the cached data
See Also:
AbstractTotalCache.getCacheMap()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.