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 * 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.
30 */
31 public static String DEFAULT_USER_AGENT = "Rome Client (http://rome.dev.java.net/)";
32
33 /***
34 * @return the User-Agent currently being sent to servers
35 */
36 public abstract String getUserAgent();
37 /***
38 * @param string The User-Agent to sent to servers
39 */
40 public abstract void setUserAgent(String string);
41 /***
42 * Retrieve a feed over HTTP
43 *
44 * @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
45 * @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
46 * @throws IllegalArgumentException if the URL is null;
47 * @throws IOException if a TCP error occurs
48 * @throws FeedException if the feed is not valid
49 * @throws FetcherException if a HTTP error occurred
50 */
51 public abstract SyndFeed retrieveFeed(URL feedUrl) throws IllegalArgumentException, IOException, FeedException, FetcherException;
52
53 /***
54 * <p>Add a FetcherListener.</p>
55 *
56 * <p>The FetcherListener will receive an FetcherEvent when
57 * a Fetcher event (feed polled, retrieved, etc) occurs</p>
58 *
59 * @param listener The FetcherListener to recieve the event
60 */
61 public abstract void addFetcherEventListener(FetcherListener listener);
62
63 /***
64 * <p>Remove a FetcherListener</p>
65 *
66 * @param listener The FetcherListener to remove
67 */
68 public abstract void removeFetcherPolledListener(FetcherListener listener);
69
70 /***
71 * <p>Is this fetcher using rfc3229 delta encoding?</p>
72 *
73 * @return
74 */
75 public abstract boolean isUsingDeltaEncoding();
76
77 /***
78 * <p>Turn on or off rfc3229 delta encoding</p>
79 *
80 * <p>See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html</p>
81 *
82 * <p>NOTE: This is experimental and feedback is welcome!</p>
83 *
84 * @param useDeltaEncoding
85 */
86 public abstract void setUsingDeltaEncoding(boolean useDeltaEncoding);
87
88 }