org.rometools.fetcher.impl
Class AbstractFeedFetcher

java.lang.Object
  extended by org.rometools.fetcher.impl.AbstractFeedFetcher
All Implemented Interfaces:
FeedFetcher
Direct Known Subclasses:
HttpClientFeedFetcher, HttpURLFeedFetcher

public abstract class AbstractFeedFetcher
extends Object
implements FeedFetcher


Field Summary
 
Fields inherited from interface org.rometools.fetcher.FeedFetcher
DEFAULT_USER_AGENT
 
Constructor Summary
AbstractFeedFetcher()
           
 
Method Summary
 void addFetcherEventListener(FetcherListener listener)
          Add a FetcherListener.
static com.sun.syndication.feed.synd.SyndFeed combineFeeds(com.sun.syndication.feed.synd.SyndFeed originalFeed, com.sun.syndication.feed.synd.SyndFeed newFeed)
          Combine the entries in two feeds into a single feed.
protected  void fireEvent(String eventType, String urlStr)
           
protected  void fireEvent(String eventType, String urlStr, com.sun.syndication.feed.synd.SyndFeed feed)
           
protected  void fireEvent(String eventType, URLConnection connection)
           
protected  void fireEvent(String eventType, URLConnection connection, com.sun.syndication.feed.synd.SyndFeed feed)
           
 String getUserAgent()
           
protected  void handleErrorCodes(int responseCode)
          Handles HTTP error codes.
 boolean isPreserveWireFeed()
           
 boolean isUsingDeltaEncoding()
          Is this fetcher using rfc3229 delta encoding?
 void removeFetcherEventListener(FetcherListener listener)
          Remove a FetcherListener
 void setPreserveWireFeed(boolean preserveWireFeed)
          If set to true, the WireFeed will be made accessible from the SyndFeed object returned from the Fetcher via the originalWireFeed() method.
 void setUserAgent(String string)
           
 void setUsingDeltaEncoding(boolean useDeltaEncoding)
          Turn on or off rfc3229 delta encoding See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html NOTE: This is experimental and feedback is welcome!
protected  void throw4XXError(int responseCode)
           
protected  void throwAuthenticationError(int responseCode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rometools.fetcher.FeedFetcher
retrieveFeed, retrieveFeed
 

Constructor Detail

AbstractFeedFetcher

public AbstractFeedFetcher()
Method Detail

getUserAgent

public String getUserAgent()
Specified by:
getUserAgent in interface FeedFetcher
Returns:
the User-Agent currently being sent to servers

setUserAgent

public void setUserAgent(String string)
Specified by:
setUserAgent in interface FeedFetcher
Parameters:
string - The User-Agent to sent to servers

fireEvent

protected void fireEvent(String eventType,
                         URLConnection connection)
Parameters:
eventType - The event type to fire
connection - the current connection

fireEvent

protected void fireEvent(String eventType,
                         URLConnection connection,
                         com.sun.syndication.feed.synd.SyndFeed feed)
Parameters:
eventType - The event type to fire
connection - the current connection
feed - The feed to pass to the event

fireEvent

protected void fireEvent(String eventType,
                         String urlStr)
Parameters:
eventType - The event type to fire
urlStr - the current url as a string

fireEvent

protected void fireEvent(String eventType,
                         String urlStr,
                         com.sun.syndication.feed.synd.SyndFeed feed)
Parameters:
eventType - The event type to fire
urlStr - the current url as a string
feed - The feed to pass to the event

addFetcherEventListener

public void addFetcherEventListener(FetcherListener listener)
Description copied from interface: FeedFetcher

Add a FetcherListener.

The FetcherListener will receive an FetcherEvent when a Fetcher event (feed polled, retrieved, etc) occurs

Specified by:
addFetcherEventListener in interface FeedFetcher
Parameters:
listener - The FetcherListener to recieve the event
See Also:
com.sun.syndication.fetcher.FeedFetcher#addFetcherEventListener(com.sun.syndication.fetcher.FetcherListener)

removeFetcherEventListener

public void removeFetcherEventListener(FetcherListener listener)
Description copied from interface: FeedFetcher

Remove a FetcherListener

Specified by:
removeFetcherEventListener in interface FeedFetcher
Parameters:
listener - The FetcherListener to remove
See Also:
com.sun.syndication.fetcher.FeedFetcher#removeFetcherEventListener(com.sun.syndication.fetcher.FetcherListener)

isUsingDeltaEncoding

public boolean isUsingDeltaEncoding()
Description copied from interface: FeedFetcher

Is this fetcher using rfc3229 delta encoding?

Specified by:
isUsingDeltaEncoding in interface FeedFetcher
Returns:
Returns the useDeltaEncoding.

setUsingDeltaEncoding

public void setUsingDeltaEncoding(boolean useDeltaEncoding)
Description copied from interface: FeedFetcher

Turn on or off rfc3229 delta encoding

See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html

NOTE: This is experimental and feedback is welcome!

Specified by:
setUsingDeltaEncoding in interface FeedFetcher
Parameters:
useDeltaEncoding - The useDeltaEncoding to set.

handleErrorCodes

protected void handleErrorCodes(int responseCode)
                         throws FetcherException

Handles HTTP error codes.

Parameters:
responseCode - the HTTP response code
Throws:
FetcherException - if response code is in the range 400 to 599 inclusive

throw4XXError

protected void throw4XXError(int responseCode)
                      throws FetcherException
Throws:
FetcherException

throwAuthenticationError

protected void throwAuthenticationError(int responseCode)
                                 throws FetcherException
Throws:
FetcherException

combineFeeds

public static com.sun.syndication.feed.synd.SyndFeed combineFeeds(com.sun.syndication.feed.synd.SyndFeed originalFeed,
                                                                  com.sun.syndication.feed.synd.SyndFeed newFeed)

Combine the entries in two feeds into a single feed.

The returned feed will have the same data as the newFeed parameter, with the entries from originalFeed appended to the end of its entries.

Parameters:
originalFeed -
newFeed -
Returns:

isPreserveWireFeed

public boolean isPreserveWireFeed()

setPreserveWireFeed

public void setPreserveWireFeed(boolean preserveWireFeed)
Description copied from interface: FeedFetcher
If set to true, the WireFeed will be made accessible from the SyndFeed object returned from the Fetcher via the originalWireFeed() method. Each Entry in the feed will have the corresponding wireEntry property set.

Specified by:
setPreserveWireFeed in interface FeedFetcher


Copyright © 2004-2013 ROME Project. All Rights Reserved.