Tutorials > Content management > Create a content-managed resource > Make the resource content managed
Specify a managed resource
To specify a managed asset, a resource within a resource container must be created to represent the asset. A resource container is a collection of resources that are related to each other. Resource containers are typically classified into components such as catalog or marketing promotions in which the set of resources are dependent in terms of data integrity.
Resources and resource containers are configured through xml files that are located...
- WC_EAR/xml/content-management
- WC_INSTALL/xml/content-management
The file wc-resource-containers.xml contains a list of all of the managed resource containers. Each resource container has one or more resource manager groupings specified.
Resource Containers are specified in the wc-resource-containers.xml file within the wc:ResourceContainer tag. All containers are specified within this file and must be ordered to maintain data integrity such that containers with data dependency (such as foreign key references) to other containers must be specified after the referenced container. The key attributes of a container within the xml are the following:
- id: a unique number to identify the container.
- name: identifier for the container.
- className: fully qualified class name that implements the container logic
- configurationFile: the relative path from the xml directory to the resource container configuration file. The file specifies the property of the container including all the resources managed by container.
Below is a sample of wc:ResourceContainer definition. See the XSD in the above directory for full implementation details.
<wc:ResourceContainer name="CatalogContainer" className="com.ibm.commerce.catalog.content.resources.CatalogContainer" configurationFile="content-management/wc-catalog-resource-managers.xml" />
Resources are specified in the configuration file of a container (for a list of existing managed assets, refer to Managed Assets). Managed content assets are specified within a wc:ManagedResource tag and must be ordered to maintain data integrity such that resources with data dependency to other resources must be specified after the referenced resource. The key attributes of a resource within the xml are the following:
- name: identifier for the resource.
- resourceClassName: fully qualified name of the class which implements the access to data within a workspace schema. For most WC resources, the resourceClassName refers to the AccessBean class which is used to create, update, delete or retrieve instances of the data.
- managed: true if this resource is managed by the WebSphere Commerce data model.
- resource: the name of the table for which this resource refers to.
- resourceManagerClassName: fully qualified class name that implements
In addition a resource may be identified as a related resource when an action on one resource causes a similar action on the related resource. For example, a related resource may be a table which has a foreign key relationship with a cascade such that deleting the parent resource also deletes the related resource.
Similarly, managed operational assets are specified within a wc:OperationalResource tag. The key attributes of a resource within the xml are the following:
- name: identifier for the resource.
- resourceClassName: fully qualified name of the class which implements the access to data within a workspace schema. For most WC resources, the resourceClassName refers to the AccessBean class which is used to create, update, delete or retrieve instances of the data.
- managed: true if this resource is managed by the WebSphere Commerce data model.
- resource: the name of the table for which this resource refers to.
The following is a sample definition of a file. See the XSD in the above directory for full implementations.
<?xml version="1.0" ?> <ContentManagementManagedResources> <ContentManagedData> <ManagedResource name="CATALOG" abClassName="com.ibm.commerce.catalog.objects.CatalogAccessBean" resMgrClassName="com.ibm.commerce.catalog.content.resources.CatalogResourceManager" managed="1" primaryKey="CATALOG_ID" businessKey WhereClause="CATALOG_ID = ? "/> </ContentManagedData> <OperationalResource name="ORDERS" abClassName="" /> <OperationalResource name="ORDERITEMS" abClassName="" /> </OperationalData> </ContentManagementManagedResources>