1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.fetcher;
18
19 import java.io.IOException;
20 import java.net.URL;
21
22 import com.sun.syndication.feed.synd.SyndFeed;
23 import com.sun.syndication.io.FeedException;
24
25 public interface FeedFetcher {
26 /***
27 * <p>The default user agent. It is not marked final so
28 * buggy java compiler will not write this string
29 * into all classes that reference it.</p>
30 *
31 * <p>http://tinyurl.com/64t5n points to https://rome.dev.java.net/
32 * Some servers ban user agents with "Java" in the name.</p>
33 *
34 */
35 public static String DEFAULT_USER_AGENT = "Rome Client (http://tinyurl.com/64t5n)";
36
37 /***
38 * @return the User-Agent currently being sent to servers
39 */
40 public abstract String getUserAgent();
41 /***
42 * @param string The User-Agent to sent to servers
43 */
44 public abstract void setUserAgent(String string);
45 /***
46 * Retrieve a feed over HTTP
47 *
48 * @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
49 * @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
50 * @throws IllegalArgumentException if the URL is null;
51 * @throws IOException if a TCP error occurs
52 * @throws FeedException if the feed is not valid
53 * @throws FetcherException if a HTTP error occurred
54 */
55 public abstract SyndFeed retrieveFeed(URL feedUrl) throws IllegalArgumentException, IOException, FeedException, FetcherException;
56
57 /***
58 * <p>Add a FetcherListener.</p>
59 *
60 * <p>The FetcherListener will receive an FetcherEvent when
61 * a Fetcher event (feed polled, retrieved, etc) occurs</p>
62 *
63 * @param listener The FetcherListener to recieve the event
64 */
65 public abstract void addFetcherEventListener(FetcherListener listener);
66
67 /***
68 * <p>Remove a FetcherListener</p>
69 *
70 * @param listener The FetcherListener to remove
71 */
72 public abstract void removeFetcherEventListener(FetcherListener listener);
73
74 /***
75 * <p>Is this fetcher using rfc3229 delta encoding?</p>
76 *
77 * @return
78 */
79 public abstract boolean isUsingDeltaEncoding();
80
81 /***
82 * <p>Turn on or off rfc3229 delta encoding</p>
83 *
84 * <p>See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html</p>
85 *
86 * <p>NOTE: This is experimental and feedback is welcome!</p>
87 *
88 * @param useDeltaEncoding
89 */
90 public abstract void setUsingDeltaEncoding(boolean useDeltaEncoding);
91
92 }