Using Java Interfaces to Customize File Processing

Java interfaces enable you to customize file processing by using Java classes that you write. These interfaces are InputSorter, InputSource, PreProcessor, and PostProcessor.

These enhancements to the driver require Java programming. To implement this functionality, complete the following processes:


Creating a New Java Class

JavaDoc and a sample class are included with the driver to help you implement this new functionality. Find these files at platform\dirxml\drivers\delimitedtext\extensions.


Creating a Java .jar File

After you have implemented your class file, create a Java .jar file (Java archive) using the jar tool. The .jar file must contain the class that you have created. Put the .jar file into the novell/nds/lib directory. The path might differ, depending on the platform you're on, but it should be the same location as the DelimitedTextShim.jar and the DelimitedTextUtil.jar.


Configuring the Driver to Use the New Class

After you have placed the new .jar file in the correct location, configure the driver to use your new class by modifying the driver's properties.

  1. In iManager, select DirXML Management > Overview.

  2. Locate the driver in its driver set.

  3. Click the driver icon to open the Driver Overview Page.

  4. Click the driver icon again to open the Modify Object page.

  5. Click Driver Configuration > Driver Parameters > Edit XML.

  6. Locate the <publisher-options> section of the file.

    This file defines which parameters and values appear in the Driver Parameters section of the Driver Configuration page.

    For each class you created that works on the Publisher channel, you will enter an additional option in the <publisher-options> section. After you've updated this file, you'll see your new options in the interface.

  7. For each new class you created on the publisher channel, add an entry corresponding to the interface type. Use the following table as a guide:

    Interface New Entry

    InputSorter

    <input-sorter display-name="InputSorter Class">com.acme.MyNewClass</input-sorter>

    <input-sorter-params display-name="InputSorter init string">MY CONFIG PARAMS</input-sorter-params>

    InputSource

    <input-source display-name="InputSource Class">com.acme.MyNewClass</input-source>

    <input-source-params display-name="InputSource init string">MY CONFIG PARAMS</input-source-params>

    PreProcessor

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

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

    1. Replace com.acme.MyNewClass with the name of the class that you have defined along with a full package identifier.

    2. Replace MY CONFIG PARAMS with any information that you want to pass to the init method of your class.

      The init method of your class is then responsible for parsing the information contained in this string. If your class doesn't require a configuration string to be passed to the init method, you can leave off the whole element, in which case null would be passed to the init method.

  8. If you created a PostProcessor rule, locate the <subscriber-options> section of the file and add the following lines:

    <post-processor display-name="PostProcessor Class">com.acme.MyNewClass</post-processor> <post-processor-params display-name="PostProcessor init string">MY CONFIG PARAMS</post-processor-params> 
    1. Replace com.acme.MyNewClass with the name of the class that you have defined along with full package information.

    2. Replace MY CONFIG PARAMS with any information that you want to pass to the init method of your class.

      The init method of your class is then responsible for parsing the information contained in this string. If your class doesn't require a configuration string to be passed to the init method, you can leave off the entire element, in which case null would be passed to the init method.

  9. Click OK.