com.novell.nds.dirxml.driver.delimitedtext
Interface PreProcessor

All Superinterfaces:
Extension

public interface PreProcessor
extends Extension

The listener interface for receiving notification of new input files to process. The class that is interested in doing pre-processing on input files implements this interface. When the publisher channel of the delimited text driver finds a new input file to process, it calls the nextInputFile method of this interface and then does its processing. In that way, a class can be notified of and do pre-processing on any input file that the delimited text driver consumes.

In order for the driver to find the appropriate class that implements this interface, the DirXML administrator (implementor) needs to configure the <publisher-options> section of the driver configuration by adding a line similar to the following:

<pre-processor display-name="PreProcessor Class">com.acme.MyPreProcessor</pre-processor>

If you also add a line similar to the following, the string it contains will be passed to the init method of the PreProcessor:

<pre-processor-params display-name="PreProcessor init string">MY CONFIG DATA</pre-processor-params>

If the supplied value actually represents a class that is in a .jar file in the lib directory, that class will receive notification before the driver processes each input file.

See Also:
PostProcessor, InputSorter, InputSource

Method Summary
 void nextInputFile(java.io.File inputFile)
          Invoked just before the Delimited Text driver processes an input file.
 
Methods inherited from interface com.novell.nds.dirxml.driver.delimitedtext.Extension
init
 

Method Detail

nextInputFile

public void nextInputFile(java.io.File inputFile)
                   throws SkipFileException,
                          WaitException,
                          StatusException,
                          java.lang.Exception
Invoked just before the Delimited Text driver processes an input file. After this method returns, the driver will open and process the file. If you use this method to actually open and read or modify the file, be sure to close the file before this method returns.

Parameters:
inputFile - Represents the next file which is about to be processed by the publisher channel.
Throws:
SkipFileException - Throw this if you want the driver to never process this input file. The driver will immediately attempt to rename or delete the file, based on its rename-ext parameter.
WaitException - Throw this if you want the driver to skip this file for now, and then look for it again after the next polling interval. You might also want to throw this exception if you delete a file yourself for some reason.
StatusException - Throw this if you want to report an error all the way back to the DirXML engine.
java.lang.Exception - If you throw any other exception, it will get reported back to the engine as an error status level and printed in red on the DSTrace utility.