ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbeerbo...@apache.org
Subject git commit: AMBARI-4646 - Ambari Views : Allow view deployment as a Web App
Date Fri, 14 Feb 2014 16:03:37 GMT
Updated Branches:
  refs/heads/trunk d3ddf51c8 -> c337d7df1


AMBARI-4646 - Ambari Views : Allow view deployment as a Web App


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

Branch: refs/heads/trunk
Commit: c337d7df188bec9f955c7cbd38b0f51410e29fae
Parents: d3ddf51
Author: tbeerbower <tbeerbower@hortonworks.com>
Authored: Wed Feb 12 22:23:06 2014 -0500
Committer: tbeerbower <tbeerbower@hortonworks.com>
Committed: Fri Feb 14 11:03:32 2014 -0500

----------------------------------------------------------------------
 .../ambari/server/controller/AmbariServer.java  |  14 +-
 .../internal/ViewInstanceResourceProvider.java  |  14 +-
 .../internal/ViewResourceProvider.java          |   3 +
 .../ambari/server/view/ViewDefinition.java      |  35 +++-
 .../server/view/ViewInstanceDefinition.java     |  39 ++--
 .../apache/ambari/server/view/ViewRegistry.java | 177 +++++++++----------
 .../view/configuration/ServletConfig.java       |  72 --------
 .../configuration/ServletMappingConfig.java     |  60 -------
 .../server/view/configuration/ViewConfig.java   |  74 --------
 .../ambari/server/view/ViewDefinitionTest.java  |  14 +-
 .../server/view/ViewInstanceDefinitionTest.java |  23 +--
 .../ambari/server/view/ViewRegistryTest.java    |  20 +++
 .../view/configuration/ServletConfigTest.java   |  51 ------
 .../configuration/ServletMappingConfigTest.java |  51 ------
 .../view/configuration/ViewConfigTest.java      |  36 ----
 .../org/apache/ambari/view/ViewContext.java     |   6 +
 16 files changed, 205 insertions(+), 484 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index d480aee..e4ebc1c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -64,9 +64,11 @@ import org.apache.ambari.server.security.unsecured.rest.CertificateDownload;
 import org.apache.ambari.server.security.unsecured.rest.CertificateSign;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.ambari.server.view.ViewInstanceDefinition;
 import org.apache.ambari.server.view.ViewRegistry;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.HandlerList;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
 import org.eclipse.jetty.servlet.DefaultServlet;
@@ -167,9 +169,10 @@ public class AmbariServer {
           ClassPathXmlApplicationContext(contextLocations, parentSpringAppContext);
       //setting ambari web context
 
-      ServletContextHandler root = new ServletContextHandler(server, CONTEXT_PATH,
+      ServletContextHandler root = new ServletContextHandler(
           ServletContextHandler.SECURITY | ServletContextHandler.SESSIONS);
 
+      root.setContextPath(CONTEXT_PATH);
       root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class));
 
       //Changing session cookie name to avoid conflicts
@@ -277,7 +280,14 @@ public class AmbariServer {
       root.addServlet(sh, "/api/v1/*");
       sh.setInitOrder(2);
 
-      ViewRegistry.readViewArchives(configs, root, springSecurityFilter);
+      HandlerList handlerList = new HandlerList();
+
+      for (ViewInstanceDefinition viewInstanceDefinition : ViewRegistry.readViewArchives(configs)){
+        handlerList.addHandler(ViewRegistry.getWebAppContext(viewInstanceDefinition));
+      }
+      handlerList.addHandler(root);
+
+      server.setHandler(handlerList);
 
       ServletHolder agent = new ServletHolder(ServletContainer.class);
       agent.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
index 7efea04..d0901e8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
@@ -45,10 +45,10 @@ public class ViewInstanceResourceProvider extends AbstractResourceProvider
{
   /**
    * View instance property id constants.
    */
-  public static final String VIEW_NAME_PROPERTY_ID        = "ViewInstanceInfo/view_name";
-  public static final String INSTANCE_NAME_PROPERTY_ID    = "ViewInstanceInfo/instance_name";
-  public static final String PROPERTIES_PROPERTY_ID       = "ViewInstanceInfo/properties";
-  public static final String SERVLET_MAPPINGS_PROPERTY_ID = "ViewInstanceInfo/servlet_mappings";
+  public static final String VIEW_NAME_PROPERTY_ID     = "ViewInstanceInfo/view_name";
+  public static final String INSTANCE_NAME_PROPERTY_ID = "ViewInstanceInfo/instance_name";
+  public static final String PROPERTIES_PROPERTY_ID    = "ViewInstanceInfo/properties";
+  public static final String CONTEXT_PATH_PROPERTY_ID  = "ViewInstanceInfo/context_path";
 
   /**
    * The key property ids for a view instance resource.
@@ -67,7 +67,7 @@ public class ViewInstanceResourceProvider extends AbstractResourceProvider
{
     propertyIds.add(VIEW_NAME_PROPERTY_ID);
     propertyIds.add(INSTANCE_NAME_PROPERTY_ID);
     propertyIds.add(PROPERTIES_PROPERTY_ID);
-    propertyIds.add(SERVLET_MAPPINGS_PROPERTY_ID);
+    propertyIds.add(CONTEXT_PATH_PROPERTY_ID);
   }
 
 
@@ -118,8 +118,8 @@ public class ViewInstanceResourceProvider extends AbstractResourceProvider
{
               setResourceProperty(resource, INSTANCE_NAME_PROPERTY_ID, viewInstanceDefinition.getName(),
requestedIds);
               setResourceProperty(resource, PROPERTIES_PROPERTY_ID,
                   viewInstanceDefinition.getProperties(), requestedIds);
-              setResourceProperty(resource, SERVLET_MAPPINGS_PROPERTY_ID,
-                  viewInstanceDefinition.getServletMappings(), requestedIds);
+              setResourceProperty(resource, CONTEXT_PATH_PROPERTY_ID,
+                  viewInstanceDefinition.getContextPath(), requestedIds);
 
               resources.add(resource);
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
index 17d3b94..b643773 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
@@ -48,6 +48,7 @@ public class ViewResourceProvider extends AbstractResourceProvider {
   public static final String LABEL_PROPERTY_ID      = "ViewInfo/label";
   public static final String VERSION_PROPERTY_ID    = "ViewInfo/version";
   public static final String PARAMETERS_PROPERTY_ID = "ViewInfo/parameters";
+  public static final String ARCHIVE_PROPERTY_ID    = "ViewInfo/archive";
 
 
   /**
@@ -67,6 +68,7 @@ public class ViewResourceProvider extends AbstractResourceProvider {
     propertyIds.add(LABEL_PROPERTY_ID);
     propertyIds.add(VERSION_PROPERTY_ID);
     propertyIds.add(PARAMETERS_PROPERTY_ID);
+    propertyIds.add(ARCHIVE_PROPERTY_ID);
   }
 
   
@@ -115,6 +117,7 @@ public class ViewResourceProvider extends AbstractResourceProvider {
           setResourceProperty(resource, VERSION_PROPERTY_ID, viewDefinition.getVersion(),
requestedIds);
           setResourceProperty(resource, PARAMETERS_PROPERTY_ID,
               viewDefinition.getConfiguration().getParameters(), requestedIds);
+          setResourceProperty(resource, ARCHIVE_PROPERTY_ID, viewDefinition.getArchivePath(),
requestedIds);
 
           resources.add(resource);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDefinition.java
b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDefinition.java
index 4d813c6..cc2ec5d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDefinition.java
@@ -68,6 +68,16 @@ public class ViewDefinition {
    */
   private final Resource.Type externalResourceType;
 
+  /**
+   * The classloader used to load the view.
+   */
+  private final ClassLoader classLoader;
+
+  /**
+   * The archive path for the view.
+   */
+  private final String archivePath;
+
 
   // ----- Constructors ------------------------------------------------------
 
@@ -76,10 +86,15 @@ public class ViewDefinition {
    *
    * @param configuration        the view configuration
    * @param ambariConfiguration  the Ambari configuration
+   * @param classLoader          the class loader
+   * @param archivePath          the path of the view archive
    */
-  public ViewDefinition(ViewConfig configuration, Configuration ambariConfiguration) {
+  public ViewDefinition(ViewConfig configuration, Configuration ambariConfiguration,
+                        ClassLoader classLoader, String archivePath) {
     this.configuration       = configuration;
     this.ambariConfiguration = ambariConfiguration;
+    this.classLoader         = classLoader;
+    this.archivePath         = archivePath;
 
     this.externalResourceType =
         new Resource.Type(getQualifiedResourceTypeName(ResourceConfig.EXTERNAL_RESOURCE_PLURAL_NAME));
@@ -261,4 +276,22 @@ public class ViewDefinition {
   public String getQualifiedResourceTypeName(String resourceTypeName) {
     return configuration.getName() + "/" + resourceTypeName;
   }
+
+  /**
+   * Get the class loader used to load the view classes.
+   *
+   * @return the class loader
+   */
+  public ClassLoader getClassLoader() {
+    return classLoader;
+  }
+
+  /**
+   * Get the path for the archive for the view.
+   *
+   * @return the archive path
+   */
+  public String getArchivePath() {
+    return archivePath;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/ViewInstanceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewInstanceDefinition.java
b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewInstanceDefinition.java
index 7a7a5eb..42b4f4e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewInstanceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewInstanceDefinition.java
@@ -30,6 +30,11 @@ import java.util.Map;
  */
 public class ViewInstanceDefinition {
   /**
+   * The prefix for every view instance context path.
+   */
+  public static final String VIEWS_CONTEXT_PATH_PREFIX = "/views/";
+
+  /**
    * The associated configuration.
    */
   private final InstanceConfig instanceConfig;
@@ -55,10 +60,9 @@ public class ViewInstanceDefinition {
   private final Map<String, Object> services = new HashMap<String, Object>();
 
   /**
-   * The mapping of servlet name to servlet path spec.
+   * The context path for the view web app.
    */
-  private final Map<String, String> servletMappings = new HashMap<String, String>();
-
+  private final String contextPath;
 
 
   // ----- Constructors ------------------------------------------------------
@@ -72,6 +76,7 @@ public class ViewInstanceDefinition {
   public ViewInstanceDefinition(ViewDefinition viewDefinition, InstanceConfig instanceConfig)
{
     this.instanceConfig = instanceConfig;
     this.viewDefinition = viewDefinition;
+    this.contextPath    = VIEWS_CONTEXT_PATH_PREFIX + viewDefinition.getName() + "/" + instanceConfig.getName();
   }
 
 
@@ -105,25 +110,6 @@ public class ViewInstanceDefinition {
   }
 
   /**
-   * Add a mapping from servlet name to path spec.
-   *
-   * @param servletName  the servlet name
-   * @param pathSpec     the path
-   */
-  public void addServletMapping(String servletName, String pathSpec) {
-    servletMappings.put(servletName, pathSpec);
-  }
-
-  /**
-   * Get the servlet mappings.
-   *
-   * @return the servlet mappings
-   */
-  public Map<String, String> getServletMappings() {
-    return servletMappings;
-  }
-
-  /**
    * Add a view instance property.
    *
    * @param key    the property key
@@ -195,4 +181,13 @@ public class ViewInstanceDefinition {
     String typeName = viewDefinition.getName() + "/" + type;
     return resourceProviders.get(Resource.Type.valueOf(typeName));
   }
+
+  /**
+   * Get the context path for the UI for this view.
+   *
+   * @return the context path
+   */
+  public String getContextPath() {
+    return contextPath;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index 8781d89..abeff05 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -34,14 +34,10 @@ import org.apache.ambari.server.view.configuration.ResourceConfig;
 import org.apache.ambari.server.view.configuration.ViewConfig;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.ViewResourceHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.web.filter.DelegatingFilterProxy;
 
-import javax.servlet.http.HttpServlet;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
 import java.beans.IntrospectionException;
@@ -209,16 +205,15 @@ public class ViewRegistry {
   /**
    * Read the view archives.
    *
-   * @param configuration       Ambari configuration
-   * @param rootContextHandler  the root servlet context handler
-   * @param filterProxy         the security filter
+   * @param configuration  Ambari configuration
    */
-  public static void readViewArchives(Configuration configuration, ServletContextHandler
rootContextHandler,
-                                      DelegatingFilterProxy filterProxy) {
+  public static Set<ViewInstanceDefinition> readViewArchives(Configuration configuration)
{
 
     File   viewDir = configuration.getViewsDir();
     File[] files   = viewDir.listFiles();
 
+    Set<ViewInstanceDefinition> instanceDefinitions = new HashSet<ViewInstanceDefinition>();
+
     if (files != null) {
       for (final File fileEntry : files) {
         if (!fileEntry.isDirectory()) {
@@ -229,12 +224,12 @@ public class ViewRegistry {
             JAXBContext    jaxbContext      = JAXBContext.newInstance(ViewConfig.class);
             Unmarshaller   jaxbUnmarshaller = jaxbContext.createUnmarshaller();
             ViewConfig     viewConfig       = (ViewConfig) jaxbUnmarshaller.unmarshal(configStream);
-            ViewDefinition viewDefinition   = installView(viewConfig, cl, configuration);
+            ViewDefinition viewDefinition   = installView(viewConfig, configuration, cl,
fileEntry.getAbsolutePath());
 
             List<InstanceConfig> instances = viewConfig.getInstances();
 
             for (InstanceConfig instanceConfig : instances) {
-              installViewInstance(viewDefinition, instanceConfig, cl, rootContextHandler,
filterProxy, configuration);
+              instanceDefinitions.add(installViewInstance(viewDefinition, instanceConfig));
             }
           } catch (Exception e) {
             LOG.error("Caught exception loading view from " + fileEntry.getAbsolutePath(),
e);
@@ -242,6 +237,81 @@ public class ViewRegistry {
         }
       }
     }
+    return instanceDefinitions;
+  }
+
+  /**
+   * Install a view instance described by the given instance configuration
+   * for the view defined by the given view definition.
+   *
+   * @param viewDefinition  the view definition
+   * @param instanceConfig  the instance configuration
+   *
+   * @return the new view instance definition
+   *
+   * @throws ClassNotFoundException if the view classes in the given configuration can not
be found
+   */
+  public static ViewInstanceDefinition installViewInstance(ViewDefinition viewDefinition,
+                                                            InstanceConfig instanceConfig)
+      throws ClassNotFoundException {
+
+    ViewInstanceDefinition viewInstanceDefinition = new ViewInstanceDefinition(viewDefinition,
instanceConfig);
+
+    List<PropertyConfig> propertyConfigs = instanceConfig.getProperties();
+
+    for (PropertyConfig propertyConfig : propertyConfigs) {
+      viewInstanceDefinition.addProperty(propertyConfig.getKey(), propertyConfig.getValue());
+    }
+
+    ViewContext viewInstanceContext = new ViewContextImpl(viewInstanceDefinition);
+
+    ViewExternalSubResourceService externalSubResourceService =
+        new ViewExternalSubResourceService(viewDefinition.getExternalResourceType(), viewInstanceDefinition);
+
+    viewInstanceDefinition.addService(ResourceConfig.EXTERNAL_RESOURCE_PLURAL_NAME, externalSubResourceService);
+
+    Collection<ViewSubResourceDefinition> resourceDefinitions = viewDefinition.getResourceDefinitions().values();
+    for (ViewSubResourceDefinition resourceDefinition : resourceDefinitions) {
+
+      Resource.Type  type           = resourceDefinition.getType();
+      ResourceConfig resourceConfig = resourceDefinition.getResourceConfiguration();
+
+      ViewResourceHandler viewResourceService =
+          new ViewSubResourceService(type, viewDefinition.getName(), instanceConfig.getName());
+
+      ClassLoader cl = viewDefinition.getClassLoader();
+
+      Object service = getService(resourceConfig.getServiceClass(cl), viewResourceService,
viewInstanceContext);
+
+      if (resourceConfig.isExternal()) {
+        externalSubResourceService.addResourceService(resourceConfig.getName(), service);
+      } else {
+        viewInstanceDefinition.addService(viewDefinition.getResourceDefinition(type).getPluralName(),service);
+        viewInstanceDefinition.addResourceProvider(type,
+            getProvider(resourceConfig.getProviderClass(cl), viewInstanceContext));
+      }
+    }
+
+    viewDefinition.addInstanceDefinition(viewInstanceDefinition);
+    ViewRegistry.getInstance().addInstanceDefinition(viewDefinition, viewInstanceDefinition);
+
+    return viewInstanceDefinition;
+  }
+
+  /**
+   * Get a WebAppContext for the given view instance.
+   *
+   * @param viewInstanceDefinition  the view instance definition
+   *
+   * @return a web app context
+   */
+  public static WebAppContext getWebAppContext(ViewInstanceDefinition viewInstanceDefinition)
{
+    ViewDefinition viewDefinition = viewInstanceDefinition.getViewDefinition();
+
+    WebAppContext context = new WebAppContext(viewDefinition.getArchivePath(), viewInstanceDefinition.getContextPath());
+    context.setClassLoader(viewDefinition.getClassLoader());
+    context.setAttribute(ViewContext.CONTEXT_ATTRIBUTE, new ViewContextImpl(viewInstanceDefinition));
+    return context;
   }
 
 
@@ -257,12 +327,13 @@ public class ViewRegistry {
   }
 
   // install a new view definition
-  private static ViewDefinition installView(ViewConfig viewConfig, ClassLoader cl, Configuration
ambariConfig)
+  private static ViewDefinition installView(ViewConfig viewConfig, Configuration ambariConfig,
+                                            ClassLoader cl, String archivePath)
       throws ClassNotFoundException, IntrospectionException {
 
     List<ResourceConfig> resourceConfigurations = viewConfig.getResources();
 
-    ViewDefinition viewDefinition = new ViewDefinition(viewConfig, ambariConfig);
+    ViewDefinition viewDefinition = new ViewDefinition(viewConfig, ambariConfig, cl, archivePath);
 
     Resource.Type externalResourceType = viewDefinition.getExternalResourceType();
 
@@ -297,71 +368,6 @@ public class ViewRegistry {
     return viewDefinition;
   }
 
-  // install a new view instance definition
-  private static void installViewInstance(ViewDefinition viewDefinition,
-                                   InstanceConfig instanceConfig,
-                                   ClassLoader cl,
-                                   ServletContextHandler root,
-                                   DelegatingFilterProxy springSecurityFilter,
-                                   Configuration ambariConfig) throws ClassNotFoundException
{
-
-    ViewInstanceDefinition viewInstanceDefinition = new ViewInstanceDefinition(viewDefinition,
instanceConfig);
-
-    List<PropertyConfig> propertyConfigs = instanceConfig.getProperties();
-
-    for (PropertyConfig propertyConfig : propertyConfigs) {
-      viewInstanceDefinition.addProperty(propertyConfig.getKey(), propertyConfig.getValue());
-    }
-
-    ViewContext viewInstanceContext = new ViewContextImpl(viewInstanceDefinition);
-
-    ViewExternalSubResourceService externalSubResourceService =
-        new ViewExternalSubResourceService(viewDefinition.getExternalResourceType(), viewInstanceDefinition);
-
-    viewInstanceDefinition.addService(ResourceConfig.EXTERNAL_RESOURCE_PLURAL_NAME, externalSubResourceService);
-
-    Collection<ViewSubResourceDefinition> resourceDefinitions = viewDefinition.getResourceDefinitions().values();
-    for (ViewSubResourceDefinition resourceDefinition : resourceDefinitions) {
-
-      Resource.Type  type           = resourceDefinition.getType();
-      ResourceConfig resourceConfig = resourceDefinition.getResourceConfiguration();
-
-      ViewResourceHandler viewResourceService =
-          new ViewSubResourceService(type, viewDefinition.getName(), instanceConfig.getName());
-
-      Object service = getService(resourceConfig.getServiceClass(cl), viewResourceService,
viewInstanceContext);
-
-      if (resourceConfig.isExternal()) {
-        externalSubResourceService.addResourceService(resourceConfig.getName(), service);
-      } else {
-        viewInstanceDefinition.addService(viewDefinition.getResourceDefinition(type).getPluralName(),service);
-        viewInstanceDefinition.addResourceProvider(type,
-            getProvider(resourceConfig.getProviderClass(cl), viewInstanceContext));
-      }
-    }
-
-    ViewConfig viewConfig = viewDefinition.getConfiguration();
-
-    Map<String, Class<? extends HttpServlet>> servletPathMap = viewConfig.getServletPathMap(cl);
-    Map<String, String> servletURLPatternMap = viewConfig.getServletURLPatternMap();
-
-    for (Map.Entry<String, Class<? extends HttpServlet>> entry : servletPathMap.entrySet())
{
-      HttpServlet servlet = getServlet(entry.getValue(), viewInstanceContext);
-      ServletHolder sh = new ServletHolder(servlet);
-      String servletName = entry.getKey();
-      String pathSpec = "/views/" + viewDefinition.getName() + "/" +
-          viewInstanceDefinition.getName() + servletURLPatternMap.get(servletName);
-      root.addServlet(sh, pathSpec);
-      viewInstanceDefinition.addServletMapping(servletName, pathSpec);
-
-      if (ambariConfig.getApiAuthentication()) {
-        root.addFilter(new FilterHolder(springSecurityFilter), pathSpec, 1);
-      }
-    }
-    viewDefinition.addInstanceDefinition(viewInstanceDefinition);
-    ViewRegistry.getInstance().addInstanceDefinition(viewDefinition, viewInstanceDefinition);
-  }
-
   // get the given service class from the given class loader; inject a handler and context
   private static <T> T getService(Class<T> clazz,
                                   final ViewResourceHandler viewResourceHandler,
@@ -378,19 +384,6 @@ public class ViewRegistry {
     return viewInstanceInjector.getInstance(clazz);
   }
 
-  // get the given servlet class from the given class loader; inject a context
-  private static HttpServlet getServlet(Class<? extends HttpServlet> clazz,
-                                        final ViewContext viewInstanceContext) {
-    Injector viewInstanceInjector = Guice.createInjector(new AbstractModule() {
-      @Override
-      protected void configure() {
-        bind(ViewContext.class)
-            .toInstance(viewInstanceContext);
-      }
-    });
-    return viewInstanceInjector.getInstance(clazz);
-  }
-
   // get the given resource provider class from the given class loader; inject a context
   private static org.apache.ambari.view.ResourceProvider getProvider(
       Class<? extends org.apache.ambari.view.ResourceProvider> clazz,

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletConfig.java
b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletConfig.java
deleted file mode 100644
index a62d0f3..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletConfig.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.server.view.configuration;
-
-import javax.servlet.http.HttpServlet;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- *  View servlet mapping.
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ServletConfig {
-  /**
-   * The servlet name.
-   */
-  @XmlElement(name="servlet-name")
-  private String name;
-
-  /**
-   * The servlet class name.
-   */
-  @XmlElement(name="servlet-path")
-  private String path;
-
-  /**
-   * The servlet class.
-   */
-  private Class<? extends HttpServlet> servletClass = null;
-
-  /**
-   * The servlet name.
-   *
-   * @return the servlet name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Get the servlet class.
-   *
-   * @param cl  the class loader
-   *
-   * @return the servlet class
-   *
-   * @throws ClassNotFoundException if the class can not be loaded
-   */
-  public Class<? extends HttpServlet> getServletClass(ClassLoader cl) throws ClassNotFoundException
{
-    if (servletClass == null) {
-      servletClass = cl.loadClass(path).asSubclass(HttpServlet.class);
-    }
-    return servletClass;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletMappingConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletMappingConfig.java
b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletMappingConfig.java
deleted file mode 100644
index cc11e07..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ServletMappingConfig.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.server.view.configuration;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * View servlet mapping configuration.
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ServletMappingConfig {
-
-  /**
-   * The servlet name.
-   */
-  @XmlElement(name="servlet-name")
-  private String name;
-
-  /**
-   * The URL pattern.
-   */
-  @XmlElement(name="url-pattern")
-  private String urlPattern;
-
-  /**
-   * Get the servlet name.
-   *
-   * @return the servlet name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Get the URL pattern.
-   *
-   * @return the URL pattern
-   */
-  public String getUrlPattern() {
-    return urlPattern;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java
b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java
index 90e4a24..fa1bed1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java
@@ -67,23 +67,6 @@ public class ViewConfig {
   private List<InstanceConfig> instances;
 
   /**
-   * The list of servlets.
-   */
-  @XmlElement(name="servlet")
-  private List<ServletConfig> servlets;
-
-  /**
-   * The mapping of servlet names to servlet classes.
-   */
-  public Map<String, Class<? extends HttpServlet>> servletPathMap = null;
-
-  /**
-   * The list of servlet mappings.
-   */
-  @XmlElement(name="servlet-mapping")
-  private List<ServletMappingConfig> mappings;
-
-  /**
    * The mapping of servlet names to URL patterns.
    */
   public Map<String, String> servletURLPatternMap = null;
@@ -141,61 +124,4 @@ public class ViewConfig {
   public List<InstanceConfig> getInstances() {
     return instances;
   }
-
-  /**
-   * Get the list of servlets.
-   *
-   * @return the list of view servlets
-   */
-  public List<ServletConfig> getServlets() {
-    return servlets;
-  }
-
-  /**
-   * Get the list of servlet mappings.
-   *
-   * @return the list of view servlet mappings.
-   */
-  public List<ServletMappingConfig> getMappings() {
-    return mappings;
-  }
-
-  /**
-   * Get the mapping of servlet names to servlet classes.
-   *
-   * @param cl  the class loader
-   *
-   * @return the mapping of servlet names to servlet classes
-   *
-   * @throws ClassNotFoundException if a servlet class can not be loaded
-   */
-  public synchronized Map<String, Class<? extends HttpServlet>> getServletPathMap(ClassLoader
cl)
-      throws ClassNotFoundException{
-    if (servletPathMap == null) {
-      servletPathMap = new HashMap<String, Class<? extends HttpServlet>>();
-      if (servlets != null) {
-        for (ServletConfig servletConfig : servlets) {
-          servletPathMap.put(servletConfig.getName(), servletConfig.getServletClass(cl));
-        }
-      }
-    }
-    return servletPathMap;
-  }
-
-  /**
-   * Get the mapping of servlet names to URL patterns.
-   *
-   * @return the mapping of servlet names to URL patterns
-   */
-  public synchronized Map<String, String> getServletURLPatternMap() {
-    if (servletURLPatternMap == null) {
-      servletURLPatternMap = new HashMap<String, String>();
-      if (mappings != null) {
-        for (ServletMappingConfig servletMappingConfig : mappings) {
-          servletURLPatternMap.put(servletMappingConfig.getName(), servletMappingConfig.getUrlPattern());
-        }
-      }
-    }
-    return servletURLPatternMap;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDefinitionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDefinitionTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDefinitionTest.java
index 92766df..0aa2a08 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDefinitionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDefinitionTest.java
@@ -53,7 +53,7 @@ public class ViewDefinitionTest {
     properties.put("p3", "v3");
 
     Configuration ambariConfig = new Configuration(properties);
-    return new ViewDefinition(viewConfig, ambariConfig);
+    return new ViewDefinition(viewConfig, ambariConfig, ViewDefinitionTest.class.getClassLoader(),
"view.jar");
   }
 
   @Test
@@ -175,4 +175,16 @@ public class ViewDefinitionTest {
 
     verify(definition);
   }
+
+  @Test
+  public void testGetClassLoader() throws Exception {
+    ViewDefinition viewDefinition = getViewDefinition();
+    Assert.assertEquals(ViewDefinitionTest.class.getClassLoader(), viewDefinition.getClassLoader());
+  }
+
+  @Test
+  public void testGetArchivePath() throws Exception {
+    ViewDefinition viewDefinition = getViewDefinition();
+    Assert.assertEquals("view.jar", viewDefinition.getArchivePath());
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/ViewInstanceDefinitionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewInstanceDefinitionTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewInstanceDefinitionTest.java
index 6df3e1e..22652aa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewInstanceDefinitionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewInstanceDefinitionTest.java
@@ -59,21 +59,6 @@ public class ViewInstanceDefinitionTest {
   }
 
   @Test
-  public void testAddGetServletMapping() throws Exception {
-    ViewInstanceDefinition viewInstanceDefinition = getViewInstanceDefinition();
-
-    viewInstanceDefinition.addServletMapping("Servlet1", "path1");
-    viewInstanceDefinition.addServletMapping("Servlet2", "path2");
-
-    Map<String, String> mappings = viewInstanceDefinition.getServletMappings();
-
-    Assert.assertEquals(2, mappings.size());
-
-    Assert.assertEquals("path1", mappings.get("Servlet1"));
-    Assert.assertEquals("path2", mappings.get("Servlet2"));
-  }
-
-  @Test
   public void testAddGetProperty() throws Exception {
     ViewInstanceDefinition viewInstanceDefinition = getViewInstanceDefinition();
 
@@ -119,6 +104,14 @@ public class ViewInstanceDefinitionTest {
     Assert.assertEquals(provider, viewInstanceDefinition.getResourceProvider("myType"));
   }
 
+  @Test
+  public void testContextPath() throws Exception {
+    ViewInstanceDefinition viewInstanceDefinition = getViewInstanceDefinition();
+
+    Assert.assertEquals(ViewInstanceDefinition.VIEWS_CONTEXT_PATH_PREFIX + "MY_VIEW/INSTANCE1",
+        viewInstanceDefinition.getContextPath());
+  }
+
   public static ViewInstanceDefinition getViewInstanceDefinition() throws Exception {
     InstanceConfig instanceConfig = InstanceConfigTest.getInstanceConfigs().get(0);
     ViewDefinition viewDefinition = ViewDefinitionTest.getViewDefinition();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
index 20bae47..2820ef9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
@@ -21,8 +21,12 @@ package org.apache.ambari.server.view;
 import org.apache.ambari.server.api.resources.SubResourceDefinition;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.view.configuration.InstanceConfig;
+import org.apache.ambari.server.view.configuration.InstanceConfigTest;
 import org.apache.ambari.server.view.configuration.ResourceConfig;
 import org.apache.ambari.server.view.configuration.ResourceConfigTest;
+import org.apache.ambari.server.view.configuration.ViewConfig;
+import org.apache.ambari.server.view.configuration.ViewConfigTest;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
@@ -93,6 +97,22 @@ public class ViewRegistryTest {
     Assert.assertEquals("myType", subResourceDefinitions.iterator().next().getType().name());
   }
 
+  @Test
+  public void testInstallViewInstance() throws Exception {
+    ViewRegistry registry = ViewRegistry.getInstance();
+
+    ViewDefinition viewDefinition = ViewDefinitionTest.getViewDefinition();
+    InstanceConfig instanceConfig = InstanceConfigTest.getInstanceConfigs().get(0);
+
+    ViewInstanceDefinition viewInstanceDefinition = ViewRegistry.installViewInstance(viewDefinition,
instanceConfig);
+
+    Collection<ViewInstanceDefinition> viewInstanceDefinitions = registry.getInstanceDefinitions(viewDefinition);
+
+    Assert.assertEquals(1, viewInstanceDefinitions.size());
+
+    Assert.assertEquals(viewInstanceDefinition, viewInstanceDefinitions.iterator().next());
+  }
+
   @Before
   public void before() throws Exception {
     ViewRegistry.getInstance().clear();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletConfigTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletConfigTest.java
deleted file mode 100644
index 8cf0ff7..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletConfigTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.server.view.configuration;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.xml.bind.JAXBException;
-import java.util.List;
-
-/**
- * ServletConfig tests.
- */
-public class ServletConfigTest {
-  @Test
-  public void testGetName() throws Exception {
-    List<ServletConfig> servletConfigs = getServletConfigs();
-
-    Assert.assertEquals(1, servletConfigs.size());
-    Assert.assertEquals("MyViewServlet", servletConfigs.get(0).getName());
-  }
-
-  @Test
-  public void testGetServletClass() throws Exception {
-    List<ServletConfig> servletConfigs = getServletConfigs();
-
-    Assert.assertEquals(1, servletConfigs.size());
-    Assert.assertTrue(servletConfigs.get(0).getServletClass(getClass().getClassLoader()).equals(ViewConfigTest.MyViewServlet.class));
-  }
-
-  public static List<ServletConfig> getServletConfigs() throws JAXBException {
-    ViewConfig viewConfig = ViewConfigTest.getConfig();
-    return viewConfig.getServlets();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletMappingConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletMappingConfigTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletMappingConfigTest.java
deleted file mode 100644
index c0447bb..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ServletMappingConfigTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.server.view.configuration;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.xml.bind.JAXBException;
-import java.util.List;
-
-/**
- * ServletMappingConfig tests.
- */
-public class ServletMappingConfigTest {
-  @Test
-  public void testGetName() throws Exception {
-    List<ServletMappingConfig> mappingConfigs = getServletMappingConfigs();
-
-    Assert.assertEquals(1, mappingConfigs.size());
-    Assert.assertEquals("MyViewServlet", mappingConfigs.get(0).getName());
-  }
-
-  @Test
-  public void testGetUrlPattern() throws Exception {
-    List<ServletMappingConfig> mappingConfigs = getServletMappingConfigs();
-
-    Assert.assertEquals(1, mappingConfigs.size());
-    Assert.assertEquals("/ui", mappingConfigs.get(0).getUrlPattern());
-  }
-
-  public static List<ServletMappingConfig> getServletMappingConfigs() throws JAXBException
{
-    ViewConfig viewConfig = ViewConfigTest.getConfig();
-    return viewConfig.getMappings();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
index 04e71a8..27a7644 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
@@ -147,42 +147,6 @@ public class ViewConfigTest {
     Assert.assertEquals("INSTANCE2", instances.get(1).getName());
   }
 
-  @Test
-  public void testGetServlets() throws Exception {
-    ViewConfig config = getConfig();
-    List<ServletConfig> servlets = config.getServlets();
-    Assert.assertEquals(1, servlets.size());
-    Assert.assertEquals("MyViewServlet", servlets.get(0).getName());
-  }
-
-  @Test
-  public void testGetMappings() throws Exception {
-    ViewConfig config = getConfig();
-    List<ServletMappingConfig> mappings = config.getMappings();
-    Assert.assertEquals(1, mappings.size());
-    Assert.assertEquals("MyViewServlet", mappings.get(0).getName());
-  }
-
-  @Test
-  public void testGetServletPathMap() throws Exception {
-    ViewConfig config = getConfig();
-    Map<String, Class<? extends HttpServlet>> servletPathMap = config.getServletPathMap(getClass().getClassLoader());
-
-    Assert.assertEquals(1, servletPathMap.size());
-    Assert.assertEquals("MyViewServlet", servletPathMap.keySet().iterator().next());
-    Assert.assertTrue(servletPathMap.values().iterator().next().equals(MyViewServlet.class));
-  }
-
-  @Test
-  public void testGetServletURLPatternMap() throws Exception {
-    ViewConfig config = getConfig();
-    Map<String, String> servletURLPatternMap = config.getServletURLPatternMap();
-
-    Assert.assertEquals(1, servletURLPatternMap.size());
-    Assert.assertEquals("MyViewServlet", servletURLPatternMap.keySet().iterator().next());
-    Assert.assertEquals("/ui", servletURLPatternMap.values().iterator().next());
-  }
-
   public static  ViewConfig getConfig() throws JAXBException {
       return getConfig(xml);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c337d7df/ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java
----------------------------------------------------------------------
diff --git a/ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java b/ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java
index b81fb09..cd684c3 100644
--- a/ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java
+++ b/ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java
@@ -26,6 +26,12 @@ import java.util.Map;
  * the current execution context.
  */
 public interface ViewContext {
+
+  /**
+   * Key for mapping a view context as a property.
+   */
+  public static final String CONTEXT_ATTRIBUTE = "ambari-view-context";
+
   /**
    * Get the current user name.
    *


Mime
View raw message