You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sp...@apache.org on 2015/01/02 20:53:53 UTC

ambari git commit: AMBARI-8798: Example view to exercise the view validator capability

Repository: ambari
Updated Branches:
  refs/heads/trunk 50342566d -> d81bc9b33


AMBARI-8798: Example view to exercise the view validator capability

Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d81bc9b3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d81bc9b3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d81bc9b3

Branch: refs/heads/trunk
Commit: d81bc9b330d84e3e56ea15bd3c4588abc7291d6b
Parents: 5034256
Author: sposetti <co...@yahoo.com>
Authored: Fri Jan 2 14:53:35 2015 -0500
Committer: sposetti <co...@yahoo.com>
Committed: Fri Jan 2 14:53:35 2015 -0500

----------------------------------------------------------------------
 ambari-views/examples/README.md                 |   4 +-
 .../property-validator-view/docs/index.md       |  70 ++++++
 .../examples/property-validator-view/pom.xml    |  96 ++++++++
 .../ambari/view/property/MyValidator.java       | 226 +++++++++++++++++++
 .../view/property/PropertyValidatorService.java |  83 +++++++
 .../src/main/resources/ui/index.html            |  63 ++++++
 .../src/main/resources/view.xml                 |  61 +++++
 7 files changed, 602 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/README.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/README.md b/ambari-views/examples/README.md
index 4b65216..ec1226e 100644
--- a/ambari-views/examples/README.md
+++ b/ambari-views/examples/README.md
@@ -23,9 +23,11 @@ See the documentation pages for the view examples.
 
 * [Hello World View](helloworld-view/docs/index.md) : Demonstrates the very basics of how to write and deploy a view in Ambari.
 * [Hello Servlet View](hello-servlet-view/docs/index.md) : Includes instance parameters and a servlet for a dynamic UI. 
-* [Favorite view](favorite-view/docs/index.md) : Exposes a simple resource to work with instance parameters and data
+* [Favorite view](favorite-view/docs/index.md) : Exposes a simple resource to work with instance parameters and data.
 * [Calculator View](calculator-view/docs/index.md) : Includes a simple resource.
 * [Phone List View](phone-list-view/docs/index.md) : Demonstrates simple view persistence.
+* [Property View](property-view/docs/index.md) : Demonstrates view configuration property options.
+* [Property Validator View](property-validator-view/docs/index.md) : Demonstrates configuration property validator.
 * [Weather view](weather-view/docs/index.md)
 
 Please also visit the [Apache Ambari Project](http://ambari.apache.org/) page for more information.

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/docs/index.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/docs/index.md b/ambari-views/examples/property-validator-view/docs/index.md
new file mode 100644
index 0000000..ae00c06
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/docs/index.md
@@ -0,0 +1,70 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+Property Validator View Example
+======
+
+Description
+-----
+The Property Validator View is an example of a basic view that validates configuration parameter values.
+It demonstrates the very basics of how to use the Validator.
+
+The view.xml specifies a Validator class to use for property validation. This class is packaged with the view
+and implements the [org.apache.ambari.view.validation.Validator](https://github.com/apache/ambari/blob/trunk/ambari-views/src/main/java/org/apache/ambari/view/validation/Validator.java)
+interface. When a view instance is created, or updated, the validator class is called where
+the view performs any special configuration property validation. The result of that validation is returned as a
+[org.apache.ambari.view.validation.ValidationResult](https://github.com/apache/ambari/blob/trunk/ambari-views/src/main/java/org/apache/ambari/view/validation/ValidationResult.java)
+
+    <validator-class>org.apache.ambari.view.property.MyValidator</validator-class>
+
+Package
+-----
+All views are packaged as a view archive. The view archive contains the configuration
+file and various optional components of the view.
+
+#####view.xml
+
+The view.xml file is the only required file for a view archive.  The view.xml is the configuration that describes the view and view instances for Ambari.
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    cd ambari-views/examples/property-validator-view
+    mvn clean package
+
+The build will produce the view archive.
+
+    ambari-views/examples/property-view/target/property-validator-view-0.1.0.jar
+
+Place the view archive on the Ambari Server and restart to deploy.    
+
+    cp property-validator-view-0.1.0.jar /var/lib/ambari-server/resources/views/
+    ambari-server restart
+    
+Create View Instance
+-----
+
+With the view deployed, from the Ambari Administration interface,
+create an instance of the view (called P_1) to be used by Ambari users.
+
+Access the view service end point:
+
+    /api/v1/views/PROPERTY-VALIDATOR/versions/0.1.0/instances/P_1/resources/properties
+
+Access the view UI:
+
+    /views/PROPERTY-VALIDATOR/0.1.0/P_1

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/pom.xml b/ambari-views/examples/property-validator-view/pom.xml
new file mode 100644
index 0000000..9429a86
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/pom.xml
@@ -0,0 +1,96 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.ambari</groupId>
+    <artifactId>ambari-view-examples</artifactId>
+    <version>1.0.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>property-validator-view</artifactId>
+  <version>0.1.0</version>
+  <packaging>jar</packaging>
+  <name>Ambari Property Validator View</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ambari</groupId>
+      <artifactId>ambari-views</artifactId>
+      <version>${ambari.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+      <version>1.8</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.12</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+        <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rpm-maven-plugin</artifactId>
+        <version>2.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>rpm</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <resources>
+        <resource>
+            <directory>src/main/resources/ui/</directory>
+            <filtering>false</filtering>
+        </resource>
+        <resource>
+            <directory>src/main/resources/</directory>
+            <filtering>false</filtering>
+            <includes>
+                <include>view.xml</include>
+            </includes>
+        </resource>
+        <resource>
+            <targetPath>WEB-INF/lib</targetPath>
+            <filtering>false</filtering>
+            <directory>target/lib</directory>
+        </resource>
+    </resources>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/MyValidator.java
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/MyValidator.java b/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/MyValidator.java
new file mode 100644
index 0000000..6b3a46c
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/MyValidator.java
@@ -0,0 +1,226 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.property;
+
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.ViewInstanceDefinition;
+import org.apache.ambari.view.validation.Validator;
+import org.apache.ambari.view.validation.ValidationResult;
+
+import java.util.Map;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+
+/**
+ * The validator class for the PropertyValidator view.
+ *
+ */
+public class MyValidator implements Validator {
+
+    private static  final   String      PARAMETER_NAME_FREEFORM = "freeform";
+    private static  final   String      PARAMETER_NAME_INTEGER = "integer";
+    private static  final   String      PARAMETER_NAME_FIRST_VALUE = "first.value";
+    private static  final   String      PARAMETER_NAME_SECOND_VALUE = "second.value";
+    private static  final   String      PARAMETER_NAME_URL = "url";
+
+    private static  final   int         SECOND_VALUE_MAX = 100;
+    
+    @Override
+    public ValidationResult validateInstance(ViewInstanceDefinition definition, ValidationContext mode) {
+        // get the instance props
+        Map<String,String> props = definition.getPropertyMap();
+        
+        // do a check to confirm first is less than or equals to second    
+        return  validateParameterFirstSecondValues(props);
+    }
+
+    @Override
+    public ValidationResult validateProperty(String property, ViewInstanceDefinition definition, ValidationContext mode) {
+        if (property.equals(PARAMETER_NAME_FREEFORM)) {
+            // do nothing, this property can be free form
+        } else if (property.equals(PARAMETER_NAME_URL)) {
+            return  validateParameterURL(definition.getPropertyMap());
+        } else if (property.equals(PARAMETER_NAME_INTEGER)) {
+            return  validateParameterInteger(definition.getPropertyMap());
+        } else if (property.equals(PARAMETER_NAME_FIRST_VALUE)) {
+            return  validateParameterFirst(definition.getPropertyMap());
+        } else if (property.equals(PARAMETER_NAME_SECOND_VALUE)) {
+            return  validateParameterSecond(definition.getPropertyMap());
+        }
+        
+        return ValidationResult.SUCCESS;
+    }
+
+    /**
+     * Validates the parameter URL.
+     *
+     * @param   properties      the view instance parameters
+     * @return  the validation result
+     */
+    private ValidationResult    validateParameterURL(Map<String,String> properties) {
+        String urlProp = properties.get(PARAMETER_NAME_URL);
+
+        URL u = null;
+        try {
+            u = new URL(urlProp);
+        } catch (MalformedURLException e) {
+            return  new MyValidationResult(false, "Must be valid URL");
+        }
+
+        try {
+            u.toURI();
+        } catch (URISyntaxException e) {
+            return  new MyValidationResult(false, "Must be valid URL");
+        }
+    
+        return  ValidationResult.SUCCESS;
+    }
+
+    /**
+     * Validates the parameter Integer.
+     *
+     * @param   properties      the view instance parameters
+     * @return  the validation result
+     */
+    private ValidationResult    validateParameterInteger(Map<String,String> properties) {
+        String val = properties.get(PARAMETER_NAME_INTEGER);
+        int intValue = -1;
+        try {
+            checkInteger(val);
+        } catch (NumberFormatException nfe) {
+            return  new MyValidationResult(false, "Must be an integer");
+        }
+        return  ValidationResult.SUCCESS;
+    }
+    
+    /**
+     * Validates the parameter first value.
+     *
+     * @param   properties      the view instance parameters
+     * @return  the validation result
+     */
+    private ValidationResult    validateParameterFirst(Map<String,String> properties) {
+        String val = properties.get(PARAMETER_NAME_FIRST_VALUE);
+        int intValue = -1;
+        try {
+            checkInteger(val);
+        } catch (NumberFormatException nfe) {
+            return  new MyValidationResult(false, "Must be an integer");
+        }
+        return  ValidationResult.SUCCESS;
+    }
+    
+    /**
+     * Validates the parameter second value.
+     *
+     * @param   properties      the view instance parameters
+     * @return  the validation result
+     */
+    private ValidationResult    validateParameterSecond(Map<String,String> properties) {
+        String val = properties.get(PARAMETER_NAME_SECOND_VALUE);
+        int intValue = -1;
+        try {
+            intValue = checkInteger(val);
+        } catch (NumberFormatException nfe) {
+            return  new MyValidationResult(false, "Must be an integer");
+        }
+
+        if (intValue > SECOND_VALUE_MAX)
+            return  new MyValidationResult(false, "Must be less than "+SECOND_VALUE_MAX);
+
+        return  ValidationResult.SUCCESS;
+    }
+    
+    /**
+     * Validates the parameter First and Second values.
+     *
+     * @param   properties      the view instance parameters
+     * @return  the validation result
+     */
+    private ValidationResult    validateParameterFirstSecondValues(Map<String,String> properties) {
+        // check that first is an int
+        String firstValue = properties.get(PARAMETER_NAME_FIRST_VALUE);
+        int firstIntValue = -1;
+        try {
+            firstIntValue = checkInteger(firstValue);
+        } catch (NumberFormatException nfe) {
+            return  new MyValidationResult(false, "Must be an integer");
+        }
+        
+        // check that second is an int
+        String secondValue = properties.get(PARAMETER_NAME_SECOND_VALUE);
+        int secondIntValue = -1;
+        try {
+            secondIntValue = checkInteger(secondValue);
+        } catch (NumberFormatException nfe) {
+            return  new MyValidationResult(false, "Must be an integer");
+        }
+
+        // check that second >= first
+        if (secondIntValue < firstIntValue)
+            return  new MyValidationResult(false, "Second value must be greater or equal to first");
+        
+        return  ValidationResult.SUCCESS;
+    }
+   
+    /**
+     * Check integer.
+     *
+     * @param   value      the value
+     * @return  the resulting integer
+     * @throws  NumberFormatException if the value is not a valid integer
+     */
+    private static  int checkInteger(String value) {
+        return  Integer.parseInt(value);
+    }
+ 
+    /**
+     * Represents a validation result for this validator.
+     *
+     */
+    private static  class    MyValidationResult implements ValidationResult {
+
+        private boolean     valid;
+        private String      details;
+    
+        /**
+         * Constructor.
+         *
+         * @param   valid       if <code>true</code>, result is valid
+         * @param   details     the details of the result
+         *
+         */
+        public  MyValidationResult(boolean valid, String details) {
+            this.valid = valid;
+            this.details = details;
+        }
+        
+        @Override
+        public boolean isValid() {
+            return  this.valid;
+        }
+
+        @Override
+        public String getDetail() {
+            return  this.details;
+        }
+
+    } // end inner MyValidationResult class
+    
+} // end MyValidator class

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/PropertyValidatorService.java
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/PropertyValidatorService.java b/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/PropertyValidatorService.java
new file mode 100644
index 0000000..275720b
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/PropertyValidatorService.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.view.property;
+
+import org.apache.ambari.view.ViewContext;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * The PropertyValidator service.
+ */
+public class PropertyValidatorService {
+
+  /**
+   * The view context.
+   */
+  @Inject
+  ViewContext context;
+  
+  /**
+   * Handles: GET /.
+   *
+   * @param headers   http headers
+   * @param ui        uri info
+   *
+   * @return value JSON representation
+   */
+  @GET
+  @Path("/")
+  @Produces({"text/plain", "application/json"})
+  public Response getValue(@Context HttpHeaders headers, @Context UriInfo ui) {
+
+    Map props = context.getProperties();;
+
+    Iterator it = props.entrySet().iterator();
+    StringBuffer buf = new StringBuffer();
+    boolean first = true;
+    buf.append("[");
+    while(it.hasNext()) {
+        Map.Entry pairs = (Map.Entry)it.next();
+        if (first == false)
+            buf.append(",\n");
+        buf.append("{\"");
+        buf.append(pairs.getKey());
+        buf.append("\" : \"");
+        buf.append(pairs.getValue());
+        buf.append("\"}");
+        first = false;
+    }
+    buf.append("]");
+
+    return Response.ok(buf.toString()).build();
+  }
+
+} // end PropertyService

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/src/main/resources/ui/index.html
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/src/main/resources/ui/index.html b/ambari-views/examples/property-validator-view/src/main/resources/ui/index.html
new file mode 100644
index 0000000..d5c3a8e
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/src/main/resources/ui/index.html
@@ -0,0 +1,63 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<html>
+<head>
+    <style>
+        body{
+            text-align: center;
+            font-family: arial;
+        }
+        .button{
+            margin:20px;
+            font-size:16px;
+            font-weight: bold;
+            padding:5px 10px;
+        }
+    </style>
+</head>
+<body>
+    <h1>Property Service</h1>
+    <br />
+    <input type="button" value="Get Value" class="button" />
+    <br />
+    <span id="results"></span>
+
+    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
+
+    <script>
+      function _getPropertyResourceUri() {
+        var parts = window.location.pathname.match(/\/[^\/]*/g);
+        var view = parts[1];
+        var version = '/versions' + parts[2];
+        var instance = parts[3];
+        return '/api/v1/views' + view + version + '/instances' + instance+'/resources/properties';
+      }
+        $(document).ready(function() {
+            $('.button').click(function(){
+                $.ajax({
+                    url: _getPropertyResourceUri(),
+                    dataType: "text",
+                    success: function(data) {
+                        $('#results').html(data);
+                    }
+                });
+            });
+        });
+    </script>
+
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d81bc9b3/ambari-views/examples/property-validator-view/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/property-validator-view/src/main/resources/view.xml b/ambari-views/examples/property-validator-view/src/main/resources/view.xml
new file mode 100644
index 0000000..2ce765e
--- /dev/null
+++ b/ambari-views/examples/property-validator-view/src/main/resources/view.xml
@@ -0,0 +1,61 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<view>
+  <name>PROPERTY-VALIDATOR</name>
+  <label>PropertyValidator</label>
+  <version>0.1.0</version>
+  <validator-class>org.apache.ambari.view.property.MyValidator</validator-class>
+  <parameter>
+    <name>integer</name>
+    <description>Enter an integer value</description>
+    <label>Integer</label>
+    <required>true</required>
+  </parameter>
+  <parameter>
+    <name>url</name>
+    <description>URL</description>
+    <label>URL</label>
+    <placeholder>http://enter.some.url</placeholder>
+    <required>true</required>
+  </parameter>
+  <parameter>
+    <name>freeform</name>
+    <description>Enter a free-form string</description>
+    <label>FreeForm String</label>
+    <default-value>this is some free form string</default-value>
+    <required>true</required>
+  </parameter>
+  <parameter>
+    <name>first.value</name>
+    <description>This is the first value, must be less that second value</description>
+    <label>First Value</label>
+    <placeholder>0</placeholder>
+    <required>true</required>
+  </parameter>
+  <parameter>
+    <name>second.value</name>
+    <description>This is the second value, must be greater that second value</description>
+    <label>Second Value</label>
+    <placeholder>10</placeholder>
+    <required>true</required>
+  </parameter>
+  
+  <resource>
+    <name>properties</name>
+    <service-class>org.apache.ambari.view.property.PropertyValidatorService</service-class>
+  </resource>
+</view>
\ No newline at end of file