com.bea.apps.groupspace.rss.feed
Class FeedCache

java.lang.Object
  extended by com.bea.apps.groupspace.rss.feed.FeedCache

public class FeedCache
extends Object

Frontend for storing Feeds in com.bea.p13n.cache Feeds need a frontend, because a feed might be refreshed on the originating site while the feed is stored in the cache. In this case the cache frontend should return null even if the entry exists in the cache so that the originating site will be checked for updates.


Field Summary
protected  String communityUri
          Uri for the community for which this FeedCache relates
protected  Cache entryCache
          Cache for Feed Entries
protected  Cache feedCache
          Cache for Feeds
 
Constructor Summary
FeedCache(String acommunityUri)
          Constructs a p13n feed cache scoped to the Community
 
Method Summary
 FeedEntryItem getCachedEntry(String uid)
          Retrieve a cached FeedEntryItem based on its Unique ID
 RssFeedImpl getCachedFeed(URL feedUrl)
          Will retrieve the feed from the cache if it exists in the cache and it is not expired
 List<FeedEntryItem> getCachedFeedEntries(URL feedUrl)
          Will retrieve the cached Feed Entries as a list
 Cache getEntryCache()
          Returns the Feed Entry Cache
 Cache getFeedCache()
          Returns the Feed Cache.
 void invalidateEntry(String entryUid)
          Invalidate a cached Feed Entry
 void invalidateEntryCache()
          Invalidate all feed entries in the cache
 void invalidateFeed(RssFeedImpl feed)
          Invalidate a Feed in the cache
 void invalidateFeedEntryList(RssFeedImpl feed)
          Invalidate a feed entry list for a given feed
 boolean storeEntriesAsList(RssFeedImpl feed, List<FeedEntryItem> entries)
          Store a List of FeedEntries in the cache
 boolean storeEntriesIndividual(List<FeedEntryItem> entries)
          Store a List of FeedEntries individually in the cache
 boolean storeEntry(FeedEntryItem entry)
          Store a single FeedEntry
 RssFeedImpl storeFeed(RssFeedImpl feed)
          Try to store the feed in cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

communityUri

protected String communityUri
Uri for the community for which this FeedCache relates


feedCache

protected Cache feedCache
Cache for Feeds


entryCache

protected Cache entryCache
Cache for Feed Entries

Constructor Detail

FeedCache

public FeedCache(String acommunityUri)
Constructs a p13n feed cache scoped to the Community

Parameters
acommunityUri - The communityUri for which that cache should be constructed
Method Detail

getCachedFeed

public RssFeedImpl getCachedFeed(URL feedUrl)
                          throws NullUrlException
Will retrieve the feed from the cache if it exists in the cache and it is not expired

Parameters
feedUrl - url of the feed to retrieve
Throws
NullUrlException

getCachedFeedEntries

public List<FeedEntryItem> getCachedFeedEntries(URL feedUrl)
Will retrieve the cached Feed Entries as a list

Parameters
feedUrl - url of the feed to retrieve
Throws
NullUrlException

storeFeed

public RssFeedImpl storeFeed(RssFeedImpl feed)
                      throws NullUrlException
Try to store the feed in cache. Passing in a feed with null URL (unique id) will result in a NullUrlException.

Parameters
feed - Feed to store in cache
Returns
The original feed if succesful
Throws
NullUrlException - If the feedUrl field of feed is null

getCachedEntry

public FeedEntryItem getCachedEntry(String uid)
Retrieve a cached FeedEntryItem based on its Unique ID

Parameters
uid - Unique Id of the feed entry
Returns
Returns cache feed entry or null if not found in the cache

storeEntriesIndividual

public boolean storeEntriesIndividual(List<FeedEntryItem> entries)
Store a List of FeedEntries individually in the cache

Parameters
entries - List of feed entry items
Returns
Determines if a list of feed entries were cached succesfully

storeEntriesAsList

public boolean storeEntriesAsList(RssFeedImpl feed,
                                  List<FeedEntryItem> entries)
Store a List of FeedEntries in the cache

Parameters
feed - Feed to which entries belong
entries - A list of feed entries to cache
Returns
Determines if a List of Feed Entries were cached successfully

storeEntry

public boolean storeEntry(FeedEntryItem entry)
Store a single FeedEntry

Parameters
entry - Feed entry to cache
Returns
Determines if a Feed Entry was cached succesfully

invalidateEntry

public void invalidateEntry(String entryUid)
Invalidate a cached Feed Entry

Parameters
entryUid - The UID of the feed entry to invalidate

invalidateEntryCache

public void invalidateEntryCache()
Invalidate all feed entries in the cache


invalidateFeed

public void invalidateFeed(RssFeedImpl feed)
Invalidate a Feed in the cache

Parameters
feed - Feed to invalidate

invalidateFeedEntryList

public void invalidateFeedEntryList(RssFeedImpl feed)
Invalidate a feed entry list for a given feed

Parameters
feed - feed for which to invalidate feed entry list

getFeedCache

public Cache getFeedCache()
Returns the Feed Cache.

Returns
Feed Cache

getEntryCache

public Cache getEntryCache()
Returns the Feed Entry Cache

Returns
Feed entry cache


Copyright © 2006 BEA Systems, Inc. All Rights Reserved