Configuring the business object configuration file
The business object configuration file defines how to load the data into the database. In this file, you specify the implementation classes for your Data Reader, Business Object Builder, and Business Object Mediator components. You also specify the attributes and properties for these components.
About this task
- WC_installdir/samples/DataLoad/Catalog
- WCDE_installdir/samples/DataLoad/Catalog
Procedure
- Create a copy of this sample wc-loader-catalog.xml file and rename the file.
- Open the new business object configuration file for editing.
- Specify your data reader implementation class.
- Find the
<_config:DataReader>
element. - Set the
className
attribute value.The value of this attribute specifies the class name for the data reader. You can specify the provided class,- com.ibm.commerce.foundation.dataload.datareader.CSVReader
- com.ibm.commerce.foundation.dataload.datareader.XmlReader
For example, the following snippet configures the data reader:<_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" > <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" > </_config:DataReader>
- Find the
- Specify your business object builder class.
- Find the
<_config:BusinessObjectBuilder>
element. - Set the
className
attribute value.The value of this attribute specifies the class name for the business object builder. The two implementation classes that are provided are:- com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder for component-based business objects
- com.ibm.commerce.foundation.dataload.businessobjectbuilder.TableObjectBuilder for table-based objects
For more information about configuring these business object builders, see
- Find the
- Optional: Configure the Data Load utility to
exclude any columns that you do not want the utility to load data
into or change.To exclude columns, you can define a column exclusion list within the
<_config:DataLoader>
element. For more information, see Configuring a column exclusion list. - Save and close the file.As an example, the following snippet configures the business object configuration file for loading attribute dictionary attribute allowed value data:
<?xml version="1.0" encoding="UTF-8"?> <_config:DataloadBusinessObjectConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../ xml/config/xsd/wc-dataload-businessobject.xsd" xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config"> <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" > <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" > <_config:property name="keyColumns" value="Identifier,ValueIdentifier" /> </_config:DataReader> <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder" packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="AttributeDictionaryAttributeType" > <_config:DataMapping> <_config:mapping xpath="AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier" /> <_config:mapping xpath="AttributeIdentifier/UniqueID" value="AttributeUniqueId" /> <_config:mapping xpath="AllowedValue/identifier" value="ValueIdentifier" /> <_config:mapping xpath="AllowedValue/displaySequence" value="Sequence" /> <_config:mapping xpath="AllowedValue/Value" value="Value" /> <_config:mapping xpath="AllowedValue/ExtendedValue/ValueUsage" value="1" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField1" value="AttributeValueField1" /> <_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField2" value="AttributeValueField2" /> <_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField3" value="AttributeValueField3" /> <_config:mapping xpath="AllowedValue/ExtendedValue/Image1" value="Image1" /> <_config:mapping xpath="AllowedValue/ExtendedValue/Image2" value="Image2" /> <_config:mapping xpath="AllowedValue/ExtendedValue/Field1" value="Field1" /> <_config:mapping xpath="AllowedValue/ExtendedValue/Field2" value="Field2" /> <_config:mapping xpath="AllowedValue/ExtendedValue/Field3" value="Field3" /> <_config:mapping xpath="AllowedValue/language" value="Language" /> <_config:mapping xpath="AllowedValue/language" value="LanguageId" /> <_config:mapping xpath="" value="Delete" deleteValue="1" /> </_config:DataMapping> <_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.AttributeDictionaryAttributeMediator" componentId="com.ibm.commerce.catalog" > <_config:property name="allowChangeAttributeType" value="true" /> <_config:property name="validateAttribute" value="true" /> </_config:BusinessObjectMediator> </_config:BusinessObjectBuilder> </_config:DataLoader> </_config:DataloadBusinessObjectConfiguration>