KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > syndication > fetcher > FeedFetcher


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.fetcher;
18
19 import java.io.IOException JavaDoc;
20 import java.net.URL JavaDoc;
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 JavaDoc 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 JavaDoc getUserAgent();
41     /**
42      * @param string The User-Agent to sent to servers
43      */

44     public abstract void setUserAgent(String JavaDoc 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 JavaDoc feedUrl) throws IllegalArgumentException JavaDoc, IOException JavaDoc, 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 }
Popular Tags