org.apache.geronimo.javamail.store.nntp.newsrc
Class NNTPNewsrc

java.lang.Object
  extended by org.apache.geronimo.javamail.store.nntp.newsrc.NNTPNewsrc
Direct Known Subclasses:
NNTPNewsrcFile

public abstract class NNTPNewsrc
extends Object

Base class implementation of a standard news reader news rc file. This is used to track newsgroup subscriptions and SEEN flags for articles. This is an abstract class designed for subclasses to bridge to the physical store type used for the newsgroup information.


Constructor Summary
protected NNTPNewsrc()
          Base class constructor for NNTPNewsrc items.
 
Method Summary
 void close()
          Close the newsrc file, persisting it back to disk if the file has changed.
 NNTPNewsrcGroup getGroup(String name)
          Retrieve the newsrc group information for a named group.
 Iterator getGroups()
          Retrieve the current set of loaded groups.
abstract  BufferedReader getInputReader()
          Abstract open method intended for sub class initialization.
abstract  Writer getOutputWriter()
          Abstract open for output method intended for subclass implementation.
 void load()
          Load the data from the newsrc file and parse into an instore group database.
 void save()
          Save the newsrc file data back to the original source file.
 void setDirty()
          Mark this newsrc database as dirty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NNTPNewsrc

protected NNTPNewsrc()
Base class constructor for NNTPNewsrc items. Subclasses provide their own domain-specific intialization.

Method Detail

load

public void load()
Load the data from the newsrc file and parse into an instore group database.


save

public void save()
          throws IOException
Save the newsrc file data back to the original source file.

Throws:
IOException

getInputReader

public abstract BufferedReader getInputReader()
                                       throws IOException
Abstract open method intended for sub class initialization. The subclass is responsible for creating the BufferedReaded used to read the .newsrc file.

Returns:
A BufferedReader for reading the .newsrc file.
Throws:
IOException

getOutputWriter

public abstract Writer getOutputWriter()
                                throws IOException
Abstract open for output method intended for subclass implementation. The subclasses are reponsible for opening the output stream and creating an appropriate Writer for saving the .newsrc file.

Returns:
A Writer target at the .newsrc file save location.
Throws:
IOException

getGroup

public NNTPNewsrcGroup getGroup(String name)
Retrieve the newsrc group information for a named group. If the file does not currently include this group, an unsubscribed group will be added to the file.

Parameters:
name - The name of the target group.
Returns:
The NNTPNewsrcGroup item corresponding to this name.

setDirty

public void setDirty()
Mark this newsrc database as dirty.


close

public void close()
Close the newsrc file, persisting it back to disk if the file has changed.


getGroups

public Iterator getGroups()
Retrieve the current set of loaded groups.

Returns:
An iterator for traversing the group set.


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.