org.jasig.portal
Class UserInstance

java.lang.Object
  extended by org.jasig.portal.UserInstance
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener
Direct Known Subclasses:
GuestUserInstance

public class UserInstance
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener

A class handling holding all user state information. The class is also reponsible for request processing and orchestrating the entire rendering procedure. (this is a replacement for the good old LayoutBean class)

Version:
$Revision: 1.127.2.7 $
Author:
Peter Kharchenko

Field Summary
static boolean CACHE_ENABLED
           
private  ChannelManager channelManager
           
static boolean CHARACTER_CACHE_ENABLED
           
private static java.lang.String CHARACTER_SET
           
static int guestUserId
           
private  LocaleManager localeManager
           
private static org.apache.commons.logging.Log log
           
private static boolean logXMLBeforeStructureTransformation
           
private static boolean logXMLBeforeThemeTransformation
           
private static MediaManager MEDIAMANAGER
           
private  IUserLayoutNodeDescription newNodeDescription
           
private  StandaloneChannelRenderer p_browserMapper
           
private  java.lang.Object p_rendering_lock
           
protected  IPerson person
           
private static int SYSTEM_CHARACTER_BLOCK_CACHE_MIN_SIZE
           
private static int SYSTEM_XSLT_CACHE_MIN_SIZE
           
(package private)  SoftHashMap systemCache
           
(package private)  SoftHashMap systemCharacterCache
           
private  IUserPreferencesManager uPreferencesManager
           
static java.lang.String USER_LAYOUT_ROOT_NODE
           
private static java.lang.String WORKER_PROPERTIES_FILE_NAME
           
private static java.util.Properties workerProperties
           
 
Constructor Summary
UserInstance(IPerson person)
           
 
Method Summary
private  java.lang.String constructCacheKey(IPerson person, java.lang.String rootNodeId)
           
private  IAggregatedUserLayoutManager getAggregatedLayoutManager(IUserLayoutManager ulm)
           
 IPerson getPerson()
          Gets the person object from the session.
protected  boolean processPortletActionIfNecessary(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Determines if this request is triggering a portlet's processAction method, and if so, starts the rendering cycle early which has the effect of feeding the portlet control structures and channel runtime data to the portlet adapter so that the portlet's process action method gets a chance to complete before we continue.
private  void processUserLayoutParameters(javax.servlet.http.HttpServletRequest req, ChannelManager channelManager)
          Process layout action events.
protected  boolean processWorkerDispatch(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, ChannelManager cm)
          A method will determine if current request is a worker dispatch, and if so process it appropriatly
 void renderState(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, ChannelManager channelManager, LocaleManager localeManager, IUserPreferencesManager upm, java.lang.Object rendering_lock)
          renderState method orchestrates the rendering pipeline.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
          Notifies UserInstance that it has been bound to a session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
          This notifies UserInstance that it has been unbound from the session.
 void writeContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Prepares for and initates the rendering cycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

guestUserId

public static final int guestUserId
See Also:
Constant Field Values

logXMLBeforeStructureTransformation

private static final boolean logXMLBeforeStructureTransformation

logXMLBeforeThemeTransformation

private static final boolean logXMLBeforeThemeTransformation

uPreferencesManager

private IUserPreferencesManager uPreferencesManager

channelManager

private ChannelManager channelManager

localeManager

private LocaleManager localeManager

MEDIAMANAGER

private static final MediaManager MEDIAMANAGER

p_browserMapper

private StandaloneChannelRenderer p_browserMapper

p_rendering_lock

private java.lang.Object p_rendering_lock

CACHE_ENABLED

public static final boolean CACHE_ENABLED

SYSTEM_XSLT_CACHE_MIN_SIZE

private static final int SYSTEM_XSLT_CACHE_MIN_SIZE

SYSTEM_CHARACTER_BLOCK_CACHE_MIN_SIZE

private static final int SYSTEM_CHARACTER_BLOCK_CACHE_MIN_SIZE

CHARACTER_CACHE_ENABLED

public static final boolean CHARACTER_CACHE_ENABLED

USER_LAYOUT_ROOT_NODE

public static final java.lang.String USER_LAYOUT_ROOT_NODE
See Also:
Constant Field Values

WORKER_PROPERTIES_FILE_NAME

private static final java.lang.String WORKER_PROPERTIES_FILE_NAME
See Also:
Constant Field Values

workerProperties

private static java.util.Properties workerProperties

CHARACTER_SET

private static final java.lang.String CHARACTER_SET
See Also:
Constant Field Values

systemCache

final SoftHashMap systemCache

systemCharacterCache

final SoftHashMap systemCharacterCache

person

protected IPerson person

newNodeDescription

private IUserLayoutNodeDescription newNodeDescription
Constructor Detail

UserInstance

public UserInstance(IPerson person)
Method Detail

writeContent

public void writeContent(javax.servlet.http.HttpServletRequest req,
                         javax.servlet.http.HttpServletResponse res)
                  throws PortalException
Prepares for and initates the rendering cycle.

Parameters:
req - the servlet request object
res - the servlet response object
Throws:
PortalException

processPortletActionIfNecessary

protected boolean processPortletActionIfNecessary(javax.servlet.http.HttpServletRequest req,
                                                  javax.servlet.http.HttpServletResponse res)
Determines if this request is triggering a portlet's processAction method, and if so, starts the rendering cycle early which has the effect of feeding the portlet control structures and channel runtime data to the portlet adapter so that the portlet's process action method gets a chance to complete before we continue. This allows portlets to affect things like window states and be able to redirect to another web page as required by the portlet specification.

Parameters:
req - the http servlet request
res - the http servlet response

renderState

public void renderState(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse res,
                        ChannelManager channelManager,
                        LocaleManager localeManager,
                        IUserPreferencesManager upm,
                        java.lang.Object rendering_lock)
                 throws PortalException
renderState method orchestrates the rendering pipeline.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
channelManager - the ChannelManager instance
upm - the IUserPreferencesManager instance
rendering_lock - a lock for rendering on a single user
Throws:
PortalException - if an error occurs

constructCacheKey

private java.lang.String constructCacheKey(IPerson person,
                                           java.lang.String rootNodeId)
                                    throws PortalException
Throws:
PortalException

getPerson

public IPerson getPerson()
Gets the person object from the session. Null is returned if no person is logged in

Returns:
the person object, null if no person is logged in

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
This notifies UserInstance that it has been unbound from the session. Method triggers cleanup in ChannelManager.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
bindingEvent - an HttpSessionBindingEvent value

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent bindingEvent)
Notifies UserInstance that it has been bound to a session.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
bindingEvent - a HttpSessionBindingEvent value

processUserLayoutParameters

private void processUserLayoutParameters(javax.servlet.http.HttpServletRequest req,
                                         ChannelManager channelManager)
                                  throws PortalException
Process layout action events. Events are described by the following request params: uP_help_target uP_about_target uP_edit_target uP_remove_target uP_detach_target

Parameters:
req - a HttpServletRequest value
channelManager - a ChannelManager value
Throws:
PortalException - if an error occurs

getAggregatedLayoutManager

private IAggregatedUserLayoutManager getAggregatedLayoutManager(IUserLayoutManager ulm)
                                                         throws PortalException
Throws:
PortalException

processWorkerDispatch

protected boolean processWorkerDispatch(javax.servlet.http.HttpServletRequest req,
                                        javax.servlet.http.HttpServletResponse res,
                                        ChannelManager cm)
                                 throws PortalException
A method will determine if current request is a worker dispatch, and if so process it appropriatly

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
cm - the ChannelManager instance
Returns:
a boolean value
Throws:
PortalException - if an error occurs