org.makumba.forms.responder
Class ResponderCacheManager

java.lang.Object
  extended by org.makumba.forms.responder.ResponderCacheManager

public class ResponderCacheManager
extends Object

This class is handling the caching mechanism of the Responder. There are two caches: one memory cache and one cache on the disk. In case of server failure, responder objects are serialized on the disk so they can be retrieved again after restart and form data is not lost.

Version:
$Id: ResponderCacheManager.java,v 1.1 03.10.2007 09:54:18 Manuel Exp $
Author:
Manuel Gay

Field Summary
(package private) static NamedResources cache
          We cache the responder in the memory because if two forms are the same (often the case in multiple forms), their responder looks exactly the same.
(package private) static Hashtable<Integer,Object> indexedCache
           
static String makumbaResponderBaseDirectory
          The directory where makumba will store to and load responders from.
 
Constructor Summary
ResponderCacheManager()
           
 
Method Summary
 ResponderFactory getFactory()
           
static ResponderCacheManager getInstance()
           
(package private)  Responder getResponder(String code, String suffix, String parentSuffix)
          Fetches a responder from the cache.
 void setFactory(ResponderFactory factory)
           
 void setResponderWorkingDir(HttpServletRequest request)
          Sets the responder working directory from the "javax.servlet.context.tempdir" variable.
 void setResponderWorkingDir(Object tempDir, String contextPath)
          Sets the responder working directory from the given temp directory and context path.
(package private) static String validResponderFilename(int responderValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexedCache

static Hashtable<Integer,Object> indexedCache

makumbaResponderBaseDirectory

public static String makumbaResponderBaseDirectory
The directory where makumba will store to and load responders from.


cache

static NamedResources cache
We cache the responder in the memory because if two forms are the same (often the case in multiple forms), their responder looks exactly the same.

Constructor Detail

ResponderCacheManager

public ResponderCacheManager()
Method Detail

getInstance

public static ResponderCacheManager getInstance()

validResponderFilename

static String validResponderFilename(int responderValue)

setResponderWorkingDir

public void setResponderWorkingDir(HttpServletRequest request)
Sets the responder working directory from the "javax.servlet.context.tempdir" variable.


setResponderWorkingDir

public void setResponderWorkingDir(Object tempDir,
                                   String contextPath)
Sets the responder working directory from the given temp directory and context path.


getResponder

Responder getResponder(String code,
                       String suffix,
                       String parentSuffix)
Fetches a responder from the cache. If the memory cache is empty we try to get the responder from the disk.

Parameters:
code - the responder code
suffix - the responder suffix
parentSuffix - the suffix of the parent responder (of the parent form)
Returns:
the cached responder object, if any could be found

getFactory

public ResponderFactory getFactory()

setFactory

public void setFactory(ResponderFactory factory)