You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by tb...@apache.org on 2014/02/19 16:11:59 UTC

[2/2] git commit: AMBARI-4690 - Add Ambari View examples.

AMBARI-4690 - Add Ambari View examples.


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

Branch: refs/heads/trunk
Commit: 81c32ed50ab018a56e3f2c04b06913b3f2928099
Parents: 3892671
Author: tbeerbower <tb...@hortonworks.com>
Authored: Sat Feb 15 23:21:16 2014 -0500
Committer: tbeerbower <tb...@hortonworks.com>
Committed: Wed Feb 19 10:11:24 2014 -0500

----------------------------------------------------------------------
 ambari-views/examples/README.md                 |  65 +++
 .../examples/calculator-view/docs/add.png       | Bin 0 -> 23104 bytes
 .../examples/calculator-view/docs/index.md      | 174 ++++++
 .../examples/calculator-view/docs/usage.png     | Bin 0 -> 36210 bytes
 ambari-views/examples/calculator-view/pom.xml   |  89 +++
 .../ambari/view/proxy/CalculatorResource.java   | 129 +++++
 .../calculator-view/src/main/resources/view.xml |  28 +
 .../hello-servlet-view/docs/hello_1.png         | Bin 0 -> 17248 bytes
 .../hello-servlet-view/docs/hello_2.png         | Bin 0 -> 14443 bytes
 .../examples/hello-servlet-view/docs/index.md   | 232 ++++++++
 .../examples/hello-servlet-view/pom.xml         |  90 +++
 .../apache/ambari/view/hello/HelloServlet.java  |  70 +++
 .../src/main/resources/WEB-INF/web.xml          |  37 ++
 .../src/main/resources/view.xml                 |  43 ++
 .../helloworld-view/docs/hello_world.png        | Bin 0 -> 17467 bytes
 .../examples/helloworld-view/docs/index.md      | 145 +++++
 ambari-views/examples/helloworld-view/pom.xml   |  84 +++
 .../src/main/resources/index.html               |  24 +
 .../helloworld-view/src/main/resources/view.xml |  24 +
 ambari-views/examples/pom.xml                   |  71 +++
 .../examples/weather-view/docs/index.md         | 566 +++++++++++++++++++
 .../examples/weather-view/docs/portland.png     | Bin 0 -> 34597 bytes
 .../examples/weather-view/docs/weather.png      | Bin 0 -> 25611 bytes
 ambari-views/examples/weather-view/pom.xml      | 115 ++++
 .../ambari/view/weather/CityResource.java       |  99 ++++
 .../view/weather/CityResourceProvider.java      | 183 ++++++
 .../apache/ambari/view/weather/CityService.java |  74 +++
 .../ambari/view/weather/WeatherServlet.java     | 131 +++++
 .../src/main/resources/WEB-INF/web.xml          |  37 ++
 .../weather-view/src/main/resources/view.xml    |  94 +++
 30 files changed, 2604 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/README.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/README.md b/ambari-views/examples/README.md
new file mode 100644
index 0000000..8773c4d
--- /dev/null
+++ b/ambari-views/examples/README.md
@@ -0,0 +1,65 @@
+<!---
+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.
+-->
+
+Ambari Views Examples
+============
+
+The *Ambari Views Examples* are a collection of simple Ambari Views provided as a development guide.
+
+## Documentation
+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. 
+* [Calculator View](calculator-view/docs/index.md) : Includes a simple resource.
+* [Weather view](weather-view/docs/index.md)
+
+Please also visit the [Apache Ambari Project](http://ambari.apache.org/) page for more information.
+
+
+## License
+
+*Ambari* is released under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
+
+## Issue Tracking
+
+Report any issues via the [Ambari JIRA](https://issues.apache.org/jira/browse/AMBARI).
+
+## Build
+
+####Examples
+
+######Requirements
+* JDK 1.6
+* Maven 3.0
+
+######Maven modules
+* ambari-views (ambari view interfaces)
+
+######Maven build goals
+ * Clean : mvn clean
+ * Compile : mvn compile
+ * Run tests : mvn test
+ * Create JARS : mvn package
+ * Install JARS in M2 cache : mvn install
+
+######Tests options
+  * -DskipTests to skip tests when running the following Maven goals:
+    'package', 'install', 'deploy' or 'verify'
+  * -Dtest=\<TESTCLASSNAME>,\<TESTCLASSNAME#METHODNAME>,....
+  * -Dtest.exclude=\<TESTCLASSNAME>
+  * -Dtest.exclude.pattern=\*\*/\<TESTCLASSNAME1>.java,\*\*/\<TESTCLASSNAME2>.java
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/docs/add.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/docs/add.png b/ambari-views/examples/calculator-view/docs/add.png
new file mode 100644
index 0000000..28555d2
Binary files /dev/null and b/ambari-views/examples/calculator-view/docs/add.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/docs/index.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/docs/index.md b/ambari-views/examples/calculator-view/docs/index.md
new file mode 100644
index 0000000..7898923
--- /dev/null
+++ b/ambari-views/examples/calculator-view/docs/index.md
@@ -0,0 +1,174 @@
+<!---
+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.
+-->
+
+Calculator View Example
+========
+Description
+-----
+The Calculator view is another simple view example.  Like the HelloWorld view example, it demonstrates the basics of how to write and deploy a view in Ambari but also includes a simple resource.  The Calculator resource uses JAX-RS annotations to define the actions that can be performed on the resource.
+
+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.
+
+      <view>
+        <name>CALCULATOR</name>
+        <label>The Calculator View</label>
+        <version>1.0.0</version>
+        <resource>
+          <name>calculator</name>
+          <service-class>org.apache.ambari.view.proxy.CalculatorResource</service-class>
+        </resource>
+        <instance>
+          <name>INSTANCE_1</name>
+        </instance>
+      </view>
+
+The configuration in this case defines a view named CALCULATOR that has a single instance.  The view also defines a resource named 'calculator'.
+
+
+
+#####CalculatorResource.java
+
+The CalculatorResource class defines the calculator resource for the view.  It uses JAX-RS annotations to define the actions that can be performed on the resource.
+
+      @GET
+      @Path("/add/{a}/{b}")
+      @Produces({"text/html"})
+      public Response add(@PathParam("a") double a, @PathParam("b") double b) {
+        String result = a + " + " + b + " = " + (a + b);
+        return Response.ok("<b>" + result + "</b>").type("text/html").build();
+      }
+
+The add method will service requests to **'calculator/add/{a}/{b}'** for INSTANCE_1 of the CALCULATOR view.  
+
+For example ...
+
+     http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1/resources/calculator/add/77.5/87.62
+
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    cd ambari-views/examples/calculator-view
+    mvn clean package
+
+The build will produce the view archive.
+
+    ambari-views/examples/calculator-view/target/calculator-view-1.0.0.jar
+
+
+Deploy
+-----
+To deploy a view we simply place the view archive in the views folder of the ambari-server machine.  By default the views folder is located at ...
+
+    /var/lib/ambari-server/resources/views
+
+To deploy the Calculator view simply copy the calculator-view jar to the ambari-server views folder and restart the ambari server.
+
+Use
+-----
+
+After deploying a view you should see it as a view resource in the Ambari REST API.  If we request all views, we should see the CALCULATOR view.
+
+      {
+        "href" : "http://<server>:8080/api/v1/views",
+        "items" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/CALCULATOR",
+            "ViewInfo" : {
+              "view_name" : "CALCULATOR"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET",
+            "ViewInfo" : {
+              "view_name" : "HELLO_SERVLET"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD",
+            "ViewInfo" : {
+              "view_name" : "HELLO_WORLD"
+            }
+          }
+        ]
+      }
+
+
+If we want to see the details about a specific view, we can ask for it by name.  This shows us that the CALCULATOR view has a single instance named INSTANCE_1.
+
+      http://<server>:8080/api/v1/views/CALCULATOR/
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/CALCULATOR/",
+        "ViewInfo" : {
+          "archive" : "/var/lib/ambari-server/resources/views/calculator-view-1.0.0.jar",
+          "label" : "The Calculator View",
+          "parameters" : [ ],
+          "version" : "1.0.0",
+          "view_name" : "CALCULATOR"
+        },
+        "instances" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1",
+            "ViewInstanceInfo" : {
+              "instance_name" : "INSTANCE_1",
+              "view_name" : "CALCULATOR"
+            }
+          }
+        ]
+      }
+
+To see a specific instance of a view, we can ask for it by name.  Here we can see the attributes of the view instance.  We can also see that this view has a resource name 'calculator'.
+
+    http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1
+
+    {
+      "href" : "http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1",
+      "ViewInstanceInfo" : {
+        "context_path" : "/views/CALCULATOR/INSTANCE_1",
+        "instance_name" : "INSTANCE_1",
+        "view_name" : "CALCULATOR",
+        "properties" : { }
+      },
+      "resources" : [
+        {
+          "href" : "http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1/resources/calculator",
+          "instance_name" : "INSTANCE_1",
+          "name" : "calculator",
+          "view_name" : "CALCULATOR"
+        }
+      ]
+    }
+
+We can access the view's resource through the resource's href.
+
+    http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1/resources/calculator
+
+![image](usage.png)
+
+We can access the add method of the resource with the following …
+
+     http://<server>:8080/api/v1/views/CALCULATOR/instances/INSTANCE_1/resources/calculator/add/77.5/87.62
+
+![image](add.png)

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/docs/usage.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/docs/usage.png b/ambari-views/examples/calculator-view/docs/usage.png
new file mode 100644
index 0000000..207d31f
Binary files /dev/null and b/ambari-views/examples/calculator-view/docs/usage.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/pom.xml b/ambari-views/examples/calculator-view/pom.xml
new file mode 100644
index 0000000..ce89ebc
--- /dev/null
+++ b/ambari-views/examples/calculator-view/pom.xml
@@ -0,0 +1,89 @@
+<!--
+   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>calculator-view</artifactId>
+  <packaging>jar</packaging>
+  <name>Ambari Calculator View</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    <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>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/src/main/java/org/apache/ambari/view/proxy/CalculatorResource.java
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/src/main/java/org/apache/ambari/view/proxy/CalculatorResource.java b/ambari-views/examples/calculator-view/src/main/java/org/apache/ambari/view/proxy/CalculatorResource.java
new file mode 100644
index 0000000..9899072
--- /dev/null
+++ b/ambari-views/examples/calculator-view/src/main/java/org/apache/ambari/view/proxy/CalculatorResource.java
@@ -0,0 +1,129 @@
+/**
+ * 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.proxy;
+
+import org.apache.ambari.view.ViewContext;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+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;
+
+/**
+ * The calculator resource.
+ */
+public class CalculatorResource {
+  /**
+   * The view context.
+   */
+  @Inject
+  ViewContext context;
+
+  /**
+   * Handles: GET /calculator Get the calculator usage.
+   *
+   * @param headers   http headers
+   * @param ui        uri info
+   *
+   * @return the response including the usage of the calculator resource
+   */
+  @GET
+  @Produces({"text/html"})
+  public Response getUsage(@Context HttpHeaders headers, @Context UriInfo ui) throws IOException{
+
+    String entity = "<h2>Usage of calculator</h2><br>" +
+        "<ul>" +
+        "<li><b>calculator/add/{a}/{b}</b> - add {a} to {b}</li>" +
+        "<li><b>calculator/subtract/{a}/{b}</b> - subtract {a} from {b}</li>" +
+        "<li><b>calculator/multiply/{a}/{b}</b> - multiply {a} with {b}</li>" +
+        "<li><b>calculator/divide/{a}/{b}</b> - divide {a} by {b}</li>" +
+        "</ul>"
+        ;
+    return Response.ok(entity).type("text/html").build();
+  }
+
+  /**
+   * Handles: GET /calculator/add/{a}/{b} Get the results of a + b.
+   *
+   * @param a  the left side operand
+   * @param b  the right side operand
+   *
+   * @return the response including the result of a + b
+   */
+  @GET
+  @Path("/add/{a}/{b}")
+  @Produces({"text/html"})
+  public Response add(@PathParam("a") double a, @PathParam("b") double b) {
+    String result = a + " + " + b + " = " + (a + b);
+    return Response.ok("<b>" + result + "</b>").type("text/html").build();
+  }
+
+  /**
+   * Handles: GET /calculator/subtract/{a}/{b} Get the results of a - b.
+   *
+   * @param a  the left side operand
+   * @param b  the right side operand
+   *
+   * @return the response including the result of a - b
+   */
+  @GET
+  @Path("/subtract/{a}/{b}")
+  @Produces({"text/html"})
+  public Response subtract(@PathParam("a") double a, @PathParam("b") double b) {
+    String result =  a + " - " + b + " = " + (a - b);
+    return Response.ok("<b>" + result + "</b>").type("text/html").build();
+  }
+
+  /**
+   * Handles: GET /calculator/multiply/{a}/{b} Get the results of a * b.
+   *
+   * @param a  the left side operand
+   * @param b  the right side operand
+   *
+   * @return the response including the result of a * b
+   */
+  @GET
+  @Path("/multiply/{a}/{b}")
+  @Produces({"text/html"})
+  public Response multiply(@PathParam("a") double a, @PathParam("b") double b) {
+    String result =  a + " * " + b + " = " + (a * b);
+    return Response.ok("<b>" + result + "</b>").type("text/html").build();
+  }
+
+  /**
+   * Handles: GET /calculator/divide/{a}/{b} Get the results of a / b.
+   *
+   * @param a  the left side operand
+   * @param b  the right side operand
+   *
+   * @return the response including the result of a / b
+   */
+  @GET
+  @Path("/divide/{a}/{b}")
+  @Produces({"text/html"})
+  public Response divide(@PathParam("a") double a, @PathParam("b") double b) {
+    String result =  a + " / " + b + " = " + (a / b);
+    return Response.ok("<b>" + result + "</b>").type("text/html").build();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/calculator-view/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/calculator-view/src/main/resources/view.xml b/ambari-views/examples/calculator-view/src/main/resources/view.xml
new file mode 100644
index 0000000..ba26831
--- /dev/null
+++ b/ambari-views/examples/calculator-view/src/main/resources/view.xml
@@ -0,0 +1,28 @@
+<!--
+   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>CALCULATOR</name>
+  <label>The Calculator View</label>
+  <version>1.0.0</version>
+  <resource>
+    <name>calculator</name>
+    <service-class>org.apache.ambari.view.proxy.CalculatorResource</service-class>
+  </resource>
+  <instance>
+    <name>INSTANCE_1</name>
+  </instance>
+</view>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/docs/hello_1.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/docs/hello_1.png b/ambari-views/examples/hello-servlet-view/docs/hello_1.png
new file mode 100644
index 0000000..845bc68
Binary files /dev/null and b/ambari-views/examples/hello-servlet-view/docs/hello_1.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/docs/hello_2.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/docs/hello_2.png b/ambari-views/examples/hello-servlet-view/docs/hello_2.png
new file mode 100644
index 0000000..bea65ab
Binary files /dev/null and b/ambari-views/examples/hello-servlet-view/docs/hello_2.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/docs/index.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/docs/index.md b/ambari-views/examples/hello-servlet-view/docs/index.md
new file mode 100644
index 0000000..7e91f12
--- /dev/null
+++ b/ambari-views/examples/hello-servlet-view/docs/index.md
@@ -0,0 +1,232 @@
+<!---
+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.
+-->
+
+Hello Servlet View Example
+========
+Description
+-----
+The Hello Servlet view is a very simple view example.  Like the HelloWorld view example, it demonstrates the basics of how to write and deploy a view in Ambari but also include instance parameters and a servlet for a dynamic UI.  The Hello Servlet view displays a Hello world! message that is customized based on the properties of the view instance and the view context.
+
+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.
+
+      <view>
+        <name>HELLO_SERVLET</name>
+        <label>The Hello Servlet View!</label>
+        <version>1.0.0</version>
+        <parameter>
+          <name>name</name>
+          <description>The name for the greeting. Defaults to current user.</description>
+          <required>false</required>
+        </parameter>
+        <instance>
+          <name>USER</name>
+        </instance>
+        <instance>
+          <name>TOM</name>
+          <property>
+            <key>name</key>
+            <value>Tom</value>
+          </property>
+        </instance>
+        <instance>
+          <name>JERRY</name>
+          <property>
+            <key>name</key>
+            <value>Jerry</value>
+          </property>
+        </instance>
+      </view>
+
+The configuration in this case defines a view named HELLO_SERVLET that has a multiple instances.  You can see that the view includes an optional parameter called name.  Each view instance may assign a property value to the name parameter.  In this case the view instances TOM and JERRY both assign a name value, while the instance USER does not.
+
+
+#####WEB-INF/web.xml
+The web.xml is the deployment descriptor used to deploy the view as a web app.  The Java EE standards apply for the descriptor.  We can see that for this example a single servlet is mapped to the root context path.
+
+      <servlet>
+        <servlet-name>HelloServlet</servlet-name>
+        <servlet-class>org.apache.ambari.view.hello.HelloServlet</servlet-class>
+      </servlet>
+      <servlet-mapping>
+        <servlet-name>HelloServlet</servlet-name>
+        <url-pattern>/</url-pattern>
+      </servlet-mapping>
+
+#####HelloServlet.java
+
+The servlet HelloServlet will be deployed as part of the view and mapped as described in the web.xml.
+
+Notice that we can access the view context in the servlet by obtaining it as a servlet context attribute in the init() method.
+
+      private ViewContext viewContext;
+
+      @Override
+      public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+
+        ServletContext context = config.getServletContext();
+        viewContext = (ViewContext) context.getAttribute(ViewContext.CONTEXT_ATTRIBUTE);
+      }
+
+
+If we take a look at the doGet() method of the servlet we see that the Hello message is customized to the name value specified as an instance property.  This means that each view instance may show a different greeting.  The default if no name property value is specified is the current user name.  The instance property values can be obtained from the view context.
+
+      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        response.setContentType("text/html");
+        response.setStatus(HttpServletResponse.SC_OK);
+
+        PrintWriter writer = response.getWriter();
+
+        Map<String, String> properties = viewContext.getProperties();
+
+        String name = properties.get("name");
+        if (name == null) {
+          name = viewContext.getUsername();
+          if (name == null || name.length() == 0) {
+            name = "world";
+          }
+        }
+        writer.println("<h1>Hello " + name + "!</h1>");
+      }
+
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    cd ambari-views/examples/hello-servlet-view
+    mvn clean package
+
+The build will produce the view archive.
+
+    ambari-views/examples/hello-servlet-view/target/hello-servlet-view-1.0.0.jar
+
+
+Deploy
+-----
+To deploy a view we simply place the view archive in the views folder of the ambari-server machine.  By default the views folder is located at ...
+
+    /var/lib/ambari-server/resources/views
+
+To deploy the Hello Servlet view simply copy the hello-servlet-view jar to the ambari-server views folder and restart the ambari server.
+
+Use
+-----
+
+After deploying a view you should see it as a view resource in the Ambari REST API.  If we request all views, we should see the HELLO_SERVLET view.
+
+      http://<server>:8080/api/v1/views
+
+      {
+        "href" : "http://<server>:8080/api/v1/views",
+        "items" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET",
+            "ViewInfo" : {
+              "view_name" : "HELLO_SERVLET"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD",
+            "ViewInfo" : {
+              "view_name" : "HELLO_WORLD"
+            }
+          }
+        ]
+      }
+
+
+If we want to see the details about a specific view, we can ask for it by name.  This shows us that the HELLO_SERVLET view defines a single 'name' parameter and has a three instances.
+
+      http://<server>:8080/api/v1/views/HELLO_SERVLET/
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET/",
+        "ViewInfo" : {
+          "archive" : "/var/lib/ambari-server/resources/views/hello-servlet-view-1.0.0.jar",
+          "label" : "The Hello Servlet View!",
+          "parameters" : [
+            {
+              "name" : "name",
+              "description" : "The name for the greeting. Defaults to current user.",
+              "required" : false
+            }
+          ],
+          "version" : "1.0.0",
+          "view_name" : "HELLO_SERVLET"
+        },
+        "instances" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET/instances/JERRY",
+            "ViewInstanceInfo" : {
+              "instance_name" : "JERRY",
+              "view_name" : "HELLO_SERVLET"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET/instances/TOM",
+            "ViewInstanceInfo" : {
+              "instance_name" : "TOM",
+              "view_name" : "HELLO_SERVLET"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET/instances/USER",
+            "ViewInstanceInfo" : {
+              "instance_name" : "USER",
+              "view_name" : "HELLO_SERVLET"
+            }
+          }
+        ]
+      }
+
+To see a specific instance of a view, we can ask for it by name.  Here we can see the attributes of the view including its name and root context path.  We can also see that this view instance defines a value for the name property.
+
+    http://<server>:8080/api/v1/views/HELLO_SERVLET/instances/TOM
+
+    {
+      "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET/instances/TOM",
+      "ViewInstanceInfo" : {
+        "context_path" : "/views/HELLO_SERVLET/TOM",
+        "instance_name" : "TOM",
+        "view_name" : "HELLO_SERVLET",
+        "properties" : {
+          "name" : "Tom"
+        }
+      },
+      "resources" : [ ]
+    }
+
+If the view contains any web content, we can access it at the view's root context path.  In this case its the HelloServlet which displays a greeting customized to the view instance.
+      
+    http://<server>:8080/views/HELLO_SERVLET/JERRY/
+
+![image](hello_1.png)
+
+
+    http://<server>:8080/views/HELLO_SERVLET/TOM/
+
+
+![image](hello_2.png)
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/pom.xml b/ambari-views/examples/hello-servlet-view/pom.xml
new file mode 100644
index 0000000..f2c2438
--- /dev/null
+++ b/ambari-views/examples/hello-servlet-view/pom.xml
@@ -0,0 +1,90 @@
+<!--
+   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>hello-servlet-view</artifactId>
+  <packaging>jar</packaging>
+  <name>Ambari Hello Servlet View</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    <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.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+      <scope>provided</scope>
+    </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>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/src/main/java/org/apache/ambari/view/hello/HelloServlet.java
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/src/main/java/org/apache/ambari/view/hello/HelloServlet.java b/ambari-views/examples/hello-servlet-view/src/main/java/org/apache/ambari/view/hello/HelloServlet.java
new file mode 100644
index 0000000..d417c0f
--- /dev/null
+++ b/ambari-views/examples/hello-servlet-view/src/main/java/org/apache/ambari/view/hello/HelloServlet.java
@@ -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
+ *
+ * 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.hello;
+
+import org.apache.ambari.view.ViewContext;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+/**
+ * Simple servlet for hello view.
+ */
+public class HelloServlet extends HttpServlet {
+
+  /**
+   * The view context.
+   */
+  private ViewContext viewContext;
+
+  @Override
+  public void init(ServletConfig config) throws ServletException {
+    super.init(config);
+
+    ServletContext context = config.getServletContext();
+    viewContext = (ViewContext) context.getAttribute(ViewContext.CONTEXT_ATTRIBUTE);
+  }
+
+  @Override
+  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+    response.setContentType("text/html");
+    response.setStatus(HttpServletResponse.SC_OK);
+
+    PrintWriter writer = response.getWriter();
+
+    Map<String, String> properties = viewContext.getProperties();
+
+    String name = properties.get("name");
+    if (name == null) {
+      name = viewContext.getUsername();
+      if (name == null || name.length() == 0) {
+        name = "world";
+      }
+    }
+    writer.println("<h1>Hello " + name + "!</h1>");
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/src/main/resources/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/src/main/resources/WEB-INF/web.xml b/ambari-views/examples/hello-servlet-view/src/main/resources/WEB-INF/web.xml
new file mode 100644
index 0000000..df66c08
--- /dev/null
+++ b/ambari-views/examples/hello-servlet-view/src/main/resources/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+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. Kerberos, LDAP, Custom. Binary/Htt
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+         version="2.4">
+
+  <display-name>Hello Servlet Application</display-name>
+  <description>
+    This is the hello servlet view application.
+  </description>
+  <servlet>
+    <servlet-name>HelloServlet</servlet-name>
+    <servlet-class>org.apache.ambari.view.hello.HelloServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>HelloServlet</servlet-name>
+    <url-pattern>/</url-pattern>
+  </servlet-mapping>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/hello-servlet-view/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/hello-servlet-view/src/main/resources/view.xml b/ambari-views/examples/hello-servlet-view/src/main/resources/view.xml
new file mode 100644
index 0000000..287791c
--- /dev/null
+++ b/ambari-views/examples/hello-servlet-view/src/main/resources/view.xml
@@ -0,0 +1,43 @@
+<!--
+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. Kerberos, LDAP, Custom. Binary/Htt
+-->
+<view>
+  <name>HELLO_SERVLET</name>
+  <label>The Hello Servlet View!</label>
+  <version>1.0.0</version>
+  <parameter>
+    <name>name</name>
+    <description>The name for the greeting. Defaults to current user.</description>
+    <required>false</required>
+  </parameter>
+  <instance>
+    <name>USER</name>
+  </instance>
+  <instance>
+    <name>TOM</name>
+    <property>
+      <key>name</key>
+      <value>Tom</value>
+    </property>
+  </instance>
+  <instance>
+    <name>JERRY</name>
+    <property>
+      <key>name</key>
+      <value>Jerry</value>
+    </property>
+  </instance>
+</view>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/helloworld-view/docs/hello_world.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/helloworld-view/docs/hello_world.png b/ambari-views/examples/helloworld-view/docs/hello_world.png
new file mode 100644
index 0000000..bc8b67c
Binary files /dev/null and b/ambari-views/examples/helloworld-view/docs/hello_world.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/helloworld-view/docs/index.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/helloworld-view/docs/index.md b/ambari-views/examples/helloworld-view/docs/index.md
new file mode 100644
index 0000000..66e1e6a
--- /dev/null
+++ b/ambari-views/examples/helloworld-view/docs/index.md
@@ -0,0 +1,145 @@
+<!---
+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.
+-->
+
+HelloWorld View Example
+========
+Description
+-----
+The HelloWorld view is a very simple view example.  It demonstrates the very basics of how to write and deploy a view in Ambari.  The HelloWorld view simply makes some static web content (a Hello world! message) available to view.
+
+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.
+
+      <view>
+        <name>HELLO_WORLD</name>
+        <label>The Hello World View!</label>
+        <version>1.0.0</version>
+        <instance>
+          <name>INSTANCE_1</name>
+        </instance>
+      </view>
+
+The configuration in this case defines a view named HELLO_WORLD that has a single instance named INSTANCE_1.
+
+
+#####index.html
+
+The index.html is the static web content being exposed by this view.
+
+      <html>
+        <head>
+          <title>Hello world!</title>
+        </head>
+        <body>
+          <h1>Hello world!</h1>
+        </body>
+      </html>
+
+
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    cd ambari-views/examples/helloworld-view
+    mvn clean package
+
+The build will produce the view archive.
+    
+    ambari-views/examples/helloworld-view/target/helloworld-view-1.0.0.jar
+
+
+Deploy
+-----
+To deploy a view we simply place the view archive in the views folder of the ambari-server machine.  By default the views folder is located at ...
+
+    /var/lib/ambari-server/resources/views
+
+To deploy the HelloWorld view simply copy the helloworld-view jar to the ambari-server views folder and restart the ambari server.
+
+Use
+-----
+
+After deploying a view you should see it as a view resource in the Ambari REST API.  If we request all views, we should see the HELLO_WORLD view.  In this example it is shown as the only deployed view.
+
+      http://<server>:8080/api/v1/views
+
+      {
+        "href" : "http://<server>:8080/api/v1/views",
+        "items" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD",
+            "ViewInfo" : {
+              "view_name" : "HELLO_WORLD"
+            }
+          }
+        ]
+      }
+
+
+If we want to see the details about a specific view, we can ask for it by name.  This shows us that the HELLO_WORLD view does not define any parameters and has a single instance named INSTANCE_1.
+
+      http://<server>:8080/api/v1/views/HELLO_WORLD/
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD/",
+        "ViewInfo" : {
+          "archive" : "/var/lib/ambari-server/resources/views/helloworld-view-1.0.0.jar",
+          "label" : "The Hello World View!",
+          "parameters" : [ ],
+          "version" : "1.0.0",
+          "view_name" : "HELLO_WORLD"
+        },
+        "instances" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD/instances/INSTANCE_1",
+            "ViewInstanceInfo" : {
+              "instance_name" : "INSTANCE_1",
+              "view_name" : "HELLO_WORLD"
+            }
+          }
+        ]
+      }
+
+To see a specific instance of a view, we can ask for it by name.  Here we can see the attributes of the view including its name and root context path.  We can also see that this view instance does not define any properties or resources.
+
+    http://<server>:8080/api/v1/views/HELLO_WORLD/instances/INSTANCE_1
+
+    {
+      "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD/instances/INSTANCE_1",
+      "ViewInstanceInfo" : {
+        "context_path" : "/views/HELLO_WORLD/INSTANCE_1",
+        "instance_name" : "INSTANCE_1",
+        "view_name" : "HELLO_WORLD",
+        "properties" : { }
+      },
+      "resources" : [ ]
+    }
+
+If the view contains any web content, we can access it at the view's root context path.  In this case its the index.html which displays Hello world!
+
+    http://<server>:8080/views/HELLO_WORLD/INSTANCE_1/
+
+
+![image](hello_world.png)
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/helloworld-view/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/helloworld-view/pom.xml b/ambari-views/examples/helloworld-view/pom.xml
new file mode 100644
index 0000000..d53e9d7
--- /dev/null
+++ b/ambari-views/examples/helloworld-view/pom.xml
@@ -0,0 +1,84 @@
+<!--
+   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>helloworld-view</artifactId>
+  <packaging>jar</packaging>
+  <name>Ambari Hello World View</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    <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>
+  </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>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/helloworld-view/src/main/resources/index.html
----------------------------------------------------------------------
diff --git a/ambari-views/examples/helloworld-view/src/main/resources/index.html b/ambari-views/examples/helloworld-view/src/main/resources/index.html
new file mode 100644
index 0000000..aa8d274
--- /dev/null
+++ b/ambari-views/examples/helloworld-view/src/main/resources/index.html
@@ -0,0 +1,24 @@
+<!--
+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. Kerberos, LDAP, Custom. Binary/Htt
+-->
+<html>
+  <head>
+    <title>Hello world!</title>
+  </head>
+  <body>
+    <h1>Hello world!</h1>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/helloworld-view/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/helloworld-view/src/main/resources/view.xml b/ambari-views/examples/helloworld-view/src/main/resources/view.xml
new file mode 100644
index 0000000..a8f4cc6
--- /dev/null
+++ b/ambari-views/examples/helloworld-view/src/main/resources/view.xml
@@ -0,0 +1,24 @@
+<!--
+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. Kerberos, LDAP, Custom. Binary/Htt
+-->
+<view>
+  <name>HELLO_WORLD</name>
+  <label>The Hello World View!</label>
+  <version>1.0.0</version>
+  <instance>
+    <name>INSTANCE_1</name>
+  </instance>
+</view>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/pom.xml b/ambari-views/examples/pom.xml
new file mode 100644
index 0000000..94a9579
--- /dev/null
+++ b/ambari-views/examples/pom.xml
@@ -0,0 +1,71 @@
+<!--
+   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">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ambari</groupId>
+  <artifactId>ambari-view-examples</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0.0</version>
+  <name>Ambari View Examples</name>
+  <modules>
+    <module>helloworld-view</module>
+    <module>hello-servlet-view</module>
+    <module>calculator-view</module>
+    <module>weather-view</module>
+  </modules>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <version>0.8</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <!--GIT files-->
+            <exclude>.git/</exclude>
+            <exclude>**/.gitignore</exclude>
+            <exclude>**/.gitattributes</exclude>
+            <!--gitignore content-->
+            <exclude>.idea/</exclude>
+            <exclude>pass.txt</exclude>
+            <exclude>.DS_Store</exclude>
+            <exclude>.iml/</exclude>
+            <exclude>.classpath</exclude>
+            <exclude>.project</exclude>
+            <exclude>.settings</exclude>
+            <!--license files-->
+            <exclude>MSPL-LICENSE</exclude>
+            <!--VS generated files-->
+            <exclude>**/*.resources</exclude>
+            <exclude>**/*.rtf</exclude>
+            <exclude>**/*.snk</exclude>
+            <exclude>**/*.cs</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/weather-view/docs/index.md
----------------------------------------------------------------------
diff --git a/ambari-views/examples/weather-view/docs/index.md b/ambari-views/examples/weather-view/docs/index.md
new file mode 100644
index 0000000..da3d9b5
--- /dev/null
+++ b/ambari-views/examples/weather-view/docs/index.md
@@ -0,0 +1,566 @@
+<!---
+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.
+-->
+
+Weather View Example
+========
+Description
+-----
+The Weather view demonstrates the the use of instance parameters, a servlet for a dynamic UI and a managed resource.  The Weather view displays the weather for various cites around the world.  Unlike the calculator resource in the example [Calculator View](calculator-view/docs/index.md), the Weather view's city resources are managed by Ambari.  This means that they are accessed through a user defined resource provider and plugged into Ambari's REST API as subresources of the view instance.
+
+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.
+
+      <view>
+        <name>WEATHER</name>
+        <label>Weather</label>
+        <version>1.0.0</version>
+        <parameter>
+          <name>cities</name>
+          <description>The list of cities.</description>
+          <required>true</required>
+        </parameter>
+        <parameter>
+          <name>units</name>
+          <description>The units (metric or imperial).</description>
+          <required>false</required>
+        </parameter>
+        <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>
+        <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>
+        <instance>
+          <name>US_EAST</name>
+          <property>
+            <key>cities</key>
+            <value>New York, US;Boston, US;Philadelphia, US;Atlanta, US</value>
+          </property>
+          <property>
+            <key>units</key>
+            <value>imperial</value>
+          </property>
+        </instance>
+        <instance>
+          <name>US_CENTRAL</name>
+          <property>
+            <key>cities</key>
+            <value>Chicago, US;Dallas, US</value>
+          </property>
+          <property>
+            <key>units</key>
+            <value>imperial</value>
+          </property>
+        </instance>
+        <instance>
+          <name>US_MOUNTAIN</name>
+          <property>
+            <key>cities</key>
+            <value>Denver, US;Phoenix, US</value>
+          </property>
+          <property>
+            <key>units</key>
+            <value>imperial</value>
+          </property>
+        </instance>
+        <instance>
+          <name>EUROPE</name>
+          <property>
+            <key>cities</key>
+            <value>London, UK;Paris;Munich</value>
+          </property>
+          <property>
+            <key>units</key>
+            <value>imperial</value>
+          </property>
+        </instance>
+      </view>
+
+The configuration in this case defines a view named WEATHER that has a multiple instances.  You can see that the view includes a required parameter called **'cities'** and an optional parameter called **'units'**.  The view also contains an entry for a managed resource named **'city'**.  Because the resource is managed by Ambari, it is accessible as a sub-resource of the view instance through the Ambari REST API.
+
+
+#####WEB-INF/web.xml
+The web.xml is the deployment descriptor used to deploy the view as a web app.  The Java EE standards apply for the descriptor.  We can see that for this example a single servlet named **WeatherServlet** is mapped to the context path **'/ui'**.
+
+      <servlet>
+        <servlet-name>WeatherServlet</servlet-name>
+        <servlet-class>org.apache.ambari.view.weather.WeatherServlet</servlet-class>
+      </servlet>
+      <servlet-mapping>
+        <servlet-name>WeatherServlet</servlet-name>
+        <url-pattern>/ui</url-pattern>
+      </servlet-mapping>
+
+#####WeatherServlet.java
+
+The servlet WeatherServlet will be deployed as part of the view and mapped as described in the web.xml.
+
+Notice that we can access the view context in the servlet by obtaining it as a servlet context attribute in the init() method.
+
+      private ViewContext viewContext;
+
+      @Override
+      public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+
+        ServletContext context = config.getServletContext();
+        viewContext = (ViewContext) context.getAttribute(ViewContext.CONTEXT_ATTRIBUTE);
+      }
+
+
+The doGet() method of the servlet accesses the view context and the CityResourceProvider to display the list of cities available through the current view instance and detailed weather information for any select city.
+
+      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
+      {
+        ...
+
+        String targetCity = request.getParameter("city");
+
+        if (targetCity == null) {
+          Map<String, String> properties = viewContext.getProperties();
+
+          String   cityStr = properties.get("cities");
+          String[] cities  = cityStr.split(";");
+          
+          // list the cities for this view instance
+          for (String city : cities) {
+            // write city info ...
+          }
+        } else {
+          // Use the view's resource provider to get the specified city resource...
+          ResourceProvider resourceProvider = viewContext.getResourceProvider("city");
+          CityResource resource = 
+              (CityResource) resourceProvider.getResource(targetCity, Collections.singleton("weather"));
+          // write the specific city weather details ...
+        }
+      }
+
+#####CityResource.java
+
+ The CityResource class is a JavaBean that contains the attributes of a city resource for the Weather view.
+
+      public class CityResource {
+
+        private String id;
+
+        private Map<String, Object> weather;
+
+        private String units;
+
+        public String getId() {
+          return id;
+        }
+
+        public void setId(String id) {
+          this.id = id;
+        }
+        ...
+      }
+
+#####CityResourceProvider.java
+
+The CityResourceProvider class is an implementation of the ResourceProvider interface that provides access to city resources for the Ambari API framework.
+
+      public class CityResourceProvider implements ResourceProvider<CityResource> {
+        @Inject
+        ViewContext viewContext;
+
+
+        @Override
+        public CityResource getResource(String resourceId, Set<String> propertyIds) throws
+            SystemException, NoSuchResourceException, UnsupportedPropertyException {
+
+          Map<String, String> properties = viewContext.getProperties();
+
+          String units = properties.get("units");
+
+          try {
+            return getResource(resourceId, units, propertyIds);
+          } catch (IOException e) {
+            throw new SystemException("Can't get city resource " + resourceId + ".", e);
+          }
+        }
+        ...
+      }
+
+#####CityService.java
+
+The CityService uses JAX-RS annotations to define the actions to get the city resources.  Note that the injected ViewResourceHandler is used to pass control to the API framework.
+
+      @Inject
+      ViewResourceHandler resourceHandler;
+
+      @GET
+      @Path("{cityName}")
+      @Produces({"text/plain", "application/json"})
+      public Response getCity(@Context HttpHeaders headers, @Context UriInfo ui,
+                              @PathParam("cityName") String cityName) {
+        return resourceHandler.handleRequest(headers, ui, cityName);
+      }
+
+      @GET
+      @Produces({"text/plain", "application/json"})
+      public Response getCities(@Context HttpHeaders headers, @Context UriInfo ui) {
+        return resourceHandler.handleRequest(headers, ui, null);
+      }
+
+Build
+-----
+
+The view can be built as a maven project.
+
+    cd ambari-views/examples/weather-view
+    mvn clean package
+
+The build will produce the view archive.
+
+    ambari-views/examples/weather-view/target/weather-view-1.0.0.jar
+
+
+Deploy
+-----
+To deploy a view we simply place the view archive in the views folder of the ambari-server machine.  By default the views folder is located at ...
+
+    /var/lib/ambari-server/resources/views
+
+To deploy the Weather view simply copy the weather-view jar to the ambari-server views folder and restart the ambari server.
+
+Use
+-----
+
+After deploying a view you should see it as a view resource in the Ambari REST API.  If we request all views, we should see the WEATHER view.
+
+      http://<server>:8080/api/v1/views
+
+      {
+        "href" : "http://<server>:8080/api/v1/views",
+        "items" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/CALCULATOR",
+            "ViewInfo" : {
+              "view_name" : "CALCULATOR"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_SERVLET",
+            "ViewInfo" : {
+              "view_name" : "HELLO_SERVLET"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/HELLO_WORLD",
+            "ViewInfo" : {
+              "view_name" : "HELLO_WORLD"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER",
+            "ViewInfo" : {
+              "view_name" : "WEATHER"
+            }
+          }
+        ]
+      }
+
+If we want to see the details about a specific view, we can ask for it by name.  This shows us that the WEATHER view has multiple parameters and multiple instances.
+
+      http://<server>:8080/api/v1/views/WEATHER/
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/WEATHER/",
+        "ViewInfo" : {
+          "archive" : "/var/lib/ambari-server/resources/views/weather-view-1.0.0.jar",
+          "label" : "Weather",
+          "parameters" : [
+            {
+              "name" : "cities",
+              "description" : "The list of cities.",
+              "required" : true
+            },
+            {
+              "name" : "units",
+              "description" : "The units (metric or imperial).",
+              "required" : false
+            }
+          ],
+          "version" : "1.0.0",
+          "view_name" : "WEATHER"
+        },
+        "instances" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/EUROPE",
+            "ViewInstanceInfo" : {
+              "instance_name" : "EUROPE",
+              "view_name" : "WEATHER"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_CENTRAL",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_CENTRAL",
+              "view_name" : "WEATHER"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_EAST",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_EAST",
+              "view_name" : "WEATHER"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_MOUNTAIN",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_MOUNTAIN",
+              "view_name" : "WEATHER"
+            }
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_WEST",
+              "view_name" : "WEATHER"
+            }
+          }
+        ]
+      }
+
+To see a specific instance of a view, we can ask for it by name.  Here we can see the attributes of the view including its name and root context path.  We can also see that this view instance defines a value for the name property.
+
+    http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST
+
+    {
+      "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/",
+      "ViewInstanceInfo" : {
+        "context_path" : "/views/WEATHER/US_WEST",
+        "instance_name" : "US_WEST",
+        "view_name" : "WEATHER",
+        "properties" : {
+          "cities" : "Palo Alto, US;Los Angeles, US;Portland, US;Seattle, US",
+          "units" : "imperial"
+        }
+      },
+      "resources" : [ ],
+      "cities" : [
+        {
+          "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Los Angeles, US",
+          "id" : "Los Angeles, US",
+          "instance_name" : "US_WEST",
+          "view_name" : "WEATHER"
+        },
+        {
+          "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US",
+          "id" : "Palo Alto, US",
+          "instance_name" : "US_WEST",
+          "view_name" : "WEATHER"
+        },
+        {
+          "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Portland, US",
+          "id" : "Portland, US",
+          "instance_name" : "US_WEST",
+          "view_name" : "WEATHER"
+        },
+        {
+          "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Seattle, US",
+          "id" : "Seattle, US",
+          "instance_name" : "US_WEST",
+          "view_name" : "WEATHER"
+        }
+      ]
+    }
+
+To see a specific city sub-resource we can ask for it by name.  Here we can see the city resource for Palo Alto.
+
+      http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US",
+        "id" : "Palo Alto, US",
+        "instance_name" : "US_WEST",
+        "units" : "imperial",
+        "view_name" : "WEATHER",
+        "weather" : {
+          "base" : "cmc stations",
+          "cod" : 200.0,
+          "dt" : 1.392507995E9,
+          "icon_src" : "http://openweathermap.org/img/w/04d",
+          "id" : 5380748.0,
+          "name" : "Palo Alto",
+          "clouds" : {
+            "all" : 92.0
+          },
+          "coord" : {
+            "lat" : 37.44,
+            "lon" : -122.14
+          },
+          "main" : {
+            "humidity" : 82.0,
+            "pressure" : 969.0,
+            "temp" : 59.2,
+            "temp_max" : 62.01,
+            "temp_min" : 55.99
+          },
+          "sys" : {
+            "country" : "US",
+            "message" : 0.0116,
+            "sunrise" : 1.392562529E9,
+            "sunset" : 1.392601779E9
+          },
+          "weather" : {
+            "description" : "overcast clouds",
+            "icon" : "04d",
+            "id" : 804.0,
+            "main" : "Clouds"
+          },
+          "wind" : {
+            "deg" : 159.001,
+            "speed" : 4.54
+          }
+        }
+      }
+
+
+Because the city resource is managed by Ambari and exposed through the REST API, it may be queried through the API like any other Ambari resource.  All of the features of the API are available including partial response and query parameters.  For example, we can request select weather attributes for the cities where the temperature is greater than 50 degrees...
+
+
+      http://<server>:8080/api/v1/views/WEATHER/instances/?fields=cities/weather/main&cities/weather/main/temp>50
+
+      {
+        "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/?fields=cities/weather/main&cities/weather/main/temp>50",
+        "items" : [
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_CENTRAL",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_CENTRAL",
+              "view_name" : "WEATHER"
+            },
+            "cities" : [
+              {
+                "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_CENTRAL/cities/Dallas, US",
+                "id" : "Dallas, US",
+                "instance_name" : "US_CENTRAL",
+                "view_name" : "WEATHER",
+                "weather" : {
+                  "main" : {
+                    "humidity" : 50.0,
+                    "pressure" : 1015.0,
+                    "temp" : 64.29,
+                    "temp_max" : 64.99,
+                    "temp_min" : 64.0
+                  }
+                }
+              }
+            ]
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_MOUNTAIN",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_MOUNTAIN",
+              "view_name" : "WEATHER"
+            },
+            "cities" : [
+              {
+                "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_MOUNTAIN/cities/Phoenix, US",
+                "id" : "Phoenix, US",
+                "instance_name" : "US_MOUNTAIN",
+                "view_name" : "WEATHER",
+                "weather" : {
+                  "main" : {
+                    "humidity" : 49.0,
+                    "pressure" : 1013.0,
+                    "temp" : 84.7,
+                    "temp_max" : 85.28,
+                    "temp_min" : 84.0
+                  }
+                }
+              }
+            ]
+          },
+          {
+            "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST",
+            "ViewInstanceInfo" : {
+              "instance_name" : "US_WEST",
+              "view_name" : "WEATHER"
+            },
+            "cities" : [
+              {
+                "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Los Angeles, US",
+                "id" : "Los Angeles, US",
+                "instance_name" : "US_WEST",
+                "view_name" : "WEATHER",
+                "weather" : {
+                  "main" : {
+                    "humidity" : 37.0,
+                    "pressure" : 1013.0,
+                    "temp" : 74.5,
+                    "temp_max" : 78.01,
+                    "temp_min" : 69.01
+                  }
+                }
+              },
+              {
+                "href" : "http://<server>:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US",
+                "id" : "Palo Alto, US",
+                "instance_name" : "US_WEST",
+                "view_name" : "WEATHER",
+                "weather" : {
+                  "main" : {
+                    "humidity" : 82.0,
+                    "pressure" : 969.0,
+                    "temp" : 59.2,
+                    "temp_max" : 62.01,
+                    "temp_min" : 55.99
+                  }
+                }
+              }
+            ]
+          }
+        ]
+      }
+
+
+If the view contains any web content, we can access it at the view's root context path.  In this case its the WeatherServlet which displays a the weather for a set of cities based on the properties of the view instance.
+
+    http://<server>:8080/views/WEATHER/US_WEST/ui
+
+![image](weather.png)
+
+Selecting a specific city will show details about the weather in that city.
+
+    http://<server>:8080/views/WEATHER/US_WEST/ui?city=Portland%2C+US
+
+
+![image](portland.png)
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/weather-view/docs/portland.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/weather-view/docs/portland.png b/ambari-views/examples/weather-view/docs/portland.png
new file mode 100644
index 0000000..519b762
Binary files /dev/null and b/ambari-views/examples/weather-view/docs/portland.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/weather-view/docs/weather.png
----------------------------------------------------------------------
diff --git a/ambari-views/examples/weather-view/docs/weather.png b/ambari-views/examples/weather-view/docs/weather.png
new file mode 100644
index 0000000..f382bf2
Binary files /dev/null and b/ambari-views/examples/weather-view/docs/weather.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/weather-view/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-views/examples/weather-view/pom.xml b/ambari-views/examples/weather-view/pom.xml
new file mode 100644
index 0000000..fd6d5b6
--- /dev/null
+++ b/ambari-views/examples/weather-view/pom.xml
@@ -0,0 +1,115 @@
+<!--
+   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>weather-view</artifactId>
+  <packaging>jar</packaging>
+  <name>Ambari Weather View</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <ambari.version>1.3.0-SNAPSHOT</ambari.version>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <version>3.1</version>
+      <scope>test</scope>
+    </dependency>
+    <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>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.3.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>4.2.5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.6</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>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81c32ed5/ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityResource.java
----------------------------------------------------------------------
diff --git a/ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityResource.java b/ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityResource.java
new file mode 100644
index 0000000..a8f91f4
--- /dev/null
+++ b/ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityResource.java
@@ -0,0 +1,99 @@
+/**
+ * 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.weather;
+
+
+import java.util.Map;
+
+/**
+ * City resource bean.
+ * Represents city for the weather view.
+ */
+public class CityResource {
+
+  /**
+   * The city id.
+   */
+  private String id;
+
+  /**
+   * The city weather properties.
+   */
+  private Map<String, Object> weather;
+
+  /**
+   * The weather units (imperial or metric).
+   */
+  private String units;
+
+
+  /**
+   * Get the city id.
+   *
+   * @return the id
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * Set the city id.
+   *
+   * @param id  the id
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  /**
+   * Get the weather properties.
+   *
+   * @return the weather properties
+   */
+  public Map<String, Object> getWeather() {
+    return weather;
+  }
+
+  /**
+   * Set the weather properties.
+   *
+   * @param weather  the weather properties
+   */
+  public void setWeather(Map<String, Object> weather) {
+    this.weather = weather;
+  }
+
+  /**
+   * Get the weather units (imperial or metric).
+   *
+   * @return the weather units
+   */
+  public String getUnits() {
+    return units;
+  }
+
+  /**
+   * Set the weather units (imperial or metric).
+   *
+   * @param units  the weather units
+   */
+  public void setUnits(String units) {
+    this.units = units;
+  }
+}