uPortal 2.4.1
API Documentation

org.jasig.portal.channels.portlet
Class CPortletAdapter

java.lang.Object
  extended byorg.jasig.portal.channels.portlet.CPortletAdapter
All Implemented Interfaces:
IMultithreadedCacheable, IMultithreadedChannel, IMultithreadedCharacterChannel, IMultithreadedDirectResponse, IMultithreadedPrivileged

public class CPortletAdapter
extends java.lang.Object
implements IMultithreadedCharacterChannel, IMultithreadedPrivileged, IMultithreadedCacheable, IMultithreadedDirectResponse

A JSR 168 Portlet adapter that presents a portlet through the uPortal channel interface.

There is a related channel type called "Portlet Adapter" that is included with uPortal, so to use this channel, just select the "Portlet" type when publishing.

Note: A portlet can specify the String "password" in the user attributes section of the portlet.xml. In this is done, this adapter will look for the user's cached password. If the user's password is being stored in memory by a caching security context, the adapter will consult the cache to fill the request for the attribute. If the user's password is not cached, null will be set for the attributes value.

Version:
$Revision: 1.45.2.3 $
Author:
Ken Weiner, kweiner@unicon.net

Field Summary
static java.lang.String portletPreferenceNamePrefix
           
 
Constructor Summary
CPortletAdapter()
           
 
Method Summary
 ChannelCacheKey generateKey(java.lang.String uid)
          Generates a channel cache key.
 ChannelRuntimeProperties getRuntimeProperties(java.lang.String uid)
          Sets channel runtime properties.
 boolean isCacheValid(java.lang.Object validity, java.lang.String uid)
          Determines whether the cached content for this channel is still valid.
 void receiveEvent(PortalEvent ev, java.lang.String uid)
          React to portal events.
 void renderCharacters(java.io.PrintWriter pw, java.lang.String uid)
          Output channel content to the portal as raw characters
 void renderXML(org.xml.sax.ContentHandler out, java.lang.String uid)
          Output channel content to the portal.
 void setPortalControlStructures(PortalControlStructures pcs, java.lang.String uid)
          Sets the portal control structures.
 void setResponse(java.lang.String uid, javax.servlet.http.HttpServletResponse response)
          Sets the HttpServletResponse for the channel to use.
 void setRuntimeData(ChannelRuntimeData rd, java.lang.String uid)
          Sets the channel runtime data.
static void setServletConfig(javax.servlet.ServletConfig config)
          Receive the servlet config from uPortal's PortalSessionManager servlet.
 void setStaticData(ChannelStaticData sd, java.lang.String uid)
          Sets the channel static data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portletPreferenceNamePrefix

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

CPortletAdapter

public CPortletAdapter()
Method Detail

setServletConfig

public static void setServletConfig(javax.servlet.ServletConfig config)
Receive the servlet config from uPortal's PortalSessionManager servlet. Pluto needs access to this object from serveral places.

Parameters:
config - the servlet config

getRuntimeProperties

public ChannelRuntimeProperties getRuntimeProperties(java.lang.String uid)
Sets channel runtime properties.

Specified by:
getRuntimeProperties in interface IMultithreadedChannel
Parameters:
uid - a unique ID used to identify the state of the channel
Returns:
channel runtime properties

receiveEvent

public void receiveEvent(PortalEvent ev,
                         java.lang.String uid)
React to portal events. Removes channel state from the channel state map when the session expires.

Specified by:
receiveEvent in interface IMultithreadedChannel
Parameters:
ev - a portal event
uid - a unique ID used to identify the state of the channel

setStaticData

public void setStaticData(ChannelStaticData sd,
                          java.lang.String uid)
                   throws PortalException
Sets the channel static data.

Specified by:
setStaticData in interface IMultithreadedChannel
Parameters:
sd - the channel static data
uid - a unique ID used to identify the state of the channel
Throws:
PortalException

setRuntimeData

public void setRuntimeData(ChannelRuntimeData rd,
                           java.lang.String uid)
                    throws PortalException
Sets the channel runtime data.

Specified by:
setRuntimeData in interface IMultithreadedChannel
Parameters:
rd - the channel runtime data
uid - a unique ID used to identify the state of the channel
Throws:
PortalException

setPortalControlStructures

public void setPortalControlStructures(PortalControlStructures pcs,
                                       java.lang.String uid)
                                throws PortalException
Sets the portal control structures.

Specified by:
setPortalControlStructures in interface IMultithreadedPrivileged
Parameters:
pcs - the portal control structures
uid - a unique ID used to identify the state of the channel
Throws:
PortalException
See Also:
PortalControlStructures

renderCharacters

public void renderCharacters(java.io.PrintWriter pw,
                             java.lang.String uid)
                      throws PortalException
Output channel content to the portal as raw characters

Specified by:
renderCharacters in interface IMultithreadedCharacterChannel
Parameters:
pw - a print writer
uid - a unique ID used to identify the state of the channel
Throws:
PortalException - if an error occurs

renderXML

public void renderXML(org.xml.sax.ContentHandler out,
                      java.lang.String uid)
               throws PortalException
Output channel content to the portal. This version of the render method is normally not used since this is a "character channel".

Specified by:
renderXML in interface IMultithreadedChannel
Parameters:
out - a sax document handler
uid - a unique ID used to identify the state of the channel
Throws:
PortalException

generateKey

public ChannelCacheKey generateKey(java.lang.String uid)
Generates a channel cache key. The key scope is set to be system-wide when the channel is anonymously accessed, otherwise it is set to be instance-wide. The caching implementation here is simple and may not handle all cases. It may also violate the Portlet Specification so this obviously needs further discussion.

Specified by:
generateKey in interface IMultithreadedCacheable
Parameters:
uid - the unique identifier
Returns:
the channel cache key

isCacheValid

public boolean isCacheValid(java.lang.Object validity,
                            java.lang.String uid)
Determines whether the cached content for this channel is still valid.

Return true when:

  1. We have not just received an event
  2. No runtime parameters are sent to the channel
  3. The focus hasn't switched.
Otherwise, return false.

In other words, cache the content in all cases except for when a user clicks a channel button, a link or form button within the channel, or the focus or unfocus button.

Specified by:
isCacheValid in interface IMultithreadedCacheable
Parameters:
validity - the validity object
uid - the unique identifier
Returns:
true if the cache is still valid, otherwise false

setResponse

public void setResponse(java.lang.String uid,
                        javax.servlet.http.HttpServletResponse response)
Description copied from interface: IMultithreadedDirectResponse
Sets the HttpServletResponse for the channel to use.

Specified by:
setResponse in interface IMultithreadedDirectResponse
Parameters:
uid - The unique ID of the channel
response - The HttpServletResponse for the channel to use.

uPortal 2.4.1
API Documentation