Master Index Match Engine Reference

Step 2: Register the Comparator in the Comparators List

In order to include new comparators in a master index application, you need to create a comparators list file defining the configuration of the comparators. When you import the comparator package into the master index application, this file is read and the entries are added to the comparators list for the project.

Below is a sample comparators list file. Note that the first comparator includes all possible configurations (parameters, dependency classes, data sources, and curve adjust). Most comparators will not be that complex. The second comparator class defines two comparators, Approx and Adjust.


<?xml version="1.0" encoding="UTF-8"?>
<comparators-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="comparatorsList.xsd">
    <group description="New group of comparators" 
     path="com.mycomparators.matchcomparators">
        <comparator description="New Exact Comparator">
            <className>NewExactComparator</className>
            <codes>
                <code description="New Exact Comparator" name="Exact" />
            </codes>
            <params>
              <param description="Fixed length" name="length" 
               type="java.lang.Integer" />
              <param description="Data type" name="dataType" 
               type="java.lang.String" />
            </params>
            <data-sources>
              <datasource description="Serial numbers" type="java.io.File" />
            </data-sources>
            <dependency-classes>
              <dependency-class matchfield="Serial" 
               name="com.genericcomparaotrs.StringComparator" />
            </dependency-classes>
            <curve-adjust status="true" />
        </comparator>
       <comparator description="New Approximate Comparator">
            <className>NewApproxComparator</className>
            <codes>
                <code description="New approximate comparator" name="Approx" />
                <code description="New adjustable comparator" name="Adjust" />
            </codes>
        </comparator>
     </group>               
</comparators-list>

ProcedureTo Register the Comparators

  1. Complete Step 1: Create the Custom Comparator Java Class.

  2. In the same folder where you created the custom Java class package, create a new file named comparatorsList.xml.


    Tip –

    The comparators list file needs to be in the same working directory you created for the custom comparator Java classes.


  3. Add the following header information to the file. You can copy this from the comparatorList.xml file in a master index application.


    <?xml version="1.0" encoding="UTF-8"?>
    <comparators-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:noNamespaceSchemaLocation="comparatorsList.xsd">
     ...
    </comparators-list>
  4. Define the following properties, using the XML structure described in Master Index Match Engine Comparator Definition List. Use the sample above as an example.

    • The group description and Java package for the group.

    • A description for each comparator.

    • The Java class name for each comparator or comparator subgroup.

    • The unique identifying name for each comparator.

    • A list of static parameters for each comparator or comparator subgroup (optional). If you define parameters, you must also perform the steps under Step 3: Define Parameter Validations (Optional).

    • A list of data sources for each comparator or comparator subgroup (optional). If you define data sources, you must also perform the steps under Step 4: Define Data Source Handling (Optional).

    • A list of dependency classes for each comparator or comparator subgroup (optional).

    • Whether to use curve adjustment for each comparator or comparator subgroup (optional). If you set curve adjustment to true, you must perform the steps under Step 5: Define Curve Adjustment or Linear Fitting (Optional).

  5. Continue to Step 3: Define Parameter Validations (Optional)