Loader package

The WebSphere Commerce Loader package consists primarily of command utilities for preparing and loading data into a WebSphere Commerce database. You can use the Loader package to load large amounts of data and to update data in your WebSphere Commerce database.

The Loader command utility in this package uses valid and well-formed XML as input to load data into the database. Elements of the XML document map to table names in the database, and element attributes map to columns.

The Loader command utilities can:

Utilities

The Loader package consists of the following utilities:

Text Transformer
The Text Transformer transforms data between a character-delimited variable format and an XML data format.
XML Transformer
The XML Transformer changes, aggregates, and remaps the data in an XML document to alternate XML formats for use by other users or systems as needed.
DTD Generator
The DTD Generator generates a DTD based on the target database to which your data must conform. This DTD will be used throughout the load process. The DTD Generator needs to be run only once.

The document type definition (DTD) specifies structural elements and markup definitions that can be used within the XML data document. For example, a DTD can list elements to be used in a document and specify the attributes that each element can take.

The DTD Generator is a Loader package command utility that creates a DTD for the Loader to use based on the database schema. This DTD describes the tables and columns into which the Loader imports data.

Note: The wcs.dtd file located in WC_Installdir\schema\xml is provided with WebSphere Commerce. This file is designed to work with the Loader.

ID Resolver
The ID Resolver is a Loader package command utility that generates identifiers for XML elements with their associated identifiers. This step is essential because Loader package XML files map directly to the target database schema. As such, they must have identifiers.

Note: If your XML content already supplies identifiers, you do not have to run the ID Resolver.

The ID Resolver includes an error reporter that generates an exception document if there is an error.

The following are examples of situations in which you may want to use the ID Resolver:

  • Loading new content in XML format when identifiers for the data are required
  • Updating content when identifiers already exist for an object in the database

The ID Resolver can supply actual identifiers, or identifiers can be resolved using the following techniques:

Internal-alias resolution
To use internal-alias resolution with the ID Resolver, an alias is placed in the primary-key attribute (identifier) in the XML file. The alias can then be used throughout the XML file to refer to that element. This process eliminates the need for a program to determine the unique indexes necessary to build the XML file.
Properties-file specification
The ID Resolver in the Loader package can use a Java properties file to determine which columns of a primary table should be used as lookups for tables that require the identifier of a primary table. A table is primary if it is listed in the KEYS or SUBKEYS table.
Unique-index resolution
In the ID Resolver, unique-index resolution uses any specified unique indexes on a table as a means of determining an identifier. For example, MEMBER_ID plus IDENTIFIER is a unique index on the CATALOG table and can therefore be used as a resolution point to the primary key CATALOG_ID of the CATALOGDSC table.

The ID Resolver can analyze the database schema to determine whether there is a unique index that fulfills its requirements. The ID Resolver looks for a unique index only when there is no entry in the properties file for the table being analyzed or when there is no properties file. If these conditions are true, a unique-index check is performed. The unique index is considered valid if it exists and does not include the primary key for the table.

Loader
The Loader is responsible for populating and updating the WebSphere Commerce database. The Loader is the most common means of loading data into a system.

The Loader allows column-level updates to a table. It also allows you to delete data from a database.

The Loader loads valid and well-formed XML input to the database. In this input, element names correspond to table names and attributes of the element correspond to column names in the table. The following example shows an excerpt from well-formed and valid XML input to the Loader:

  <ADDRBOOK
    ADDRBOOK_ID="11801"
    MEMBER_ID="100"
    DISPLAYNAME="Friends"
    DESCRIPTION="All my friends"
    TYPE="P"
  />
In the preceding example, ADDRBOOK is the table name and the columns to be updated are indicated by attributes of the ADDRBOOK element.

The Loader command utility includes the following features:

Error reporter
The Loader includes an error reporter that generates an exception document if there is an error.
Product Advisor search-space synchronization
If you enable the Loader package's Product Advisor search-space synchronization feature, you can maintain near real-time synchronicity of Product Advisor search spaces and WebSphere Commerce catalog tables being updated by the Loader.
Extract utility
The Extract utility extracts selected subsets of data from a database in the form of XML files.

The Extract utility uses a query against a database to extract selected subsets of data from the database into an XML document. The data to be extracted from the database is specified using an extraction-filter XML document.

The function of the Extract utility is opposite that of the Loader. You use the Extract utility to extract selective subsets of data from the WebSphere Commerce database in the form of XML files. You can extract data on products related to an upcoming holiday, for example, or you can extract information from a consolidated database for use with other systems.

Logger
The Loader package command utilities log messages to indicate success, failure, and errors as well as to provide program trace information. You can customize the logger to specify what types of logs are created and what types of messages are logged.

Each command utility in the Loader package creates log messages to indicate success, failure, and errors as well as to provide program trace information.

The utilities in the Loader package reference the WCALoggerConfig.xml file.

  • AIXLinuxSun Solaris Operating EnvironmentWindows This file exists in a directory specified in the classpath system-environment variable. It can also be specified by the com.ibm.wca.logging.configFile Java systems property.
  • i5/OSiSeries This file is located in the /instroot/xml/loader directory.

WCALoggerConfig.xml determines what logging information each utility provides and where the information is displayed or stored. You can customize this file and specify what types of logs are created as well as what types of messages are logged.

Feedback