uPortal 2.4.1
API Documentation

org.jasig.portal
Class ChannelRenderer

java.lang.Object
  extended byorg.jasig.portal.ChannelRenderer
All Implemented Interfaces:
IChannelRenderer

public class ChannelRenderer
extends java.lang.Object
implements IChannelRenderer

This class takes care of initiating channel rendering thread, monitoring it for timeouts, retreiving cache, and returning rendering results and status.

Version:
$Revision: 1.37 $
Author:
Peter Kharchenko

Field Summary
static boolean CACHE_CHANNELS
           
static int RENDERING_FAILED
           
static int RENDERING_SUCCESSFUL
           
static int RENDERING_TIMED_OUT
           
static java.lang.String[] renderingStatus
           
 
Fields inherited from interface org.jasig.portal.IChannelRenderer
RCS_ID
 
Constructor Summary
ChannelRenderer(IChannel chan, ChannelRuntimeData runtimeData, ThreadPool threadPool)
          Default contstructor
ChannelRenderer(IChannel chan, ChannelRuntimeData runtimeData, ThreadPool threadPool, SetCheckInSemaphore groupSemaphore, java.lang.Object groupRenderingKey)
          Default contstructor
 
Method Summary
 void cancelRendering()
          Cancels the rendering job.
 int completeRendering()
          Requests renderer to complete rendering and return status.
 SAX2BufferImpl getBuffer()
          Returns rendered buffer.
 java.lang.String getCharacters()
          Returns a character output of a channel rendering.
 int outputRendering(org.xml.sax.ContentHandler out)
          Output channel rendering through a given ContentHandler.
 void setCacheTables(java.util.Map cacheTables)
          Sets the cache tables for the channel renderer.
 void setChannel(IChannel channel)
          Sets the channel on which ChannelRenderer is to operate.
 void setCharacterCache(java.lang.String chars)
          Sets a character cache for the current rendering.
 void setCharacterCacheable(boolean setting)
          Informs IChannelRenderer that a character caching scheme will be used for the current rendering.
 void setTimeout(long value)
          Set the timeout value
 void startRendering()
          Start rendering of the channel in a new thread.
 void startRendering(SetCheckInSemaphore groupSemaphore, java.lang.Object groupRenderingKey)
          Starts the channel rendering process.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_CHANNELS

public static final boolean CACHE_CHANNELS

RENDERING_SUCCESSFUL

public static final int RENDERING_SUCCESSFUL
See Also:
Constant Field Values

RENDERING_FAILED

public static final int RENDERING_FAILED
See Also:
Constant Field Values

RENDERING_TIMED_OUT

public static final int RENDERING_TIMED_OUT
See Also:
Constant Field Values

renderingStatus

public static final java.lang.String[] renderingStatus
Constructor Detail

ChannelRenderer

public ChannelRenderer(IChannel chan,
                       ChannelRuntimeData runtimeData,
                       ThreadPool threadPool)
Default contstructor

Parameters:
chan - an IChannel value
runtimeData - a ChannelRuntimeData value
threadPool - a ThreadPool value

ChannelRenderer

public ChannelRenderer(IChannel chan,
                       ChannelRuntimeData runtimeData,
                       ThreadPool threadPool,
                       SetCheckInSemaphore groupSemaphore,
                       java.lang.Object groupRenderingKey)
Default contstructor

Parameters:
chan - an IChannel value
runtimeData - a ChannelRuntimeData value
threadPool - a ThreadPool value
groupSemaphore - a SetCheckInSemaphore for the current rendering group
groupRenderingKey - an Object to be used for check ins with the group semaphore
Method Detail

setChannel

public void setChannel(IChannel channel)
Sets the channel on which ChannelRenderer is to operate.

Parameters:
channel - an IChannel

setTimeout

public void setTimeout(long value)
Set the timeout value

Specified by:
setTimeout in interface IChannelRenderer
Parameters:
value - timeout in milliseconds

setCacheTables

public void setCacheTables(java.util.Map cacheTables)
Description copied from interface: IChannelRenderer

Sets the cache tables for the channel renderer.

Specified by:
setCacheTables in interface IChannelRenderer
Parameters:
cacheTables - cache table for the channel renderer

setCharacterCacheable

public void setCharacterCacheable(boolean setting)
Informs IChannelRenderer that a character caching scheme will be used for the current rendering.

Specified by:
setCharacterCacheable in interface IChannelRenderer
Parameters:
setting - a boolean value

startRendering

public void startRendering()
Start rendering of the channel in a new thread. Note that rendered information will be accumulated in a buffer until outputRendering() function is called. startRendering() is a non-blocking function.

Specified by:
startRendering in interface IChannelRenderer

startRendering

public void startRendering(SetCheckInSemaphore groupSemaphore,
                           java.lang.Object groupRenderingKey)
Description copied from interface: IChannelRenderer

Starts the channel rendering process.

Specified by:
startRendering in interface IChannelRenderer
Parameters:
groupSemaphore - semaphore to use for a group of channels
groupRenderingKey - group rendering key

cancelRendering

public void cancelRendering()

Cancels the rendering job.

Specified by:
cancelRendering in interface IChannelRenderer

outputRendering

public int outputRendering(org.xml.sax.ContentHandler out)
                    throws java.lang.Throwable
Output channel rendering through a given ContentHandler. Note: call of outputRendering() without prior call to startRendering() is equivalent to sequential calling of startRendering() and then outputRendering(). outputRendering() is a blocking function. It will return only when the channel completes rendering or fails to render by exceeding allowed rendering time.

Specified by:
outputRendering in interface IChannelRenderer
Parameters:
out - Document Handler that will receive information rendered by the channel.
Returns:
error code. 0 - successful rendering; 1 - rendering failed; 2 - rendering timedOut;
Throws:
java.lang.Throwable - if an error occurs

completeRendering

public int completeRendering()
                      throws java.lang.Throwable
Requests renderer to complete rendering and return status. This does exactly the same things as outputRendering except for the actual stream output.

Specified by:
completeRendering in interface IChannelRenderer
Returns:
an int return status value
Throws:
java.lang.Throwable

getBuffer

public SAX2BufferImpl getBuffer()
Returns rendered buffer. This method does not perform any status checks, so make sure to call completeRendering() prior to invoking this method.

Specified by:
getBuffer in interface IChannelRenderer
Returns:
rendered buffer

getCharacters

public java.lang.String getCharacters()
Returns a character output of a channel rendering.

Specified by:
getCharacters in interface IChannelRenderer
Returns:
string representation of the channel rendering characters

setCharacterCache

public void setCharacterCache(java.lang.String chars)
Sets a character cache for the current rendering.

Specified by:
setCharacterCache in interface IChannelRenderer
Parameters:
chars - character cache for the channel renderer

uPortal 2.4.1
API Documentation