Loading a store
You can load XML data for an entire store into the WebSphere Commerce database.
Procedure
- Review
the following information:
- Overview of loading store data, which provides the background information for the loading utilities.
- Plan
your loading process for a complete set of store database
assets. In the next steps, you will use or create the following files
for
your loading process:
- one or more database asset files for each group. When you load the complete store, you need all of your created database asset files. For example, you will need a database asset.xml file (as in campaign.xml, catalog.xml or currency.xml), and separate, locale specific database asset.xml files for locale your store supports. Examples of such files are contained within the WebSphere Commerce starter store archives. The starter store archives are organized by business model in the WC_installdir/starterstores directory. Note that not all database asset groups require locale specific information.
- a new XML file which consolidates all the XML database asset files for your store, contains the XML entity references, and contains the root element for the entire store. This is referred to as the main database asset group XML file. You can find this file in the sample package, called store-data-assets.xml.
- a new DTD file which defines all the data types required by the XML files from a database asset group, referred to as the main database asset group DTD file. You can find this file in the sample package, called store-data-assets.dtd.
- a second DTD file which defines the external dependencies. You may need to include this file in the main database asset group DTD file. You can find this file in the sample package, called ForeignKeys.dtd.
- a third DTD file containing the definition of all WebSphere Commerce tables. The wcs.dtd file already exists in WebSphere Commerce, located in the WC_installdir/schema/xml directory. You may need to include this file in the main database asset group DTD file. If you have not customized the WebSphere Commerce schema, then you can use this file without modification.
-
Create the database asset XML files. The database asset files
should
not contain any DTD declarations or page directives at the start of
the file
since this may cause conflicts when the files are concatenated. The
only file
that must have a root element is the main database asset group XML
file. Note: If you have database asset files for more than one language, then each file must specify an encoding, for example,
<?xml encoding = "UTF-8"?>
- Create the main database
asset group XML file for the entire set
of store data. This file contains reference entities to include various
database
asset XML files for your store. By using external reference entities,
you
can concatenate the XML files to simplify the idresgen utility and
the load
process. Also, internal aliases used within each XML file can be external
to another XML database asset file within a group or across other
groups when
loading more than one group at a time. An XML parser would substitute
the
contents of the file referenced by the external reference entity in
place
of the external reference.
Using the following example for loading the entire set of store data as your guide, you can create your database asset group file based on this extract:
<?xml version="1.0"?> <!DOCTYPE import SYSTEM "store-data-assets.dtd"> <import> <!Fulfillment data group --> &fulfillment.xml; <!-- Store data group --> &store.xml; &en_US_store.xml; &fr_FR_store.xml; <!-- Tax data group --> &tax.xml; &en_US_tax.xml; &fr_FR_tax.xml; &taxfulfill.xml; <!-- Shipping data group --> &shipping.xml; &en_US_shipping.xml; &fr_FR_shipping.xml; &shipfulfill.xml; <!-- Catalog data group --> &catalog.xml; &en_US_catalog.xml; &fr_FR_catalog.xml; &storecatalog.xml; &storefulfill.xml; &offering.xml; &store-catalog-tax.xml; &store-catalog-shipping.xml; <!-- Currency data group --> ¤cy.xml; &en_US_currency.xml; &fr_FR_currency.xml; <!-- Campaign data group --> &campaign.xml; &en_US_campaign.xml; &fr_FR_campaign.xml; <!-- Business policy data group --> &businesspolicy.xml; &en_US_businesspolicy.xml; &fr_FR_businesspolicy.xml; <!-- Access control data group --> &accesscontrol.xml; &en_US_accesscontrol.xml; &fr_FR_accesscontrol.xml; <!-- Other data groups --> &command.xml; &store-default.xml; </import>
where
- import
- is the root element of the XML document. The root element has already been defined in the wcs.dtd file, provided with WebSphere Commerce, and includes the definitions for all the WebSphere Commerce database tables. However, if you customized the WebSphere Commerce schema, you may need to use a different root element. You can generate a new DTD file that reflects the customized schema or you can update the existing wcs.dtd file.
- store-data-assets.dtd
- refers to the name of the main database asset group DTD file you will create in the next step. The commented text separates the different database asset groups for your store.
- &database asset.xml;
- is an XML entity reference to the database asset XML fragment file. The path and location of the database asset are defined in the database asset group DTD file. The name of the &database asset.xml; file will change to match the database asset already created for each group.
- &locale_database asset.xml;
- is needed for each language your store supports. If your store is unilingual, then only reference one file. If your store supports more than one language, then you require a reference for each language. The above extract assumes that your store supports the English and French languages.
- Create a main database asset
group DTD file that defines the preceding
entities and the other DTD files required by the database assets.
Using the following example for the entire set of store database assets as your guide, you can create your main database asset group DTD file:
<!ENTITY % wcs.dtd SYSTEM " absolute path for WebSphere Commerce wcs.dtd file"> %wcs.dtd; <!ENTITY % ForeignKeys.dtd SYSTEM "ForeignKeys.dtd"> %ForeignKeys.dtd; <!ENTITY fulfillment.xml SYSTEM "data/fulfillment.xml"> <!ENTITY en_US_fulfillment.xml SYSTEM "data/en_US/fulfillment.xml"> <!ENTITY fr_FR_fulfillment.xml SYSTEM "data/fr_FR/fulfillment.xml"> <!ENTITY store.xml SYSTEM "data/store.xml"> <!ENTITY en_US_store.xml SYSTEM "data/en_US/store.xml"> <!ENTITY fr_FR_store.xml SYSTEM "data/fr_FR/store.xml"> <!ENTITY tax.xml SYSTEM "data/tax.xml"> <!ENTITY en_US_tax.xml SYSTEM "data/en_US/tax.xml"> <!ENTITY fr_FR_tax.xml SYSTEM "data/fr_FR/tax.xml"> <!ENTITY taxfulfill.xml SYSTEM "data/taxfulfill.xml"> <!ENTITY shipping.xml SYSTEM "data/shipping.xml"> <!ENTITY en_US_shipping.xml SYSTEM "data/en_US/shipping.xml"> <!ENTITY fr_FR_shipping.xml SYSTEM "data/fr_FR/shipping.xml"> <!ENTITY shipfulfill.xml SYSTEM "data/shipfulfill.xml"> <!ENTITY catalog.xml SYSTEM "data/catalog.xml"> <!ENTITY en_US_catalog.xml SYSTEM "data/en_US/catalog.xml"> <!ENTITY fr_FR_catalog.xml SYSTEM "data/fr_FR/catalog.xml"> <!ENTITY store-catalog.xml SYSTEM "data/store-catalog.xml"> <!ENTITY storefulfill.xml SYSTEM "data/storefulfill.xml"> <!ENTITY offering.xml SYSTEM "data/offering.xml"> <!ENTITY store-catalog-tax.xml SYSTEM "data/store-catalog-tax.xml"> <!ENTITY store-catalog-shipping.xml SYSTEM "data/store-catalog-shipping.xml"> <!ENTITY currency.xml SYSTEM "data/currency.xml"> <!ENTITY en_US_currency.xml SYSTEM "data/en_US/currency.xml"> <!ENTITY fr_FR_currency.xml SYSTEM "data/fr_FR/currency.xml"> <!ENTITY campaign.xml SYSTEM "data/campaign.xml"> <!ENTITY en_US_campaign.xml SYSTEM "data/en_US/campaign.xml"> <!ENTITY fr_FR_campaign.xml SYSTEM "data/fr_FR/campaign.xml"> <!ENTITY businesspolicy.xml SYSTEM "data/businesspolicy.xml"> <!ENTITY en_US_businesspolicy.xml SYSTEM "data/en_US/businesspolicy.xml"> <!ENTITY fr_FR_businesspolicy.xml SYSTEM "data/fr_FR/businesspolicy.xml"> <!ENTITY accesscontrol.xml SYSTEM "data/accesscontrol.xml"> <!ENTITY en_US_accesscontrol.xml SYSTEM "data/en_US/accesscontrol.xml"> <!ENTITY fr_FR_accesscontrol.xml SYSTEM "data/fr_FR/accesscontrol.xml"> <!ENTITY command.xml SYSTEM "data/command.xml"> <!ENTITY store-defaults.xml SYSTEM "data/store-defaults.xml">
where
- wcs.dtd
- the DTD file containing data defined outside its database asset group. This file, provided with WebSphere Commerce, also defines the root element used in the database asset group XML file.
- ForeignKeys.dtd
- the DTD file which defines elements other than the root element.
This
file contains all the XML entity reference declarations and definitions
for
the external dependencies outside the database asset group. As such,
the XML
files have references to foreign key values that are not created as
part of
the database asset group and must already be loaded into the database
before
this group.
Note:
Ensure that the path is correctly identified. In this example, the file is in the same directory as the main database asset group DTD file. - store.xml, en_US_store.xml, and fr_FR_store.xml are the external reference entities used in the main database asset group XML file, assuming your store supports English and French. To use the reference, follow the entity reference convention: &alias_name;.
- database asset.xml
- refers to the name of the XML files from which the database assets are loaded. This name will change to match the database assets files already created for each group. Examples of such files are contained within the WebSphere Commerce starter store archives. The starter store archives are organized by business model in the WC_installdir/starterstores directory.
- The locale_database asset.xml files are needed for each language your store supports, located under the preceding directories. If your store is unilingual, then you would only reference one file. If your store supports more than one language, then you would require a locale-specific file for each language. The above extract assumes that your store supports the English and French languages.
- Each
database asset group requires information defined outside
its domain or its set of data, as each group may have external dependencies.
You can provide this data in a DTD file. For example, the store database
asset
group has the following external dependencies:
bootstrap.LANGUAGE.LANGUAGE_ID, bootstrap.MEMBER.MEMBER_ID, bootstrap.SETCURR.SETCURR_ID, fulfillment.FFMCENTER.FFMCENTER_ID
When loading a database asset group or the entire set of store assets, the external dependencies must be defined from the WebSphere Commerce database. To use this data, follow the corresponding XML entity reference. For example, to use the data defined by the
ffmcenter_id
entity, you would write&ffmcenter_id;
in your XML file. Using the following example for store database assets as your guide, you can create your DTD file based on this extract, called ForeignKeys.dtd:<!ENTITY en_US "-1"> <!ENTITY fr_FR "-2"> <!ENTITY de_DE "-3"> <!ENTITY it_IT "-4"> <!ENTITY es_ES "-5"> <!ENTITY pt_BR "-6"> <!ENTITY zh_CN "-7"> <!ENTITY zh_TW "-8"> <!ENTITY ko_KR "-9"> <!ENTITY ja_JP "-10"> <!ENTITY MEMBER_ID "-2000"> <!ENTITY ffmcenter_id "10001">
where
-
MEMBER_ID
- is the internal reference number that identifies the owner of the store.
-
ffmcenter
- is the reference number for your store's fulfillment center. Since your store can use more than one fulfillment center, more than one can be defined in the ForeignKeys.dtd file.
-
locale
- is the WebSphere Commerce reference number for each locale (identified by country or region and language). The values are located in the LANGUAGE database table.
Note: If you are splitting an existing store archive into database asset groups, ensure that all references to, as an example, alias@ffmcenter_id
are replaced with the corresponding entity reference:&ffmcenter_id;
. -
- Once all the data files have been created, run the idresgen utility against the main database asset group XML file to resolve the data as described in idresgen utility.
- Run the Load command on the resolved data file as described in massload utility. To verify your loading process, refer to the log files generated by the idresgen utility and the massload utility.
- Run the AccountImport command as described in Publishing business account assets.
- If applicable, publish contracts as described in Publishing contract assets.
- Complete the tasks in Publishing storefront assets and store configuration files by copying to the WebSphere Commerce Server