org.exoplatform.frameworks.portletcontainer.portalframework
Class PortalFramework

java.lang.Object
  extended by org.exoplatform.frameworks.portletcontainer.portalframework.PortalFramework

public class PortalFramework
extends Object

Created by The eXo Platform SAS .

Version:
$Id$
Author:
Roman Pedchenko

Constructor Summary
PortalFramework(org.exoplatform.container.ExoContainer cnt)
          Constructor.
 
Method Summary
protected  void addEvents(List<javax.portlet.Event> newEvents)
          Adds events for delivery just after checking of their type.
 void addPortalPage(String page)
           
 String addPortlet(String appName, String portletName)
          Adds a requested portlet by creating a WindowID2 instance for it.
 void addPortletToPage(String portletUniqueId)
           
 void addPortletToPage(String page, String portlet)
           
 String addPortletWithId(String appName, String portletName, String windowId)
          Adds a requested portlet by creating a WindowID2 instance for it with given window ID.
protected  void buildEventDeliveryAndPublicParamsMaps(Map<String,WindowID2> portlets)
          Generates maps for event and public parameters delivery.
protected  boolean checkEventValueType(EventInfo eventInfo)
          Checks whether an event that is about to be delivered has its payload type appropriate to declared.
protected  ActionInput createActionInput()
          Creates ActionInput instance and fills it with appropriate values.
protected  EventInput createEventInput(EventInfo event)
          Creates EventInput instance and fills it with appropriate values.
 void createOrUpdatePortletWindows()
          Method createOrUpdatePortletWindows came from PortletFilter.
protected  RenderInput createRenderInput(String plt)
          Creates RenderInput instance and fills it with appropriate values.
protected  ResourceInput createResourceInput()
          Creates ResourceInput instance and fills it with appropriate values.
 void delPortalPage(String page)
           
protected  void dispatchEvents(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
          Subsequently delivers generated events.
protected  HashMap<String,String[]> fillPublicParams(String pname, HashMap<String,String[]> params)
          For specified portlet adds public params that are supported by the portlet.
 int getAction()
          Returns name of requested action after parsing incoming http request.
 List<String> getAllPortlets()
           
 HashSet<String> getChanges()
          Returns set of portlets that were changed after event processing.
 String getCurrentPage()
           
 String getDesktopLayout()
           
static PortalFramework getInstance()
           
 List<String> getPagePortlets()
           
 List<String> getPagePortlets(String page)
           
 String getPortalName()
          Returns name of parent portal.
 Iterator<String> getPortalPages()
           
protected  HashMap<String,String[]> getPortalParams()
          Returns map of portal parameters after parsing incoming http request.
 String getPortalPortletModeUrl(String id, String mode)
           
 String getPortalWindowStateUrl(String id, String state)
           
protected  String getPortletDisplayName(String plt)
          Returns display name of specified portlet.
protected  boolean getPortletEscapeXml(String plt)
          Returns value of 'javax.portlet.escapeXml' portlet container runtime option for specified portlet.
 ArrayList<PortletInfo> getPortletInfos()
           
protected  Collection<javax.portlet.PortletMode> getPortletModes(String pan, String pn)
          Returns collection of supported portlet modes for specified portlet.
 List<String> getPortletNames()
          Returns set of all portlets currently registered in the portlet container.
protected  HashMap<String,String[]> getPortletParams()
          Returns map of portlet parameters after parsing incoming http request.
 WindowID2 getPortletWindowById(String id)
           
 javax.servlet.http.HttpServletRequest getPresavedHttpRequest()
           
 javax.servlet.http.HttpServletResponse getPresavedHttpResponse()
           
 String getRedirect()
          Returns redirect path (if any) after processing of the portlet request.
 Map<String,Object> getRenderedPortletInfos()
           
 byte[] getResourceContent()
          Returns data generated by serveResource().
 String getResourceContentType()
          Returns serveResource() generated data content type.
 Map<String,String> getResourceHeaders()
          Returns http headers set by serveResource().
 int getResourceStatus()
          Returns http status set by serveResource().
protected  String getTarget()
          Returns name of target portlet after parsing incoming http request.
protected  WindowID2 getWindowID(String plt)
          Returns WindowID object for specified portlet.
protected  Collection<javax.portlet.WindowState> getWindowStates(String pan, String pn)
          Returns collection of supported window states for specified portlet.
 void init(javax.servlet.http.HttpSession actualHttpSession)
          Makes framework initialization for every http request.
protected  void initMaps()
          Initializes event delivery and public parameter mapsm updates or creates (if necessary) portlet window objects.
 void preRenderRequest(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String markupType)
           
protected  ActionOutput processAction(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, ActionInput actionInput)
          Calls processAction() for target portlet and parses its output.
protected  EventOutput processEvent(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, EventInput eventInput, EventInfo event)
          Calls processEvent() for target portlet and parses its output.
 void processRender(List<String> portlets2render)
           
 ArrayList<PortletInfo> processRequest(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String markupType, List<String> list)
          Includes the full cycle of portlet container user http request processing, collects data returned by portlets and returns it to a caller.
 ArrayList<PortletInfo> processRequestForCurrentPage(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String markupType)
          The same as processRequest() but for the currently selected page.
 ArrayList<PortletInfo> processRequestForPage(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String markupType, String page)
          The same as processRequest() but for a specified page.
 void removePortlet(String key)
          Removes a requested portlet by deleting its WindowID2 instance.
 void removePortletFromPages(String id)
           
protected  RenderOutput render(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, RenderInput renderInput)
          Calls render() for target portlet and parses its output.
 PortletInfo renderPortlet(String portlet)
           
protected  ResourceOutput serveResource(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, ResourceInput resourceInput)
          Calls serveResource() for target portlet and parses its output.
 void setCurrentPage(String currentPage)
           
 void setDesktopLayout(String layout)
           
static void setInstance(PortalFramework framework)
           
 void setPagePortlets(List<String> portlets)
           
 void setPagePortlets(String page, List<String> portlets)
           
protected  void setParams(javax.servlet.http.HttpServletRequest httpRequest, String currCntType)
          Parses incoming http request parameters, sets up requested action, target portlet (if any) for the requested action, and changes portlet mode and window state for the target portlet if requested.
static void setPortalParamNames(String[] names)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortalFramework

public PortalFramework(org.exoplatform.container.ExoContainer cnt)
Constructor.

Parameters:
cnt - portal container
Method Detail

setInstance

public static void setInstance(PortalFramework framework)

getInstance

public static PortalFramework getInstance()

setPortalParamNames

public static void setPortalParamNames(String[] names)

getPortalName

public final String getPortalName()
Returns name of parent portal.

Returns:
name of parent portal

getTarget

protected final String getTarget()
Returns name of target portlet after parsing incoming http request.

Returns:
name of target portlet

getAction

public final int getAction()
Returns name of requested action after parsing incoming http request.

Returns:
name of requested action

getRedirect

public final String getRedirect()
Returns redirect path (if any) after processing of the portlet request.

Returns:
redirect path or null

getChanges

public final HashSet<String> getChanges()
Returns set of portlets that were changed after event processing.

Returns:
set of portlet names. The returned set may be empty

getPortletNames

public final List<String> getPortletNames()
Returns set of all portlets currently registered in the portlet container.

Returns:
set of portlet names

getResourceContent

public final byte[] getResourceContent()
Returns data generated by serveResource().

Returns:
portlet resource binary data

getResourceContentType

public final String getResourceContentType()
Returns serveResource() generated data content type.

Returns:
portlet resource content type

getResourceHeaders

public final Map<String,String> getResourceHeaders()
Returns http headers set by serveResource().

Returns:
http headers map

getResourceStatus

public final int getResourceStatus()
Returns http status set by serveResource().

Returns:
status

getDesktopLayout

public String getDesktopLayout()
Returns:
portal layout

setDesktopLayout

public void setDesktopLayout(String layout)
Parameters:
layout - portal layout

init

public final void init(javax.servlet.http.HttpSession actualHttpSession)
Makes framework initialization for every http request.

Parameters:
actualHttpSession - actual http session

getPortletModes

protected final Collection<javax.portlet.PortletMode> getPortletModes(String pan,
                                                                      String pn)
Returns collection of supported portlet modes for specified portlet.

Parameters:
pan - portlet application name
pn - portlet name infer
Returns:
collection of javax.portlet.PortletMode

getWindowStates

protected final Collection<javax.portlet.WindowState> getWindowStates(String pan,
                                                                      String pn)
Returns collection of supported window states for specified portlet.

Parameters:
pan - portlet application name
pn - portlet name
Returns:
collection of javax.portlet.WindowState

getPortletDisplayName

protected final String getPortletDisplayName(String plt)
Returns display name of specified portlet.

Parameters:
plt - portlet name
Returns:
display name of a portlet

getWindowID

protected final WindowID2 getWindowID(String plt)
Returns WindowID object for specified portlet.

Parameters:
plt - portlet name
Returns:
WindowID

getPortalParams

protected final HashMap<String,String[]> getPortalParams()
Returns map of portal parameters after parsing incoming http request.

Returns:
map of mixed java.lang.String and java.lang.String[]

getPortletParams

protected final HashMap<String,String[]> getPortletParams()
Returns map of portlet parameters after parsing incoming http request.

Returns:
map of mixed java.lang.String and java.lang.String[]

setParams

protected final void setParams(javax.servlet.http.HttpServletRequest httpRequest,
                               String currCntType)
Parses incoming http request parameters, sets up requested action, target portlet (if any) for the requested action, and changes portlet mode and window state for the target portlet if requested.

Parameters:
httpRequest - actual portal http request
currCntType - portal content type

initMaps

protected final void initMaps()
Initializes event delivery and public parameter mapsm updates or creates (if necessary) portlet window objects.


addPortlet

public final String addPortlet(String appName,
                               String portletName)
                        throws PortletNotFoundException
Adds a requested portlet by creating a WindowID2 instance for it.

Parameters:
appName - portlet application name
portletName - portlet name
Returns:
unique Id
Throws:
PortletNotFoundException - requested portlet isn't registered on the portlet container

addPortletWithId

public final String addPortletWithId(String appName,
                                     String portletName,
                                     String windowId)
                              throws PortletNotFoundException
Adds a requested portlet by creating a WindowID2 instance for it with given window ID.

Parameters:
appName - portlet application name
portletName - portlet name
windowId - window ID
Returns:
unique Id
Throws:
PortletNotFoundException - requested portlet isn't registered on the portlet container

getPortletWindowById

public final WindowID2 getPortletWindowById(String id)
Parameters:
id - window ID
Returns:
portlet window

removePortlet

public final void removePortlet(String key)
Removes a requested portlet by deleting its WindowID2 instance.

Parameters:
key - portlet unique key

getAllPortlets

public List<String> getAllPortlets()
Returns:
list of portlets currently added to the portal

getPagePortlets

public List<String> getPagePortlets(String page)
Parameters:
page - page key
Returns:
list of portlets currently added to the specified portal page

getPagePortlets

public List<String> getPagePortlets()
Returns:
list of portlets currently added to the current portal page

setPagePortlets

public void setPagePortlets(String page,
                            List<String> portlets)
Parameters:
page - page key
portlets - list of portlets the specified portal page to contain

setPagePortlets

public void setPagePortlets(List<String> portlets)
Parameters:
portlets - list of portlets the current portal page to contain

addPortletToPage

public void addPortletToPage(String page,
                             String portlet)
Parameters:
page - page key
portlet - portlet key

addPortletToPage

public void addPortletToPage(String portletUniqueId)
Parameters:
portletUniqueId - portlet key

removePortletFromPages

public void removePortletFromPages(String id)
Parameters:
id - portlet window id

getPortalPages

public Iterator<String> getPortalPages()
Returns:
iterator by page names

getCurrentPage

public String getCurrentPage()
Returns:
the currentPage

setCurrentPage

public void setCurrentPage(String currentPage)
Parameters:
currentPage - the currentPage to set

addPortalPage

public void addPortalPage(String page)
Parameters:
currentPage - the currentPage to set

delPortalPage

public void delPortalPage(String page)
Parameters:
currentPage - the currentPage to set

buildEventDeliveryAndPublicParamsMaps

protected final void buildEventDeliveryAndPublicParamsMaps(Map<String,WindowID2> portlets)
Generates maps for event and public parameters delivery.

Parameters:
portlets - map of portlet metadata objects

fillPublicParams

protected final HashMap<String,String[]> fillPublicParams(String pname,
                                                          HashMap<String,String[]> params)
For specified portlet adds public params that are supported by the portlet.

Parameters:
pname - portlet name
params - actual parameters map
Returns:
map with parameters that are available to specified portlet

getPortletEscapeXml

protected final boolean getPortletEscapeXml(String plt)
Returns value of 'javax.portlet.escapeXml' portlet container runtime option for specified portlet.

Parameters:
plt - portlet name
Returns:
either 'javax.portlet.escapeXml' portlet container runtime option is set

checkEventValueType

protected final boolean checkEventValueType(EventInfo eventInfo)
Checks whether an event that is about to be delivered has its payload type appropriate to declared.

Parameters:
eventInfo - event to check its payload
Returns:
whether payload type valid or not

addEvents

protected final void addEvents(List<javax.portlet.Event> newEvents)
Adds events for delivery just after checking of their type.

Parameters:
newEvents - list of new events to add to delivery queue

createResourceInput

protected final ResourceInput createResourceInput()
Creates ResourceInput instance and fills it with appropriate values.

Returns:
resource input object

createActionInput

protected final ActionInput createActionInput()
Creates ActionInput instance and fills it with appropriate values.

Returns:
action input object

createEventInput

protected final EventInput createEventInput(EventInfo event)
Creates EventInput instance and fills it with appropriate values.

Parameters:
event - event to deliver
Returns:
event input object

createRenderInput

protected final RenderInput createRenderInput(String plt)
Creates RenderInput instance and fills it with appropriate values.

Parameters:
plt - name of portlet to render
Returns:
render input object

serveResource

protected final ResourceOutput serveResource(javax.servlet.http.HttpServletRequest httpRequest,
                                             javax.servlet.http.HttpServletResponse httpResponse,
                                             ResourceInput resourceInput)
                                      throws PortletContainerException
Calls serveResource() for target portlet and parses its output.

Parameters:
httpRequest - http servlet request
httpResponse - http servlet response
resourceInput - resource input object
Returns:
resource output object
Throws:
PortletContainerException - exception

processAction

protected final ActionOutput processAction(javax.servlet.http.HttpServletRequest httpRequest,
                                           javax.servlet.http.HttpServletResponse httpResponse,
                                           ActionInput actionInput)
                                    throws PortletContainerException
Calls processAction() for target portlet and parses its output.

Parameters:
httpRequest - http servlet request
httpResponse - http servlet response
actionInput - action input object
Returns:
action output object
Throws:
PortletContainerException

processEvent

protected final EventOutput processEvent(javax.servlet.http.HttpServletRequest httpRequest,
                                         javax.servlet.http.HttpServletResponse httpResponse,
                                         EventInput eventInput,
                                         EventInfo event)
                                  throws PortletContainerException
Calls processEvent() for target portlet and parses its output.

Parameters:
httpRequest - http servlet request
httpResponse - http servlet response
eventInput - event input object
event - event to deliver
Returns:
event output object
Throws:
PortletContainerException

render

protected final RenderOutput render(javax.servlet.http.HttpServletRequest httpRequest,
                                    javax.servlet.http.HttpServletResponse httpResponse,
                                    RenderInput renderInput)
                             throws PortletContainerException
Calls render() for target portlet and parses its output.

Parameters:
httpRequest - http servlet request
httpResponse - http servlet response
renderInput - render input object
Returns:
render output object
Throws:
PortletContainerException

dispatchEvents

protected final void dispatchEvents(javax.servlet.ServletContext ctx,
                                    javax.servlet.http.HttpServletRequest httpRequest,
                                    javax.servlet.http.HttpServletResponse httpResponse)
Subsequently delivers generated events.

Parameters:
ctx - servlet context
httpRequest - http servlet request
httpResponse - http servlet response

processRequestForCurrentPage

public final ArrayList<PortletInfo> processRequestForCurrentPage(javax.servlet.ServletContext ctx,
                                                                 javax.servlet.http.HttpServletRequest httpRequest,
                                                                 javax.servlet.http.HttpServletResponse httpResponse,
                                                                 String markupType)
The same as processRequest() but for the currently selected page.

Parameters:
ctx - servlet context
httpRequest - http servlet request
httpResponse - http servlet response
markupType - portal mark up type
Returns:
array of PortletInfo objects

processRequestForPage

public final ArrayList<PortletInfo> processRequestForPage(javax.servlet.ServletContext ctx,
                                                          javax.servlet.http.HttpServletRequest httpRequest,
                                                          javax.servlet.http.HttpServletResponse httpResponse,
                                                          String markupType,
                                                          String page)
The same as processRequest() but for a specified page.

Parameters:
ctx - servlet context
httpRequest - http servlet request
httpResponse - http servlet response
markupType - portal mark up type
page - page key
Returns:
array of PortletInfo objects

processRequest

public final ArrayList<PortletInfo> processRequest(javax.servlet.ServletContext ctx,
                                                   javax.servlet.http.HttpServletRequest httpRequest,
                                                   javax.servlet.http.HttpServletResponse httpResponse,
                                                   String markupType,
                                                   List<String> list)
Includes the full cycle of portlet container user http request processing, collects data returned by portlets and returns it to a caller.

Parameters:
ctx - servlet context
httpRequest - http servlet request
httpResponse - http servlet response
markupType - portal mark up type
list - list of requested portlet names
Returns:
array of PortletInfo objects

getPortalPortletModeUrl

public String getPortalPortletModeUrl(String id,
                                      String mode)

getPortalWindowStateUrl

public String getPortalWindowStateUrl(String id,
                                      String state)

preRenderRequest

public void preRenderRequest(javax.servlet.ServletContext ctx,
                             javax.servlet.http.HttpServletRequest httpRequest,
                             javax.servlet.http.HttpServletResponse httpResponse,
                             String markupType)
Parameters:
ctx -
httpRequest -
httpResponse -
markupType -

renderPortlet

public PortletInfo renderPortlet(String portlet)
Parameters:
httpRequest -
httpResponse -
portlet -
Returns:

getRenderedPortletInfos

public Map<String,Object> getRenderedPortletInfos()

createOrUpdatePortletWindows

public void createOrUpdatePortletWindows()
Method createOrUpdatePortletWindows came from PortletFilter.


processRender

public void processRender(List<String> portlets2render)

getPortletInfos

public ArrayList<PortletInfo> getPortletInfos()

getPresavedHttpRequest

public javax.servlet.http.HttpServletRequest getPresavedHttpRequest()
Returns:
the presavedHttpRequest

getPresavedHttpResponse

public javax.servlet.http.HttpServletResponse getPresavedHttpResponse()
Returns:
the presavedHttpResponse


Copyright © 2009 eXo Platform SAS. All Rights Reserved.