|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sourceforge.java.feednread.backend.archive.NewsFeedArchive
Manages and organizes an archive of ArchivedNewsFeed
instances. The archive itself is separated into two areas communicating among
each other: The live archive which resides in memory and the persistent
archive which is stored on a persistent medium, e.g. a harddisk or database.
The settings controlling the behaviour of these two areas are configurable in
the ConfigurationManager.
Use the following snippet to get the singleton NewsFeedArchive
and add an arbitrary ArchivedNewsFeed to the archive.
NewsFeedArchive archive = NewsFeedArchive.getInstance(); archive.add(newsfeed);
| Nested Class Summary | |
private class |
NewsFeedArchive.ArchivedFilenameFilter
|
| Field Summary | |
private Map |
archivedNewsFeeds
The Map to hold the archived NewsFeeds |
private static NewsFeedArchive |
SINGLETON_INSTANCE
The single unique NewsFeedArchive instance |
| Constructor Summary | |
private |
NewsFeedArchive()
Creates a new NewsFeedArchive instance.
|
| Method Summary | |
void |
add(ArchivedNewsFeed newsFeed)
Adds the specified NewsFeed to this
NewsFeedArchive.
|
private void |
archive(ArchivedNewsFeed newsFeed)
Archives the specified ArchivedNewsFeed.
|
private void |
cleanupLiveArchive()
Cleans up the live archive. |
void |
cleanupPersistentArchive()
Cleans up the persistent archive. |
void |
clearPersistentArchive()
Clears this NewsFeedArchive's persistent archive completely,
i.e. removes all ArchivedNewsFeeds.
|
private String |
createId(String newsFeedUrl)
Creates an unique id for the newsfeed at the specified feedUrl.
|
private double |
deletePersistent(String id)
Deletes the ArchivedNewsFeed denoted by the
specified id from the underlying persistent archive.
|
private ArchivedNewsFeed |
getFromPersistentArchive(String id)
Gets the ArchivedNewsFeed identified by the specified
unique id from the persistent archive.
|
private String |
getId(File f)
Gets the id of the specified persistent ArchivedNewsFeed.
|
static NewsFeedArchive |
getInstance()
Gets the single unique NewsFeedArchive instance.
|
ArchivedNewsFeed |
getNewsFeed(String newsFeedUrl)
Gets the ArchivedNewsFeed denoted by the specified
newsFeedUrl from this NewsFeedArchive.
|
private void |
makePersistent(ArchivedNewsFeed newsFeed)
Makes the specified ArchivedNewsFeed persistent by
writing it back to the persistent medium, e.g. the local harddisk.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static NewsFeedArchive SINGLETON_INSTANCE
The single unique NewsFeedArchive instance
private Map archivedNewsFeeds
The Map to hold the archived NewsFeeds
| Constructor Detail |
private NewsFeedArchive()
Creates a new NewsFeedArchive instance.
| Method Detail |
public static NewsFeedArchive getInstance()
Gets the single unique NewsFeedArchive instance.
NewsFeedArchive instancepublic ArchivedNewsFeed getNewsFeed(String newsFeedUrl)
Gets the ArchivedNewsFeed denoted by the specified
newsFeedUrl from this NewsFeedArchive.
newsFeedUrl - the url of the ArchivedNewsFeed to get
from this NewsFeedArchive
ArchivedNewsFeed or null if there
is no entry in this NewsFeedArchived matching the
specified newsFeedUrlpublic void add(ArchivedNewsFeed newsFeed)
Adds the specified NewsFeed to this
NewsFeedArchive.
newsFeed - the ArchivedNewsFeed to addpublic void cleanupPersistentArchive()
Cleans up the persistent archive.
public void clearPersistentArchive()
Clears this NewsFeedArchive's persistent archive completely,
i.e. removes all ArchivedNewsFeeds.
private void archive(ArchivedNewsFeed newsFeed)
Archives the specified ArchivedNewsFeed.
newsFeed - the ArchivedNewsFeed to archiveprivate void makePersistent(ArchivedNewsFeed newsFeed)
Makes the specified ArchivedNewsFeed persistent by
writing it back to the persistent medium, e.g. the local harddisk.
newsFeed - the ArchivedNewsFeed to make
persistent
private ArchivedNewsFeed getFromPersistentArchive(String id)
throws IOException,
ClassNotFoundException
Gets the ArchivedNewsFeed identified by the specified
unique id from the persistent archive.
id - the unique id of the ArchivedNewsFeed
ArchivedNewsFeed from the persistent archive
IOException - if an io error occured during the archive retrieval
operation
ClassNotFoundException - if a Class mismatch was
detectedprivate void cleanupLiveArchive()
Cleans up the live archive.
private String getId(File f)
Gets the id of the specified persistent ArchivedNewsFeed.
f - the persistent ArchivedNewsFeed File
null if no valid persistent
ArchivedNewsFeed Fileprivate double deletePersistent(String id)
Deletes the ArchivedNewsFeed denoted by the
specified id from the underlying persistent archive.
id - the id of the persistent ArchivedNewsFeed
to delete
private String createId(String newsFeedUrl)
Creates an unique id for the newsfeed at the specified
feedUrl.
newsFeedUrl - the url of the newsfeed to generate an unique id for
newsFeedUrl
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||