IBM Support

How to programmatically configure an IBM DB2 Content Manager OnDemand Web Enablement Kit API ODServer object

Question & Answer


Question

Previously, the arswww.ini file was the only method used to configure various system parameters for an application written to the IBM® DB2® OnDemand Web Enablement Kit (ODWEK) API set. As of V7.1.2.7, the ODWEK API set includes an ODConfig Java™ object that allows applications to configure the ODServer instance.

Answer

A new ODConfig object allows a programmatic way to configure an application written to the ODWEK API set. Where the arswww.ini contained parameters that controlled the ODWEK CGI and ODWEK Servlet instances, the ODConfig object is specific to the ODWEK API set. This change removes confusion about the impact of setting a parameter. As of ODWEK 8.4, the ODConfig Java object is the preferred method in which to configure the system parameters, and the arswww.ini method is deprecated.

There are eight system parameters that are needed for a working ODServer instance. These parameters can be set to default values through the ODConfig default constructor:

        try{
            ODConfig cfg = new ODConfig();
            ODServer srvr = new ODServer(cfg);
            srvr.initialize(null, "MyCustomApp")
            cfg.printConfig();
        }
        catch(ODException e){
            System.out.println("Exception " + e);
        }

This sample code configures the following default parameters:

AfpViewOpt     PLUGIN
LineViewOpt    APPLET
MaxHits        200
MetaViewOpt    NATIVE
AppletDir      /applets
Language       ENU
TempDir        The temp path as defined by the Java
               System.getProperty("java.io.tmpdir") method.
TraceDir       The temp path as defined by the Java
               System.getProperty("java.io.tmpdir") method.
TraceLevel     0

For information about these parameters, see the "Specifying the arswww.ini file" information in the OnDemand Web Enablement Kit Implementation Guide.

These eight parameters can also be explicitly set by using the following sample code that uses a different ODConfig constructor:

        try{
            ODConfig cfg = new ODConfig(
            /*AfpViewer*/           ODConstant.PLUGIN,
            /*LineViewer*/          ODConstant.APPLET,
            /*MetaViewer default*/  null,
            /*MaxHits*/             500,
            /*AppletDir*/           "/applets",
            /*Language*/            "ENU",
            /*TempDir*/             "c:\\temp",
            /*TraceDir*/            "c:\\temp\\trace",
            /*TraceLevel*/          1);

            ODServer srvr = new ODServer(cfg);
            srvr.initialize(null, "MyCustomApp")
            cfg.printConfig();
        }
        catch(ODException e){
            System.out.println("Exception " + e);
        }

This constructor sets parameters with zero or null values to the defaults mentioned above.

[{"Product":{"code":"SSEPCD","label":"Content Manager OnDemand for Multiplatforms"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Internet","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF027","label":"Solaris"},{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.1.2.7;8.4","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
13 June 2019

UID

swg21241045