Description This method initializes the API. The parameters specify which version of the API that your application should bind with.
You must call this method before calling any of the other methods in the API.
public static void initialize(
) throws UWIException;
Table 1. Method parameters
|progName||String||The name of the application calling initialize. This name identifies the application within the PureEdgeAPI.ini file. It also sets the name that is returned by the XFDL applicationName function.|
|progVer||String||The version and build numbers of the application calling initialize. If the PureEdgeAPI.ini file has an entry for this version of the application, the application binds to the version of the API listed in that entry.|
|apiVer||String||The version number of the API that the application should use by default. If the PureEdgeAPI.ini file does not contain an entry for the specific application, the application binds to the API specified by this parameter.|
Returns Nothing if call is successful or throws a UWIException exception if an error occurs.
Notes The initialize method is a static method belonging to the DTK class.
Note: About Binding Your Applications to the API
When you initialize the API, the initialize method determines which version of the API to use based on the parameters you pass it. This allows you to exercise a great deal of control over which version of the API is used by your applications, and prevents the problems normally associated with DLL files.
The initialize method relies on a configuration file to determine which version of the API will bind to any application. This allows multiple versions of the API to co-exist on your computer, and ensures that your applications use the correct version of the API.
The configuration file is called PureEdgeAPI.ini and is installed with the API.
Note: You should redistribute the PureEdgeAPI.ini file with any applications that use the API. See Developing and distributing applications API 4 Java.
The configuration file contains a section for each application that uses the API, plus a default [API] section. Each section contains a list of version numbers in the following format:
For example, the configuration file on a Windows® system might look like this:
<version of application> = <path to API>
The above example contains the default [API] section and a section for the formSample application. The asterisk acts as a wildcard. In the example, 8.0.* corresponds to 8.0.0, 8.0.1, and so on.
The initialize method checks the configuration file to see if your application is listed. For example, using the configuration example above, if you make an initialization call as follows:
8.0.* = C:\Program Files\IBM\Forms Server\4.0\API\redist\Win32\PureEdge\80
1.1.0 = C:\Program Files\IBM\Forms Server\4.0\API\redist\Win32\PureEdge\80
1.0.0 = C:\Program Files\IBM\Lotus Forms\Server\3.5\API\redist\msc32\PureEdge\76
the application binds to the API in C:\Program Files\IBM\Forms Server\4.0\API\redist\Win32\PureEdge\80 because the entry for version 1.1.0 in the formSample section points to C:\Program Files\IBM\Forms Server\4.0\API\redist\Win32\PureEdge\80.
If your application is not listed in the configuration file, the initialization call uses the version of the API in the apiVer parameter. For example, if you make an initialization call as follows:
DTK.initialize("formSample", "1.1.0", "8.8.0")
the application binds to the API in the [API] section that corresponds to 8.0.0 because there is no entry for version 2.0.0 in the formSample section.
You can add your own entries to the configuration file before distributing it to your customers, or you can rely on the default API entries.
DTK.initialize("formSample", "2.0.0", "8.0.0")
Example In the example below, initialize initializes the API for the application called formSample.
private static void initialize( ) throws UWIException
DTK.initialize("formSample", "1.0.0", "8.0.0");