use of com.hortonworks.streamline.streams.cluster.exception.ClusterNotFoundException in project streamline by hortonworks.
the class AbstractBundleHintProvider method provide.
@Override
public Map<Long, BundleHintsResponse> provide(Namespace namespace, SecurityContext securityContext, Subject subject) {
Map<Long, BundleHintsResponse> hintMap = new HashMap<>();
Collection<NamespaceServiceClusterMap> serviceMappings = environmentService.listServiceClusterMapping(namespace.getId(), getServiceName());
for (NamespaceServiceClusterMap mapping : serviceMappings) {
Long clusterId = mapping.getClusterId();
Cluster cluster = environmentService.getCluster(clusterId);
if (cluster == null) {
throw new RuntimeException(new ClusterNotFoundException(clusterId));
}
BundleHintsResponse response = new BundleHintsResponse(cluster, getHintsOnCluster(cluster, securityContext, subject));
hintMap.put(clusterId, response);
}
return hintMap;
}
use of com.hortonworks.streamline.streams.cluster.exception.ClusterNotFoundException in project streamline by hortonworks.
the class AbstractSecureBundleHintProvider method provide.
@Override
public Map<Long, BundleHintsResponse> provide(Namespace namespace, SecurityContext securityContext, Subject subject) {
Map<Long, BundleHintsResponse> hintMap = new HashMap<>();
Collection<NamespaceServiceClusterMap> serviceMappings = environmentService.listServiceClusterMapping(namespace.getId(), getServiceName());
for (NamespaceServiceClusterMap mapping : serviceMappings) {
Long clusterId = mapping.getClusterId();
Cluster cluster = environmentService.getCluster(clusterId);
if (cluster == null) {
throw new RuntimeException(new ClusterNotFoundException(clusterId));
}
BundleHintsResponse response = new SecureBundleHintsResponse(cluster, getSecurity(cluster, securityContext, subject), getHintsOnCluster(cluster, securityContext, subject));
hintMap.put(clusterId, response);
}
return hintMap;
}
Aggregations