Data Transformation Engine Services Guide

Chapter 15 – Adapter Functions
98
Chapter 15 – Adapter Functions
The following functions may be provided by each adapter and defined in the mercadpt.ini
file. Mercator Command Server reads the ini file and registers the parameters
described therein. Note that some of the functions are mandatory and others are optional.
The following table defines the functions that an adapter may provide:
Function Participate in
connection
management
Initialize
Adapter
Optional
Shutdown Adapter Optional
Validate Command
Required
Compare Connections
Required
Connect
Required
Disconnect
Required
Validate Connection Optional
Free Adapter Parms
Required
Get
Required
Put
Required
Note that the functions do not have to use these names. The actual function names are
specified by the mercadpt.ini file, which is read and registered by Mercator Command
Server at startup time. Hence adapters may use whatever function names they like. Note
however, that multiple adapters may NOT use the same entry points (or function names)
because the adapter is linked with the Mercator Command Server.
The chronological sequence of calls to an adapter is described below. Note that there are
references here to fields within a structure; these are described in the Exit Parameters
section.
Initialize Adapter Used to initialize anything in the adapter (such as global
variables, etc).
Validate Command Used to parse an adapter command. The result of the call
is a structure which is returned in lpAdapterParms. Validate Command is called once
for each card or rule (such as GET or PUT). The Validate Command function must
define the structure for lpAdapterParms and allocate space for it.
Connect Used to connect to the resource. The adapter obtains its connection
information from the lpAdapterParms field, connects to the resource, and returns
connection handles and other context information in a structure pointed to by
lpContext. The Connect function must define the structure for lpContext and allocate
space for it. Connect is called whenever a new connection is required to be made.
Because of connection reuse, there may be less calls to Connect than there are to
Validate Command