Tutorials > Program model > Customize the Data Load utility
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.
Procedure
- Create the XWARRANTY and XCAREINSTRUCTION tables in the database used by the target WebSphere Commerce Server:
- Connect to the DB2 database.
- In the Script window, run the following SQL statement:
CREATE TABLE XWARRANTY ( CATENTRY_ID BIGINT NOT NULL, WARTERM INTEGER, WARTYPE VARCHAR(32), OPTCOUNTER SMALLINT, CONSTRAINT XWARRANTY_PK PRIMARY KEY(CATENTRY_ID), CONSTRAINT XWARRANTY_FK FOREIGN KEY (CATENTRY_ID) REFERENCES CATENTRY(CATENTRY_ID)); CREATE TABLE XCAREINSTRUCTION ( CATENTRY_ID BIGINT NOT NULL, LANGUAGE_ID INTEGER NOT NULL, CAREINSTRUCTION VARCHAR(254), OPTCOUNTER SMALLINT, CONSTRAINT XCAREINST_PK PRIMARY KEY (CATENTRY_ID, LANGUAGE_ID), CONSTRAINT XCAREINST_FK1 FOREIGN KEY (CATENTRY_ID, LANGUAGE_ID) REFERENCES CATENTDESC(CATENTRY_ID, LANGUAGE_ID), CONSTRAINT XCAREINST_FK2 FOREIGN KEY (CATENTRY_ID) REFERENCES CATENTRY (CATENTRY_ID) );
- Connect to the Oracle database.
- In the SQL Plus window, run the following statement:
CREATE TABLE XWARRANTY ( CATENTRY_ID NUMBER NOT NULL, WARTERM INTEGER, WARTYPE VARCHAR(32), OPTCOUNTER SMALLINT, CONSTRAINT XWARRANTY_PK PRIMARY KEY(CATENTRY_ID), CONSTRAINT XWARRANTY_FK FOREIGN KEY (CATENTRY_ID) REFERENCES CATENTRY(CATENTRY_ID) ); CREATE TABLE XCAREINSTRUCTION ( CATENTRY_ID NUMBER NOT NULL, LANGUAGE_ID INTEGER NOT NULL, CAREINSTRUCTION VARCHAR(254), OPTCOUNTER SMALLINT, CONSTRAINT XCAREINSTRUCTION_PK PRIMARY KEY (CATENTRY_ID, LANGUAGE_ID), CONSTRAINT XCAREINSTRUCTION_FK1 FOREIGN KEY (CATENTRY_ID, LANGUAGE_ID) REFERENCES CATENTDESC(CATENTRY_ID, LANGUAGE_ID), CONSTRAINT XCAREINSTRUCTION_FK2 FOREIGN KEY (CATENTRY_ID) REFERENCES CATENTRY (CATENTRY_ID) );
- Create the WC_INSTALL\instances\instance\xml\config\com.ibm.commerce.catalog-ext directory if it does not exist.
- Copy all the custom Data Service Layer configuration files from the WebSphere Commerce development environment to the WebSphere Commerce server instance directory: workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext to WC_INSTALL\instances\instance\xml\config\com.ibm.commerce.catalog-ext.
- Package your custom XML reader class and the custom physical SDO classes in the WebSphereCommerceServerExtensionsLogic project to a JAR file.
- Create the WC_INSTALL\ext\lib directory if it does not exist, and copy the JAR file to the WC_INSTALL\ext\lib directory. Your custom JAR files must be placed in this directory.
- Copy all the custom data load configuration files from the WebSphere Commerce development environment to the WebSphere Commerce server environment: WCDE_INSTALL\samples\DataLoad\warranty to WC_INSTALL\samples\DataLoad\warranty.
- Modify the wc-dataload-env.xml file to match the WebSphere Commerce Server instance information:
- The attribute values inside the <_config:BusinessContext > element is changed to match the store settings.
- The attribute values inside the <_config:Database> element is changed to match the database environment properties.
See Configure the data load environment settings for more information about configuring the data load environment file.
- Test the customization on the WebSphere Commerce server by running the Data Load utility with an extra parameter -Dinstance=instance For example, enter the following command:
./dataload.sh ..samples/DataLoad/warranty/wc-dataload-warranty.xml -Dinstance=instance
dataload ..\samples\DataLoad\warranty\wc-dataload-warranty.xml -Dinstance=instance
Customize the Data Load utility
This tutorial demonstrated how to customize the data load utility to load data from an XML file.
Lessons learned
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
- Deploy the custom code to the WebSphere Commerce Server.