Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.sitemap
Class LiveSitemapCache  view LiveSitemapCache download LiveSitemapCache.java

java.lang.Object
  extended bycom.RuntimeCollective.sitemap.LiveSitemapCache

public class LiveSitemapCache
extends java.lang.Object

A class which caches the id of the live Channels, Subsections, Pages and Subsections, so that the dynamic sitemap.jsp for example doesn't have to re-read those lists every time. This static cache can be notified to update itself using markNeedUpdate (eg when a new page is made live). It also update itself after midnight, ie when new pages are scheduled to go live or dead. This could be made more efficient using a Timer. This class is very much SE specific - but it can give some ideas for other projects.

Version:
$Id: LiveSitemapCache.java,v 1.16 2003/09/30 15:12:58 joe Exp $

Field Summary
protected static int LastUpdateDOW
          The day of the week of the last update
protected static java.util.Vector LiveChannelList
          The list of live Channels
protected static java.lang.Integer minusOne
           
protected static boolean MustUpdate
          Whether the cache should be updated before serving any information
protected static java.lang.String NavbarHtml
          The HTML which displays the navbar
protected static java.util.HashMap NavbarJavascripts
          The HTML which displays the navbar, for each channel id
protected static java.lang.String SitemapHtml
          The HTML which displays the sitemap
 
Constructor Summary
LiveSitemapCache()
           
 
Method Summary
static java.lang.String computeUptodateNavbarHtml(boolean pagePreviewOnly, int pageId)
          Get an uptodate version of the navbar's html
static java.lang.String computeUptodateNavbarJavascripts(boolean pagePreviewOnly, int pageId, int pageChannelId)
          Compute one or all uptodate versions of the navbar's javascript.
static java.util.Vector getLiveChannelList()
          Get the list of live channems
static java.lang.String getNavbarHtml(boolean pagePreviewOnly, int pageId)
          Get the navbar's html
static java.lang.String getNavbarJavascript(boolean pagePreviewOnly, int pageId, int pageChannelId)
          Get the navbar's html for a given pageChannelId
static java.lang.String getSitemapHtml()
          Deprecated. The sitemap is not cached anymore, so this method should not be used anymore.
static java.util.Vector getUptodateLiveChannelList()
          Get an uptodate version of the live channel list
static java.lang.String getUptodateSitemapHtml()
          Deprecated. The sitemap is not cached anymore, so this method should not be used anymore.
static void markMustUpdate()
          Tell the cache that it must update itself
static void update()
          Update the cache
static void updateIfNecessary()
          Update the cache if necessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LastUpdateDOW

protected static int LastUpdateDOW
The day of the week of the last update


MustUpdate

protected static boolean MustUpdate
Whether the cache should be updated before serving any information


NavbarJavascripts

protected static final java.util.HashMap NavbarJavascripts
The HTML which displays the navbar, for each channel id


minusOne

protected static final java.lang.Integer minusOne

NavbarHtml

protected static java.lang.String NavbarHtml
The HTML which displays the navbar


LiveChannelList

protected static java.util.Vector LiveChannelList
The list of live Channels


SitemapHtml

protected static java.lang.String SitemapHtml
The HTML which displays the sitemap

Constructor Detail

LiveSitemapCache

public LiveSitemapCache()
Method Detail

markMustUpdate

public static void markMustUpdate()
Tell the cache that it must update itself


updateIfNecessary

public static void updateIfNecessary()
Update the cache if necessary


update

public static void update()
Update the cache


getNavbarJavascript

public static java.lang.String getNavbarJavascript(boolean pagePreviewOnly,
                                                   int pageId,
                                                   int pageChannelId)
Get the navbar's html for a given pageChannelId


computeUptodateNavbarJavascripts

public static java.lang.String computeUptodateNavbarJavascripts(boolean pagePreviewOnly,
                                                                int pageId,
                                                                int pageChannelId)
Compute one or all uptodate versions of the navbar's javascript. If pagePreviewOnly is set, this will return the Javascript for that previewed page. Otherwise this method only updates the cache, and returns an empty String.


getNavbarHtml

public static java.lang.String getNavbarHtml(boolean pagePreviewOnly,
                                             int pageId)
Get the navbar's html


computeUptodateNavbarHtml

public static java.lang.String computeUptodateNavbarHtml(boolean pagePreviewOnly,
                                                         int pageId)
Get an uptodate version of the navbar's html


getLiveChannelList

public static java.util.Vector getLiveChannelList()
Get the list of live channems


getUptodateLiveChannelList

public static java.util.Vector getUptodateLiveChannelList()
Get an uptodate version of the live channel list


getSitemapHtml

public static java.lang.String getSitemapHtml()
Deprecated. The sitemap is not cached anymore, so this method should not be used anymore.

Get the sitemap's html.


getUptodateSitemapHtml

public static java.lang.String getUptodateSitemapHtml()
Deprecated. The sitemap is not cached anymore, so this method should not be used anymore.

Get an uptodate version of the sitemap's html