This module provides common utils for views


  • Ambari 2.1.0 or later

HDFS Utility

HdfsApi class provides business delegate for HDFS client that provides proxyuser configuration. You can create the HdfsApi based on your ViewContext:

HdfsApi api = HdfsUtil.connectToHDFSApi(viewContext);

It will read instance properties and create HdfsApi configured to specific cluster. NameNodes HA is supported.


AmbariApi provides methods to get Ambari configurations and cluster topology.

Custer association functionality:

AmbariApi api = new AmbariApi(viewContext);
Cluster cluster = api.getCluster();

It can work with local cluster or with remote cluster based on your instance properties of Ambari URL, username and password in the ViewContext. To determine if you have associated cluster, either local or remote:

boolean isAssociated = api.isClusterAssociated();

Also provides the API to get cluster topology:

List<String> nnHosts = api.getHostsWithComponent("NAMENODE");