Implementing Your Gateway


There are numerous strategies for implementing your own gateway. The following steps outline one strategy that you can use:

1. Review and modify the style files that come with the sample. You perhaps can understand them best if you look at them in the following order: style.vgw, vgwsamp.prm, vgwsamp.gfl, vgwsamp.vgw, and vgwsamp.cfg. Working with these files first will help you understand the relationships between the style files and the gateway and the kinds of entries you can make. You typically will modify these files several times before you finish implementing your gateway. For more information about style files, see Configuring Style Files.

2. Take the sample gateway callback functions in vgwsamp.c, (for more information, see Understanding the Sample Gateway Code) and remove all the code, but not the comments, from within the callback functions.

3. Implement your driver callback functions, which are described in Driver Interface. Determine the kind of per-driver repository data that will be needed by your other callback functions.

4. Implement your session callback functions, which are described in Session Interface. Determine the kind of repository-specific information you will need to keep for each session. Don’t forget to include information related to security and internationalization.

5. Implement your schema callback functions, which are described in Schema Interface. Determine the “view” of the repository you want the user to see. Include an internal field for security, if desired.

6. Implement your field callback functions, which are described in Field Interface. You will need to provide document-level security and internationalization.

7. Implement your stream callback functions, which are described in Stream Interface. Initially, your VgwStreamGetTokenFnc function can create a VdkTokenType_Eof, which will immediately free the stream yet allow you to test your functions.

8. Create a collection using your gateway; see Building and Testing Your Gateway Driver. You can use the rcvdk command’s search option to list the documents in your repository.

9. Implement your security callback functions, which are described in Security Interface. You can use the rcvdk command’s user option to authenticate the user before performing a search.

10. Finish implementing the VgwStreamGetTokenFnc and VgwStreamGetTokenFreeFnc functions. (For more information, see Stream Interface.) You can provide translation to the locale’s character set, if necessary. You can use the rcvdk command’s results and view options to obtain the search results and view a document after performing a search.

11. Thoroughly test your gateway using the mkvdk and rcvdk commands. For more information, see Testing Your Gateway Driver.