The following describes the syntax of the View Definition (view.xml
) file as part of the View Package.
<view>
The <view>
element is the enclosing element in the Definition File. The following table describes the elements you can include in the <view>
element:
Element | Required | Description |
---|---|---|
name | Yes | The unique name of the view. See <name> for more information. |
label | Yes | The label of the view. See <label> for more information. |
version | Yes | The version of the view. See <version> for more information. |
parameter | No | Defines a configuration parameter that is used to when creating a view instance. See <parameter> for more information. |
resource | No | Defines a resource that is exposed by the view. See <resource> for more information. |
<name>
The unique name of the view. Example:
<name>MY_COOL_VIEW</name>
<label>
The label of the view. Example:
<label>My Cool View</label>
<version>
The version of the view. Example:
<version>0.1.0</version>
<parameter>
Element | Required | Description |
---|---|---|
name | Yes | The name of the parameter. |
description | Yes | The description of the parameter. |
required | Yes | If true, the parameter is required in order to create a view instance. |
<parameter> <name>someParameter</name> <description>Some parameter this is used to configure an instance of this view</description> <required>false</required> </parameter>
<resource>
Element | Required | Description |
---|---|---|
name | Yes | The name of the parameter. See <parameter><name> for more information. |
service-class | No | |
provider-class | No | |
resource-class | No |
<resource> <name>calculator</name> <service-class>org.apache.ambari.view.proxy.CalculatorResource</service-class> </resource>
See the Calculator View Example to see a REST service endpoint view implementation.
<resource> <name>city</name> <plural-name>cities</plural-name> <id-property>id</id-property> <resource-class>org.apache.ambari.view.weather.CityResource</resource-class> <provider-class>org.apache.ambari.view.weather.CityResourceProvider</provider-class> <service-class>org.apache.ambari.view.weather.CityService</service-class> </resource>
See the Weather View Example to see an Ambari-Managed ResourceProvider view implementation..