net.i2p.router.news
Class PersistNews

java.lang.Object
  extended by net.i2p.router.news.PersistNews

 class PersistNews
extends Object

Store and retrieve news entries from disk. Each entry is stored in a separate file, with the name derived from the UUID.

Since:
0.9.23

Constructor Summary
PersistNews()
           
 
Method Summary
static boolean delete(I2PAppContext ctx, NewsEntry entry)
          Unused for now, as we don't have any way to remember it's deleted.
static List<NewsEntry> load(I2PAppContext ctx)
          This does not check for any missing values.
static boolean store(I2PAppContext ctx, List<Node> entries)
          Store each entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistNews

PersistNews()
Method Detail

store

public static boolean store(I2PAppContext ctx,
                            List<Node> entries)
Store each entry. Old entries are always overwritten, as they may change even without the updated date changing.

Parameters:
entries - each one should be "entry" at the root
Returns:
success

load

public static List<NewsEntry> load(I2PAppContext ctx)
This does not check for any missing values. Any fields in any NewsEntry may be null. Content is not sanitized by NewsXMLParser here, do that before storing.

Returns:
non-null, sorted by updated date, newest first

delete

public static boolean delete(I2PAppContext ctx,
                             NewsEntry entry)
Unused for now, as we don't have any way to remember it's deleted.

Returns:
success