IM Relationship Resolution Information Center, Version 4.2

initPlugin

Custom scoring plugins require an initPlugin function.

Example

initPlugin allows the plugin to load and save configuration information that it will need for scoring. The database connection string and the .ini file name are provided in the configInfo string. initPlugin will be called once for each attribute type that uses a plug-in. These are shared objects. To support plugin use for more than one attribute type, configuration information must be saved for each attribute type. This way when score is called, it can look up the configuration information for the appropriate attribute type.

const int initPlugin(const char *configInfo, 
                     const uint configSize, 
                     char *errorStr, 
                     const uint maxStrSize);
configSize
is the length of the string contained in configInfo Error must be in the following format.
errorStr
is a pre-allocated memory buffer to copy a null terminated string. The string contains XML that describes any initialization errors. The error must be in the following format:
<ERROR>error text</ERROR>
maxStrSize
is the size of the pre-allocated memory buffer that errorStr points to. The size of error string cannot exceed this value.

The following is a pseudocode example of a score function:

const int initPlugin(const char *configInfo, const uint configSize, char *errorStr, const uint maxStrSize)
{
  //create string out of configInfo
  //parse string with XML parser
  //extract DB_CONNECTION and CONFIG_FILE
  //connect to database
  //select config info from database
  //open CONFIG_FILE
  //read config info from .ini file
  
  //if there was an error create null terminated error string and 
  //strcpy into errorStr. Return -1.
  //if no error, return 0.
}

The initPlugin should return -1 if an error is encountered.



Feedback

Last updated: 2009