Data Transformation Engine Services Guide

Chapter 13 – Writing the Adapter
95
Chapter 13 – Writing the
Adapter
Sample User-Written Adapter
A sample adapter, “useradapter” is included with the NonStop DTE Command Server.
Also included is the source code for the adapter, the makefile, and a sample ini file
(mercadpt.ini). The sample adapter includes the following files:
useradapter.c The adapter.
useradapter.mak Makefile for the adapter.
mercadpt.ini Description file for the adapter.
The sample adapter “useradapter” is a simple file adapter. The purpose of the file
useradapter.c is to show the structures and code required to implement a user adapter and
how properties are set and obtained. The adapter can be built using the provided makefile
useradapter.mak. To build libuseradapter.a, issue the following commands from a
Command Prompt in the. /src directory:
make -f useradapter.mak clean
make -f useradapter.mak all
The useradapter behaves just like the rest of the adapters. It has to be relinked to the
Command Server in order to be functional. Once libuseradapter.a is built, copy it to the
Mercator directory. To register the adapter, copy the following line to the adapters.xml
file, under the UserAdapters section:
<UserAdapter name=" File Sample " alias="SFILE" id="201"
library="useradapter" vendor="Mercator"/>
To test the useradapter, a map useradapter.mmc has been provided in the ./src directory.
It has been compiled to use the useradapter; if you don't have it set up, the map will fail
with Return Code 12 - Source Not Available. The app_adapter directory in /examples,
which contained files for a Custom adapter example provided in the 5.0.3 version, has
been removed.
The whole purpose of the useradapter map and files is to show how to code a user adapter
and demonstrate all the steps that are required to get it running.