Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.fm.rss
Class fsChannelStorage  view fsChannelStorage download fsChannelStorage.java

java.lang.Object
  extended bycom.fm.rss.fsChannelStorage
All Implemented Interfaces:
ChannelStorage

public class fsChannelStorage
extends java.lang.Object
implements ChannelStorage

File system channel storage.

Storage will save/load its state to/from the well formed XML document stored in the file specified by DESTINATION parameter. Load operation accepts remote resources if they are specified by correct URI.

Complete format of the storage file may discovered from the FM DTD, here is the only brief schema: Date when current storage was actually created Date when current storage was last time saved to disk //Each category is stored in separate hasPart element Category string here Another category string here .....


Field Summary
private  java.util.HashMap categories
           
private static java.lang.String DEFAULT_SOURCE_NAME
           
private  java.util.HashMap params
           
 
Fields inherited from interface com.fm.rss.ChannelStorage
DESTINATION, OUTPUT_FILTER, SOURCE
 
Constructor Summary
fsChannelStorage()
          Default constructor
 
Method Summary
 java.util.Map getCategories()
          Return list of the channel categories
 java.util.Map getChannels()
          Returns plain list of the channel entries reqtreived from existing categories
 java.lang.Object getDefaultSource()
          Return name of the default file from which data should be loaded
 java.lang.Object getParamValue(java.lang.String param)
          Return value of the configuration param.
 void load()
          Loads state of the storage from the source.
 void save()
          Saves state of the storage to disk.
 void setCategories(java.util.Map newCats)
          Set list of the existing categories to given value
 void setParamValue(java.lang.String param, java.lang.Object value)
          Set configuration param.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

params

private java.util.HashMap params

categories

private java.util.HashMap categories

DEFAULT_SOURCE_NAME

private static final java.lang.String DEFAULT_SOURCE_NAME
See Also:
Constant Field Values
Constructor Detail

fsChannelStorage

public fsChannelStorage()
Default constructor

Method Detail

getCategories

public java.util.Map getCategories()
Return list of the channel categories

Specified by:
getCategories in interface ChannelStorage

getChannels

public java.util.Map getChannels()
Returns plain list of the channel entries reqtreived from existing categories


setCategories

public void setCategories(java.util.Map newCats)
Set list of the existing categories to given value

Specified by:
setCategories in interface ChannelStorage

save

public void save()
          throws java.io.IOException
Saves state of the storage to disk. The destination file must be specified using setParamValue(), with ChannelStorage.DESTINATION as a parameter name.

Specified by:
save in interface ChannelStorage

load

public void load()
          throws java.io.IOException,
                 rssParseException
Loads state of the storage from the source.

The source file(resource) must be specified using setParamValue(), with ChannelStorage.SOURCE as a parameter name. Note that for load operation the source may be a remote resource specified by URI as well.

Specified by:
load in interface ChannelStorage

setParamValue

public void setParamValue(java.lang.String param,
                          java.lang.Object value)
Set configuration param. All unrecognized params are ignored.

Specified by:
setParamValue in interface ChannelStorage

getParamValue

public java.lang.Object getParamValue(java.lang.String param)
Return value of the configuration param. The null will be returned if specified param doesn't exist.

Specified by:
getParamValue in interface ChannelStorage

getDefaultSource

public java.lang.Object getDefaultSource()
Return name of the default file from which data should be loaded

Specified by:
getDefaultSource in interface ChannelStorage