use of com.hortonworks.streamline.streams.cluster.exception.ServiceComponentNotFoundException in project streamline by hortonworks.
the class ZookeeperMetadataService method getZookeeperServers.
public List<HostPort> getZookeeperServers() throws ServiceNotFoundException, ServiceComponentNotFoundException {
final Long serviceId = environmentService.getServiceIdByName(clusterId, STREAMS_JSON_SCHEMA_SERVICE_ZOOKEEPER);
if (serviceId == null) {
throw new ServiceNotFoundException(clusterId, ServiceConfigurations.ZOOKEEPER.name());
}
final Component zookeeperServer = environmentService.getComponentByName(serviceId, STREAMS_JSON_SCHEMA_COMPONENT_ZOOKEEPER_SERVER);
if (zookeeperServer == null) {
throw new ServiceComponentNotFoundException(clusterId, ServiceConfigurations.STORM.name(), ComponentPropertyPattern.ZOOKEEPER_SERVER.name());
}
final Collection<ComponentProcess> zookeeperServers = environmentService.listComponentProcesses(zookeeperServer.getId());
return zookeeperServers.stream().map(cp -> new HostPort(cp.getHost(), cp.getPort())).collect(Collectors.toList());
}
Aggregations