SlideShare ist ein Scribd-Unternehmen logo
1 von 32
AMBARI VIEWS
Ambari UX So Far…
Mostly for addressing “Operator” Concerns
Host went
down!
Disk is full!
Need to
tweak
configs
The
DataNodes
are down!
Need to
add hosts
Need to
secure
cluster
Need
NameNode
HA
Ambari UX So Far…
Some for addressing “Data Worker” Concerns
Hmm…why is
my query slow?
Across Hadoop…a whole bunch of
other UIs out there!
You may have used…
• Native UIs for various Hadoop ecosystem components:
MapReduce Job History, NameNode, ResourceManager,
HBase, Storm, Oozie, Falcon, etc.
• Hue
• Ambrose (Twitter)
• White Elephant (LinkedIn)
• Lipstick (Netflix)
• …and so on
!@#$
Ambari: Common UX for Hadoop
Provide a common, secure and pluggable
approach for UX across:
• Operators, System Admin
• Data Workers
• Application Developers
• …and others
Yay!
Yay!
Ambari Views: Goals
Single point of entry
✔ Common URL for common user communities
✔ “Views” embedded in Ambari UI
Pluggable UI Framework
✔ “Views” contributed and shared as plugins
✔ No code changes to the core
✔ Browse published Views and install
Ambari Views: Goals
Authorization
✔ Control who can access which views and which
aspects of views
✔ Deployment model supports connecting to different
LDAP/ADs by user community
Runs on Ambari Server
✔ No extra daemons needed
Runs Ambari “standalone”
✔ No need to deploy cluster via Ambari to use Views
Example Views
Operators
• Capacity Scheduler
Queue Manager
• YARN Resource Utilization
• Heatmaps
• HDFS / Hive Mirroring
Data Workers
• Pig Query Editor
• Hive Query Editor
• Workflow Design
• HDFS File Browser
• Hive/Tez
Visualization
Application Developers
• Job Visualization
• Streaming Topology Visualization
Views and the Framework
Views Framework
Views
Core to Ambari
Plugins to Ambari
Components of a View
VIEW
Client-side
assets
(.js, html)
AMBARI WEB
VIEW
Server-side
resources
(java)
AMBARI SERVER
{rest}
Hadoop
and other
systems
View Packaging
• View descriptor : view.xml
• Resource / Service classes : JAX-RS annotated
• UI classes : html, Servlets deployed as web app (WEB-INF/web.xml).
• Application logic : Supporting classes
• Dependencies : 3rd party jars or classes
├── WEB-INF
│ └── web.xml
├── org
│ └── apache
│ └── ambari
│ └── view
│ └── filebrowser
│ ├── DownloadService.class
│ ├── FileBrowserService.class
│ └── FileOperationService.class
└── view.xml
Page 11
View Versions + Instances
• Multiple versions of a View
• Multiple View Instances of each version
View Name
View
Instances
View
Versions
View
Versions
View
Instances
View
Instances
View
Instances
• View Context
– View and user information
• Instance Data
– Lightweight name/value (for prefs)
• Events
– Framework and Custom events
Framework Services
Client-Side Server-Side
ViewContext.getUsername()
ViewContext.getInstanceData()
ViewController.fireEvent()
View Events
• Server-side Framework and Custom events
onDeploy(), onCreate(), onDestroy()
Develop Deploy
Create
instances
Package
onDeploy() onCreate()
onDestroy()
Authentication
VIEW
AMBARI SERVER
Ambari
DB
LDAP
{rest}
<html>
User AuthN Source
User-Permission
Mapping
Authenticate
Provide principal
via ViewContext
Views Deployment
• Deploy Views as part of an operational Ambari Server
• Or deploy standalone “Ambari Views Server” for data
workers
Page 16
Ambari
Server
HADOOP
Store & Process
Ambari
Views
Server
Operators
manage the
cluster, may
have Views
deployed
Data Workers
use the cluster
and use the
Ambari Views
Server for
Views (no
agents)
Learn More
• Framework
https://github.com/apache/ambari/tree/trunk/ambari-views
https://github.com/apache/ambari/blob/trunk/ambari-
views/docs/index.md
• Framework Examples
https://github.com/apache/ambari/tree/trunk/ambari-
views/examples
• View Contribs
https://github.com/apache/ambari/tree/trunk/contrib/views
EXTRAS
Page 18
Š Hortonworks Inc. 2014
The Deployed View
Page 19
• Views are deployed by placing the view package in the
Ambari view folder.
• Once deployed, views and view instances are available
through the Ambari REST API.
GET http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/views/",
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER",
"ViewInfo" : {
"view_name" : "WEATHER"
}
}
]
}
Š Hortonworks Inc. 2014
View Descriptor : view.xml
Page 20
• name – the internal name of the view (must be unique)
• label – the public display name of the view
• version – the version of the view
• parameter – metadata about view instance properties
• resource – the names of the classes required to support a view
sub-resource
• instance – optional property sets which define view instances.
<view>
<name>MYVIEW</name>
<label>My View</label>
<version>1.0.0</version>
<parameter>
<name>scope</name>
<description>The scope of the instance.</description>
<required>true</required>
</parameter>
</view>
Š Hortonworks Inc. 2014
View Descriptor : parameter
Page 21
• Values for view parameters are given as properties when a
view instance is defined.
–name – the name of the parameter
–description – a brief description of the parameter
–required – indicates whether the parameter is required for instance
definition
<view>
…
<parameter>
<name>scope</name>
<description>The scope of the instance.</description>
<required>true</required>
</parameter>
<instance>
<name>GLOBAL_INSTANCE</name>
<property>
<key>scope</key>
<value>global</value>
</instance>
</view>
Š Hortonworks Inc. 2014
View Descriptor : instance
Page 22
• Values for view parameters are given as properties when
a view instance is defined.
• Multiple instance may be defined for a view.
–name – the name of the instance
–property– key / value pair. Name should match a view parameter.
<view>
…
<parameter>
<name>scope</name>
<description>The scope of the instance.</description>
<required>true</required>
</parameter>
<instance>
<name>GLOBAL_INSTANCE</name>
<property>
<key>scope</key>
<value>global</value>
</instance>
</view>
Š Hortonworks Inc. 2014
View Descriptor : resource
Page 23
• The defined resources of a view plug into the Ambari REST
API.
–name – the name of the resource
–plural-name – the plural name as represented in the API
–id-property – the identifying property of the resource
–resource-class – the JavaBean resource class
–provider-class – the ResourceProvider implementation
–service-class – the JAX-RS annotated resource service class
<view>
…
<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>
</view>
Š Hortonworks Inc. 2014
View Descriptor : resource
Page 24
A resource class can be any JavaBean. The resource
instances will be provided by an implementation of a
ResourceProvider, which is written by the view developer.
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;
}
…
}
Š Hortonworks Inc. 2014
View Descriptor : resource
Page 25
A resource provider class should implement
ResourceProvider. Note the injected ViewContext in the
following example…
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);
}
}
…
}
Š Hortonworks Inc. 2014
View Descriptor : resource
Page 26
A resource service class should be annotated with JAX-RS
annotations to handle service requests. Note the injected
ViewResourceHandler in the following example…
public class CityService {
@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);
}
…
}
Š Hortonworks Inc. 2014
View Descriptor : resource
Page 27
The defined resources of a view plug into the Ambari REST
API and are accessed through the given JAX-RS annotated
ResourceProvider implementation.
GET http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/versions/0.1.0/instances/US_WEST/
{
"ViewInstanceInfo" : {
"instance_name" : "US_WEST",
"view_name" : "WEATHER",
"properties" : {
"cities" : "Palo Alto, US;Los Angeles, US;Portland, US;Seattle, US",
"units" : "imperial"
}
},
"cities" : [
{
"href" : "http://….org:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Los Angeles, US",
"id" : "Los Angeles, US",
"instance_name" : "US_WEST”
},
{
"href" : "http://…:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US",
"id" : "Palo Alto, US",
"instance_name" : "US_WEST”
},…
Š Hortonworks Inc. 2014
View Interfaces: ViewContext
Page 28
• Available to the view components through injection.
• Provides access to the view and instance attributes.
• Provides access to Ambari configuration.
• Provides access to run time information about the current
execution context.
public interface ViewContext {
public String getUsername();
public String getViewName();
public String getInstanceName();
public Map<String, String> getProperties();
public String getAmbariProperty(String key);
public ResourceProvider<?> getResourceProvider(String type);
public URLStreamProvider getURLStreamProvider();
}
Š Hortonworks Inc. 2014
View Interfaces : ResourceProvider
Page 29
• Optional SPI.
• Only required if the view defines a resource that needs to be
plugged into the Ambari API framework.
• Used to monitor and manage view sub-resources through
CRUD operations.
• The view developer may choose not to support all operations.
public interface ResourceProvider<T> {
public T getResource(String resourceId, Set<String> properties);
public Set<T> getResources(ReadRequest request;
public void createResource(
String resourceId, Map<String, Object> properties;
public boolean updateResource(
String resourceId, Map<String, Object> properties;
public boolean deleteResource(String resourceId);
}
Š Hortonworks Inc. 2014
View UI
Page 30
• Optional.
• A view package may include a WEB-INF/web.xml so that
the view may be deployed as a web app.
<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>Weather Application</display-name>
<description>
This is the weather view application.
</description>
<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>
</web-app>
Š Hortonworks Inc. 2014
View UI
Page 31
• Servlet specified in web.xml.
• Note the use of the ViewContext in the following example
…
public class WeatherServlet extends HttpServlet {
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
{
…
PrintWriter writer = response.getWriter();
writer.println("<h1>" + viewContext.getInstanceName() + " Weather</h1>");
Š Hortonworks Inc. 2014
View UI
Page 32
• Access View UI.
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/versions/0.1.0/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"
}
},

Weitere ähnliche Inhalte

Was ist angesagt?

Apache Jackrabbit Oak on MongoDB
Apache Jackrabbit Oak on MongoDBApache Jackrabbit Oak on MongoDB
Apache Jackrabbit Oak on MongoDB
MongoDB
 
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018 클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
Amazon Web Services Korea
 

Was ist angesagt? (20)

Apache Ambari: Past, Present, Future
Apache Ambari: Past, Present, FutureApache Ambari: Past, Present, Future
Apache Ambari: Past, Present, Future
 
Securing Hadoop with Apache Ranger
Securing Hadoop with Apache RangerSecuring Hadoop with Apache Ranger
Securing Hadoop with Apache Ranger
 
Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3
 
Apache Ranger
Apache RangerApache Ranger
Apache Ranger
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Data Warehousing with Amazon Redshift
Data Warehousing with Amazon RedshiftData Warehousing with Amazon Redshift
Data Warehousing with Amazon Redshift
 
Apache Jackrabbit Oak on MongoDB
Apache Jackrabbit Oak on MongoDBApache Jackrabbit Oak on MongoDB
Apache Jackrabbit Oak on MongoDB
 
Kafka Retry and DLQ
Kafka Retry and DLQKafka Retry and DLQ
Kafka Retry and DLQ
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Tuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agentsTuning Apache Ambari performance for Big Data at scale with 3000 agents
Tuning Apache Ambari performance for Big Data at scale with 3000 agents
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018 클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
 
Apache Ambari Stack Extensibility
Apache Ambari Stack ExtensibilityApache Ambari Stack Extensibility
Apache Ambari Stack Extensibility
 
Managing your Hadoop Clusters with Apache Ambari
Managing your Hadoop Clusters with Apache AmbariManaging your Hadoop Clusters with Apache Ambari
Managing your Hadoop Clusters with Apache Ambari
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive
 
AWS Secrets Manager
AWS Secrets ManagerAWS Secrets Manager
AWS Secrets Manager
 
Heap Dump Analysis - AEM: Real World Issues
Heap Dump Analysis - AEM: Real World IssuesHeap Dump Analysis - AEM: Real World Issues
Heap Dump Analysis - AEM: Real World Issues
 
Overview of new features in Apache Ranger
Overview of new features in Apache RangerOverview of new features in Apache Ranger
Overview of new features in Apache Ranger
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 

Andere mochten auch

Ambari Meetup: Architecture and Demo
Ambari Meetup: Architecture and DemoAmbari Meetup: Architecture and Demo
Ambari Meetup: Architecture and Demo
Hortonworks
 
Managing Enterprise Hadoop Clusters with Apache Ambari
Managing Enterprise Hadoop Clusters with Apache AmbariManaging Enterprise Hadoop Clusters with Apache Ambari
Managing Enterprise Hadoop Clusters with Apache Ambari
Hortonworks
 
Storm: distributed and fault-tolerant realtime computation
Storm: distributed and fault-tolerant realtime computationStorm: distributed and fault-tolerant realtime computation
Storm: distributed and fault-tolerant realtime computation
nathanmarz
 
Realtime Analytics with Storm and Hadoop
Realtime Analytics with Storm and HadoopRealtime Analytics with Storm and Hadoop
Realtime Analytics with Storm and Hadoop
DataWorks Summit
 

Andere mochten auch (20)

Hortonworks SmartSense
Hortonworks SmartSenseHortonworks SmartSense
Hortonworks SmartSense
 
Apache Ambari: Managing Hadoop and YARN
Apache Ambari: Managing Hadoop and YARNApache Ambari: Managing Hadoop and YARN
Apache Ambari: Managing Hadoop and YARN
 
Discover HDP 2.1: Using Apache Ambari to Manage Hadoop Clusters
Discover HDP 2.1: Using Apache Ambari to Manage Hadoop Clusters Discover HDP 2.1: Using Apache Ambari to Manage Hadoop Clusters
Discover HDP 2.1: Using Apache Ambari to Manage Hadoop Clusters
 
Ambari Meetup: Architecture and Demo
Ambari Meetup: Architecture and DemoAmbari Meetup: Architecture and Demo
Ambari Meetup: Architecture and Demo
 
Managing your Hadoop Clusters with Ambari
Managing your Hadoop Clusters with AmbariManaging your Hadoop Clusters with Ambari
Managing your Hadoop Clusters with Ambari
 
Managing Apache HAWQ with Apache AMBARI
Managing Apache HAWQ with Apache AMBARIManaging Apache HAWQ with Apache AMBARI
Managing Apache HAWQ with Apache AMBARI
 
Real time trade surveillance in financial markets
Real time trade surveillance in financial marketsReal time trade surveillance in financial markets
Real time trade surveillance in financial markets
 
Hortonworks Technical Workshop: Apache Ambari
Hortonworks Technical Workshop:   Apache AmbariHortonworks Technical Workshop:   Apache Ambari
Hortonworks Technical Workshop: Apache Ambari
 
Managing Enterprise Hadoop Clusters with Apache Ambari
Managing Enterprise Hadoop Clusters with Apache AmbariManaging Enterprise Hadoop Clusters with Apache Ambari
Managing Enterprise Hadoop Clusters with Apache Ambari
 
Apache Ambari - What's New in 2.4
Apache Ambari - What's New in 2.4 Apache Ambari - What's New in 2.4
Apache Ambari - What's New in 2.4
 
Deploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARIDeploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARI
 
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsBest Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
 
How to Use Apache Zeppelin with HWX HDB
How to Use Apache Zeppelin with HWX HDBHow to Use Apache Zeppelin with HWX HDB
How to Use Apache Zeppelin with HWX HDB
 
Apache NiFi- MiNiFi meetup Slides
Apache NiFi- MiNiFi meetup SlidesApache NiFi- MiNiFi meetup Slides
Apache NiFi- MiNiFi meetup Slides
 
Resource Aware Scheduling in Apache Storm
Resource Aware Scheduling in Apache StormResource Aware Scheduling in Apache Storm
Resource Aware Scheduling in Apache Storm
 
Scaling Apache Storm - Strata + Hadoop World 2014
Scaling Apache Storm - Strata + Hadoop World 2014Scaling Apache Storm - Strata + Hadoop World 2014
Scaling Apache Storm - Strata + Hadoop World 2014
 
Storm: distributed and fault-tolerant realtime computation
Storm: distributed and fault-tolerant realtime computationStorm: distributed and fault-tolerant realtime computation
Storm: distributed and fault-tolerant realtime computation
 
Realtime Analytics with Storm and Hadoop
Realtime Analytics with Storm and HadoopRealtime Analytics with Storm and Hadoop
Realtime Analytics with Storm and Hadoop
 
Yahoo compares Storm and Spark
Yahoo compares Storm and SparkYahoo compares Storm and Spark
Yahoo compares Storm and Spark
 
Enabling the Real Time Analytical Enterprise
Enabling the Real Time Analytical EnterpriseEnabling the Real Time Analytical Enterprise
Enabling the Real Time Analytical Enterprise
 

Ähnlich wie Ambari Views - Overview

Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012 Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Atlassian
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
WO Community
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Vlad Savitsky
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
James Johnson
 

Ähnlich wie Ambari Views - Overview (20)

Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012 Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
 
What's new in the July 2017 Update for Dynamics 365 - Developer features
What's new in the July 2017 Update for Dynamics 365 - Developer featuresWhat's new in the July 2017 Update for Dynamics 365 - Developer features
What's new in the July 2017 Update for Dynamics 365 - Developer features
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RS
 
Advanced #6 clean architecture
Advanced #6  clean architectureAdvanced #6  clean architecture
Advanced #6 clean architecture
 
RESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services FrameworkRESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services Framework
 
Infrastructure as code terraformujeme cloud
Infrastructure as code   terraformujeme cloudInfrastructure as code   terraformujeme cloud
Infrastructure as code terraformujeme cloud
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides
 
Cross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with EclipseCross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with Eclipse
 
Spring 3 - Der dritte FrĂźhling
Spring 3 - Der dritte FrĂźhlingSpring 3 - Der dritte FrĂźhling
Spring 3 - Der dritte FrĂźhling
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
Build A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON APIBuild A Killer Client For Your REST+JSON API
Build A Killer Client For Your REST+JSON API
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 

Mehr von Hortonworks

Mehr von Hortonworks (20)

Hortonworks DataFlow (HDF) 3.3 - Taking Stream Processing to the Next Level
Hortonworks DataFlow (HDF) 3.3 - Taking Stream Processing to the Next LevelHortonworks DataFlow (HDF) 3.3 - Taking Stream Processing to the Next Level
Hortonworks DataFlow (HDF) 3.3 - Taking Stream Processing to the Next Level
 
IoT Predictions for 2019 and Beyond: Data at the Heart of Your IoT Strategy
IoT Predictions for 2019 and Beyond: Data at the Heart of Your IoT StrategyIoT Predictions for 2019 and Beyond: Data at the Heart of Your IoT Strategy
IoT Predictions for 2019 and Beyond: Data at the Heart of Your IoT Strategy
 
Getting the Most Out of Your Data in the Cloud with Cloudbreak
Getting the Most Out of Your Data in the Cloud with CloudbreakGetting the Most Out of Your Data in the Cloud with Cloudbreak
Getting the Most Out of Your Data in the Cloud with Cloudbreak
 
Johns Hopkins - Using Hadoop to Secure Access Log Events
Johns Hopkins - Using Hadoop to Secure Access Log EventsJohns Hopkins - Using Hadoop to Secure Access Log Events
Johns Hopkins - Using Hadoop to Secure Access Log Events
 
Catch a Hacker in Real-Time: Live Visuals of Bots and Bad Guys
Catch a Hacker in Real-Time: Live Visuals of Bots and Bad GuysCatch a Hacker in Real-Time: Live Visuals of Bots and Bad Guys
Catch a Hacker in Real-Time: Live Visuals of Bots and Bad Guys
 
HDF 3.2 - What's New
HDF 3.2 - What's NewHDF 3.2 - What's New
HDF 3.2 - What's New
 
Curing Kafka Blindness with Hortonworks Streams Messaging Manager
Curing Kafka Blindness with Hortonworks Streams Messaging ManagerCuring Kafka Blindness with Hortonworks Streams Messaging Manager
Curing Kafka Blindness with Hortonworks Streams Messaging Manager
 
Interpretation Tool for Genomic Sequencing Data in Clinical Environments
Interpretation Tool for Genomic Sequencing Data in Clinical EnvironmentsInterpretation Tool for Genomic Sequencing Data in Clinical Environments
Interpretation Tool for Genomic Sequencing Data in Clinical Environments
 
IBM+Hortonworks = Transformation of the Big Data Landscape
IBM+Hortonworks = Transformation of the Big Data LandscapeIBM+Hortonworks = Transformation of the Big Data Landscape
IBM+Hortonworks = Transformation of the Big Data Landscape
 
Premier Inside-Out: Apache Druid
Premier Inside-Out: Apache DruidPremier Inside-Out: Apache Druid
Premier Inside-Out: Apache Druid
 
Accelerating Data Science and Real Time Analytics at Scale
Accelerating Data Science and Real Time Analytics at ScaleAccelerating Data Science and Real Time Analytics at Scale
Accelerating Data Science and Real Time Analytics at Scale
 
TIME SERIES: APPLYING ADVANCED ANALYTICS TO INDUSTRIAL PROCESS DATA
TIME SERIES: APPLYING ADVANCED ANALYTICS TO INDUSTRIAL PROCESS DATATIME SERIES: APPLYING ADVANCED ANALYTICS TO INDUSTRIAL PROCESS DATA
TIME SERIES: APPLYING ADVANCED ANALYTICS TO INDUSTRIAL PROCESS DATA
 
Blockchain with Machine Learning Powered by Big Data: Trimble Transportation ...
Blockchain with Machine Learning Powered by Big Data: Trimble Transportation ...Blockchain with Machine Learning Powered by Big Data: Trimble Transportation ...
Blockchain with Machine Learning Powered by Big Data: Trimble Transportation ...
 
Delivering Real-Time Streaming Data for Healthcare Customers: Clearsense
Delivering Real-Time Streaming Data for Healthcare Customers: ClearsenseDelivering Real-Time Streaming Data for Healthcare Customers: Clearsense
Delivering Real-Time Streaming Data for Healthcare Customers: Clearsense
 
Making Enterprise Big Data Small with Ease
Making Enterprise Big Data Small with EaseMaking Enterprise Big Data Small with Ease
Making Enterprise Big Data Small with Ease
 
Webinewbie to Webinerd in 30 Days - Webinar World Presentation
Webinewbie to Webinerd in 30 Days - Webinar World PresentationWebinewbie to Webinerd in 30 Days - Webinar World Presentation
Webinewbie to Webinerd in 30 Days - Webinar World Presentation
 
Driving Digital Transformation Through Global Data Management
Driving Digital Transformation Through Global Data ManagementDriving Digital Transformation Through Global Data Management
Driving Digital Transformation Through Global Data Management
 
HDF 3.1 pt. 2: A Technical Deep-Dive on New Streaming Features
HDF 3.1 pt. 2: A Technical Deep-Dive on New Streaming FeaturesHDF 3.1 pt. 2: A Technical Deep-Dive on New Streaming Features
HDF 3.1 pt. 2: A Technical Deep-Dive on New Streaming Features
 
Hortonworks DataFlow (HDF) 3.1 - Redefining Data-In-Motion with Modern Data A...
Hortonworks DataFlow (HDF) 3.1 - Redefining Data-In-Motion with Modern Data A...Hortonworks DataFlow (HDF) 3.1 - Redefining Data-In-Motion with Modern Data A...
Hortonworks DataFlow (HDF) 3.1 - Redefining Data-In-Motion with Modern Data A...
 
Unlock Value from Big Data with Apache NiFi and Streaming CDC
Unlock Value from Big Data with Apache NiFi and Streaming CDCUnlock Value from Big Data with Apache NiFi and Streaming CDC
Unlock Value from Big Data with Apache NiFi and Streaming CDC
 

KĂźrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂźrzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Ambari Views - Overview

  • 2. Ambari UX So Far… Mostly for addressing “Operator” Concerns Host went down! Disk is full! Need to tweak configs The DataNodes are down! Need to add hosts Need to secure cluster Need NameNode HA
  • 3. Ambari UX So Far… Some for addressing “Data Worker” Concerns Hmm…why is my query slow?
  • 4. Across Hadoop…a whole bunch of other UIs out there! You may have used… • Native UIs for various Hadoop ecosystem components: MapReduce Job History, NameNode, ResourceManager, HBase, Storm, Oozie, Falcon, etc. • Hue • Ambrose (Twitter) • White Elephant (LinkedIn) • Lipstick (Netflix) • …and so on !@#$
  • 5. Ambari: Common UX for Hadoop Provide a common, secure and pluggable approach for UX across: • Operators, System Admin • Data Workers • Application Developers • …and others Yay! Yay!
  • 6. Ambari Views: Goals Single point of entry ✔ Common URL for common user communities ✔ “Views” embedded in Ambari UI Pluggable UI Framework ✔ “Views” contributed and shared as plugins ✔ No code changes to the core ✔ Browse published Views and install
  • 7. Ambari Views: Goals Authorization ✔ Control who can access which views and which aspects of views ✔ Deployment model supports connecting to different LDAP/ADs by user community Runs on Ambari Server ✔ No extra daemons needed Runs Ambari “standalone” ✔ No need to deploy cluster via Ambari to use Views
  • 8. Example Views Operators • Capacity Scheduler Queue Manager • YARN Resource Utilization • Heatmaps • HDFS / Hive Mirroring Data Workers • Pig Query Editor • Hive Query Editor • Workflow Design • HDFS File Browser • Hive/Tez Visualization Application Developers • Job Visualization • Streaming Topology Visualization
  • 9. Views and the Framework Views Framework Views Core to Ambari Plugins to Ambari
  • 10. Components of a View VIEW Client-side assets (.js, html) AMBARI WEB VIEW Server-side resources (java) AMBARI SERVER {rest} Hadoop and other systems
  • 11. View Packaging • View descriptor : view.xml • Resource / Service classes : JAX-RS annotated • UI classes : html, Servlets deployed as web app (WEB-INF/web.xml). • Application logic : Supporting classes • Dependencies : 3rd party jars or classes ├── WEB-INF │ └── web.xml ├── org │ └── apache │ └── ambari │ └── view │ └── filebrowser │ ├── DownloadService.class │ ├── FileBrowserService.class │ └── FileOperationService.class └── view.xml Page 11
  • 12. View Versions + Instances • Multiple versions of a View • Multiple View Instances of each version View Name View Instances View Versions View Versions View Instances View Instances View Instances
  • 13. • View Context – View and user information • Instance Data – Lightweight name/value (for prefs) • Events – Framework and Custom events Framework Services Client-Side Server-Side ViewContext.getUsername() ViewContext.getInstanceData() ViewController.fireEvent()
  • 14. View Events • Server-side Framework and Custom events onDeploy(), onCreate(), onDestroy() Develop Deploy Create instances Package onDeploy() onCreate() onDestroy()
  • 15. Authentication VIEW AMBARI SERVER Ambari DB LDAP {rest} <html> User AuthN Source User-Permission Mapping Authenticate Provide principal via ViewContext
  • 16. Views Deployment • Deploy Views as part of an operational Ambari Server • Or deploy standalone “Ambari Views Server” for data workers Page 16 Ambari Server HADOOP Store & Process Ambari Views Server Operators manage the cluster, may have Views deployed Data Workers use the cluster and use the Ambari Views Server for Views (no agents)
  • 17. Learn More • Framework https://github.com/apache/ambari/tree/trunk/ambari-views https://github.com/apache/ambari/blob/trunk/ambari- views/docs/index.md • Framework Examples https://github.com/apache/ambari/tree/trunk/ambari- views/examples • View Contribs https://github.com/apache/ambari/tree/trunk/contrib/views
  • 19. Š Hortonworks Inc. 2014 The Deployed View Page 19 • Views are deployed by placing the view package in the Ambari view folder. • Once deployed, views and view instances are available through the Ambari REST API. GET http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/ { "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/", "items" : [ { "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER", "ViewInfo" : { "view_name" : "WEATHER" } } ] }
  • 20. Š Hortonworks Inc. 2014 View Descriptor : view.xml Page 20 • name – the internal name of the view (must be unique) • label – the public display name of the view • version – the version of the view • parameter – metadata about view instance properties • resource – the names of the classes required to support a view sub-resource • instance – optional property sets which define view instances. <view> <name>MYVIEW</name> <label>My View</label> <version>1.0.0</version> <parameter> <name>scope</name> <description>The scope of the instance.</description> <required>true</required> </parameter> </view>
  • 21. Š Hortonworks Inc. 2014 View Descriptor : parameter Page 21 • Values for view parameters are given as properties when a view instance is defined. –name – the name of the parameter –description – a brief description of the parameter –required – indicates whether the parameter is required for instance definition <view> … <parameter> <name>scope</name> <description>The scope of the instance.</description> <required>true</required> </parameter> <instance> <name>GLOBAL_INSTANCE</name> <property> <key>scope</key> <value>global</value> </instance> </view>
  • 22. Š Hortonworks Inc. 2014 View Descriptor : instance Page 22 • Values for view parameters are given as properties when a view instance is defined. • Multiple instance may be defined for a view. –name – the name of the instance –property– key / value pair. Name should match a view parameter. <view> … <parameter> <name>scope</name> <description>The scope of the instance.</description> <required>true</required> </parameter> <instance> <name>GLOBAL_INSTANCE</name> <property> <key>scope</key> <value>global</value> </instance> </view>
  • 23. Š Hortonworks Inc. 2014 View Descriptor : resource Page 23 • The defined resources of a view plug into the Ambari REST API. –name – the name of the resource –plural-name – the plural name as represented in the API –id-property – the identifying property of the resource –resource-class – the JavaBean resource class –provider-class – the ResourceProvider implementation –service-class – the JAX-RS annotated resource service class <view> … <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> </view>
  • 24. Š Hortonworks Inc. 2014 View Descriptor : resource Page 24 A resource class can be any JavaBean. The resource instances will be provided by an implementation of a ResourceProvider, which is written by the view developer. 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; } … }
  • 25. Š Hortonworks Inc. 2014 View Descriptor : resource Page 25 A resource provider class should implement ResourceProvider. Note the injected ViewContext in the following example… 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); } } … }
  • 26. Š Hortonworks Inc. 2014 View Descriptor : resource Page 26 A resource service class should be annotated with JAX-RS annotations to handle service requests. Note the injected ViewResourceHandler in the following example… public class CityService { @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); } … }
  • 27. Š Hortonworks Inc. 2014 View Descriptor : resource Page 27 The defined resources of a view plug into the Ambari REST API and are accessed through the given JAX-RS annotated ResourceProvider implementation. GET http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/versions/0.1.0/instances/US_WEST/ { "ViewInstanceInfo" : { "instance_name" : "US_WEST", "view_name" : "WEATHER", "properties" : { "cities" : "Palo Alto, US;Los Angeles, US;Portland, US;Seattle, US", "units" : "imperial" } }, "cities" : [ { "href" : "http://….org:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Los Angeles, US", "id" : "Los Angeles, US", "instance_name" : "US_WEST” }, { "href" : "http://…:8080/api/v1/views/WEATHER/instances/US_WEST/cities/Palo Alto, US", "id" : "Palo Alto, US", "instance_name" : "US_WEST” },…
  • 28. Š Hortonworks Inc. 2014 View Interfaces: ViewContext Page 28 • Available to the view components through injection. • Provides access to the view and instance attributes. • Provides access to Ambari configuration. • Provides access to run time information about the current execution context. public interface ViewContext { public String getUsername(); public String getViewName(); public String getInstanceName(); public Map<String, String> getProperties(); public String getAmbariProperty(String key); public ResourceProvider<?> getResourceProvider(String type); public URLStreamProvider getURLStreamProvider(); }
  • 29. Š Hortonworks Inc. 2014 View Interfaces : ResourceProvider Page 29 • Optional SPI. • Only required if the view defines a resource that needs to be plugged into the Ambari API framework. • Used to monitor and manage view sub-resources through CRUD operations. • The view developer may choose not to support all operations. public interface ResourceProvider<T> { public T getResource(String resourceId, Set<String> properties); public Set<T> getResources(ReadRequest request; public void createResource( String resourceId, Map<String, Object> properties; public boolean updateResource( String resourceId, Map<String, Object> properties; public boolean deleteResource(String resourceId); }
  • 30. Š Hortonworks Inc. 2014 View UI Page 30 • Optional. • A view package may include a WEB-INF/web.xml so that the view may be deployed as a web app. <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>Weather Application</display-name> <description> This is the weather view application. </description> <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> </web-app>
  • 31. Š Hortonworks Inc. 2014 View UI Page 31 • Servlet specified in web.xml. • Note the use of the ViewContext in the following example … public class WeatherServlet extends HttpServlet { 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 { … PrintWriter writer = response.getWriter(); writer.println("<h1>" + viewContext.getInstanceName() + " Weather</h1>");
  • 32. Š Hortonworks Inc. 2014 View UI Page 32 • Access View UI. { "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/WEATHER/versions/0.1.0/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" } },