Introduced in Feature Pack 2

Management Center definitions

The Management Center framework uses configuration information that is called definitions to display all of the features available in Management Center, such as tools, business objects, properties views, and list views. Definitions are stored in definition (.def) files that are in the LOBTools/WebContent/config directory.

A definition file is an XML file that contains a root element named Definitions. Each child element of the Definitions element is a definition. These child definition elements can include definitions for tools, business objects, properties views, and list views. Each definition element must include the definitionName attribute to specify the name of the definition. The name of the definition element is the name of the class that is instantiated when the definition is loaded. By default, this class name is qualified by the three character prefix, wcf. You can override this name by specifying a package name that uses the package attribute. If a definition extends another definition, the name of the base definition is specified by using the baseDefinition attribute. All other attributes are passed to the new instance of the definition when the definition is instantiated.

Feature Pack 7 or laterAn existing definition can be extended with more child elements without directly changing the original definition or the file that includes the original definition. This definition extension can be achieved by deploying one or more extension definitions with a parentDefinitionName attribute set to be the name of the definition that is being extended. The extension definitions can be deploying within one or more definition files. When the original definition is instantiated by the framework, all of the extension definitions are instantiated as a child of the new definition instance. The following code snippet identifies a widget object definition that extends the plmBasePageLayoutPrimaryObjectDefinition definition:
<Definitions>
  <WidgetObjectDefinition package="plm"
    definitionName="plmLayoutWidget_ShoppingCartDetailPageWidget" 
    parentDefinitionName="plmBasePageLayoutPrimaryObjectDefinition"
    baseDefinitionName="plmBaseLayoutWidget"
    ...
  </WidgetObjectDefinition>;	
</Definitions>

The descendant elements of each definition element are constructed after the definition instance is created. The names of these descendant elements are the names of the classes that are instantiated when the child elements are constructed. By default, the name of this package is wcf. You can override this name by specifying a package name that uses the package attribute. By specifying the baseDefinition attribute, the attributes and each child of a child definition element are inherited from another definition. Do not specify the definitionName attribute for descendant elements. Specify the definitionName attribute for child elements of the Definitions root element only.

You can use the following special syntax to constrain the value of an attribute to the value of a resource bundle key: "${resourceBundle.key}" Where:
resourceBundle
The ID of the resource bundle instance.
key
The name of the resource bundle key.
Use this syntax only for resource bundle keys.
The following code snippet shows the syntax of a definition file:
<Definitions>
  1 <PrimaryObjectDefinition
    baseDefinitionName="catBaseCatalogPrimaryObjectDefinition" definitionName="Catalog" objectType="Catalog"/>
  2 <PrimaryObjectDefinition
    baseDefinitionName="catBaseCatalogPrimaryObjectDefinition" definitionName="InheritedCatalog" 
    displayName="${catalogResources.inheritedCatalog_DisplayName}" headerIcon="inheritedCatalogHeaderIcon" 
    icon="inheritedCatalogIcon" objectType="InheritedCatalog">
  <ParentReferenceObjectDefinition
    baseDefinitionName="catChildInheritedCatalogGroup"/>
  </PrimaryObjectDefinition>
</Definitions>
This definition file contains two definitions that describe primary object definitions:
  • 1 Catalog
  • 2 InheritedCatalog
These definitions are created when you construct an instance of wcfPrimaryObjectDefinition and are based on the catBaseCatalogPrimaryObjectDefinition definition. The InheritedCatalog definition includes a child element that is created by instantiating an instance of wcfParentReferenceObjectDefinition.
If you create your own classes to use as definition classes, you must consider the order in which these definitions and their child definitions are instantiated.
  1. Create the class instance of the parent definition element before you create the child definition elements.
  2. If you need to perform more initialization in the parent definition after you create each of the child definition elements, declare the postCreateDefinitionChildren method in the parent class. This method is called after each of the child elements are created.
  3. If the initstage attribute in the class is set to defer, the child elements are not automatically created and you must call wcfDefinitionLoader.completeCreateDefinitionChildren(this); from the completeInstantiation method of the class that deferred the initialization.
Attributes that are declared as part of the definition are passed into the constructor when the class is initialized. The type of the value is determined by checking the default value of the attribute that is declared in the class declaration. If the attribute does not have a default value and the type is not string, you must declare the type. By declaring the type, you ensure that the correct type is passed to the constructor. You can explicitly declare attribute types by adding a second attribute with "__type" appended to the name. For example, to ensure that the width attribute is interpreted as a number, add the following attribute to the class declaration:
<attribute name="width__type" type="string" value="number"/>
Valid values for these type declarations are string, number, and boolean. If the type is not declared, it is assumed to be string.

If you add or change definition files in the LOBTools/WebContent/config directory, you do not need to restart your WebSphere Commerce Server; the new definitions are automatically detected. You must restart Management Center after you close the Management Center browser window and ensuring that the browser cache is cleared.