org.apache.jetspeed.portalsite.impl
Class PortalSiteSessionContextImpl

java.lang.Object
  extended byorg.apache.jetspeed.portalsite.impl.PortalSiteSessionContextImpl
All Implemented Interfaces:
EventListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionBindingListener, org.apache.jetspeed.page.PageManagerEventListener, org.apache.jetspeed.portalsite.PortalSiteSessionContext

public class PortalSiteSessionContextImpl
extends Object
implements org.apache.jetspeed.portalsite.PortalSiteSessionContext, org.apache.jetspeed.page.PageManagerEventListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionBindingListener

This class encapsulates managed session state for and interface to the portal-site component and subscribes to page manager and session events to flush stale state

Version:
$Id: PortalSiteSessionContextImpl.java 264961 2005-08-31 07:42:59Z rwatler $
Author:
Randy Watler

Field Summary
private  Map folderPageHistory
          folderPageHistory - map of last page visited by folder
private static org.apache.commons.logging.Log log
          log - logging instance
private  Map menuDefinitionLocatorCache
          menuDefinitionLocatorCache - cached menu definition locators for absolute menus valid for session
private  org.apache.jetspeed.page.PageManager pageManager
          pageManager - PageManager component
private  Map profileLocators
          profileLocators - map of session profile locators by locator names
private  SiteView siteView
          siteView - session site view
private  boolean stale
          stale - flag that indicates whether the state managed by this context is stale
private  boolean subscribed
          subscribed - flag that indicates whether this context is subscribed as event listeners
private  String userPrincipal
          userPrincipal - session user principal
 
Constructor Summary
PortalSiteSessionContextImpl(org.apache.jetspeed.page.PageManager pageManager)
          PortalSiteSessionContextImpl - constructor
 
Method Summary
private  void clearSessionProfileLocators()
          clearSessionProfileLocators - clear cache session profile locators
 org.apache.jetspeed.om.page.Page getManagedPage(org.apache.jetspeed.om.page.Page page)
          getManagedPage - get concrete page instance from page proxy
 SiteViewMenuDefinitionLocator getMenuDefinitionLocator(org.apache.jetspeed.page.document.Node node, String name)
          getMenuDefinitionLocator - get named node proxy menu definition locator from site view
 Map getMenuDefinitionLocatorCache()
          getMenuDefinitionLocatorCache - get menu definition locators cache for absolute menus
 List getMenuDefinitionLocators(org.apache.jetspeed.page.document.Node node)
          getMenuDefinitionLocators - get list of node proxy menu definition locators from site view
 org.apache.jetspeed.page.PageManager getPageManager()
          getPageManager - return PageManager component instance
 Map getProfileLocators()
          getProfileLocators - get session profile locators
private  String getRequestPathFromLocator(org.apache.jetspeed.profiler.ProfileLocator locator)
          getRequestPathFromLocator - execute profile locator to extract request path using locator rules; this is request specific and is not part of the site view
 org.apache.jetspeed.om.folder.Folder getRequestRootFolder(Map requestProfileLocators)
          getRequestRootFolder - select root folder proxy for given profile locators
 SiteView getSiteView()
          getSiteView - lookup and/or create site view for profile locators of this context
 Set getStandardMenuNames()
          getStandardMenuNames - get set of available standard menu names
private static String locatorRequestPath(org.apache.jetspeed.profiler.ProfileLocator locator)
          locatorRequestPath - extract request specific path from profile locator using request path from locator
private static String locatorRequestPath(org.apache.jetspeed.profiler.ProfileLocator locator, String requestPath)
          locatorRequestPath - extract request specific path from profile locator
private static boolean locatorsEquals(Map locators0, Map locators1)
          locatorsEquals - test profile locator maps for equivalence ignoring request specifics
 void newNode(org.apache.jetspeed.page.document.Node node)
          newNode - invoked when the definition of a node is created by the page manager or when the node creation is otherwise detected
 org.apache.jetspeed.portalsite.PortalSiteRequestContext newRequestContext(Map requestProfileLocators)
          newRequestContext - create a new request context instance
 void removedNode(org.apache.jetspeed.page.document.Node node)
          removedNode - invoked when the definition of a node is removed by the page manager or when the node removal is otherwise detected
 org.apache.jetspeed.om.page.Page selectRequestPage(Map requestProfileLocators)
          selectRequestPage - select page proxy for request given profile locators
private  org.apache.jetspeed.om.page.Page selectRequestPage(String requestPath)
          selectRequestPage - select page proxy for request for specified path given profile locators and site view associated with this context
 void sessionDidActivate(javax.servlet.http.HttpSessionEvent event)
          sessionDidActivate - notification that the session has just been activated
 void sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)
          sessionWillPassivate - notification that the session is about to be passivated
 void setMenuDefinitionLocatorCache(Map cache)
          setMenuDefinitionLocatorCache - set menu definition locators cache for absolute menus
 void updatedNode(org.apache.jetspeed.page.document.Node node)
          updatedNode - invoked when the definition of a node is updated by the page manager or when the node modification is otherwise detected
private  boolean updateSessionProfileLocators(Map requestProfileLocators)
          updateSessionProfileLocators - detect modification of and update cached session profile locators
 void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
          valueBound - notifies this context that it is being bound to a session and identifies the session
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
          valueUnbound - notifies this context that it is being unbound from a session and identifies the session
 
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
log - logging instance


pageManager

private org.apache.jetspeed.page.PageManager pageManager
pageManager - PageManager component


profileLocators

private Map profileLocators
profileLocators - map of session profile locators by locator names


userPrincipal

private String userPrincipal
userPrincipal - session user principal


siteView

private SiteView siteView
siteView - session site view


folderPageHistory

private Map folderPageHistory
folderPageHistory - map of last page visited by folder


menuDefinitionLocatorCache

private Map menuDefinitionLocatorCache
menuDefinitionLocatorCache - cached menu definition locators for absolute menus valid for session


subscribed

private boolean subscribed
subscribed - flag that indicates whether this context is subscribed as event listeners


stale

private boolean stale
stale - flag that indicates whether the state managed by this context is stale

Constructor Detail

PortalSiteSessionContextImpl

public PortalSiteSessionContextImpl(org.apache.jetspeed.page.PageManager pageManager)
PortalSiteSessionContextImpl - constructor

Parameters:
pageManager - PageManager component instance
Method Detail

newRequestContext

public org.apache.jetspeed.portalsite.PortalSiteRequestContext newRequestContext(Map requestProfileLocators)
newRequestContext - create a new request context instance

Specified by:
newRequestContext in interface org.apache.jetspeed.portalsite.PortalSiteSessionContext
Parameters:
requestProfileLocators - request profile locators
Returns:
new request context instance

selectRequestPage

public org.apache.jetspeed.om.page.Page selectRequestPage(Map requestProfileLocators)
                                                   throws org.apache.jetspeed.page.document.NodeNotFoundException
selectRequestPage - select page proxy for request given profile locators

Parameters:
requestProfileLocators - map of profile locators for request
Returns:
selected page proxy for request
Throws:
org.apache.jetspeed.page.document.NodeNotFoundException - if not found
SecurityException - if view access not granted

getRequestPathFromLocator

private String getRequestPathFromLocator(org.apache.jetspeed.profiler.ProfileLocator locator)
getRequestPathFromLocator - execute profile locator to extract request path using locator rules; this is request specific and is not part of the site view

Parameters:
locator - profile locator to execute
Returns:
request path from profile locator

selectRequestPage

private org.apache.jetspeed.om.page.Page selectRequestPage(String requestPath)
                                                    throws org.apache.jetspeed.page.document.NodeNotFoundException
selectRequestPage - select page proxy for request for specified path given profile locators and site view associated with this context

Parameters:
requestPath - request path
Returns:
selected page proxy for request
Throws:
org.apache.jetspeed.page.document.NodeNotFoundException - if not found
SecurityException - if view access not granted

getRequestRootFolder

public org.apache.jetspeed.om.folder.Folder getRequestRootFolder(Map requestProfileLocators)
                                                          throws org.apache.jetspeed.page.document.NodeNotFoundException
getRequestRootFolder - select root folder proxy for given profile locators

Parameters:
requestProfileLocators - map of profile locators for request
Returns:
root folder proxy for request
Throws:
org.apache.jetspeed.page.document.NodeNotFoundException - if not found
SecurityException - if view access not granted

updateSessionProfileLocators

private boolean updateSessionProfileLocators(Map requestProfileLocators)
updateSessionProfileLocators - detect modification of and update cached session profile locators

Parameters:
requestProfileLocators - map of profile locators for request
Returns:
profile locators validation flag

clearSessionProfileLocators

private void clearSessionProfileLocators()
clearSessionProfileLocators - clear cache session profile locators


getSiteView

public SiteView getSiteView()
getSiteView - lookup and/or create site view for profile locators of this context

Returns:
site view instance

getPageManager

public org.apache.jetspeed.page.PageManager getPageManager()
getPageManager - return PageManager component instance

Specified by:
getPageManager in interface org.apache.jetspeed.portalsite.PortalSiteSessionContext
Returns:
PageManager instance

getProfileLocators

public Map getProfileLocators()
getProfileLocators - get session profile locators


getStandardMenuNames

public Set getStandardMenuNames()
getStandardMenuNames - get set of available standard menu names

Returns:
menu names set

getMenuDefinitionLocators

public List getMenuDefinitionLocators(org.apache.jetspeed.page.document.Node node)
getMenuDefinitionLocators - get list of node proxy menu definition locators from site view

Parameters:
node - site view node proxy
Returns:
definition locator list

getMenuDefinitionLocator

public SiteViewMenuDefinitionLocator getMenuDefinitionLocator(org.apache.jetspeed.page.document.Node node,
                                                              String name)
getMenuDefinitionLocator - get named node proxy menu definition locator from site view

Parameters:
node - site view node proxy
name - menu definition name
Returns:
menu definition locator

getManagedPage

public org.apache.jetspeed.om.page.Page getManagedPage(org.apache.jetspeed.om.page.Page page)
getManagedPage - get concrete page instance from page proxy

Parameters:
page - page proxy
Returns:
managed page

getMenuDefinitionLocatorCache

public Map getMenuDefinitionLocatorCache()
getMenuDefinitionLocatorCache - get menu definition locators cache for absolute menus

Returns:
menu definition locators cache

setMenuDefinitionLocatorCache

public void setMenuDefinitionLocatorCache(Map cache)
setMenuDefinitionLocatorCache - set menu definition locators cache for absolute menus

Returns:
menu definition locators cache

locatorsEquals

private static boolean locatorsEquals(Map locators0,
                                      Map locators1)
locatorsEquals - test profile locator maps for equivalence ignoring request specifics

Parameters:
locators0 - request profile locator map
locators1 - request profile locator map
Returns:
boolean flag indicating equivalence

locatorRequestPath

private static String locatorRequestPath(org.apache.jetspeed.profiler.ProfileLocator locator)
locatorRequestPath - extract request specific path from profile locator using request path from locator

Parameters:
locator - request profile locator
Returns:
request path

locatorRequestPath

private static String locatorRequestPath(org.apache.jetspeed.profiler.ProfileLocator locator,
                                         String requestPath)
locatorRequestPath - extract request specific path from profile locator

Parameters:
locator - request profile locator
requestPath - request path
Returns:
request path

newNode

public void newNode(org.apache.jetspeed.page.document.Node node)
newNode - invoked when the definition of a node is created by the page manager or when the node creation is otherwise detected

Specified by:
newNode in interface org.apache.jetspeed.page.PageManagerEventListener
Parameters:
node - new managed node if known

updatedNode

public void updatedNode(org.apache.jetspeed.page.document.Node node)
updatedNode - invoked when the definition of a node is updated by the page manager or when the node modification is otherwise detected

Specified by:
updatedNode in interface org.apache.jetspeed.page.PageManagerEventListener
Parameters:
node - updated managed node if known

removedNode

public void removedNode(org.apache.jetspeed.page.document.Node node)
removedNode - invoked when the definition of a node is removed by the page manager or when the node removal is otherwise detected

Specified by:
removedNode in interface org.apache.jetspeed.page.PageManagerEventListener
Parameters:
node - removed managed node if known

sessionDidActivate

public void sessionDidActivate(javax.servlet.http.HttpSessionEvent event)
sessionDidActivate - notification that the session has just been activated

Specified by:
sessionDidActivate in interface javax.servlet.http.HttpSessionActivationListener
Parameters:
event - session activation event

sessionWillPassivate

public void sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)
sessionWillPassivate - notification that the session is about to be passivated

Specified by:
sessionWillPassivate in interface javax.servlet.http.HttpSessionActivationListener
Parameters:
event - session activation event

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
valueBound - notifies this context that it is being bound to a session and identifies the session

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
event - session binding event

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound - notifies this context that it is being unbound from a session and identifies the session

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
event - session binding event


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.