org.jasig.web.util
Class LRUTrackingModelPasser

java.lang.Object
  extended by org.jasig.web.util.LRUTrackingModelPasser
All Implemented Interfaces:
ModelPasser

public class LRUTrackingModelPasser
extends Object
implements ModelPasser

Model passer that uses an LRUMap in the user's session to track model objects for keys. This approach allows a key to be re-used as long as it remains in the map. Keys are purged in LRU order once the map hits its maximum capacity.

Version:
$Revision: 1.1 $
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
LRUTrackingModelPasser()
           
 
Method Summary
 int getMaxSize()
           
protected  Map<String,Map<Object,Object>> getModelCache(javax.portlet.PortletSession portletSession)
           
 Map<Object,Object> getModelFromPortlet(HttpServletRequest request, HttpServletResponse response, String key)
          Retrieve a model for the specified key passed from a portlet in the same web application.
 void passModelToServlet(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, String key, Map<Object,Object> model)
          Take the key and model for the request and store it in a way that a servlet in the same web application.
 void setMaxSize(int maxSize)
          The maximum size of the key cache per user session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

LRUTrackingModelPasser

public LRUTrackingModelPasser()
Method Detail

getMaxSize

public int getMaxSize()

setMaxSize

public void setMaxSize(int maxSize)
The maximum size of the key cache per user session. Defaults to 100.


getModelFromPortlet

public Map<Object,Object> getModelFromPortlet(HttpServletRequest request,
                                              HttpServletResponse response,
                                              String key)
Description copied from interface: ModelPasser
Retrieve a model for the specified key passed from a portlet in the same web application.

Specified by:
getModelFromPortlet in interface ModelPasser
key - The session-unique key to retrieve the model for
Returns:
The model for the key, if no model is found null is returned.

passModelToServlet

public void passModelToServlet(javax.portlet.ActionRequest request,
                               javax.portlet.ActionResponse response,
                               String key,
                               Map<Object,Object> model)
Description copied from interface: ModelPasser
Take the key and model for the request and store it in a way that a servlet in the same web application.

Specified by:
passModelToServlet in interface ModelPasser
key - A session-unique key that can be used for passing the model
model - The model that needs to be passed to the servlet.

getModelCache

protected Map<String,Map<Object,Object>> getModelCache(javax.portlet.PortletSession portletSession)


Copyright © 2009 Jasig. All Rights Reserved.