In this step of the tutorial, you configure the environment
settings, load order, and the business object configuration file.
Procedure
- Create your data load environment configuration file.
In the environment configuration file, specify the business
context information, database connection property, ID Resolver, and
data writer class. For more information about creating this file, see
Configuring the data load environment settings. The environment variables
that are used by the Data Load utility must be configured in this
XML file.
- Copy the sample wc-dataload-env.xml environment
configuration file into the WCDE_installdir\samples\DataLoad\warranty directory.
The sample environment configuration file is located within the DataLoadSample.zip compressed
file.
- Open the wc-dataload-env.xml file
for editing.
- Change the
storeIdentifier
, and catalogIdentifier
attribute
values for the <_config:BusinessContext>
configuration
element to match your store settings. For example, <_config:BusinessContext storeIdentifier="Aurora" catalogIdentifier="Aurora" />
- Change the
name
, and type
attribute
values for the <_config:Database>
configuration
element to match your database settings. For example, <_config:Database name="..\db\mall" type="derby" />
- Change the
classname
attribute
value for the <_config:DataWriter>
configuration
element to specify the data writer class. By default the Data Load
utility uses the com.ibm.commerce.foundation.dataload.datawriter.JDBCDataWriter
data
writer class. For example, <_config:DataWriter className="com.ibm.commerce.foundation.dataload.datawriter.JDBCDataWriter" />
- Save and close the file.
- Create your business object configuration file. In the
business object configuration file, you specify your data reader,
business object builder, and business object mediator. For more information, see Configuring the business object configuration file.
- Copy the sample wc-warrantyobject-loader.xml business
object configuration file into the WCDE_installdir\samples\DataLoad\warranty directory.
The sample configuration file is located within the DataLoadSample.zip compressed
file.
- Open the wc-warrantyobject-loader.xml for
editing.
- Change the
classname
attribute value for the <_config:DataReader>
element
to specify the data reader class that you implemented. For example, <_config:DataReader className="com.mycompany.commerce.dataload.reader.WarrantyReader" />
- Change the
classname
attribute value for the <_config:BusinessObjectBuilder>
element
to specify the business object builder class that you implemented.
For example, <_config:BusinessObjectBuilder className="" >
- Change the
className
and componentId
attribute
values for the <_config:BusinessObjectMediator>
element
to specify the business object mediator. In this tutorial, the warranty
and care instruction data are extension of the catalog entry business
object. Specify the com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator class
and componentId. For example, <_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator" componentId="com.ibm.commerce.catalog"/>
- Save and close the file.
- Configure the data load order configuration file.
In
the load order configuration file, you specify a pointer to your XML
input file, environment settings file, and business object configuration
file. You also specify which data load mode that the utility is to
run. For more information, see
Configuring the data load order.
- Copy the sample wc-dataload-warranty.xml load
order configuration file into the WCDE_installdir\samples\DataLoad\warranty directory.
The sample configuration file is located within the DataLoadSample.zip compressed
file.
- Open the wc-dataload-warranty.xml file
for editing
- Change the
configFile
attribute value for the <_config:DataLoadEnvironment>
element
to specify the environment configuration file. For example, <_config:DataLoadEnvironment configFile="wc-dataload-env.xml" />
- Within the
<_config:LoadOrder >
element, configure
the <_config:LoadItem>
and <_config:DataSourceLocation
elements.
Change the commitCount
, batchSize
, dataLoadMode
, name
,
and businessObjectConfigFile
attribute values. For
example, <_config:LoadItem commitCount="1" batchSize="1" dataLoadMode="Replace" name="Warranty" businessObjectConfigFile="wc-warrantyobject-loader.xml">
</_config:LoadItem>
Within the <_config:DataSourceLocation
element,
change the location
attribute value to specify the
input file. For example, <_config:LoadOrder >
<_config:LoadOrder >
<_config:LoadItem commitCount="1" batchSize="1" dataLoadMode="Replace" name="Warranty" businessObjectConfigFile="wc-warrantyobject-loader.xml">
<_config:DataSourceLocation location="warranty.xml"/>
</_config:LoadItem>
</_config:LoadOrder>
- Save and close the file.
What to do next
In the
workspace_dir\WC\xml\config\dataload\logging.properties,
you can specify the trace level, and enable console and file logging.
The following settings are used by default:
- Logging level is set to both console and file.
- Trace level is set to
INFO
.
- Log file location is set to WCDE_installdir\logs\wc-dataload.log.
You do not need to modify the log file location. However, you
might want to change the trace level when you are debugging a data
load problem. The Data Load utility provides some command line options
to change the trace level. For more information, see
Data Load utility.
If
any errors occur, an error log file is generated per load item. The
error file name and location is specified in the summary report on
the console. The error log file is generated in the same directory
as the wc-dataload.log file.