org.apache.jetspeed.aggregator.impl
Class PortletRendererImpl

java.lang.Object
  extended by org.apache.jetspeed.aggregator.impl.PortletRendererImpl
All Implemented Interfaces:
PortletRenderer

public class PortletRendererImpl
extends java.lang.Object
implements PortletRenderer

PortletRendererService
Jetspeed-2 Rendering service.

This service process all portlet rendering requests and interfaces with the portlet container to generate the resulting markup

Version:
$Id: PortletRendererImpl.java,v 1.30 2005/05/20 14:54:22 ate Exp $
Author:
Rapha???l Luta , David Sean Taylor, Woonsan Ko

Field Summary
protected  SecurityAccessController accessController
          For security constraint checks
protected  DynamicTitleService addTitleService
           
protected  boolean checkSecurityConstraints
          flag indicating whether to check jetspeed-portlet.xml security constraints before rendering a portlet.
protected  org.apache.pluto.PortletContainer container
           
protected static org.apache.commons.logging.Log log
           
static java.lang.String OUT_OF_SERVICE_MESSAGE
           
protected  boolean overrideTitles
          OutOfService Cache
protected  JetspeedCache portletContentCache
          JSR 168 Portlet Content Cache
protected  PortletTrackingManager portletTracking
           
protected  PortalStatistics statistics
           
protected  PortletWindowAccessor windowAccessor
           
protected  WorkerMonitor workMonitor
           
 
Constructor Summary
PortletRendererImpl(org.apache.pluto.PortletContainer container, PortletWindowAccessor windowAccessor, WorkerMonitor workMonitor)
           
PortletRendererImpl(org.apache.pluto.PortletContainer container, PortletWindowAccessor windowAccessor, WorkerMonitor workMonitor, PortalStatistics statistics)
           
PortletRendererImpl(org.apache.pluto.PortletContainer container, PortletWindowAccessor windowAccessor, WorkerMonitor workMonitor, PortalStatistics statistics, DynamicTitleService addTitleService)
           
PortletRendererImpl(org.apache.pluto.PortletContainer container, PortletWindowAccessor windowAccessor, WorkerMonitor workMonitor, PortalStatistics statistics, DynamicTitleService addTitleService, PortletTrackingManager portletTracking, boolean checkSecurityConstraints, SecurityAccessController accessController, JetspeedCache portletContentCache)
           
PortletRendererImpl(org.apache.pluto.PortletContainer container, PortletWindowAccessor windowAccessor, WorkerMonitor workMonitor, PortalStatistics statistics, DynamicTitleService addTitleService, PortletTrackingManager portletTracking, boolean checkSecurityConstraints, SecurityAccessController accessController, JetspeedCache portletContentCache, boolean overrideTitles)
           
 
Method Summary
 void addTitleToHeader(org.apache.pluto.om.window.PortletWindow portletWindow, ContentFragment fragment, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ContentDispatcherCtrl dispatcher, boolean isCacheTitle)
          Set title of portlet window.
protected  void addToCache(PortletContent content)
           
protected  RenderingJob buildRenderingJob(org.apache.pluto.om.window.PortletWindow portletWindow, ContentFragment fragment, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, RequestContext requestContext, boolean isParallel, PortletDefinitionComposite portletDefinition, ContentDispatcherCtrl dispatcher, PortletContent portletContent, int expirationCache, boolean contentIsCached, long timeoutMetadata)
           
protected  RenderingJob buildRenderingJob(org.apache.pluto.om.window.PortletWindow portletWindow, ContentFragment fragment, RequestContext requestContext, boolean isParallel, PortletDefinitionComposite portletDefinition, PortletContent portletContent, boolean contentIsCached, long timeoutMetadata)
           
protected  boolean checkSecurityConstraint(PortletDefinitionComposite portlet, ContentFragment fragment)
           
 ContentDispatcherCtrl createDispatcher(RequestContext request, ContentFragment fragment, int expirationCache)
           
 RenderingJob createRenderingJob(ContentFragment fragment, RequestContext requestContext)
          Create a rendering job for the specified Page fragment.
 ContentDispatcher getDispatcher(RequestContext request, boolean isParallel)
          Retrieve the ContentDispatcher for the specified request
protected  int getExpirationCache(PortletDefinitionComposite portletDefinition)
           
 PortletTrackingManager getPortletTrackingManager()
           
protected  org.apache.pluto.om.window.PortletWindow getPortletWindow(ContentFragment fragment)
           
protected  long getTimeoutOnJob(PortletDefinitionComposite portletDefinition)
           
 void notifyContentComplete(PortletContent content)
          Notify that content completed by worker jobs So that renderer can update its state
 void processRenderingJob(RenderingJob job)
          Render the specified rendering job.
protected  void processRenderingJob(RenderingJob job, boolean parallelOnly)
           
 RenderingJob render(ContentFragment fragment, RequestContext requestContext)
          Render the specified Page fragment.
 void renderNow(ContentFragment fragment, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Render the specified Page fragment.
 void renderNow(ContentFragment fragment, RequestContext requestContext)
          Render the specified Page fragment.
protected  boolean retrieveCachedContent(RequestContext requestContext, ContentFragment fragment, org.apache.pluto.om.window.PortletWindow portletWindow, int expiration, PortletDefinitionComposite portletDefinition)
          Retrieve cached content, if content retrieved successfully return true, if no content found return false
protected  void setTimeoutOnJob(long timeoutMetadata, RenderingJob rJob)
           
 void start()
           
 void stop()
           
 void waitForRenderingJobs(java.util.List renderingJobs)
          Wait for all rendering jobs in the collection to finish successfully or otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

workMonitor

protected WorkerMonitor workMonitor

container

protected org.apache.pluto.PortletContainer container

windowAccessor

protected PortletWindowAccessor windowAccessor

statistics

protected PortalStatistics statistics

addTitleService

protected DynamicTitleService addTitleService

portletTracking

protected PortletTrackingManager portletTracking

checkSecurityConstraints

protected boolean checkSecurityConstraints
flag indicating whether to check jetspeed-portlet.xml security constraints before rendering a portlet. If security check fails, do not display portlet content


accessController

protected SecurityAccessController accessController
For security constraint checks


portletContentCache

protected JetspeedCache portletContentCache
JSR 168 Portlet Content Cache


overrideTitles

protected boolean overrideTitles
OutOfService Cache


OUT_OF_SERVICE_MESSAGE

public static final java.lang.String OUT_OF_SERVICE_MESSAGE
See Also:
Constant Field Values
Constructor Detail

PortletRendererImpl

public PortletRendererImpl(org.apache.pluto.PortletContainer container,
                           PortletWindowAccessor windowAccessor,
                           WorkerMonitor workMonitor,
                           PortalStatistics statistics,
                           DynamicTitleService addTitleService,
                           PortletTrackingManager portletTracking,
                           boolean checkSecurityConstraints,
                           SecurityAccessController accessController,
                           JetspeedCache portletContentCache,
                           boolean overrideTitles)

PortletRendererImpl

public PortletRendererImpl(org.apache.pluto.PortletContainer container,
                           PortletWindowAccessor windowAccessor,
                           WorkerMonitor workMonitor,
                           PortalStatistics statistics,
                           DynamicTitleService addTitleService,
                           PortletTrackingManager portletTracking,
                           boolean checkSecurityConstraints,
                           SecurityAccessController accessController,
                           JetspeedCache portletContentCache)

PortletRendererImpl

public PortletRendererImpl(org.apache.pluto.PortletContainer container,
                           PortletWindowAccessor windowAccessor,
                           WorkerMonitor workMonitor,
                           PortalStatistics statistics,
                           DynamicTitleService addTitleService)

PortletRendererImpl

public PortletRendererImpl(org.apache.pluto.PortletContainer container,
                           PortletWindowAccessor windowAccessor,
                           WorkerMonitor workMonitor,
                           PortalStatistics statistics)

PortletRendererImpl

public PortletRendererImpl(org.apache.pluto.PortletContainer container,
                           PortletWindowAccessor windowAccessor,
                           WorkerMonitor workMonitor)
Method Detail

start

public void start()

stop

public void stop()

renderNow

public void renderNow(ContentFragment fragment,
                      RequestContext requestContext)
Render the specified Page fragment. Result is returned in the PortletResponse.

Specified by:
renderNow in interface PortletRenderer
Throws:
FailedToRenderFragmentException
FailedToRetrievePortletWindow
UnknownPortletDefinitionException

renderNow

public void renderNow(ContentFragment fragment,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
Render the specified Page fragment. Result is returned in the PortletResponse.

Specified by:
renderNow in interface PortletRenderer
Throws:
FailedToRenderFragmentException
FailedToRetrievePortletWindow
UnknownPortletDefinitionException
PortletAccessDeniedException

getExpirationCache

protected int getExpirationCache(PortletDefinitionComposite portletDefinition)

render

public RenderingJob render(ContentFragment fragment,
                           RequestContext requestContext)
Render the specified Page fragment. The method returns before rendering is complete, rendered content can be accessed through the Content Dispatcher

Specified by:
render in interface PortletRenderer
Returns:
the asynchronous portlet rendering job to synchronize

createRenderingJob

public RenderingJob createRenderingJob(ContentFragment fragment,
                                       RequestContext requestContext)
Create a rendering job for the specified Page fragment. The method returns a rendering job which should be passed to 'processRenderingJob(RenderingJob job)' method.

Specified by:
createRenderingJob in interface PortletRenderer
Returns:
portlet rendering job to pass to render(RenderingJob job) method
Throws:
FailedToRetrievePortletWindow
UnknownPortletDefinitionException
PortletAccessDeniedException

processRenderingJob

public void processRenderingJob(RenderingJob job)
Render the specified rendering job. The method returns before rendering is complete when the job is processed in parallel mode. When it is not parallel mode, it returns after rendering is complete.

Specified by:
processRenderingJob in interface PortletRenderer
Throws:
FailedToRenderFragmentException

processRenderingJob

protected void processRenderingJob(RenderingJob job,
                                   boolean parallelOnly)

waitForRenderingJobs

public void waitForRenderingJobs(java.util.List renderingJobs)
Wait for all rendering jobs in the collection to finish successfully or otherwise.

Specified by:
waitForRenderingJobs in interface PortletRenderer
Parameters:
renderingJobs - the Collection of rendering job objects to wait for.

retrieveCachedContent

protected boolean retrieveCachedContent(RequestContext requestContext,
                                        ContentFragment fragment,
                                        org.apache.pluto.om.window.PortletWindow portletWindow,
                                        int expiration,
                                        PortletDefinitionComposite portletDefinition)
                                 throws java.lang.Exception
Retrieve cached content, if content retrieved successfully return true, if no content found return false

Parameters:
requestContext -
fragment -
portletWindow -
Returns:
true when content found, otherwise false
Throws:
java.lang.Exception

createDispatcher

public ContentDispatcherCtrl createDispatcher(RequestContext request,
                                              ContentFragment fragment,
                                              int expirationCache)

getDispatcher

public ContentDispatcher getDispatcher(RequestContext request,
                                       boolean isParallel)
Retrieve the ContentDispatcher for the specified request

Specified by:
getDispatcher in interface PortletRenderer

getPortletWindow

protected org.apache.pluto.om.window.PortletWindow getPortletWindow(ContentFragment fragment)
                                                             throws FailedToRetrievePortletWindow,
                                                                    PortletEntityNotStoredException
Throws:
FailedToRetrievePortletWindow
PortletEntityNotStoredException

buildRenderingJob

protected RenderingJob buildRenderingJob(org.apache.pluto.om.window.PortletWindow portletWindow,
                                         ContentFragment fragment,
                                         RequestContext requestContext,
                                         boolean isParallel,
                                         PortletDefinitionComposite portletDefinition,
                                         PortletContent portletContent,
                                         boolean contentIsCached,
                                         long timeoutMetadata)
                                  throws PortletAccessDeniedException,
                                         FailedToRetrievePortletWindow,
                                         PortletEntityNotStoredException
Throws:
PortletAccessDeniedException
FailedToRetrievePortletWindow
PortletEntityNotStoredException

buildRenderingJob

protected RenderingJob buildRenderingJob(org.apache.pluto.om.window.PortletWindow portletWindow,
                                         ContentFragment fragment,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response,
                                         RequestContext requestContext,
                                         boolean isParallel,
                                         PortletDefinitionComposite portletDefinition,
                                         ContentDispatcherCtrl dispatcher,
                                         PortletContent portletContent,
                                         int expirationCache,
                                         boolean contentIsCached,
                                         long timeoutMetadata)
                                  throws PortletAccessDeniedException,
                                         FailedToRetrievePortletWindow,
                                         PortletEntityNotStoredException
Throws:
PortletAccessDeniedException
FailedToRetrievePortletWindow
PortletEntityNotStoredException

getTimeoutOnJob

protected long getTimeoutOnJob(PortletDefinitionComposite portletDefinition)

setTimeoutOnJob

protected void setTimeoutOnJob(long timeoutMetadata,
                               RenderingJob rJob)

addTitleToHeader

public void addTitleToHeader(org.apache.pluto.om.window.PortletWindow portletWindow,
                             ContentFragment fragment,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             ContentDispatcherCtrl dispatcher,
                             boolean isCacheTitle)
Description copied from interface: PortletRenderer
Set title of portlet window.

Specified by:
addTitleToHeader in interface PortletRenderer

checkSecurityConstraint

protected boolean checkSecurityConstraint(PortletDefinitionComposite portlet,
                                          ContentFragment fragment)

addToCache

protected void addToCache(PortletContent content)

notifyContentComplete

public void notifyContentComplete(PortletContent content)
Description copied from interface: PortletRenderer
Notify that content completed by worker jobs So that renderer can update its state

Specified by:
notifyContentComplete in interface PortletRenderer

getPortletTrackingManager

public PortletTrackingManager getPortletTrackingManager()
Specified by:
getPortletTrackingManager in interface PortletRenderer


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