View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package com.sun.syndication.feed.synd;
18  
19  import com.sun.syndication.feed.WireFeed;
20  import com.sun.syndication.feed.module.Module;
21  import com.sun.syndication.common.ToString;
22  import com.sun.syndication.common.CopyFrom;
23  
24  import java.util.Date;
25  import java.util.List;
26  
27  /***
28   * Bean interface for all types of feeds.
29   * <p>
30   * It handles all RSS versions and Atom 0.3, it normalizes all info, it may lose information.
31   * <p>
32   * @author Alejandro Abdelnur
33   *
34   */
35  public interface SyndFeed extends ToString,Cloneable,CopyFrom {
36  
37      /***
38       * Returns the real feed types the SyndFeedImpl supports when converting from and to.
39       * <p>
40       * @return the real feed type supported.
41       */
42      List getSupportedFeedTypes();
43  
44      /***
45       * Creates a real feed containing the information of the SyndFeedImpl.
46       * <p>
47       * The feed type of the created WireFeed is taken from the SyndFeedImpl feedType property.
48       * <p>
49       * @return the real feed.
50       *
51       */
52      WireFeed createWireFeed();
53  
54      /***
55       * Creates a real feed containing the information of the SyndFeedImpl.
56       * <p>
57       * @param feedType the feed type for the WireFeed to be created.
58       * @return the real feed.
59       *
60       */
61      WireFeed createWireFeed(String feedType);
62  
63  
64      /***
65       * Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.
66       * <p>
67       * @return the feed type, <b>null</b> if none.
68       *
69       */
70      String getFeedType();
71  
72      /***
73       * Sets the wire feed type the feed will-have when coverted to a WireFeed.
74       * <p>
75       * @param feedType the feed type to set, <b>null</b> if none.
76       *
77       */
78      void setFeedType(String feedType);
79  
80      /***
81       * Returns the charset encoding of a the feed. This is not set by Rome parsers.
82       * <p>
83       * @return the charset encoding of the feed.
84       *
85       */
86      public String getEncoding();
87  
88      /***
89       * Sets the charset encoding of a the feed. This is not set by Rome parsers.
90       * <p>
91       * @param encoding the charset encoding of the feed.
92       *
93       */
94      public void setEncoding(String encoding);
95  
96      /***
97       * Returns the feed URI.
98       * <p>
99       * How the feed URI maps to a concrete feed type (RSS or Atom) depends on
100      * the concrete feed type. This is explained in detail in Rome documentation,
101      * <a href="http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping">Feed and entry URI mapping</a>.
102      * <p>
103      * The returned URI is a normalized URI as specified in RFC 2396bis.
104      * <p>
105      * @return the feed URI, <b>null</b> if none.
106      *
107      */
108     String getUri();
109 
110     /***
111      * Sets the feed URI.
112      * <p>
113      * How the feed URI maps to a concrete feed type (RSS or Atom) depends on
114      * the concrete feed type. This is explained in detail in Rome documentation,
115      * <a href="http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping">Feed and entry URI mapping</a>.
116      * <p>
117      * @param uri the feed URI to set, <b>null</b> if none.
118      *
119      */
120     void setUri(String uri);
121 
122     /***
123      * Returns the feed title.
124      * <p>
125      * @return the feed title, <b>null</b> if none.
126      *
127      */
128     String getTitle();
129 
130     /***
131      * Sets the feed title.
132      * <p>
133      * @param title the feed title to set, <b>null</b> if none.
134      *
135      */
136     void setTitle(String title);
137 
138     /***
139      * Returns the feed link.
140      * <p>
141      * @return the feed link, <b>null</b> if none.
142      *
143      */
144     String getLink();
145 
146     /***
147      * Sets the feed link.
148      * <p>
149      * @param link the feed link to set, <b>null</b> if none.
150      *
151      */
152     void setLink(String link);
153 
154     /***
155      * Returns the feed description.
156      * <p>
157      * @return the feed description, <b>null</b> if none.
158      *
159      */
160     String getDescription();
161 
162     /***
163      * Sets the feed description.
164      * <p>
165      * @param description the feed description to set, <b>null</b> if none.
166      *
167      */
168     void setDescription(String description);
169 
170     /***
171      * Returns the feed published date.
172      * <p>
173      * This method is a convenience method, it maps to the Dublin Core module date.
174      * <p>
175      * @return the feed published date, <b>null</b> if none.
176      *
177      */
178     Date getPublishedDate();
179 
180     /***
181      * Sets the feed published date.
182      * <p>
183      * This method is a convenience method, it maps to the Dublin Core module date.
184      * <p>
185      * @param publishedDate the feed published date to set, <b>null</b> if none.
186      *
187      */
188     void setPublishedDate(Date publishedDate);
189 
190     /***
191      * Returns the feed author.
192      * <p>
193      * This method is a convenience method, it maps to the Dublin Core module creator.
194      * <p>
195      * @return the feed author, <b>null</b> if none.
196      *
197      */
198     String getAuthor();
199 
200     /***
201      * Sets the feed author.
202      * <p>
203      * This method is a convenience method, it maps to the Dublin Core module creator.
204      * <p>
205      * @param author the feed author to set, <b>null</b> if none.
206      *
207      */
208     void setAuthor(String author);
209 
210     /***
211      * Returns the feed copyright.
212      * <p>
213      * This method is a convenience method, it maps to the Dublin Core module rights.
214      * <p>
215      * @return the feed copyright, <b>null</b> if none.
216      *
217      */
218     String getCopyright();
219 
220     /***
221      * Sets the feed copyright.
222      * <p>
223      * This method is a convenience method, it maps to the Dublin Core module rights.
224      * <p>
225      * @param copyright the feed copyright to set, <b>null</b> if none.
226      *
227      */
228     void setCopyright(String copyright);
229 
230     /***
231      * Returns the feed image.
232      * <p>
233      * @return the feed image, <b>null</b> if none.
234      *
235      */
236     SyndImage getImage();
237 
238     /***
239      * Sets the feed image.
240      * <p>
241      * @param image the feed image to set, <b>null</b> if none.
242      *
243      */
244     void setImage(SyndImage image);
245 
246     /***
247      * Returns the feed categories.
248      * <p>
249      * This method is a convenience method, it maps to the Dublin Core module subjects.
250      * <p>
251      * @return a list of SyndCategoryImpl elements with the feed categories,
252      *         an empty list if none.
253      *
254      */
255     List getCategories();
256 
257     /***
258      * Sets the feed categories.
259      * <p>
260      * This method is a convenience method, it maps to the Dublin Core module subjects.
261      * <p>
262      * @param categories the list of SyndCategoryImpl elements with the feed categories to set,
263      *        an empty list or <b>null</b> if none.
264      *
265      */
266     void setCategories(List categories);
267 
268     /***
269      * Returns the feed entries.
270      * <p>
271      * @return a list of SyndEntryImpl elements with the feed entries,
272      *         an empty list if none.
273      *
274      */
275     List getEntries();
276 
277     /***
278      * Sets the feed entries.
279      * <p>
280      * @param entries the list of SyndEntryImpl elements with the feed entries to set,
281      *        an empty list or <b>null</b> if none.
282      *
283      */
284     void setEntries(List entries);
285 
286     /***
287      * Returns the feed language.
288      * <p>
289      * This method is a convenience method, it maps to the Dublin Core module language.
290      * <p>
291      * @return the feed language, <b>null</b> if none.
292      *
293      */
294     String getLanguage();
295 
296     /***
297      * Sets the feed language.
298      * <p>
299      * This method is a convenience method, it maps to the Dublin Core module language.
300      * <p>
301      * @param language the feed language to set, <b>null</b> if none.
302      *
303      */
304     void setLanguage(String language);
305 
306     /***
307      * Returns the module identified by a given URI.
308      * <p>
309      * @param uri the URI of the ModuleImpl.
310      * @return The module with the given URI, <b>null</b> if none.
311      */
312     public Module getModule(String uri);
313 
314     /***
315      * Returns the feed modules.
316      * <p>
317      * @return a list of ModuleImpl elements with the feed modules,
318      *         an empty list if none.
319      *
320      */
321     List getModules();
322 
323     /***
324      * Sets the feed modules.
325      * <p>
326      * @param modules the list of ModuleImpl elements with the feed modules to set,
327      *        an empty list or <b>null</b> if none.
328      *
329      */
330     void setModules(List modules);
331 
332     /***
333      * Creates a deep clone of the object.
334      * <p>
335      * @return a clone of the object.
336      * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
337      *
338      */
339     public Object clone() throws CloneNotSupportedException;
340 
341 }