org.jasig.portal.portlet.registry
Class PortletWindowRegistryImpl

java.lang.Object
  extended by org.jasig.portal.portlet.registry.PortletWindowRegistryImpl
All Implemented Interfaces:
IPortletWindowRegistry
Direct Known Subclasses:
TransientPortletWindowRegistryImpl

public class PortletWindowRegistryImpl
extends Object
implements IPortletWindowRegistry

Provides the default implementation of the window registry, the backing for the storage of IPortletWindow objects is a Map stored in the HttpSession for the user.

Version:
$Revision$
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
static String PORTLET_WINDOW_MAP_ATTRIBUTE
           
static String TRANSIENT_PORTLET_WINDOW_MAP_ATTRIBUTE
           
static String TRANSIENT_WINDOW_ID_PREFIX
           
 
Constructor Summary
PortletWindowRegistryImpl()
           
 
Method Summary
 IPortletWindow convertPortletWindow(HttpServletRequest request, org.apache.pluto.PortletWindow plutoPortletWindow)
          Converts a Pluto PortletWindow object to a uPortal IPortletWindow.
 IPortletWindow createDefaultPortletWindow(HttpServletRequest request, IPortletEntityId portletEntityId)
          Creates a new portlet window that will have the ID returned by IPortletWindowRegistry.getDefaultPortletWindowId(IPortletEntityId) from the specified parent entity id.
 IPortletWindow createDelegatePortletWindow(HttpServletRequest request, IPortletEntityId portletEntityId, IPortletWindowId delegationParentId)
          Creates a delegating portlet window
protected  IPortletWindow createPortletWindow(HttpServletRequest request, IPortletWindowId portletWindowId, IPortletEntityId portletEntityId)
           
protected  IPortletWindow createPortletWindow(HttpServletRequest request, IPortletWindowId portletWindowId, IPortletEntityId portletEntityId, IPortletWindowId delegateParent)
          Creates a new IPortletWindow for the specified window ID and entity ID.
 IPortletWindow createPortletWindow(HttpServletRequest request, String windowInstanceId, IPortletEntityId portletEntityId)
          Creates a new portlet window for the window instance id and parent entity id.
protected  IPortletWindowId createPortletWindowId(String windowInstanceId, IPortletEntityId portletEntityId)
          Generates a new, unique, portlet window ID for the window instance ID & entity id.
 IPortletWindowId createTransientPortletWindowId(HttpServletRequest request, IPortletWindowId sourcePortletWindowId)
          Creates an ID for a transient portlet window
 IPortletWindowId getDefaultPortletWindowId(IPortletEntityId portletEntityId)
          Creates the default portlet window ID given the ID of the entity the window is based on.
 IPortletWindow getOrCreateDefaultPortletWindow(HttpServletRequest request, IPortletEntityId portletEntityId)
          Get an existing portlet window for the default window id and parent entity id.
 IPortletWindow getOrCreateDelegatePortletWindow(HttpServletRequest request, IPortletWindowId portletWindowId, IPortletEntityId portletEntityId, IPortletWindowId delegationParentId)
          Gets or Creates a delegating portlet window.
 IPortletWindow getOrCreatePortletWindow(HttpServletRequest request, String windowInstanceId, IPortletEntityId portletEntityId)
          Get an existing portlet window for the window instance id and parent entity id.
 IPortletEntity getParentPortletEntity(HttpServletRequest request, IPortletWindowId portletWindowId)
          Gets the parent portlet entity for the window specified by the window id.
 IPortletDefinitionRegistry getPortletDefinitionRegistry()
           
 IPortletEntityRegistry getPortletEntityRegistry()
           
 IPortletWindow getPortletWindow(HttpServletRequest request, IPortletWindowId portletWindowId)
          Get an existing portlet window for the window id.
 IPortletWindow getPortletWindow(HttpServletRequest request, String windowInstanceId, IPortletEntityId portletEntityId)
          Get an existing portlet window for the channel window instance id and entity id.
 IPortletWindowId getPortletWindowId(String portletWindowId)
          Creates an IPortletWindowId for the specified string identifier
protected  ConcurrentMap<IPortletWindowId,IPortletWindow> getPortletWindowMap(HttpServletRequest request)
          Get the Map of IPortletWindows for the request.
protected  HttpSession getSession(HttpServletRequest request)
          Gets the session for the request.
protected  IPortletWindow getTransientPortletWindow(HttpServletRequest request, String windowInstanceId, IPortletEntityId portletEntityId)
           
 IUserInstanceManager getUserInstanceManager()
           
protected  void initializePortletWindow(HttpServletRequest request, IPortletEntityId portletEntityId, org.jasig.portal.portlet.registry.PortletWindowImpl portletWindow)
          Initializes a newly created PortletWindow, the default implementation sets up the appropriate WindowState and PortletMode
 boolean isTransient(HttpServletRequest request, IPortletWindowId portletWindowId)
           
 void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
           
 void setPortletEntityRegistry(IPortletEntityRegistry portletEntityRegistry)
           
 void setUserInstanceManager(IUserInstanceManager userInstanceManager)
           
protected  void storePortletWindow(HttpServletRequest request, IPortletWindow portletWindow)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSIENT_WINDOW_ID_PREFIX

public static final String TRANSIENT_WINDOW_ID_PREFIX
See Also:
Constant Field Values

TRANSIENT_PORTLET_WINDOW_MAP_ATTRIBUTE

public static final String TRANSIENT_PORTLET_WINDOW_MAP_ATTRIBUTE

PORTLET_WINDOW_MAP_ATTRIBUTE

public static final String PORTLET_WINDOW_MAP_ATTRIBUTE

logger

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

PortletWindowRegistryImpl

public PortletWindowRegistryImpl()
Method Detail

getUserInstanceManager

public IUserInstanceManager getUserInstanceManager()
Returns:
the userInstanceManager

setUserInstanceManager

public void setUserInstanceManager(IUserInstanceManager userInstanceManager)
Parameters:
userInstanceManager - the userInstanceManager to set

getPortletEntityRegistry

public IPortletEntityRegistry getPortletEntityRegistry()
Returns:
the portletEntityRegistry

setPortletEntityRegistry

public void setPortletEntityRegistry(IPortletEntityRegistry portletEntityRegistry)
Parameters:
portletEntityRegistry - the portletEntityRegistry to set

getPortletDefinitionRegistry

public IPortletDefinitionRegistry getPortletDefinitionRegistry()
Returns:
the portletDefinitionRegistry

setPortletDefinitionRegistry

public void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
Parameters:
portletDefinitionRegistry - the portletDefinitionRegistry to set

convertPortletWindow

public IPortletWindow convertPortletWindow(HttpServletRequest request,
                                           org.apache.pluto.PortletWindow plutoPortletWindow)
Description copied from interface: IPortletWindowRegistry
Converts a Pluto PortletWindow object to a uPortal IPortletWindow.

Specified by:
convertPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The request related to the window objects
plutoPortletWindow - The Pluto PortletWindow to convert from
Returns:
The corresponding uPortal IPortletWindow, will not be null.

createPortletWindow

public IPortletWindow createPortletWindow(HttpServletRequest request,
                                          String windowInstanceId,
                                          IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Creates a new portlet window for the window instance id and parent entity id. If the parent IPortletEntity for the portletEntityId can't be found or a window already exists for the window instance id and entity id an exception will be thrown.

Specified by:
createPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
portletEntityId - The parent entity id.
Returns:
A new window for the parameters

getOrCreatePortletWindow

public IPortletWindow getOrCreatePortletWindow(HttpServletRequest request,
                                               String windowInstanceId,
                                               IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Get an existing portlet window for the window instance id and parent entity id. If no window exists for the parameters a new window will be created and returned. This is a convenience for IPortletWindowRegistry.getPortletWindow(HttpServletRequest, String, IPortletEntityId) and IPortletWindowRegistry.createPortletWindow(HttpServletRequest, String, IPortletEntityId)

Specified by:
getOrCreatePortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
windowInstanceId - The identifier for the instance of the window, such as an id for an inline window and an id for a detached window.
portletEntityId - The parent entity id.
Returns:
An existing window if exists or a new window if not.

getPortletWindow

public IPortletWindow getPortletWindow(HttpServletRequest request,
                                       IPortletWindowId portletWindowId)
Description copied from interface: IPortletWindowRegistry
Get an existing portlet window for the window id. If no window exists for the id null will be returned.

Specified by:
getPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
portletWindowId - The ID of the IPortletWindow to return.
Returns:
The requested IPortletWindow, if no window exists for the ID null will be returned.

getPortletWindow

public IPortletWindow getPortletWindow(HttpServletRequest request,
                                       String windowInstanceId,
                                       IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Get an existing portlet window for the channel window instance id and entity id. If no window exists for the parameters null will be returned.

Specified by:
getPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
windowInstanceId - The identifier for the instance of the window, such as an id for an inline window and an id for a detached window.
portletEntityId - The parent entity id.
Returns:
The existing window, if no window exists for the instance id and entity id null will be returned.

getPortletWindowId

public IPortletWindowId getPortletWindowId(String portletWindowId)
Description copied from interface: IPortletWindowRegistry
Creates an IPortletWindowId for the specified string identifier

Specified by:
getPortletWindowId in interface IPortletWindowRegistry
Parameters:
portletWindowId - The string represenation of the portlet window ID.
Returns:
The IPortletWindowId for the string

getDefaultPortletWindowId

public IPortletWindowId getDefaultPortletWindowId(IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Creates the default portlet window ID given the ID of the entity the window is based on.

Specified by:
getDefaultPortletWindowId in interface IPortletWindowRegistry
Parameters:
portletEntityId - The id of the entity to base the window ID on
Returns:
The default window id for the entity

getParentPortletEntity

public IPortletEntity getParentPortletEntity(HttpServletRequest request,
                                             IPortletWindowId portletWindowId)
Description copied from interface: IPortletWindowRegistry
Gets the parent portlet entity for the window specified by the window id.

Specified by:
getParentPortletEntity in interface IPortletWindowRegistry
Parameters:
request - The request related to the window objects
portletWindowId - The window ID to get the parent entity for.
Returns:
The parent portlet entity for the window, null if no window exists for the id.

createDefaultPortletWindow

public IPortletWindow createDefaultPortletWindow(HttpServletRequest request,
                                                 IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Creates a new portlet window that will have the ID returned by IPortletWindowRegistry.getDefaultPortletWindowId(IPortletEntityId) from the specified parent entity id. If the parent IPortletEntity for the portletEntityId can't be found or a window already exists for the default window id and entity id an exception will be thrown.

Specified by:
createDefaultPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
portletEntityId - The parent entity id.
Returns:
A new window for the parameters

getOrCreateDefaultPortletWindow

public IPortletWindow getOrCreateDefaultPortletWindow(HttpServletRequest request,
                                                      IPortletEntityId portletEntityId)
Description copied from interface: IPortletWindowRegistry
Get an existing portlet window for the default window id and parent entity id. If no window exists for the parameters a new window will be created and returned. This is a convenience for IPortletWindowRegistry.getDefaultPortletWindowId(IPortletEntityId), IPortletWindowRegistry.getPortletWindow(HttpServletRequest, IPortletWindowId) and IPortletWindowRegistry.createDefaultPortletWindow(HttpServletRequest, IPortletEntityId)

Specified by:
getOrCreateDefaultPortletWindow in interface IPortletWindowRegistry
Parameters:
request - The current request.
portletEntityId - The parent entity id.
Returns:
An existing window if exists or a new window if not.

createDelegatePortletWindow

public IPortletWindow createDelegatePortletWindow(HttpServletRequest request,
                                                  IPortletEntityId portletEntityId,
                                                  IPortletWindowId delegationParentId)
Description copied from interface: IPortletWindowRegistry
Creates a delegating portlet window

Specified by:
createDelegatePortletWindow in interface IPortletWindowRegistry
portletEntityId - The parent entity id for the window if it doesn't already exist
delegationParentId - The ID of the parent portlet window
Returns:
The IPortletWindow that is a delegate of the parent

getOrCreateDelegatePortletWindow

public IPortletWindow getOrCreateDelegatePortletWindow(HttpServletRequest request,
                                                       IPortletWindowId portletWindowId,
                                                       IPortletEntityId portletEntityId,
                                                       IPortletWindowId delegationParentId)
Description copied from interface: IPortletWindowRegistry
Gets or Creates a delegating portlet window.

Specified by:
getOrCreateDelegatePortletWindow in interface IPortletWindowRegistry
portletWindowId - The ID of the delegate portlet window
portletEntityId - The parent entity id for the window if it doesn't already exist
delegationParentId - The ID of the parent portlet window
Returns:
The IPortletWindow that is a delegate of the parent

createTransientPortletWindowId

public IPortletWindowId createTransientPortletWindowId(HttpServletRequest request,
                                                       IPortletWindowId sourcePortletWindowId)
Description copied from interface: IPortletWindowRegistry
Creates an ID for a transient portlet window

Specified by:
createTransientPortletWindowId in interface IPortletWindowRegistry
Returns:
The IPortletWindowId for the string

isTransient

public boolean isTransient(HttpServletRequest request,
                           IPortletWindowId portletWindowId)
Specified by:
isTransient in interface IPortletWindowRegistry
Parameters:
request - The current portal request
portletWindowId - The window ID to check
Returns:
true if the window id is for a transient window.

createPortletWindow

protected IPortletWindow createPortletWindow(HttpServletRequest request,
                                             IPortletWindowId portletWindowId,
                                             IPortletEntityId portletEntityId)
See Also:
#createPortletWindow(IPortletWindowId, IPortletEntityId, IPortletWindowId)

createPortletWindow

protected IPortletWindow createPortletWindow(HttpServletRequest request,
                                             IPortletWindowId portletWindowId,
                                             IPortletEntityId portletEntityId,
                                             IPortletWindowId delegateParent)
Creates a new IPortletWindow for the specified window ID and entity ID.

Parameters:
windowInstanceId - The window instance id.
portletEntityId - The parent entity id.
delegateParent - The id of the parent window delegating to this window, optional.
Returns:
A new portlet window

initializePortletWindow

protected void initializePortletWindow(HttpServletRequest request,
                                       IPortletEntityId portletEntityId,
                                       org.jasig.portal.portlet.registry.PortletWindowImpl portletWindow)
Initializes a newly created PortletWindow, the default implementation sets up the appropriate WindowState and PortletMode


createPortletWindowId

protected IPortletWindowId createPortletWindowId(String windowInstanceId,
                                                 IPortletEntityId portletEntityId)
Generates a new, unique, portlet window ID for the window instance ID & entity id.

Parameters:
windowInstanceId - The window instance id.
portletEntityId - The parent entity id.
Returns:
A portlet window id for the parameters.

getPortletWindowMap

protected ConcurrentMap<IPortletWindowId,IPortletWindow> getPortletWindowMap(HttpServletRequest request)
Get the Map of IPortletWindows for the request.

Parameters:
request - the current request
Returns:
The Map of IPortletWindows managed by this class for the request, null if that Map does not yet exist.

storePortletWindow

protected void storePortletWindow(HttpServletRequest request,
                                  IPortletWindow portletWindow)
Parameters:
request -
portletWindow -

getSession

protected HttpSession getSession(HttpServletRequest request)
Gets the session for the request.

Parameters:
request - The current request
Returns:
The session for the current request, will not return null.

getTransientPortletWindow

protected IPortletWindow getTransientPortletWindow(HttpServletRequest request,
                                                   String windowInstanceId,
                                                   IPortletEntityId portletEntityId)


Copyright © 2010 Jasig. All Rights Reserved.