Creating an Object Workspace for a Custom Object
If you 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.
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 create extension definitions and extension points for the object workspace tabs and subordinate views, including Summary, Monitor, Manage, and Related Objects.
Using the Object View Template to Create an Object Workspace
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. The <templateInstance> shown in the example cam appear anywhere inside the root <plugin> element in the plugin.xml file, but a best practice is to include the template definition with any other extension definitions.
Example: Instantiating the Standard Template in plugin.xml
<templateInstance id="com.vmware.samples.rack.viewTemplateInstance">
<templateId>vsphere.core.inventory.objectViewTemplate</templateId>
<variable name="namespace" value="com.vmware.samples.rack"/>
<variable name="objectType" value="samples:Rack"/>
</templateInstance>
 
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.
Namespace
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 prepends 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. 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 list shows the extension points that you create when you instantiate the standard object view template.
namespace.gettingStartedViews
namespace.summaryViews
namespace.monitorViews
namespace.monitor.issuesViews
namespace.monitor.performanceViews
namespace.monitor.performance.overviewViews
namespace.monitor.performance.advancedViews
namespace.monitor.tasksViews
namespace.monitor.eventsViews
namespace.manageViews
namespace.manage.settingsViews
namespace.manage.alarmDefinitionsViews
namespace.manage.tagsViews
namespace.manage.permissionsViews
namespace.relatedViews
namespace.list.columns
Object Type
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 appears in the vSphere Web Client when the user selects a Rack object.
Creating the Data Views Within the Template
After you create an object workspace using the standard template, you can create data views at the resulting extension points in the same way that you do for other extension points in the Virtual Infrastructure. See Defining a Data View Extension.
Top-level tabs, second-level tabs, 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 second-level tab in the Monitor tab does not appear for Rack objects.
Using the Summary Tab Template
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 in the root <plugin> element, but after the definition for the standard object workspace template.
Example 4-8, on page 41, shows an example of how to instantiate the Summary tab template for a custom object called a Rack.
Example: Instantiating the Summary Tab Template in plugin.xml
<!-- Object Workspace Template for Rack -->
<templateInstance id="com.vmware.samples.rack.viewTemplateInstance">
<templateId>vsphere.core.inventory.objectViewTemplate</templateId>
<variable name="namespace" value="com.vmware.samples.rack"/>
<variable name="objectType" value="samples:Rack"/>
</templateInstance>
 
<!-- Summary Tab Template for Rack -->
<templateInstance id="com.vmware.samples.chassis.summaryViewTemplateInstance">
<templateId>vsphere.core.inventory.summaryViewTemplate</templateId>
<variable name="namespace" value="com.vmware.samples.rack"/>
<variable name="summaryHeaderView" value="com.vmware.samples.rack.views.RackSummaryView"/>
</templateInstance>
 
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 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 a summaryHeaderView variable.
Namespace
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.
Summary Header View
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.
Adding Portlets to the Summary Tab
After you create 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 way that you do for any other extension point in the Virtual Infrastructure. See Defining a Data View Extension.