5.3 Using Java Interfaces to Customize File Processing

5.3.1 Four Java Interfaces to the Driver

Java interfaces enable you to customize file processing by using Java classes that you write:

  • InputSorter

  • InputSource

  • PreProcessor

  • PostProcessor

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

These interfaces enable you to add extensions, which are optional. The driver continues to function as before without extensions. However, if you want to directly modify the behavior of the driver, but have been unable to make these modifications from a style sheet or DirXML® Script, extending the Delimited Text driver can be useful.

By using Java classes that you write, you can use the interfaces to customize the publish and subscribe processes in the following ways:

Table 5-4 Customizing the Publish and Subscribe Processes

Process

Interface

Description

Publish

InputSorter

Defines the processing order of multiple input files.

The system where your driver is installed determines the default processing order. For example, files on an NT system are processed in alphabetical order. You can use the InputSorter to impose the processing order that you require.

Publish

InputSource

Provides data other than the files in the default location for the driver to process.

For example, you could check an FTP server for input files and then transfer the files to the local file system for processing.

Publish

PreProcessor

Ties data manipulation required to prepare input files for driver processing directly to the driver.

Before this interface was available, preprocessing was independent of the driver. You could create a separate application that would monitor another directory for input files, modify the files in some way, and then copy the files to the input directory of the driver. By creating a class that implements the PreProcessor, you can do this type of preprocessing more directly.

Subscribe

PostProcessor

Ties data manipulation required by the application consuming Identity Vault output directly to the driver.

5.3.2 Creating a Java Class

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

5.3.3 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 DelimitedTextShim.jar and DelimitedTextUtil.jar.

5.3.4 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 Identity Manager > Identity Manager Overview.

  2. Locate the driver in its driver set.

  3. Click the driver icon to open the Identity Manager Driver Overview page.

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

  5. In the drop-down menu, select Driver Configuration.

  6. Scroll to Driver Parameters, then click Edit XML.

  7. 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 enter an additional option in the <publisher-options> section. After you’ve updated this file, you’ll see your new options in the interface.

  8. 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 PARAMSMY 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.

  9. 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.

  10. Click OK.