Search in sources :

Example 26 with ServiceConfiguration

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

the class KafkaServiceRegistrar method buildServerPropertiesServiceConfiguration.

private ServiceConfiguration buildServerPropertiesServiceConfiguration(Config config) {
    ServiceConfiguration serverProperties = new ServiceConfiguration();
    serverProperties.setName(CONFIG_SERVER_PROPERTIES);
    Map<String, String> confMap = new HashMap<>();
    if (config.contains(PARAM_ZOOKEEPER_CONNECT)) {
        confMap.put(PARAM_ZOOKEEPER_CONNECT, config.getString(PARAM_ZOOKEEPER_CONNECT));
    }
    if (config.contains(PARAM_SECURITY_INTER_BROKER_PROTOCOL)) {
        confMap.put(PARAM_SECURITY_INTER_BROKER_PROTOCOL, config.getString(PARAM_SECURITY_INTER_BROKER_PROTOCOL));
    }
    try {
        String json = objectMapper.writeValueAsString(confMap);
        serverProperties.setConfiguration(json);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
    return serverProperties;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 27 with ServiceConfiguration

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

the class KafkaServiceRegistrar method buildKafkaEnvServiceConfiguration.

private ServiceConfiguration buildKafkaEnvServiceConfiguration(Config config) {
    ServiceConfiguration serverProperties = new ServiceConfiguration();
    serverProperties.setName(CONFIG_KAFKA_ENV);
    Map<String, String> confMap = new HashMap<>();
    try {
        String json = objectMapper.writeValueAsString(confMap);
        serverProperties.setConfiguration(json);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
    return serverProperties;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 28 with ServiceConfiguration

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

the class StormServiceRegistrar method buildStormServiceConfiguration.

private ServiceConfiguration buildStormServiceConfiguration(Config config) {
    ServiceConfiguration storm = new ServiceConfiguration();
    storm.setName(CONF_STORM);
    Map<String, String> confMap = new HashMap<>();
    if (config.contains(PARAM_NIMBUS_THRIFT_MAX_BUFFER_SIZE)) {
        Number thriftMaxBufferSize = readNumberFromConfig(config, PARAM_NIMBUS_THRIFT_MAX_BUFFER_SIZE);
        confMap.put(PARAM_NIMBUS_THRIFT_MAX_BUFFER_SIZE, String.valueOf(thriftMaxBufferSize));
    }
    if (config.contains(PARAM_THRIFT_TRANSPORT)) {
        confMap.put(PARAM_THRIFT_TRANSPORT, config.getString(PARAM_THRIFT_TRANSPORT));
    }
    if (config.contains(PARAM_PRINCIPAL_TO_LOCAL)) {
        confMap.put(PARAM_PRINCIPAL_TO_LOCAL, config.getString(PARAM_PRINCIPAL_TO_LOCAL));
    }
    try {
        String json = objectMapper.writeValueAsString(confMap);
        storm.setConfiguration(json);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
    return storm;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 29 with ServiceConfiguration

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

the class ZookeeperServiceRegistrar method buildZooCfgServiceConfiguration.

private ServiceConfiguration buildZooCfgServiceConfiguration(Config config) {
    ServiceConfiguration zooCfg = new ServiceConfiguration();
    zooCfg.setName(CONFIG_ZOO_CFG);
    Map<String, String> confMap = new HashMap<>();
    if (config.contains(PARAM_ZOOKEEPER_PORT)) {
        Number zookeeperPort = config.getAny(PARAM_ZOOKEEPER_PORT);
        confMap.put(PARAM_ZOOKEEPER_PORT, String.valueOf(zookeeperPort));
    }
    try {
        String json = objectMapper.writeValueAsString(confMap);
        zooCfg.setConfiguration(json);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
    return zooCfg;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 30 with ServiceConfiguration

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

the class HBaseServiceRegistrarTest method testRegister.

@Test
public void testRegister() throws Exception {
    Cluster cluster = getTestCluster(1L);
    HBaseServiceRegistrar registrar = initializeServiceRegistrar();
    try (InputStream is = getClass().getClassLoader().getResourceAsStream(HBASE_SITE_XML_FILE_PATH)) {
        ManualServiceRegistrar.ConfigFileInfo hiveSiteXml = new ManualServiceRegistrar.ConfigFileInfo(HBASE_SITE_XML, is);
        registrar.register(cluster, new Config(), Lists.newArrayList(hiveSiteXml));
    }
    Service hbaseService = environmentService.getServiceByName(cluster.getId(), Constants.HBase.SERVICE_NAME);
    assertNotNull(hbaseService);
    ServiceConfiguration hbaseSiteConf = environmentService.getServiceConfigurationByName(hbaseService.getId(), CONFIGURATION_NAME_HBASE_SITE);
    assertNotNull(hbaseSiteConf);
}
Also used : ManualServiceRegistrar(com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar) ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) InputStream(java.io.InputStream) Config(com.hortonworks.streamline.common.Config) Cluster(com.hortonworks.streamline.streams.cluster.catalog.Cluster) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) Test(org.junit.Test)

Aggregations

ServiceConfiguration (com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)40 Service (com.hortonworks.streamline.streams.cluster.catalog.Service)21 Cluster (com.hortonworks.streamline.streams.cluster.catalog.Cluster)14 Test (org.junit.Test)13 HashMap (java.util.HashMap)12 Config (com.hortonworks.streamline.common.Config)11 EnvironmentService (com.hortonworks.streamline.streams.cluster.service.EnvironmentService)9 Component (com.hortonworks.streamline.streams.cluster.catalog.Component)8 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)7 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)5 Map (java.util.Map)5 Timed (com.codahale.metrics.annotation.Timed)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Path (javax.ws.rs.Path)4 ServiceConfigurationNotFoundException (com.hortonworks.streamline.streams.cluster.exception.ServiceConfigurationNotFoundException)3 ManualServiceRegistrar (com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Collection (java.util.Collection)3 Collections (java.util.Collections)3