

Enabling workspaces support for a custom table in an existing WebSphere Commerce BOD service module
Adding workspaces support to a custom content managed table consists of creating an XML file to identify the table or tables that are managed, and running the existing UpdateWorkspaceSchema script to create the tables in all of the workspaces.
Before you begin
Procedure
-
If it has not already been created, create a resource manager XML file to contain your
workspaces customizations. Perform one of the following substeps:
-
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="10001" name="MyServiceModuleNameResourceContainer" 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 lines similar to the following
example to your file:
<wc:ManagedResources> <wc:ManagedResource id="1" name="STORE" resource="STORE" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="STORE_ID"> <wc:RelatedManagedResource resourceContainer="TutorialStoreResourceContainer" managedResource="STOREENT"/> </wc:ManagedResource> <wc:ManagedResource id="2" name="STOREENT" resource="STOREENT" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="STOREENT_ID"> </wc:ManagedResource> <wc:ManagedResource id="3" name="STOREENTDS" resource="STOREENTDS" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="LANGUAGE_ID,STOREENT_ID"> <wc:RelatedManagedResource resourceContainer="TutorialStoreResourceContainer" managedResource="STOREENT"/> </wc:ManagedResource> <wc:ManagedResource id="4" name="STORELANG" resource="STORELANG" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="STOREENT_ID"> <wc:RelatedManagedResource resourceContainer="TutorialStoreResourceContainer" managedResource="STOREENT"/> </wc:ManagedResource>
Notes:- The resource container is the name of the container that defines the related resource. The
resource container is listed in the definition element. For
example:
<wc:Definition id="100" name="TutorialStoreResourceContainer" className="com.ibm.commerce.context.content.resources.DSLResourceContainer"/>
- A managed resource element is required for each content managed table.
- The related managed resource element relates one resource to another resource. In the example the STORE, STOREENTDS, and STORELANG tables are related to the STOREENT table. If an entry in the STOREENT table is locked, the related data in the other three tables is also locked.
- The managed resource IDs are unique per resource container. However, for any cases where you are adding managed resources to an existing WebSphere Commerce resource container, it is recommended that you use values greater than 10000, to avoid all possible collisions.
- The resourceClassName attribute is always set to an empty string for Data Service Layer based implementations. This attribute is only used by workspaces in WebSphere Commerce Accelerator.
- The resourceKeys is a comma separated list of the columns that comprise the primary key of the
table. For example,
resourceKeys="LANGUAGE_ID,STOREENT_ID"
.
- The resource container is the name of the container that defines the related resource. The
resource container is listed in the definition element. For
example:
-
Add lines similar to the following example for each operational table you want to add to
workspaces:
<wc:OperationalResources> <wc:OperationalResource name="DMACTATTR" resourceClassName="" managed="true" resource="DMACTATTR"/> <wc:OperationalResource name="DMELESTATS" resourceClassName="" managed="true" resource="DMELESTATS"/> <wc:OperationalResource name="DMTRIGSND" resourceClassName="" managed="true" resource="DMTRIGSND"/> <wc:OperationalResource name="DMUSERBHVR" resourceClassName="" managed="true" resource="DMUSERBHVR"/> <wc:OperationalResource name="DMEMSPOTSTATS" resourceClassName="" managed="true" resource="DMEMSPOTSTATS"/> </wc:OperationalResources>
-
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. - Run Ant target: CM_updateWorkspacesSchema to update workspaces, using the configuration you just provided.