IBM Support

Using the Load capabilities through ODWEK

Question & Answer


Question

How do I use the Load capabilities through ODWEK?

Answer

Prior to Content Manager OnDemand Web Enablement Kit (ODWEK) Java API V9.5, the only API that allowed documents to be added to the Content Manager OnDemand archive was the ODFolder.storeDocument API, which resulted in an archive request to the Content Manager OnDemand server for each document stored.

APIs now exist to allow more than one document to be loaded at a time, similar to the ARSLOAD program. However, loading via ODWEK is not intended to replace ARSLOAD as the primary data ingestion vehicle. For example, ODWEK loading does not include an indexer to automatically parse and extract index values. As such, the indexes must be individually supplied. Additionally, ODWEK loading is not optimized to process very large input files. Performance degradation and potential load failure might result if attempted. 
To accomplish loading by using the ODWEK Java API, perform the following:
  1. Call the ODServer.loadInit API to initiate the load process.
  2. For each document to load, call the ODServer.loadAddDoc API, passing the number of pages, a Hashtable containing database field names (keys) with their corresponding indexes (values), and the document data.
  3. Call the ODServer.loadCommit API, specifying the application group and application to send the load data and load request to the Content Manager OnDemand server.

Be aware of the following:
  • The Content Manager OnDemand server version must be V9.5 or later.
  • The steps must be called in this order. Calling them out of order will result in an exception. If you need to reset the process for any reason, call the ODServer.loadReset API and begin the entire process again. All documents loaded during the process must meet all of the requirements of specified application group and application combination.  For example, they must be the correct data type and format.
  • All dates must be standardized on the ISO date and/or datetime format.
    • The format for Date must be specified as %Y-%m-%d, such as '2014-11-17'
      The format for Date/Time (with/without TZ) must be specified as %Y-%m-%d %H:%M:%S.%F, such as '2014-11-17 14:07:00.000000'
  • The number of pages that the ODServer.loadAddDoc API accepts is valid only if the application group has a field defined with the 'Page Count' attribute. If the application group does not have such a field defined, the number of pages parameter passed to ODServer.loadAddDoc will be ignored. Additionally, the value must be provided by the caller and will not be calculated as would occur when using ARSLOAD.
  • If the application to which the data is being loaded is Large Object-enabled, that attribute is not honored.

Server setup
 
Steps must be taken to prepare the Content Manager OnDemand archive where the documents will be loaded prior to calling any of the ODWEK load APIs. The directories specified must exist. For example,
  • On Unix servers and z/OS servers, add two values to the ARS.CFG configuration file for the instance:
    • ARS_DOWNLOAD_DIR=/arstmp
      ARS_DOWNLOAD_TMP_DIR=/arstmp
  • On Windows servers, use the OnDemand Configurator's Configuration Parameters panel. (Select the Parameters button on the Instance tab to launch the Configuration Parameters panel.) Enter ARS_DOWNLOAD_DIR in the Name field and a valid directory for the Value field and select the Add button. Take similar steps to add an entry for the ARS_DOWNLOAD_TMP_DIR.
  • On IBM i servers, add two values to the /QIBM/UserData/OnDemand/<instance name>/ARS.CFG configuration file:
    • ARS_DOWNLOAD_DIR=/QIBM/UserData/OnDemand/<instance name>/tmp
      ARS_DOWNLOAD_TMP_DIR=/QIBM/UserData/OnDemand/<instance name>/tmp

The following example demonstrates loading by using the ODWEK Java API.  The example loads three documents in a single ODWEK load request:

import java.io.File;
import java.util.*;

import com.ibm.edms.od.*;

public class TcLoadDocs
{
    public static void main ( String argv[] )
    {
        ODServer    odServer;
        ODConfig    odConfig;
        Hashtable<String,String> idxs;
        File        loadFile;

        if ( argv.length < 3 )
        {
            System.out.println( "usage: java TcLoadDocs <server> <userid> <password> " );
            return;
        }
        try
        {
            //----------
            // Set the stage
            //----------
            System.out.println( "This testcase should" );
            System.out.println( "  Demonstrate the ODWEK Load Process" );
            System.out.println( "" );
            System.out.println( "---------------------------------------------------" );
            System.out.println( "" );

            odConfig = new ODConfig
               (ODConstant.PLUGIN,
                     ODConstant.APPLET,
                     null,
                     200,
                     "/applets",
                     "ENU",
                     "c:/temp",
                     "c:/trace",
                     0);

            odServer = new ODServer(odConfig );
            odServer.initialize(  "TcLoadDocs.java" );
            System.out.println( "Logging on to " + argv[0] + "..." );
            odServer.logon( argv[0], argv[1], argv[2] );
           
            //----------
            // Step 1 in the ODWEK Load process
            //----------
            odServer.loadInit();
           
            //----------
            // Step 2 in the ODWEK Load process
            // Repeated for each document to be loaded
            //----------
            idxs = new Hashtable<String, String>();
           
            idxs.put("acct_name",    "Acme Art Company");
            idxs.put("acct_num",     "00112233445");
            idxs.put("purchase_date","2012-05-23");
            idxs.put("purchase_amt", "1172.18");
            loadFile = new File("c:\\invoices\\acme\\bluePaintingInvoice.afp");
            odServer.loadAddDoc(4, idxs, loadFile);
           
            idxs.clear();
            loadFile = null;
           
            idxs.put("acct_name",    "Acme Art Company");
            idxs.put("acct_num",     "00112233445");
            idxs.put("purchase_date","2012-05-30");
            idxs.put("purchase_amt", "879.39");
            loadFile = new File("c:\\invoices\\acme\\redPaintingInvoice.afp");
            odServer.loadAddDoc(3, idxs, loadFile);
           
            idxs.clear();
            loadFile = null;
           
            idxs.put("acct_name",    "Light and Dark Inc.");
            idxs.put("acct_num",     "99887766554");
            idxs.put("purchase_date","2012-05-15");
            idxs.put("purchase_amt", "8711.10");
            loadFile = new File("c:\\invoices\\light_dark\\blackWhiteCharcoalInvoice.afp");
            odServer.loadAddDoc(7, idxs, loadFile);            
           
            //----------
            // Step 3 in the ODWEK Load process
            // Done adding documents, now call the server to load
            //----------
            odServer.loadCommit("Invoices", "InvoicesWestCoast");

            //----------
            // Cleanup
            //----------
            odServer.logoff( );
            odServer.terminate( );
            System.out.println( "" );
            System.out.println( "---------------------------------------------------" );
            System.out.println( "" );
            System.out.println( "Testcase completed" );
            System.out.println( "" );
        }
        catch ( ODException e )
        {
            System.out.println( "ODException: " + e );
            System.out.println( "  id = " + e.getErrorId( ) );
            System.out.println( "  msg = " + e.getErrorMsg( ) );
            e.printStackTrace( );
        }
        catch ( Exception e2 )
        {
            System.out.println( "exception: " + e2 );
            e2.printStackTrace( );
        }
    }
}

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEPCD","label":"Content Manager OnDemand for Multiplatforms"},"ARM Category":[{"code":"a8m0z0000001gP1AAI","label":"technote"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"},{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2EG","label":"Content Manager OnDemand for i"},"ARM Category":[{"code":"a8m0z0000001gP1AAI","label":"technote"}],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"},{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSQHWE","label":"Content Manager OnDemand for z\/OS"},"ARM Category":[{"code":"a8m0z0000001gP1AAI","label":"technote"}],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
25 March 2022

UID

swg21686382