@Override
  public AmbariStreamProvider getAmbariClusterStreamProvider() {

    Long clusterHandle = viewInstanceEntity.getClusterHandle();
    ClusterType clusterType = viewInstanceEntity.getClusterType();

    AmbariStreamProvider clusterStreamProvider = null;

    if(clusterHandle != null && clusterType == ClusterType.LOCAL_AMBARI){

      clusterStreamProvider = getAmbariStreamProvider();

    } else if(clusterHandle != null && clusterType == ClusterType.REMOTE_AMBARI){

      clusterStreamProvider = viewRegistry.createRemoteAmbariStreamProvider(clusterHandle);

    }

    return clusterStreamProvider;
  }
Construct a view context from the given view entity.

@param viewEntity    the view entity
@param viewRegistry  the view registry
ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java