Enabling workspace support for the service module
About this task
One key aspect of enabling workspaces support is classifying your data as managed content assets or managed operational assets. To review the distinction between content and operational data, see Workspaces data model. You must understand whether the tables you want to manage with workspaces are content or operational before you complete this task. The tables that you are working with are all content managed. For more information, see Enabling workspaces support for a custom table in an existing WebSphere Commerce BOD service module.
Procedure
- For the custom service module that you created for recipe,
create the following file:
WC_eardir\xml\content-management\com.mycompany.commerce.project.resource-managers.xml
- Open the file in a text or XML editor and add the following
lines to beginning of 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="10005" name="ProjectResourceContainer" className="com.ibm.commerce.context.content.resources.DSLResourceContainer"> </wc:Definition>
The
wc:Definition
element defines the resource container that is used by the service module. All BOD service modules useclassName="com.ibm.commerce.context.content.resources.DSLResourceContainer"
as shown in the example. The only value that you should change from the sample XML is theid
. The value of theid
is a unique integer, not previously used by WebSphere Commerce, or other workspace customization. IBM reserves the values that range 1 - 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="1" name="XPROJECT" resource="XPROJECT" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPROJECT_ID"> </wc:ManagedResource> <wc:ManagedResource id="2" name="XPRJDES" resource="XPRJDES" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPROJECT_ID,LANGUAGE_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="3" name="XPRJMTR" resource="XPRJMTR" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJMTR_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="4" name="XPRJMTRDES" resource="XPRJMTRDES" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJMTR_ID,LANGUAGE_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="5" name="XPRJMTRCATREL" resource="XPRJMTRCATREL" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJMTR_ID,STOREENT_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPRJMTR" /> </wc:ManagedResource> <wc:ManagedResource id="6" name="XPRJINS" resource="XPRJINS" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJINS_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="7" name="XPRJINSDES" resource="XPRJINSDES" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJINS_ID,LANGUAGE_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="8" name="XPRJCATREL" resource="XPRJCATREL" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPROJECT_ID,CATENTRY_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> <wc:ManagedResource id="9" name="XPRJCOL" resource="XPRJCOL" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJCOL_ID"> </wc:ManagedResource> <wc:ManagedResource id="10" name="XPRJCOLDES" resource="XPRJCOLDES" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPRJCOL_ID,LANGUAGE_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPRJCOL" /> </wc:ManagedResource> <wc:ManagedResource id="11" name="XPRJPRJCOLREL" resource="XPRJPRJCOLREL" resourceClassName="" resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager" managed="true" resourceKeys="XPROJECT_ID,XPRJCOL_ID"> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPRJCOL" /> <wc:RelatedManagedResource resourceContainer="ProjectResourceContainer" managedResource="XPROJECT" /> </wc:ManagedResource> </wc:ManagedResources>
Where,- 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="10005" name="ProjectResourceContainer" className="com.ibm.commerce.context.content.resources.DSLResourceContainer"> </wc:Definition>
- A managed resource element is required for each content managed table.
- The related managed resource element relates one resource to another resource. For example, the XPRJDES, XPRJMTR, and XPRJMTRDES tables are related to the XPROJECT table. If an entry in the XPROJECT 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 cases where you add managed resources to a WebSphere Commerce resource container, use values greater than 10000 to avoid all possible collisions.
- The resourceClassName attribute is always set to an empty string for Data Service Layer implementations. This attribute is only used by workspaces in WebSphere Commerce Accelerator.
- The resourceKeys attribute is 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:
- 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 resource container are published separately. If set to false, transactions are grouped for all resource containers. - From a command line, run ANT target: UpdateWorkspAccesschema to create the necessary tables and views in the workspaces for the tables that you configure.