com.sun.syndication.fetcher.impl
Class HashMapFeedInfoCache

java.lang.Object
  extended by com.sun.syndication.fetcher.impl.HashMapFeedInfoCache
All Implemented Interfaces:
FeedFetcherCache, java.io.Serializable
Direct Known Subclasses:
LinkedHashMapFeedInfoCache

public class HashMapFeedInfoCache
extends java.lang.Object
implements FeedFetcherCache, java.io.Serializable

A very simple implementation of the FeedFetcherCache interface.

This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible for sort term (client aggregator?) use, as the memory usage will increase over time as the number of feeds in the cache increases.

Author:
Nick Lothian
See Also:
Serialized Form

Constructor Summary
HashMapFeedInfoCache()
          Constructor for HashMapFeedInfoCache
 
Method Summary
protected  java.util.Map createInfoCache()
           
protected  java.lang.Object get(java.lang.Object key)
           
 SyndFeedInfo getFeedInfo(java.net.URL feedUrl)
          Get a SyndFeedInfo object from the cache.
protected  java.util.Map getInfoCache()
           
static FeedFetcherCache getInstance()
          Get the global instance of the cache
protected  void put(java.lang.Object key, java.lang.Object value)
           
 void setFeedInfo(java.net.URL feedUrl, SyndFeedInfo syndFeedInfo)
          Add a SyndFeedInfo object to the cache
protected  void setInfoCache(java.util.Map map)
          The API of this class indicates that map must thread safe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashMapFeedInfoCache

public HashMapFeedInfoCache()

Constructor for HashMapFeedInfoCache

Only use this if you want multiple instances of the cache. Usually getInstance() is more appropriate.

Method Detail

getInstance

public static FeedFetcherCache getInstance()
Get the global instance of the cache

Returns:
an implementation of FeedFetcherCache

createInfoCache

protected java.util.Map createInfoCache()

get

protected java.lang.Object get(java.lang.Object key)

getFeedInfo

public SyndFeedInfo getFeedInfo(java.net.URL feedUrl)
Description copied from interface: FeedFetcherCache
Get a SyndFeedInfo object from the cache.

Specified by:
getFeedInfo in interface FeedFetcherCache
Parameters:
feedUrl - The url of the feed
Returns:
A SyndFeedInfo or null if it is not in the cache
See Also:
extensions.io.FeedFetcherCache#getFeedInfo(java.net.URL)

put

protected void put(java.lang.Object key,
                   java.lang.Object value)

setFeedInfo

public void setFeedInfo(java.net.URL feedUrl,
                        SyndFeedInfo syndFeedInfo)
Description copied from interface: FeedFetcherCache
Add a SyndFeedInfo object to the cache

Specified by:
setFeedInfo in interface FeedFetcherCache
Parameters:
feedUrl - The url of the feed
syndFeedInfo - A SyndFeedInfo for the feed
See Also:
extensions.io.FeedFetcherCache#setFeedInfo(java.net.URL, extensions.io.SyndFeedInfo)

getInfoCache

protected final java.util.Map getInfoCache()

setInfoCache

protected final void setInfoCache(java.util.Map map)
The API of this class indicates that map must thread safe. In other words, be sure to wrap it in a synchronized map unless you know what you are doing.

Parameters:
map - the map to use as the info cache.


Copyright © 2004-2006 Sun Microsystems. All Rights Reserved.