org.clapper.curn
Class DataPersisterFactory

java.lang.Object
  extended by org.clapper.curn.DataPersisterFactory
All Implemented Interfaces:
MainConfigItemPlugIn, PlugIn, PostConfigPlugIn

public final class DataPersisterFactory
extends java.lang.Object
implements MainConfigItemPlugIn, PostConfigPlugIn

Class that's used to create a DataPersister. This class is implemented as a plug-in, so that curn's plug-in discovery mechanism will find it and automatically configure it. The factory methods, though, are static; the plug-in logic merely sets up the data structures that are used by the static methods.

Version:
$Revision: 6548 $
See Also:
PlugIn, DataPersister

Constructor Summary
DataPersisterFactory()
          Creates a new instance of DataPersisterFactory
 
Method Summary
static DataPersister getInstance()
          Get the configured data persister object.
 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.
 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.
 void runPostConfigPlugIn(CurnConfig config)
          Called after the entire configuration has been read and parsed, but before any feeds are processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataPersisterFactory

public DataPersisterFactory()
Creates a new instance of DataPersisterFactory

Method Detail

getInstance

public static DataPersister getInstance()
Get the configured data persister object.

Returns:
the configured data persister.

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

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.

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

runPostConfigPlugIn

public void runPostConfigPlugIn(CurnConfig config)
                         throws CurnException
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.

Specified by:
runPostConfigPlugIn in interface PostConfigPlugIn
Parameters:
config - the parsed CurnConfig object
Throws:
CurnException - on error
See Also:
CurnConfig


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