1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.betwixt.examples.rss;
19
20 import java.io.Serializable;
21 import java.util.ArrayList;
22 import java.util.List;
23
24
25 /***
26 * <p>Implementation object representing a <strong>channel</strong> in the
27 * <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
28 * to further specialize its behavior.</p>
29 *
30 * <p>Based on the Apache Commons <code>Digester</code> implementation.</p>
31 *
32 * @author Craig R. McClanahan
33 * @author Ted Husted
34 * @version $Revision: 1.3 $ $Date: 2004/03/31 21:11:53 $
35 */
36
37 public class Channel implements Serializable {
38
39
40
41
42
43 /***
44 * The set of items associated with this Channel.
45 */
46 protected ArrayList items = new ArrayList();
47
48
49 /***
50 * The set of skip days for this channel.
51 */
52 protected ArrayList skipDays = new ArrayList();
53
54
55 /***
56 * The set of skip hours for this channel.
57 */
58 protected ArrayList skipHours = new ArrayList();
59
60
61
62
63
64 /***
65 * The channel copyright (1-100 characters).
66 */
67 protected String copyright = null;
68
69 public String getCopyright() {
70 if (this.copyright == null) {
71 return "Public Domain";
72 } else {
73 return (this.copyright);
74 }
75 }
76
77 public void setCopyright(String copyright) {
78 this.copyright = copyright;
79 }
80
81
82 /***
83 * The channel description (1-500 characters).
84 */
85 protected String description = null;
86
87 public String getDescription() {
88 return (this.description);
89 }
90
91 public void setDescription(String description) {
92 this.description = description;
93 }
94
95
96 /***
97 * The channel description file URL (1-500 characters).
98 */
99 protected String docs = null;
100
101 public String getDocs() {
102 return (this.docs);
103 }
104
105 public void setDocs(String docs) {
106 this.docs = docs;
107 }
108
109
110 /***
111 * The image describing this channel.
112 */
113 protected Image image = null;
114
115 public Image getImage() {
116 return (this.image);
117 }
118
119 public void setImage(Image image) {
120 this.image = image;
121 }
122
123
124 /***
125 * The channel language (2-5 characters).
126 */
127 protected String language = null;
128
129 public String getLanguage() {
130 return (this.language);
131 }
132
133 public void setLanguage(String language) {
134 this.language = language;
135 }
136
137
138 /***
139 * The channel last build date (1-100 characters).
140 */
141 protected String lastBuildDate = null;
142
143 public String getLastBuildDate() {
144 return (this.lastBuildDate);
145 }
146
147 public void setLastBuildDate(String lastBuildDate) {
148 this.lastBuildDate = lastBuildDate;
149 }
150
151
152 /***
153 * The channel link (1-500 characters).
154 */
155 protected String link = null;
156
157 public String getLink() {
158 return (this.link);
159 }
160
161 public void setLink(String link) {
162 this.link = link;
163 }
164
165
166 /***
167 * The managing editor (1-100 characters).
168 */
169 protected String managingEditor = null;
170
171 public String getManagingEditor() {
172 return (this.managingEditor);
173 }
174
175 public void setManagingEditor(String managingEditor) {
176 this.managingEditor = managingEditor;
177 }
178
179
180 /***
181 * The channel publication date (1-100 characters).
182 */
183 protected String pubDate = null;
184
185 public String getPubDate() {
186 return (this.pubDate);
187 }
188
189 public void setPubDate(String pubDate) {
190 this.pubDate = pubDate;
191 }
192
193
194 /***
195 * The channel rating (20-500 characters).
196 */
197 protected String rating = null;
198
199 public String getRating() {
200 return (this.rating);
201 }
202
203 public void setRating(String rating) {
204 this.rating = rating;
205 }
206
207
208 /***
209 * The text input description for this channel.
210 */
211 protected TextInput textInput = null;
212
213 public TextInput getTextInput() {
214 return (this.textInput);
215 }
216
217 public void setTextInput(TextInput textInput) {
218 this.textInput = textInput;
219 }
220
221
222 /***
223 * The channel title (1-100 characters).
224 */
225 protected String title = null;
226
227 public String getTitle() {
228 return (this.title);
229 }
230
231 public void setTitle(String title) {
232 this.title = title;
233 }
234
235
236 /***
237 * The RSS specification version number used to create this Channel.
238 */
239 protected double version = 0.91;
240
241 public double getVersion() {
242 return (this.version);
243 }
244
245 public void setVersion(double version) {
246 this.version = version;
247 }
248
249
250 /***
251 * The webmaster email address (1-100 characters).
252 */
253 protected String webMaster = null;
254
255 public String getWebMaster() {
256 return (this.webMaster);
257 }
258
259 public void setWebMaster(String webMaster) {
260 this.webMaster = webMaster;
261 }
262
263
264
265
266
267 /***
268 * Add an additional item.
269 *
270 * @param item The item to be added
271 */
272 public void addItem(Item item) {
273 synchronized (items) {
274 items.add(item);
275 }
276 }
277
278
279 /***
280 * Add an additional skip day name.
281 *
282 * @param skipDay The skip day to be added
283 */
284 public void addSkipDay(String skipDay) {
285 synchronized (skipDays) {
286 skipDays.add(skipDay);
287 }
288 }
289
290
291 /***
292 * Add an additional skip hour name.
293 *
294 * @param skipHour The skip hour to be added
295 */
296 public void addSkipHour(String skipHour) {
297 synchronized (skipHours) {
298 skipHours.add(skipHour);
299 }
300 }
301
302 /***
303 * Return the items for this channel.
304 */
305 public List getItems() {
306 return items;
307 }
308
309
310 /***
311 * Return the skip days for this channel.
312 */
313 public String[] findSkipDays() {
314 synchronized (skipDays) {
315 String skipDays[] = new String[this.skipDays.size()];
316 return ((String[]) this.skipDays.toArray(skipDays));
317 }
318 }
319
320
321 /***
322 * Return the skip hours for this channel.
323 */
324 public String[] getSkipHours() {
325 return findSkipHours();
326 }
327
328
329 /***
330 * Return the skip hours for this channel.
331 */
332 public String[] findSkipHours() {
333 synchronized (skipHours) {
334 String skipHours[] = new String[this.skipHours.size()];
335 return ((String[]) this.skipHours.toArray(skipHours));
336 }
337 }
338
339
340 /***
341 * Return the skip days for this channel.
342 */
343 public String[] getSkipDays() {
344 return findSkipDays();
345 }
346
347
348 /***
349 * Remove an item for this channel.
350 *
351 * @param item The item to be removed
352 */
353 public void removeItem(Item item) {
354 synchronized (items) {
355 items.remove(item);
356 }
357 }
358
359
360 /***
361 * Remove a skip day for this channel.
362 *
363 * @param skipDay The skip day to be removed
364 */
365 public void removeSkipDay(String skipDay) {
366 synchronized (skipDays) {
367 skipDays.remove(skipDay);
368 }
369 }
370
371
372 /***
373 * Remove a skip hour for this channel.
374 *
375 * @param skipHour The skip hour to be removed
376 */
377 public void removeSkipHour(String skipHour) {
378 synchronized (skipHours) {
379 skipHours.remove(skipHour);
380 }
381 }
382 }