The following describes the syntax of the View Definition File (view.xml
) as part of the View Package.
An XML Schema Definition is available here.
<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 display label of the view. See <label> for more information. |
version | Yes | The version of the view. See <version> for more information. |
description | No | The description of the view. See <description> for more information. |
icon | No | The 32x32 icon to display for this view. Suggested size is 32x32 and will be displayed as 8x8 and 16x16 as necessary. If this property is not set, a default view framework icon is used. |
icon64 | No | The 64x64 icon to display for this view. If this property is not set, the 32x32 sized icon will be used. |
permission | No | Defines a custom permission for this view. See <permission> 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. |
instance | No | Defines a static instance of the view. See <instance> for more information. |
view-class | No | Registers a view class to receive framework events. See <view-class> 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>
<description>
The description of the view. Example:
<description>This view is used to display information.</description>
<parameter>
Element | Required | Description |
---|---|---|
name | Yes | The name of the configuration parameter. |
description | Yes | The description of the configuration parameter. |
required | Yes | If true , the configuration parameter is required in order to create a view instance. |
masked | No | Indicated this parameter value is to be "masked" in the Ambari Web UI (i.e. not shown in the clear). Omitting this element default to not-masked. Otherwise, if true , the parameter value will be "masked" in the Web UI. |
<parameter> <name>someParameter</name> <description>Some parameter this is used to configure an instance of this view</description> <required>false</required> </parameter>
<permission>
Element | Required | Description |
---|---|---|
name | Yes | The unique name of the permission. |
description | Yes | The description of the permission. |
<resource>
Element | Required | Description |
---|---|---|
name | Yes | The name of the resource. This will be the resource endpoint name of the view instance. |
plural-name | No | The plural name of the resource. |
service-class | No | The JAX-RS annotated resource service class. |
id-property | No | The resource identifier. |
provider-class | No | The Ambari ResourceProvider resource class. |
resource-class | No | The JavaBean resource class. |
<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 ResourceProvider view implementation..
<instance>
Element | Required | Description |
---|---|---|
name | Yes | The unique name of the view instance. |
label | No | The display label of the view instance. If not set, the view definition <label> is used. |
description | No | The description of the view instance. If not set, the view definition <description> is used. |
visible | No | If true , for the view instance to show up in the users view instance list. |
icon | No | Overrides the view icon for this specific view instance. |
icon64 | No | Overrides the view icon64 for this specific view instance. |
property | No | Specifies any necessary configuration parameters for the view instance. See <property> for more information. |
<instance> <name>US_WEST</name> <property> <key>cities</key> <value>Palo Alto, US;Los Angeles, US;Portland, US;Seattle, US</value> </property> <property> <key>units</key> <value>imperial</value> </property> </instance>
<property>
Element | Required | Description |
---|---|---|
key | Yes | The property key (for the configuration parameter to set). |
value | Yes | The property value (for the configuration parameter to set). |
<property> <key>units</key> <value>imperial</value> </property>
<view-class>
Registers a view class to receive framework events. The view class must implement the View interface.
<view-class>this.is.my.viewclazz</view-class>