net.i2p.router.news
Class NewsManager

java.lang.Object
  extended by net.i2p.router.news.NewsManager
All Implemented Interfaces:
ClientApp, RouterApp

public class NewsManager
extends Object
implements RouterApp

Manage current news. Keeps current entries in memory, and provide methods to add new entries and store them to disk.

Since:
0.9.23

Field Summary
static String APP_NAME
           
 
Constructor Summary
NewsManager(I2PAppContext ctx, ClientAppManager listener, String[] args)
           
 
Method Summary
 void addEntries(List<NewsEntry> entries)
          Add or replace each entry in the list.
 String getDisplayName()
          The display name of the ClientApp, used in user interfaces.
 List<NewsEntry> getEntries()
           
 String getName()
          The generic name of the ClientApp, used for registration, e.g.
 ClientAppState getState()
          The current state of the ClientApp.
 void shutdown(String[] args)
          ClientApp interface
 void startup()
          ClientApp interface
 boolean storeEntries(List<Node> entries)
          Store each entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_NAME

public static final String APP_NAME
See Also:
Constant Field Values
Constructor Detail

NewsManager

public NewsManager(I2PAppContext ctx,
                   ClientAppManager listener,
                   String[] args)
Parameters:
args - ignored
Method Detail

getEntries

public List<NewsEntry> getEntries()
Returns:
non-null, sorted by updated date, newest first

storeEntries

public boolean storeEntries(List<Node> entries)
Store each entry. Old entries are always overwritten, as they may change even without the updated date changing. Does NOT update the NewsEntry list.

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

addEntries

public void addEntries(List<NewsEntry> entries)
Add or replace each entry in the list. Does NOT store them to disk.


startup

public void startup()
ClientApp interface

Specified by:
startup in interface ClientApp

shutdown

public void shutdown(String[] args)
ClientApp interface

Specified by:
shutdown in interface ClientApp
Parameters:
args - ignored

getState

public ClientAppState getState()
Description copied from interface: ClientApp
The current state of the ClientApp.

Specified by:
getState in interface ClientApp
Returns:
non-null

getName

public String getName()
Description copied from interface: ClientApp
The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.

Specified by:
getName in interface ClientApp
Returns:
non-null

getDisplayName

public String getDisplayName()
Description copied from interface: ClientApp
The display name of the ClientApp, used in user interfaces. The app must translate.

Specified by:
getDisplayName in interface ClientApp
Returns:
non-null