|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PlugIn
This interface defines the methods that must be supported by a class that is to be plugged into curn as a generalized plug-in. curn plug-ins are invoked at various phases of curn execution.
Each plug-in phase is represented by its own Java interface, and each interface has exactly one method. A plug-in that intercepts multiple curn processing phases must implement the interfaces for each of the phases. Here are the plug-in phases, in execution order.
| Plug-in interface | Plug-in method | Description |
|---|---|---|
StartupPlugIn |
runStartupPlugIn() |
Called immediately after curn has started, but before it has loaded its configuration file or its cache. Intercepting this phase is useful if a plug-in needs to perform initialization. |
MainConfigItemPlugIn |
runMainConfigItemPlugIn() |
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, its runMainConfigItemPlugIn() 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. |
FeedConfigItemPlugIn |
runFeedConfigItemPlugIn() |
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, its runFeedConfigItemPlugIn() 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. |
OutputHandlerConfigItemPlugIn |
runOutputHandlerConfigItemPlugIn() |
Called immediately after curn has read and processed a configuration item in an "OutputHandler" 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, its runOutputHandlerConfigItemPlugIn() 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. |
UnknownSectionConfigItemPlugIn |
runUnknownSectionConfigItemPlugIn() |
Called immediately after curn has read and processed a configuration item in an unknown 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, its runUnknownSectionConfigItemPlugIn() 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. |
PostConfigPlugIn |
runPostConfigPlugIn() |
Called after the entire configuration has been read and parsed, but before any feeds are processed. Intercepting this event is useful for plug-ins that want to adjust the configuration. For instance, the curn command-line wrapper intercepts this plug-in event so it can adjust the configuration to account for command line options. |
CacheLoadedPlugIn |
runCacheLoadedPlugIn() |
Called after the curn cache has been read (and after any expired entries have been purged), but before any feeds are processed. |
PreFeedDownloadPlugIn |
runPreFeedDownloadPlugIn() |
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:
|
PostFeedDownloadPlugIn |
runPostFeedDownloadPlugIn() |
Called immediately after a feed is downloaded. This method can return false to signal curn that the feed should be skipped. For instance, a plug-in that filters on the unparsed XML feed content could use this method to weed out non-matching feeds before they are downloaded. |
PostFeedParsePlugIn |
runPostFeedParsePlugIn() |
Called immediately after a feed is parsed, but before it is
otherwise processed. A post-feed parse plug-in has access to the
parsed RSS feed data, via an RSSChannel object. This
method can return false to signal curn that the
feed should be skipped. For instance, a plug-in that filters on the
parsed feed data could use this method to weed out non-matching
feeds before they are downloaded. Similarly, a plug-in that edits
the parsed data (removing or editing individual items, for
instance) could use method to do so. |
PreFeedOutputPlugIn |
runPreFeedOutputPlugIn() |
Called immediately before a parsed feed is passed to an output handler. A pre-feed output plug-in cannot affect the feed's processing. (The time to stop the processing of a feed is in one of the other, preceding phases.) This method will be called multiple times for each feed if there are multiple output handlers. |
PostFeedOutputPlugIn |
runPostFeedOutputPlugIn() |
Called immediately after a parsed feed is passed to an output handler. A post-feed output plug-in cannot affect the feed's processing. (The time to stop the processing of a feed is in one of the other, preceding phases.) This method will be called multiple times for each feed if there are multiple output handlers. |
PostOutputHandlerFlushPlugIn |
runPostOutputHandlerFlushPlugIn() |
Called immediately after an output handler is flushed (i.e., after it has been called to process all feeds and its output has been written to a temporary file), but before that output is displayed, emailed, etc. |
PostOutputPlugIn |
runPostOutputPlugIn() |
Called after curn has flush all output handlers. A post-output plug-in is a useful place to consolidate the output from all output handlers. For instance, such a plug-in might pack all the output into a zip file, or email it. |
PreCacheSavePlugIn |
runPreCacheSavePlugIn() |
Called right before the curn cache is to be saved. A plug-in might choose to edit the cache at this point. |
ShutdownPlugIn |
runShutdownPlugIn() |
Called just before curn gets ready to exit. This method allows plug-ins to perform any clean-up they require. |
| 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. |
| Method Detail |
|---|
java.lang.String getPlugInName()
java.lang.String getPlugInSortKey()
void initPlugIn()
throws CurnException
CurnException - on error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||