In this lesson, you enable workspace support for your custom
tables by creating an XML file to identify the table or tables that
are managed.
About this task
One key aspect of enabling workspaces support is classifying
your data as managed content assets or managed operational assets.
The distinction between content and operational data is discussed
in detail in the Workspaces
data model. You need to understand whether the tables
you want to manage using workspaces are content or operational before
performing this task. The tables you are working with are all content
managed. See Enabling workspaces support for a custom table in an existing WebSphere Commerce BOD service module for
more information.
The XWARRANTY and XCAREINSTRUCTION schema
is shown in the following diagram:
Note the primary keys for the tables.
Procedure
- Create the following file to contain catalog workspace
customizations:
WC_eardir\xml\content-management\com.ibm.commerce.catalog.resource-managers-ext.xml
- Open the file in a text or XML editor, and add the following
lines to begin the file:
<wc:ResourceContainer xmlns:wc="http://www.ibm.com/xmlns/prod/WebSphereCommerce"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce xsd/wc-resource-managers.xsd">
<wc:Definition id="10100" name="ExtendedCatalogResourceContainer"
className="com.ibm.commerce.context.content.resources.DSLResourceContainer">
</wc:Definition>
The wc:Definition element
defines the resource container used by the service module. All BOD
service modules use className="com.ibm.commerce.context.content.resources.DSLResourceContainer"
as
shown in the example. The only value you should change from the sample
XML is the id. The value of the id is
a unique integer, not previously used by WebSphere Commerce, or other
workspace customizations. IBM reserves values ranging from 1 to 9999.
Use a value over 10000.
- To add workspace support for a content managed table, add
the following sample code to your file:
<wc:ManagedResources>
<wc:ManagedResource
id="10001"
name="XWARRANTY"
resource="XWARRANTY"
resourceClassName=""
resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager"
managed="true"
resourceKeys="CATENTRY_ID">
</wc:ManagedResource>
<wc:ManagedResource
id="10002"
name="XCAREINSTRUCTION"
resource="XCAREINSTRUCTION"
resourceClassName=""
resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager"
managed="true"
resourceKeys="CATENTRY_ID,LANGUAGE_ID">
</wc:ManagedResource>
</wc:ManagedResources>
- Close the file with the following lines:
<wc:PublishRequest uniqueTransaction="false" />
</wc:ResourceContainer>
Note: The <wc:PublishRequest> element is used to indicate
whether to keep the transactions for this whole file (the resource
container) separate from all others when a workspace is published.
If set to true, the transactions for this resourceContainer will be
published separately. If set to false, transactions will be grouped
for all resourceContainers.