Initializing and preparing the Java API

Before you begin configuring document specifications and generating document-style reports, you must initialize the Java™ API and select a logging method.

Procedure

  1. Required: Select a method for initializing the API:
    • Automatically: The RPE_HOME environment variable is used to identify the path to the config and source directories in the IBM Engineering Lifecycle Optimization - Publishing(PUB) installation.
    • Programmatically: Set the path to the config and source directories in the Engineering Publishing installation by using AppUtils.setProductHome(path).
    Tip: Initializing the API programmatically is the recommended method. When you initialize the API programmatically, the application is shipped with config and source directories rather than relying on the directories in the PUB installation.
  2. Optional: Select a method for logging:
    • Configure PUB to use the logger in your application:
      • Create an instance of the org.apache.commons.logging.Log class for logging.
      • If your application does not use common logging, you can provide PUB with an instance of a class implementing the IRPELogger interface. This class transforms PUB logging calls into calls to the logging for your application.
    • Configure the PUB logger in your application:
      • Use the PUB logger in your application. Example:
        AppUtils.getLogger().info( Starting RPE);
      • Configure the Log4j logger before using any PUB function:
        • If the log4j2.xml file is in the root folder of your project, initialize the Log4j logger by:
          Configurator.initialize(null, this.class.getClassLoader().getResource(./log4j2.xml));
        • If the log4j2.xml file is not in the root folder of your project, initialize the Log4j logger by:
          Configurator.initialize(null, new File( AppUtils.getConfigFilePath(),log4j2.xml).getAbsolutePath());
  3. Optional: Connect to progress notifications.
    The report generators can be sent notification messages through RPEListener. These messages are the same messages that the Launcher application displays in the progress window while a document-style report is generating.