If you have added a new type of object to the vSphere environment, you can create a complete workspace for that object in the vSphere Web Client by using an XML template. You instantiate the XML template in the plug-in module’s
plugin.xml manifest file, much like an extension definition.
The vSphere Web Client SDK includes a standard object view template for an object workspace. The object view template uses variable values that you provide to automatically create extension definitions and extension points for the object workspace tabs and sub-views, including
Summary,
Monitor,
Manage, and
Related Objects.
To create an instance of the standard object view template, you use the <templateInstance> element in your plug-in module’s
plugin.xml file. Inside the
<templateInstance> element, you define the variables that describe the specific instance of the template.
Example: Instantiating the Standard Template in plugin.xml shows an example of how to instantiate the object view template for a new object called a Rack. While the
<templateInstance> shown in the example cam appear anywhere inside the root
<plugin> element in the
plugin.xml file, a best practice is to include the template definition with any other extension definitions.
In Example: Instantiating the Standard Template in plugin.xml, the
<templateInstance> element contains an
id attribute, which is a unique identifier of your choice.
The <templateId> element contains the identifier of the template you want to create. To use the standard object view template included with the vSphere Web Client SDK, this identifier must be
vsphere.core.inventory.objectViewTemplate. To use the
objectViewTemplate, you must define a
namespace variable and an
objectType variable.
The namespace variable sets the naming convention for the object workspace extension points. When the vSphere Web Client creates the extension points for the object workspace, it will prepend the value of the
namespace variable onto the default extension point names for each data view.
In Example: Instantiating the Standard Template in plugin.xml, the
namespace variable has a value of
com.vmware.samples.rack. The vSphere Web Client uses the value to create an extension point for each data view included in the standard object workspace. As such, the extension point for the
Monitor tab for the Rack object workspace is named
com.vmware.samples.rack.monitorViews. The other extension points in the Rack object workspace are named using the same convention. The following is a complete list of the extension points that you create when you instantiate the standard object view template.
You use the objectType variable to associate the object workspace with your custom entity type. Your custom entity type name should include a namespace prefix, such as your company name, to avoid clashing with other object type names in the vSphere environment. The vSphere Web Client displays the object workspace when the user selects an object of the specified type. In
Example: Instantiating the Standard Template in plugin.xml, the
objectType variable has the value
samples:Rack. The object workspace created by the template will appear in the vSphere Web Client when the user selects a Rack object.
Tabs, subtabs, and views created using the standard object view template do not appear in the vSphere Web Client main workspace unless you define a data view extension at that extension point. For example, if you do not define a data view extension at the
com.vmware.samples.rack.monitor.performanceViews extension point, the
Performance Views subtab in the
Monitor tab does not appear for Rack objects.
The vSphere Web Client SDK contains a template that you can use to create a standard Summary tab view for your custom object. The standard
Summary tab view contains a Summary header view displayed at the top of the main workspace, and an extension point for any number of Portlet views below the header. The extension point that the template creates for Portlet views is named
{namespace}.summarySectionViews.
To use the standard Summary tab template, you must create an instance of the template in your plug-in module
plugin.xml file, using the
<templateInstance> element. The
<templateInstance> element can appear anywhere within the root
<plugin> element, but after the definition for the standard object workspace template.
Example: Instantiating the Summary Tab Template in plugin.xml shows an example of how to instantiate the Summary tab template for a custom object called a Rack.
In Example: Instantiating the Summary Tab Template in plugin.xml, the
<templateInstance> element contains an
id attribute, which is a unique identifier of your choice.
The <templateId> element contains the identifier of the template you want to create. To use the standard Summary tab template included with the vSphere Web Client SDK, this identifier must be
vsphere.core.inventory.summaryViewTemplate. To use the
summaryViewTemplate, you must define a
namespace variable and an
summaryHeaderView variable.
The value you supply for the namespace variable must match the
namespace for the
Summary tab’s parent object workspace. The
Summary tab created by the Summary tab template uses the extension point
{namespace}.summaryViews, as defined by the object workspace template.
The Summary tab template also creates the extension point {namespace}.summarySectionViews. You can use the
{namespace}.summarySectionViews extension point to add Portlet data views to your custom object
Summary tab.
In Example: Instantiating the Summary Tab Template in plugin.xml, the
namespace variable has a value of
com.vmware.samples.rack, matching the
namespace variable in the Rack object workspace template.
You use the summaryHeaderView variable to specify the data view that appears at the top of the
Summary tab. The value you supply for the
summaryHeaderView variable must be the fully-qualified class name for an MXML data view class in your plug-in module. If you omit the
summaryHeaderView variable, no header appears in the Summary tab, and the main workspace displays the portlet data views you create at the
{namespace}.summarySectionViews extension point, if any.
Once you have created a Summary tab for your custom object workspace by using the Summary tab template, you can add portlet data views to the
Summary tab. You create the portlet data views at the
{namespace}.summarySectionViews extension point that the template creates, in the same manner as you would for any other extension point in the Virtual Infrastructure. See
Defining a Data View Extension.