Tutorials > Content management > Create a content-managed resource > Make the resource content managed
Create a resource container
Content managed resources can be broken into two parts. This first part is the resource container, which categorizes the different resources.
Procedure
- In the Enterprise Explorer view, navigate to Other Projects > WebSphereCommerceServerExtensionsLogic.
- Right-click src and select New > Class.
- In the Name field, type ExtendedCatalogDescriptionResourceContainer.
- In the Package field, type com.mycompany.catalog.content.resources
- In the SuperClass field, click the browse button and enter AbstractResourceContainerImpl in the superclass selection window.
- Click the Add button next to the Interface box.
- In the Implemented Interfaces Selection window, type ResourceContainer in the Choose interfaces field.
- In the Matching types box, select ResourceContainer and click OK.
- Ensure that Inherited Abstract Methods is not selected.
- Click Finish.
- Right after the class signature, create a constant to store the table name:
public static final String EXTCATALOGDSC = "EXTCATALOGDSC";
- Implement the Constructor for the ExtendedCatalogDescriptionResourceContainer class:
public ExtendedCatalogDescriptionResourceContainer () { super(); }
- ExtendedCatalogDescriptionResourceContainer will implement the Singleton design pattern so that only one instance of the object will exist in memory.
- Create a private, static singleton attribute:
private static ResourceContainer singleton = new ExtendedCatalogDescriptionResourceContainer();
- Implement the two methods singleton() and setResourceContainer(ResourceContainer resourceContainer):
public static ResourceContainer singleton() { return singleton; } protected void setResourceContainer(ResourceContainer resourceContainer) { singleton = resourceContainer; }