org.apache.jetspeed.portalsite.impl
Class PortalSiteSessionContextImpl

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

public class PortalSiteSessionContextImpl
extends java.lang.Object
implements PortalSiteSessionContext, PageManagerEventListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

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. Note that is object is Serializable since it is designed to be cached in the session. However, because this object is cached only for these two reasons: 1. a performance optimization to reuse SiteViews, and 2. to hold optional folder page history, this object need not be relocatable between J2 instances. Consequently, all data members are marked transient and the isValid() method is used to test whether this object is a valid context for the session or if it was transferred from another server or the persistent session store and needs to be discarded.

Version:
$Id: PortalSiteSessionContextImpl.java 553375 2007-07-05 05:37:00Z taylor $
Author:
Randy Watler
See Also:
Serialized Form

Constructor Summary
PortalSiteSessionContextImpl(PageManager pageManager)
          PortalSiteSessionContextImpl - constructor
 
Method Summary
 Page getManagedPage(Page page)
          getManagedPage - get concrete page instance from page proxy
 SiteViewMenuDefinitionLocator getMenuDefinitionLocator(Node node, java.lang.String name)
          getMenuDefinitionLocator - get named node proxy menu definition locator from site view
 java.util.Map getMenuDefinitionLocatorCache()
          getMenuDefinitionLocatorCache - get menu definition locators cache for absolute menus
 java.util.List getMenuDefinitionLocators(Node node)
          getMenuDefinitionLocators - get list of node proxy menu definition locators from site view
 PageManager getPageManager()
          getPageManager - return PageManager component instance
 java.lang.String getPipeline()
          get which pipeline this context is stored for
 java.util.Map getProfileLocators()
          getProfileLocators - get session profile locators
 Folder getRequestRootFolder(java.util.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
 java.util.Set getStandardMenuNames()
          getStandardMenuNames - get set of available standard menu names
 boolean isValid()
          isValid - return flag indicating whether this context instance is valid or if it is stale after being persisted and reloaded as session state
 void newNode(Node node)
          newNode - invoked when the definition of a node is created by the page manager or when the node creation is otherwise detected
 PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators)
          newRequestContext - create a new request context instance with fallback and history
 PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators, boolean requestFallback)
          newRequestContext - create a new request context instance with history
 PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators, boolean requestFallback, boolean useHistory)
          newRequestContext - create a new request context instance
 void removedNode(Node node)
          removedNode - invoked when the definition of a node is removed by the page manager or when the node removal is otherwise detected
 Page selectRequestPage(java.util.Map requestProfileLocators, boolean requestFallback, boolean useHistory)
          selectRequestPage - select page proxy for request given profile locators
 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(java.util.Map cache)
          setMenuDefinitionLocatorCache - set menu definition locators cache for absolute menus
 void setPipeline(java.lang.String pipeline)
          set which pipeline this context is stored for
 void updatedNode(Node node)
          updatedNode - invoked when the definition of a node is updated by the page manager or when the node modification is otherwise detected
 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
 

Constructor Detail

PortalSiteSessionContextImpl

public PortalSiteSessionContextImpl(PageManager pageManager)
PortalSiteSessionContextImpl - constructor

Parameters:
pageManager - PageManager component instance
Method Detail

newRequestContext

public PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators)
newRequestContext - create a new request context instance with fallback and history

Specified by:
newRequestContext in interface PortalSiteSessionContext
Parameters:
requestProfileLocators - request profile locators
Returns:
new request context instance

newRequestContext

public PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators,
                                                  boolean requestFallback)
newRequestContext - create a new request context instance with history

Specified by:
newRequestContext in interface PortalSiteSessionContext
Parameters:
requestProfileLocators - request profile locators
requestFallback - flag specifying whether to fallback to root folder if locators do not select a page or access is forbidden
Returns:
new request context instance

newRequestContext

public PortalSiteRequestContext newRequestContext(java.util.Map requestProfileLocators,
                                                  boolean requestFallback,
                                                  boolean useHistory)
newRequestContext - create a new request context instance

Specified by:
newRequestContext in interface PortalSiteSessionContext
Parameters:
requestProfileLocators - request profile locators
requestFallback - flag specifying whether to fallback to root folder if locators do not select a page or access is forbidden
useHistory - flag indicating whether to use visited page history to select default page per site folder
Returns:
new request context instance

selectRequestPage

public Page selectRequestPage(java.util.Map requestProfileLocators,
                              boolean requestFallback,
                              boolean useHistory)
                       throws NodeNotFoundException
selectRequestPage - select page proxy for request given profile locators

Parameters:
requestProfileLocators - map of profile locators for request
requestFallback - flag specifying whether to fallback to root folder if locators do not select a page or access is forbidden
useHistory - flag indicating whether to use visited page history to select default page per site folder
Returns:
selected page proxy for request
Throws:
NodeNotFoundException - if not found
java.lang.SecurityException - if view access not granted

getRequestRootFolder

public Folder getRequestRootFolder(java.util.Map requestProfileLocators)
                            throws 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:
NodeNotFoundException - if not found
java.lang.SecurityException - if view access not granted

getSiteView

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

Returns:
site view instance

getPageManager

public PageManager getPageManager()
getPageManager - return PageManager component instance

Specified by:
getPageManager in interface PortalSiteSessionContext
Returns:
PageManager instance

isValid

public boolean isValid()
isValid - return flag indicating whether this context instance is valid or if it is stale after being persisted and reloaded as session state

Specified by:
isValid in interface PortalSiteSessionContext
Returns:
valid context status

getProfileLocators

public java.util.Map getProfileLocators()
getProfileLocators - get session profile locators


getStandardMenuNames

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

Returns:
menu names set

getMenuDefinitionLocators

public java.util.List getMenuDefinitionLocators(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(Node node,
                                                              java.lang.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 Page getManagedPage(Page page)
getManagedPage - get concrete page instance from page proxy

Parameters:
page - page proxy
Returns:
managed page

getMenuDefinitionLocatorCache

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

Returns:
menu definition locators cache

setMenuDefinitionLocatorCache

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


newNode

public void newNode(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 PageManagerEventListener
Parameters:
node - new managed node if known

updatedNode

public void updatedNode(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 PageManagerEventListener
Parameters:
node - updated managed node if known

removedNode

public void removedNode(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 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

setPipeline

public void setPipeline(java.lang.String pipeline)
Description copied from interface: PortalSiteSessionContext
set which pipeline this context is stored for

Specified by:
setPipeline in interface PortalSiteSessionContext

getPipeline

public java.lang.String getPipeline()
Description copied from interface: PortalSiteSessionContext
get which pipeline this context is stored for

Specified by:
getPipeline in interface PortalSiteSessionContext


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