001: //$Id: RSSChannel.java,v 1.7 2004/09/04 12:09:24 taganaka Exp $
002: package org.gnu.stealthp.rsslib;
003:
004: import java.util.LinkedList;
005: import java.util.Hashtable;
006:
007: /**
008: * RSSChannel's definitions class.
009: *
010: * <blockquote>
011: * <em>This module, both source code and documentation, is in the
012: * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
013: * </blockquote>
014: *
015: * @since RSSLIB4J 0.1
016: * @author Francesco aka 'Stealthp' stealthp[@]stealthp.org
017: * @version 0.2
018: */
019:
020: public class RSSChannel extends RSSObject {
021:
022: private LinkedList rss_items;
023: private RSSImage img;
024: private RSSSequence seq;
025: private RSSTextInput input;
026: private RSSSyndicationModule sy;
027: private String lang;
028: private String copy;
029: private String managing;
030: private String master;
031: private String bdate;
032: private String udate;
033: private String category;
034: private String gen;
035: private String t;
036: private String docs;
037:
038: public RSSChannel() {
039: rss_items = new LinkedList();
040: }
041:
042: /**
043: * Set the language of channel
044: * @param language The language the channel is written in
045: */
046: public void setLanguage(String language) {
047: lang = language;
048: }
049:
050: /**
051: * Set channel's copyright
052: * @param copyright Copyright notice for content in the channel
053: */
054: public void setCopyright(String copyright) {
055: copy = copyright;
056: }
057:
058: /**
059: * Set the lastBuildDate
060: * @param lastBuildDate The last time the content of the channel changed
061: */
062: public void setLastBuildDate(String lastBuildDate) {
063: bdate = lastBuildDate;
064: }
065:
066: /**
067: * Set the managingEditor
068: * @param managingEditor Email address for person responsible for editorial content
069: */
070: public void setManagingEditor(String managingEditor) {
071: managing = managingEditor;
072: }
073:
074: /**
075: * Set the webMaster
076: * @param webMaster Email address for person responsible for technical issues relating to channel.
077: */
078: public void setWebMaster(String webMaster) {
079: master = webMaster;
080: }
081:
082: /**
083: * Set the gerator
084: * @param generator A string indicating the program used to generate the channel
085: */
086: public void setGenerator(String generator) {
087: gen = generator;
088: }
089:
090: /**
091: * Set the TTL time
092: * @param ttl the time to live
093: */
094: public void setTTL(String ttl) {
095: t = ttl;
096: }
097:
098: /**
099: * Set the documentator
100: * @param docs thw documentator
101: */
102: public void setDocs(String docs) {
103: this .docs = docs;
104: }
105:
106: /**
107: * Set a RSSImage object associated to the channel
108: * @param im Specifies a GIF, JPEG or PNG image that can be displayed with the channel.
109: */
110: public void setRSSImage(RSSImage im) {
111: this .img = im;
112: }
113:
114: /**
115: * Set a RSSTextInput object to a channel
116: * @param in Specifies a text input box that can be displayed with the channel
117: */
118: public void setRSSTextInput(RSSTextInput in) {
119: this .input = in;
120: }
121:
122: /**
123: * Get channel's lastBuildDate
124: * @return lastBuildDate
125: */
126: public String getLastBuildDate() {
127: return bdate;
128: }
129:
130: /**
131: * Get the chyannel's copyright
132: * @return copyright (optional)
133: */
134: public String getCopyright() {
135: return copy;
136: }
137:
138: /**
139: * Get the generator program's channel
140: * @return generator (optional)
141: */
142: public String getGenerator() {
143: return gen;
144: }
145:
146: /**
147: * Return the TTL's channel
148: * @return TTL (optional)
149: */
150: public String getTTL() {
151: return t;
152: }
153:
154: /**
155: * Get the docs url about Rss specifications
156: * @return the url (optional)
157: */
158: public String getDocs() {
159: return docs;
160: }
161:
162: /**
163: * Get the language of channell
164: * @return language (optional)
165: */
166: public String getLanguage() {
167: return lang;
168: }
169:
170: /**
171: * Get the webmaster email
172: * @return email of webmaster (optional)
173: */
174: public String getWebMaster() {
175: return master;
176: }
177:
178: /**
179: * Get a RSSTextInput object from the channel
180: * @return the RSSTextInput or null
181: */
182: public RSSTextInput getRSSTextInput() {
183: return input;
184: }
185:
186: /**
187: * Add an RSSItem to a channel object
188: * @param itm the RSSItem item
189: */
190: public void addItem(RSSItem itm) {
191: rss_items.add(itm);
192: }
193:
194: /**
195: * Set the channel's item's sequece
196: * @param s The RSSSequence
197: */
198: public void addRSSSequence(RSSSequence s) {
199: seq = s;
200: }
201:
202: /**
203: * Get a RSSImage from the channel
204: * @return RSSImage if exists (optional)
205: */
206: public RSSImage getRSSImage() {
207: return this .img;
208: }
209:
210: /**
211: * Get a linkedList wich contains the Channel's RSSItem
212: * @return the RSSItems's list
213: */
214: public LinkedList getItems() {
215: return this .rss_items;
216: }
217:
218: /**
219: * Get the sequnce from the channel<br>
220: * This element should be always present
221: * @return the RSSSequence
222: */
223: public RSSSequence getItemsSequence() {
224: return seq;
225: }
226:
227: /**
228: * Set syndication module for channel's
229: * @param s syndication namespaces module
230: */
231: public void setSyndicationModule(RSSSyndicationModule s) {
232: sy = s;
233: }
234:
235: /**
236: * Get the syndication module object from the RSS object
237: * @return The object or null
238: */
239: public RSSSyndicationModule getRSSSyndicationModule() {
240: return sy;
241: }
242:
243: /**
244: * Useful for debug
245: * @return An info string about channel
246: */
247: public String toString() {
248: String info = "ABOUT ATTRIBUTE: " + about + "\n" + "TITLE: "
249: + title + "\n" + "LINK: " + link + "\n"
250: + "DESCRIPTION: " + description + "\nLANGUAGE: " + lang;
251: return info;
252: }
253:
254: }
|