org.clapper.curn.plugins
Class GzipDownloadPlugIn

java.lang.Object
  extended by org.clapper.curn.plugins.GzipDownloadPlugIn
All Implemented Interfaces:
FeedConfigItemPlugIn, MainConfigItemPlugIn, PlugIn, PreFeedDownloadPlugIn

public class GzipDownloadPlugIn
extends java.lang.Object
implements MainConfigItemPlugIn, FeedConfigItemPlugIn, PreFeedDownloadPlugIn

The GzipDownloadPlugIn handles setting the global and per-feed HTTP header that requests gzipped (compressed) feed data (assuming the remote server honors that header). It intercepts the following configuration parameters:

Section Parameter Meaning
[curn] GzipDownload The global default setting, if none is supplied in individual feed sections. Defaults to true.
[Feedxxx] GzipDownload Whether or not to ask for gzipped data for a particular feed. Defaults to the global setting if not specified.

Version:
$Revision: 6491 $

Constructor Summary
GzipDownloadPlugIn()
          Default constructor (required).
 
Method Summary
 java.lang.String getPlugInName()
          Get a displayable name for the plug-in.
 java.lang.String getPlugInSortKey()
          Get the sort key for this plug-in.
 void initPlugIn()
          Initialize the plug-in.
 boolean runFeedConfigItemPlugIn(java.lang.String sectionName, java.lang.String paramName, CurnConfig config, FeedInfo feedInfo)
          Called immediately after curn has read and processed a configuration item in a "feed" configuration section.
 void runMainConfigItemPlugIn(java.lang.String sectionName, java.lang.String paramName, CurnConfig config)
          Called immediately after curn has read and processed a configuration item in the main [curn] configuration section.
 boolean runPreFeedDownloadPlugIn(FeedInfo feedInfo, java.net.URLConnection urlConn)
          Called just before a feed is downloaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GzipDownloadPlugIn

public GzipDownloadPlugIn()
Default constructor (required).

Method Detail

getPlugInName

public java.lang.String getPlugInName()
Get a displayable name for the plug-in.

Specified by:
getPlugInName in interface PlugIn
Returns:
the name

getPlugInSortKey

public java.lang.String getPlugInSortKey()
Get the sort key for this plug-in.

Specified by:
getPlugInSortKey in interface PlugIn
Returns:
the sort key string.

initPlugIn

public void initPlugIn()
                throws CurnException
Initialize the plug-in. This method is called before any of the plug-in methods are called.

Specified by:
initPlugIn in interface PlugIn
Throws:
CurnException - on error

runMainConfigItemPlugIn

public void runMainConfigItemPlugIn(java.lang.String sectionName,
                                    java.lang.String paramName,
                                    CurnConfig config)
                             throws CurnException
Called immediately after curn has read and processed a configuration item in the main [curn] configuration section. All configuration items are passed, one by one, to each loaded plug-in. If a plug-in class is not interested in a particular configuration item, this method should simply return without doing anything. Note that some configuration items may simply be variable assignment; there's no real way to distinguish a variable assignment from a blessed configuration item.

Specified by:
runMainConfigItemPlugIn in interface MainConfigItemPlugIn
Parameters:
sectionName - the name of the configuration section where the item was found
paramName - the name of the parameter
config - the CurnConfig object
Throws:
CurnException - on error
See Also:
CurnConfig

runFeedConfigItemPlugIn

public boolean runFeedConfigItemPlugIn(java.lang.String sectionName,
                                       java.lang.String paramName,
                                       CurnConfig config,
                                       FeedInfo feedInfo)
                                throws CurnException
Called immediately after curn has read and processed a configuration item in a "feed" configuration section. All configuration items are passed, one by one, to each loaded plug-in. If a plug-in class is not interested in a particular configuration item, this method should simply return without doing anything. Note that some configuration items may simply be variable assignment; there's no real way to distinguish a variable assignment from a blessed configuration item.

Specified by:
runFeedConfigItemPlugIn in interface FeedConfigItemPlugIn
Parameters:
sectionName - the name of the configuration section where the item was found
paramName - the name of the parameter
config - the active configuration
feedInfo - partially complete FeedInfo object for the feed. The URL is guaranteed to be present, but no other fields are.
Returns:
true to continue processing the feed, false to skip it
Throws:
CurnException - on error
See Also:
CurnConfig, FeedInfo, FeedInfo.getURL()

runPreFeedDownloadPlugIn

public boolean runPreFeedDownloadPlugIn(FeedInfo feedInfo,
                                        java.net.URLConnection urlConn)
                                 throws CurnException

Called just before a feed is downloaded. This method can return false to signal curn that the feed should be skipped. The plug-in method can also set values on the URLConnection used to download the plug-in, via URL.setRequestProperty(). (Note that all URLs, even file: URLs, are passed into this method. Setting a request property on the URLConnection object for a file: URL will have no effect--though it isn't specifically harmful.)

Possible uses for a pre-feed download plug-in include:

Specified by:
runPreFeedDownloadPlugIn in interface PreFeedDownloadPlugIn
Parameters:
feedInfo - the FeedInfo object for the feed to be downloaded
urlConn - the java.net.URLConnection object that will be used to download the feed's XML.
Returns:
true if curn should continue to process the feed, false to skip the feed
Throws:
CurnException - on error
See Also:
FeedInfo


Copyright © 2004-2006 Brian M. Clapper. All Rights Reserved.