Customize the Data Load utility
This tutorial demonstrates how to customize the data load utility to load data from an XML file.
In the tutorial "Adding new properties to a WebSphere Commerce service using the data service layer", you customize the Catalog service to support warranty information and care instructions for catalog entries. Now, you load the warranty and care instruction information into the target database using the Data Load utility.
The following diagram shows the data load process flow.
- The data reader reads the input file, and transforms the input into a data object. Data objects are typically Map objects.
- The business object builder instantiates the business object and populates it from the data in the data object.
- The business object mediator converts the business object into physical object.
- The data writer writes the physical object into the database.
The provided CSV reader reads the input files and create Map objects. XML files are difficult to represent in a Map object because they have complex structures. In this scenario, you create a reader that builds the logical object directly from the input XML file. Since this reader is creating a logical object, the default business object builder is used. The default business object builder simply returns the input data object without changing it.
Learning objectives
After completing this tutorial, you should be able to:
- Create the XML data reader
- Configure the Data Load utility to use the data reader and mediator
Time required
This tutorial is expected to take 1 hour to complete.
Skill level
Intermediate
Audience
This tutorial is intended for WebSphere Commerce developers who want to customize the data load utility to read from XML files.
System requirements
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Completed the following steps in Tutorial: Adding new properties to a WebSphere Commerce service using the data service layer:
Prerequisites
Saving the sample code
Before beginning this tutorial, download the DataLoadSample.zip. Save this file onto the development machine. As an example, you might save it into the WCDE_INSTALL directory.
Knowledge prerequisites
Before beginning this tutorial, ensure you have:
- A basic understanding of the Data Load utility architectural overview
- A basic understanding of DOM
- An understanding of Service Data Objects (SDO)
Lessons in this tutorial
- Create an XML input file
In this step of the tutorial, you create an XML file that contains the catalog entry information, warranty and care instruction data to load into the target database.
- Create a custom data reader
In this step of the tutorial, you create a custom data reader to read the XML input file and then transform the input data into business objects.
- Configure the Data Load utility
In this step of the tutorial, you configure the environment variable settings file, data load order file, and business object configuration file.
- Verify the customization
In this section, you verify the customization by running the Data Load utility in the development environment.
- Deploy the customized code
In this lesson, you deploy the custom code to a target WebSphere Commerce Server. Deploying to the server involves transferring the code from the WebSphere Commerce development environment to the target WebSphere Commerce Server.