Search in sources :

Example 16 with Component

use of com.hortonworks.streamline.streams.cluster.catalog.Component in project streamline by hortonworks.

the class EnvironmentService method getComponent.

public Component getComponent(Long componentId) {
    Component component = new Component();
    component.setId(componentId);
    return this.dao.get(new StorableKey(COMPONENT_NAMESPACE, component.getPrimaryKey()));
}
Also used : StorableKey(com.hortonworks.registries.storage.StorableKey) Component(com.hortonworks.streamline.streams.cluster.catalog.Component)

Example 17 with Component

use of com.hortonworks.streamline.streams.cluster.catalog.Component in project streamline by hortonworks.

the class ClusterResourceUtil method enrichCluster.

public static ClusterServicesImportResult enrichCluster(Cluster cluster, EnvironmentService environmentService) {
    ClusterServicesImportResult result = new ClusterServicesImportResult(cluster);
    for (Service service : environmentService.listServices(cluster.getId())) {
        Collection<ServiceConfiguration> configurations = environmentService.listServiceConfigurations(service.getId());
        Collection<Component> components = environmentService.listComponents(service.getId());
        ServiceWithComponents s = new ServiceWithComponents(service);
        s.setComponents(components);
        s.setConfigurations(configurations);
        result.addService(s);
    }
    return result;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) EnvironmentService(com.hortonworks.streamline.streams.cluster.service.EnvironmentService) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ServiceWithComponents(com.hortonworks.streamline.streams.cluster.model.ServiceWithComponents)

Example 18 with Component

use of com.hortonworks.streamline.streams.cluster.catalog.Component in project streamline by hortonworks.

the class KafkaServiceRegistrar method createKafkaBrokerComponent.

private Pair<Component, List<ComponentProcess>> createKafkaBrokerComponent(Config config, Map<String, String> flattenConfigMap) {
    if (!config.contains(PARAM_LISTENERS)) {
        throw new IllegalArgumentException("Required parameter " + PARAM_LISTENERS + " not present.");
    }
    Map<String, String> confMap = new HashMap<>();
    confMap.put(PARAM_LISTENERS, config.getString(PARAM_LISTENERS));
    Component kafkaBroker = new Component();
    kafkaBroker.setName(COMPONENT_KAFKA_BROKER);
    List<KafkaBrokerListeners.ListenersPropEntry> parsedProps = new KafkaBrokerListeners.ListenersPropParsed(confMap).getParsedProps();
    List<ComponentProcess> componentProcesses = parsedProps.stream().map(propEntry -> {
        ComponentProcess cp = new ComponentProcess();
        cp.setHost(propEntry.getHost());
        cp.setPort(propEntry.getPort());
        cp.setProtocol(propEntry.getProtocol().name());
        return cp;
    }).collect(toList());
    return new Pair<>(kafkaBroker, componentProcesses);
}
Also used : Config(com.hortonworks.streamline.common.Config) ComponentPropertyPattern(com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern) Pair(org.apache.commons.math3.util.Pair) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) HashMap(java.util.HashMap) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) Constants(com.hortonworks.streamline.streams.cluster.Constants) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Lists(com.google.common.collect.Lists) ServiceConfigurations(com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations) KafkaBrokerListeners(com.hortonworks.streamline.streams.cluster.service.metadata.json.KafkaBrokerListeners) ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Map(java.util.Map) HashMap(java.util.HashMap) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) KafkaBrokerListeners(com.hortonworks.streamline.streams.cluster.service.metadata.json.KafkaBrokerListeners) Pair(org.apache.commons.math3.util.Pair)

Example 19 with Component

use of com.hortonworks.streamline.streams.cluster.catalog.Component in project streamline by hortonworks.

the class StormServiceRegistrar method createNimbusComponent.

private Pair<Component, List<ComponentProcess>> createNimbusComponent(Config config, Map<String, String> flatConfigMap) {
    if (!config.contains(PARAM_NIMBUS_SEEDS)) {
        throw new IllegalArgumentException("Required parameter " + PARAM_NIMBUS_SEEDS + " not present.");
    }
    if (!config.contains(PARAM_NIMBUS_THRIFT_PORT)) {
        throw new IllegalArgumentException("Required parameter " + PARAM_NIMBUS_THRIFT_PORT + " not present.");
    }
    String nimbusSeeds;
    try {
        nimbusSeeds = config.getString(PARAM_NIMBUS_SEEDS);
    } catch (ClassCastException e) {
        throw new IllegalArgumentException("Required parameter " + PARAM_NIMBUS_SEEDS + " should be a string.");
    }
    Number nimbusThriftPort = readNumberFromConfig(config, PARAM_NIMBUS_THRIFT_PORT);
    Component nimbus = new Component();
    nimbus.setName(COMPONENT_NIMBUS);
    List<ComponentProcess> componentProcesses = Arrays.stream(nimbusSeeds.split(",")).map(nimbusHost -> {
        ComponentProcess cp = new ComponentProcess();
        cp.setHost(nimbusHost);
        cp.setPort(nimbusThriftPort.intValue());
        return cp;
    }).collect(toList());
    return new Pair<>(nimbus, componentProcesses);
}
Also used : Config(com.hortonworks.streamline.common.Config) ComponentPropertyPattern(com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern) Arrays(java.util.Arrays) Pair(org.apache.commons.math3.util.Pair) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) HashMap(java.util.HashMap) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) Constants(com.hortonworks.streamline.streams.cluster.Constants) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Lists(com.google.common.collect.Lists) ServiceConfigurations(com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations) ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Map(java.util.Map) Collections(java.util.Collections) Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) Pair(org.apache.commons.math3.util.Pair)

Example 20 with Component

use of com.hortonworks.streamline.streams.cluster.catalog.Component in project streamline by hortonworks.

the class StormServiceRegistrar method createStormUIServerComponent.

private Pair<Component, List<ComponentProcess>> createStormUIServerComponent(Config config, Map<String, String> flattenConfigMap) {
    if (!config.contains(PARAM_UI_HOST)) {
        throw new IllegalArgumentException("Required parameter " + PARAM_UI_HOST + " not present.");
    }
    if (!config.contains(PARAM_UI_PORT)) {
        throw new IllegalArgumentException("Required parameter " + PARAM_UI_PORT + " not present.");
    }
    String stormUiServerHost;
    try {
        stormUiServerHost = config.getString(PARAM_UI_HOST);
    } catch (ClassCastException e) {
        throw new IllegalArgumentException("Required parameter " + PARAM_UI_HOST + " should be a string.");
    }
    Number stormUiServerPort = readNumberFromConfig(config, PARAM_UI_PORT);
    Component stormUiServer = new Component();
    stormUiServer.setName(COMPONENT_STORM_UI_SERVER);
    ComponentProcess uiProcess = new ComponentProcess();
    uiProcess.setHost(stormUiServerHost);
    uiProcess.setPort(stormUiServerPort.intValue());
    return new Pair<>(stormUiServer, Collections.singletonList(uiProcess));
}
Also used : Component(com.hortonworks.streamline.streams.cluster.catalog.Component) ComponentProcess(com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess) Pair(org.apache.commons.math3.util.Pair)

Aggregations

Component (com.hortonworks.streamline.streams.cluster.catalog.Component)28 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)15 Service (com.hortonworks.streamline.streams.cluster.catalog.Service)13 ServiceConfiguration (com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)11 EnvironmentService (com.hortonworks.streamline.streams.cluster.service.EnvironmentService)10 Config (com.hortonworks.streamline.common.Config)7 ComponentPropertyPattern (com.hortonworks.streamline.streams.cluster.discovery.ambari.ComponentPropertyPattern)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Timed (com.codahale.metrics.annotation.Timed)5 Constants (com.hortonworks.streamline.streams.cluster.Constants)5 Cluster (com.hortonworks.streamline.streams.cluster.catalog.Cluster)5 List (java.util.List)5 Path (javax.ws.rs.Path)5 ServiceConfigurations (com.hortonworks.streamline.streams.cluster.discovery.ambari.ServiceConfigurations)4 Collections (java.util.Collections)4 Pair (org.apache.commons.math3.util.Pair)4 Test (org.junit.Test)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3