Building J2C Java beans using the Batch Importer

You can create and access J2C binding classes through the Batch Importer, a command-line interface, rather than using the J2C data binding wizard. You can also run the Batch Importer from the workbench.

The Batch Importer allows you to generate J2C binding classes for the CICS® ECI and IMS™ resource adapters. You can create and access J2C binding classes through the Batch Importer, a command-line interface, rather than using the J2C data binding wizard. You can also run the Batch Importer from the workbench.
Before you can create J2C binding classes with the Batch Importer, you must import a resource adapter into the workspace in which you want to create the binding classes.
  1. You need to modify the parameters in five files to suit your particular environment. These files can be obtained from x:/rad/eclipse/plugins/com.ibm.adapter.command_6.0.0/runtime and x:/rad/eclipse/plugins/com.ibm.adapter.command_6.0.0/sample (where x refers to the directory where you installed your Rational® development software). These are the files you require:
    1. CICSECI_PlatformProperties.xml: This file specifies the C or COBOL source file parameters that will be invoked as default, depending upon which platform you are using to run the Batch Importer (NT, AIX®, or MVS™).
    2. CICSECI_cobolSample.xml: This file contains the service properties that the Batch Importer will use:
      • EISProject
        • name: Name of the service project that will contain the new enterprise service. If the service project does not exist, it will be created automatically.
          Note: The sample file contains an ImportPropertyArray element within the EISProject. The import properties contained here will override any values set in PlatformProperties.xml. If the defaults set in PlatformProperties.xml are correct for this service, the ImportPropertyArray element may be removed.
      • EISService (note that multiple EISService elements can be defined for each EISProject):
        • name: Name of the enterprise service. After importing the C or COBOL files, three WSDL files will be created for each service (interface, binding. and service files).
        • type : Name of the resource adapter used for the service. It is the name of the connector project that has the RAR file.
        • targetNameSpace: URL of the target namespace (http://...). Additionally, a package will be created in the service project based on the targetNameSpace to contain the generated wsdl files.
        • generateHelpers: If the native data you are importing consists of complex data types such as structures in C, then Helper classes are required when running the service. When this option is set to "true", the import batch program will automatically generate and compile these helper classes for you.
      • Operation: (note that multiple Operation elements that can be defined for each EISService):
        • name : Name of the operation.
        • type: The type of operation. It is either REQUEST_RESPONSE or ONE_WAY.
          Note: Depending on the Operation type, a ONE_WAY Operation should contain an InputMessage definition while a REQUEST_RESPONSE should contain an InputMessage definition and an OutputMessage definition. If the InputMessage and OutputMessage share the same type definition, a single InputOutputMessage definition is used.
      • ...Message
        • importFile: Name of the file containing the definition to be used for the creation of the enterprise service operation. This file can be a C or COBOL source file.
        • importDirectory: The path containing the importFile. If the importDirectory attribute is not specified, then the inputdir and the current directory will be used to search for the importFile.
        • nativeTypeName : Name of the data type to be imported from the importFile. For example, in COBOL the nativeTypeName is probably DFHCOMMAREA. If after parsing the importFile, the nativeTypeName is not identified as a valid data type, then an error will be returned.
        • name: Name to be used for the imported type. For example, if DFHCOMMAREA represents customer data, you could set the name to Customer.
        • generationPackage: An optional attribute that allows you to specify a different package name for the generated helper classes (that is, the beans and format handlers). This provides a different namespace for the schema which is generated in the interface WSDL file.
    3. sampleContainer.xml : This file will be passed as an argument to the Batch Importer and contains a list of the files (ImportDefinitions) that need to be processed. The ImportDefinitionArray element has these attributes:
      • platform: This names the platform for the host system. The values can be NT, AIX, or OS390.
      • platformProperties: This specifies the name of the platform properties file.
    4. importBatch.bat (win) or importBatch.sh (linux): This is the Batch importer program file with the following parameters:
      • containerFile: is the file defined at step c.
      • Optional parameters
        • generationStyle
          • 0: the default setting, which matches WebSphere® Studio V5.0 style
          • 1: which matches VisualAge® for Java™ generation options: direct, no notification, no inner class, no shorten names, and with primitive type arrays.
          • 2: which matches VisualAge® for Java™ generation options: direct, no notification, no inner class, shorten names, with primitive type arrays.
        • workspace: the fully qualified path of the workspace to be used for the import
        • RAD_installdir: the directory in which Rational Application Developer is installed.
    5. C or COBOL source file.: You will use this COBOL (TADERC99.ccp) or C source file to generate the data binding files and the interface files through the Batch Importer
  2. Running the Batch Importer from the command line: Follow these steps to invoke the Batch Importer from the command line:
    1. Be sure the resource adapter that you want to use has been imported into your workspace.
    2. Create a directory to hold the files mentioned at step 1. The remaining steps will refer to this directory as the inputdir.
    3. Set the language and connection properties for your host system in a platform properties file. Copy the appropriate platform properties file (CICSECI_PlatformProperties.xml or IMS_PlatformProperties.xml) from x:/rad/eclipse/plugins/com.ibm.adapter.command_6.0.0/sample (where x refers to the directory where you installed your Rational development software) to inputdir and open it with a text editor. You set the default properties that reflect your target environment in this file. Any of the properties set in this file can be overridden in the service definition file described in the next step. You do not have to delete platform definitions that are not used.
    4. Copy the appropriate sample service definition file (CICSECI_cSample.xml, CICSECI_cobolSample.xml or IMS_cobolSample.xml) to inputdir , renaming the file as desired.
    5. Copy the sample container file, sampleContainer.xml to inputdir , renaming the file as desired. Open the resulting file with a text editor and set the appropriate platform and, for each service definition file that was created in step d, add an ImportDefinition element referencing the service definition file that you created.
    6. If an instance of Rational Application Developer that uses the target workspace is running, then close it.
    7. From the command line, invoke the importBatch command with the following options: importBatch -file=containerFile [-style=generationStyle] [-d workspace] [-e RAD_installdir]
      Note: The -file parameter requires a full file system path for the containerFile
  3. Running the Batch Importer from the workbench: Follow these steps to invoke the Batch Importer from the workbench:
    1. Be sure the resource adapter that you want to use has been imported into your workspace
    2. Create a Simple project (name it Temp) to hold the files mentioned at step 1. The remaining steps will refer to this directory as the inputdir.
    3. Execute step c, step d, and step e from Running the Batch Importer from the command line.
    4. Copy the batchImport.xml from x:/rad/eclipse/plugins/com.ibm.adapter.command_6.0.0/script into inputdir . Change the sampleContainer.xml to the match the name of your container file.
    5. Right click on the batchImport.xml select option Run > 2 Ant build." In the opened window, select JRE and select Run in the same JRE as the workspace. Click Apply and Close. This step is only required once.
    6. Right click on the batchImport.xml and select Run > 1 Ant build.

      The Batch Importer will import the COBOL and C files and generate the binding files in the project (EISProject) and package (derived from targetNameSpace) specified in the XML file.

      Note: The Batch Importer invoked from command line has a similar execution process as running from within the Workspace. To demonstrate this, open the workspace in which the files at step 1 were generated. You will notice a project called Temp containing the same files that were imported by hand at step 3.
Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.