Source code: com/fm/rss/ChannelStorage.java
1 /****************************************************************************
2 * Copyright (c) 2003 Andrew Duka | aduka@users.sourceforge.net
3 * All right reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 ****************************************************************************/
11 package com.fm.rss;
12
13 import java.util.ArrayList;
14 import java.util.HashMap;
15 import java.util.Map;
16 import java.io.Serializable;
17 import java.io.IOException;
18
19 import org.w3c.dom.Element;
20
21 /**
22 * Defines interface required from the channel storage.
23 *
24 * <p><code>ChannelStorage</code> interface also defines the way storage parameters
25 * should be set. This should be done through <code>setParamVaslue</code> and
26 * <code>getParamVaslue</code>. All parameters names and values are storage
27 * implementation specific except for two names: <see>SOURCE</see> and
28 * <see>DESTINATION</see>. These names are reserved to be a names for a channel's
29 * source and destination params name respectively.</p>
30 *
31 * @author Andrew Duka (Andrew.Duka@oktet.ru)
32 */
33 public interface ChannelStorage {
34
35 /** Name for the storage source parameter value */
36 public static String SOURCE = "CH_ST_SOURCE";
37 /** Name for the storage destination parameter value */
38 public static String DESTINATION = "CH_ST_DESTINATION";
39 /** Name for output filter parameter value */
40 public static String OUTPUT_FILTER = "OUT_FILTER";
41
42 /**
43 * Return list of the channel categories
44 *
45 * @return Map of categories (list is empty if no categories exist)
46 */
47 public Map getCategories();
48
49
50 /**
51 * Set list of the existing categories to a given value
52 *
53 * @param newCats
54 */
55 public void setCategories(Map newCats);
56
57 /**
58 * Saves current state to destination (destination depends on implementation)
59 *
60 * @throws IOException if I/O error occures during saving
61 */
62 public void save() throws IOException;
63
64 /**
65 * Loads current state from the source
66 *
67 * @throws IOException if I/O error occures during saving
68 */
69 public void load() throws IOException, rssParseException;
70
71 /**
72 * Set configuration param.
73 *
74 * All unrecognized params are ignored.
75 *
76 * @param param String with parameter name
77 * @param value Object instance representing parameter value
78 */
79 public void setParamValue(String param,Object value);
80
81 /**
82 * Return value of the configuration param.
83 *
84 * The <code>null</code> will be returned if specified param
85 * doesn't exist.
86 *
87 * @return Object as parameter value or <code>null</code> if parameter
88 * doesn't exist.
89 */
90 public Object getParamValue(String param);
91
92
93 /**
94 * Return implementation specific default source.
95 *
96 * <p>Each storage type may define its own default source. For example file
97 * system storage may use string with the default name of file from which
98 * contents will be loaded.</p>
99 * @return
100 */
101 public Object getDefaultSource();
102
103
104
105 }