Sun Java System Calendar Server 6 2005Q4 Developer's Guide

CSAPI Architecture

The CSAPI is a group of shared-object runtime interfaces to Calendar Server functions. You can use plug-in CSAPI modules to manipulate server data for incoming requests and for responses. This architecture allows the server to act as a simple gateway to data that it knows nothing about. It also allows for dynamic logging and statistics tracking, external authentication schemes, user attribute manipulation, and a variety of other functions.

Figure 1–1 shows the relationship of CSAPI modules to other subsystems within Calendar Server. Depending on which functional group or groups a CSAPI module supports, it can interact with one or more areas of Calendar Server functionality, such as data formatting, authentication, and directory services.

A module is a shared object (.so file) on UNIX, or dynamic linked library (.dll file) on Windows. Each module that you provide must implement one or more of the CSAPI interfaces (or pure virtual base classes) defined in this document. For information about the CSAPI interfaces, see Chapter 2, CSAPI Reference.

Each client-side interface addresses a functional area of Calendar Server. The implementation contained in a module can either augment or override the native Calendar Server functionality in its area.

A set of server-side API's allows CSAPI modules to get the server’s version information, and use the server’s fast memory allocation mechanism.

You can use the default code for each of the CSAPI interfaces as a template to create your own plug-ins. The Calendar Server bundle contains all the default code, along with all supporting libraries and headers you need to implement your own plug-ins.

Figure 1–1 CSAPI Relationship to Other Subsystems

This graphic shows how the Calendar Server internal modules communicate
directly to CSAPI plug-in modules.

Thread Safe Requirement

CSAPI module plug-ins must be thread safe, as many thousands of threads can access a module at any time. For those plug-ins that cannot be thread-aware, use simple monitors at the function-call level in the plug-in itself. For more information on Netscape Portable Runtime (NSPR) threads, refer to the NSPR reference manual at www.mozilla.org. For the URL, see the Dependencies section that follows.

Dependencies

CSAPI is a C and C++ interface for UNIX and Windows systems. It uses Netscape Portable Runtime (NSPR), a part of the Mozilla source code that is a platform independent API to operating system services, and XPCOM for Interface Dispatch.

For documentation on NSPR see the MozillaTM technical documentation site:

http://www.mozilla.org/projects/nspr/reference/html/index.html

For documentation on XPCOM, see:

http://www.mozilla.org/projects/xpcom

You must use NSPR for platform-independent C data types and runtime functions in implementations that need to run on different platforms. Calendar Server uses the XPCOM C++ API (QueryInterface) to discover the exact interfaces a specific module implements.