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.fetcher;
18  
19  import java.io.IOException;
20  import java.net.URL;
21  
22  import com.sun.syndication.feed.synd.SyndFeedI;
23  import com.sun.syndication.io.FeedException;
24  
25  public interface FeedFetcherI {
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.SyndFeedI} 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 SyndFeedI 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  }