HCL Commerce Enterprise

Enabling workspaces support for a custom table in an existing HCL 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

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.

Procedure

  1. If it has not already been created, create a resource manager XML file to contain your workspaces customizations. Perform one of the following substeps:
    1. For a default HCL Commerce service module, do not modify the default resource managers file. Create a file with "-ext" in the name:
      • HCL Commerce Developerworkspace_dir\wc\xml\content-management\servicemodulename.resource-managers-ext.xml
    2. For a custom service module that you created, create the following file:
      • HCL Commerce Developerworkspace_dir\wc\xml\content-management\ servicemodulename.resource-managers.xml
  2. 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 HCL Commerce, or other workspace customizations. IBM reserves values ranging from 1 to 9999. Use a value over 10000.

  3. 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 HCL 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 HCL 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".
  4. 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>
  5. 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.
  6. Run Ant target: CM_updateWorkspacesSchema to update workspaces, using the configuration you just provided.