Master Index Match Engine Reference

Step 4: Define Data Source Handling (Optional)

If your custom comparators use external data sources to provide additional information for matching weight calculations, you need to create a Java class that lets you load the file to memory or have real-time access to the data file content. You can also define validations to perform. You do not need to create this file in the same package as the Java comparator class, but for packaging purposes, create it in the same working folder.

You need to perform this step if you defined lines similar to the following in comparatorsList.xml:


<data-sources>
   <datasource description="Serial numbers" type="java.io.File" />
</data-sources>

ProcedureTo Define Data Source Handling

  1. Complete Step 3: Define Parameter Validations (Optional).

  2. Create a Java class named the same name as the Java class that defines the comparator with “SourcesHandler” appended.

    For example, if the comparator is defined by a class named ExactComparator, the parameter validation class would be ExactComparatorSourcesHandler.

  3. In this class, implement com.sun.mdm.matcher.comparators.validator.DataSourcesHandler.

    The method in this class is described below.

  4. Continue to Step 5: Define Curve Adjustment or Linear Fitting (Optional).

handleComparatorsDataSources

Description

The DataSourcesHandler class contains one method, handleComparatorsDataSources, that allows you to define properties for the data source. This method takes one parameter that is a DataSourcesProperties object. This class and its methods are described in DataSourcesProperties Class.

Syntax

Object handleComparatorsDataSources(DataSourcesProperties dataSources)

Parameters

Parameter 

Type 

Description 

dataSources 

DataSourceProperties 

A list of properties for the data handler (see DataSourcesProperties Class).

Return Value

Object

Throws

MatcherException

IOException