Search in sources :

Example 1 with ServiceComponentNotFoundException

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());
}
Also used : ServiceComponentNotFoundException(com.hortonworks.streamline.streams.cluster.exception.ServiceComponentNotFoundException) EnvironmentService(com.hortonworks.streamline.streams.cluster.service.EnvironmentService) ComponentPropertyPattern(com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern) List(java.util.List) ServiceConfigurations(com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations) Collection(java.util.Collection) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) HostPort(com.hortonworks.streamline.streams.cluster.service.metadata.common.HostPort) ServiceNotFoundException(com.hortonworks.streamline.streams.cluster.exception.ServiceNotFoundException) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) Collectors(java.util.stream.Collectors) ServiceComponentNotFoundException(com.hortonworks.streamline.streams.cluster.exception.ServiceComponentNotFoundException) ServiceNotFoundException(com.hortonworks.streamline.streams.cluster.exception.ServiceNotFoundException) HostPort(com.hortonworks.streamline.streams.cluster.service.metadata.common.HostPort) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)

Aggregations

Component (com.hortonworks.streamline.streams.cluster.catalog.Component)1 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)1 ComponentPropertyPattern (com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern)1 ServiceConfigurations (com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations)1 ServiceComponentNotFoundException (com.hortonworks.streamline.streams.cluster.exception.ServiceComponentNotFoundException)1 ServiceNotFoundException (com.hortonworks.streamline.streams.cluster.exception.ServiceNotFoundException)1 EnvironmentService (com.hortonworks.streamline.streams.cluster.service.EnvironmentService)1 HostPort (com.hortonworks.streamline.streams.cluster.service.metadata.common.HostPort)1 Collection (java.util.Collection)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1