Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal
Class ChannelRenderer

    java.lang.Object
      org.jasig.portal.ChannelRenderer

All Implemented Interfaces:
  IDynamicChannelTitleRenderer, IChannelRenderer

    public class ChannelRenderer

extends java.lang.Object
implements IChannelRenderer, IDynamicChannelTitleRenderer

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

Version:
  $Revision: 1.45.2.7 $
Author:
  Peter Kharchenko

Nested Class Summary
`protected class` | `ChannelRenderer.Worker`

Field Summary
`static boolean` | `CACHE_CHANNELS`
`protected java.util.Map` | `cacheTables`
`protected boolean` | `ccacheable`
`protected IChannel` | `channel`
`protected java.util.Map` | `channelCache`
`private static boolean` | `DEFAULT_CACHE_CHANNELS` Default value for CACHE_CHANNELS.
`protected boolean` | `donerendering`
`protected java.lang.Object` | `groupRenderingKey`
`protected SetCheckInSemaphore` | `groupSemaphore`
`protected org.apache.commons.logging.Log` | `log`
`protected ChannelRuntimeData` | `rd`
`protected boolean` | `rendering`
`static java.lang.String[]` | `renderingStatus`
`protected long` | `startTime`
`protected static java.util.Map` | `systemCache`
`protected long` | `timeOut`
`protected static edu.emory.mathcs.backport.java.util.concurrent.ExecutorService` | `tp`
`protected ChannelRenderer.Worker` | `worker`
`protected java.lang.Thread` | `workerThread`
`protected edu.emory.mathcs.backport.java.util.concurrent.Future` | `workTracker`

Fields inherited from interface org.jasig.portal.IChannelRenderer
`RCS_ID, RENDERING_FAILED, RENDERING_SUCCESSFUL, RENDERING_TIMED_OUT`

Constructor Summary
`ChannelRenderer(IChannel chan, ChannelRuntimeData runtimeData, edu.emory.mathcs.backport.java.util.concurrent.ExecutorService threadPool)` Default contstructor
`ChannelRenderer(IChannel chan, ChannelRuntimeData runtimeData, edu.emory.mathcs.backport.java.util.concurrent.ExecutorService 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.
`(package private) java.util.Map` | `getChannelCache()` Obtains a content cache specific for this channel instance.
`java.lang.String` | `getChannelTitle()` Get the dynamic channel title, if any, for the channel that this renderer has rendered.
`java.lang.String` | `getCharacters()` Returns a character output of a channel rendering.
`protected void` | `kill()` This method suppose to take care of the runaway rendering threads.
`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.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### log

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

### DEFAULT_CACHE_CHANNELS

    private static final boolean DEFAULT_CACHE_CHANNELS

  Default value for CACHE_CHANNELS. This value will be used when the corresponding property cannot be loaded.

  See Also:
    Constant Field Values

### CACHE_CHANNELS

    public static final boolean CACHE_CHANNELS

### renderingStatus

    public static final java.lang.String[] renderingStatus

### channel

    protected IChannel channel

### rd

    protected ChannelRuntimeData rd

### channelCache

    protected java.util.Map channelCache

### cacheTables

    protected java.util.Map cacheTables

### rendering

    protected boolean rendering

### donerendering

    protected boolean donerendering

### workerThread

    protected java.lang.Thread workerThread

### worker

    protected ChannelRenderer.Worker worker

### workTracker

    protected edu.emory.mathcs.backport.java.util.concurrent.Future workTracker

### startTime

    protected long startTime

### timeOut

    protected long timeOut

### ccacheable

    protected boolean ccacheable

### tp

    protected static edu.emory.mathcs.backport.java.util.concurrent.ExecutorService tp

### systemCache

    protected static java.util.Map systemCache

### groupSemaphore

    protected SetCheckInSemaphore groupSemaphore

### groupRenderingKey

    protected java.lang.Object groupRenderingKey

Constructor Detail

### ChannelRenderer

    public ChannelRenderer(IChannel chan,
                           ChannelRuntimeData runtimeData,
                           edu.emory.mathcs.backport.java.util.concurrent.ExecutorService threadPool)

  Default contstructor

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

### ChannelRenderer

    public ChannelRenderer(IChannel chan,
                           ChannelRuntimeData runtimeData,
                           edu.emory.mathcs.backport.java.util.concurrent.ExecutorService 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`

### getChannelCache

    java.util.Map getChannelCache()

  Obtains a content cache specific for this channel instance.

  Returns:
    a key->rendering map for this channel

### 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

### kill

    protected void kill()

  This method suppose to take care of the runaway rendering threads. This method will be called from ChannelManager explictly.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getChannelTitle

    public java.lang.String getChannelTitle()

  Description copied from interface: `IDynamicChannelTitleRenderer`
  Get the dynamic channel title, if any, for the channel that this renderer has rendered. This method must not be executed concurently with outputRendering(): the rendering framework should either first request the channel content and then requets the title, or first request the title and then request the channel content, but not both concurrently. Both this method and outputRendering() block on the channel rendering worker thread, blocking until the thread completes rendering the channel, or until the thread times out.

  Specified by:
    `getChannelTitle` in interface `IDynamicChannelTitleRenderer`
  Returns:
    String representing the dynamic channel title, or null if no dynamic channel title.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD