Search in sources :

Example 6 with ServiceConfiguration

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

the class EnvironmentService method removeServiceConfiguration.

public ServiceConfiguration removeServiceConfiguration(Long configurationId) {
    ServiceConfiguration serviceConfiguration = new ServiceConfiguration();
    serviceConfiguration.setId(configurationId);
    return this.dao.remove(new StorableKey(SERVICE_CONFIGURATION_NAMESPACE, serviceConfiguration.getPrimaryKey()));
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) StorableKey(com.hortonworks.registries.storage.StorableKey)

Example 7 with ServiceConfiguration

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

the class ServiceConfigurationCatalogResource method addServiceConfiguration.

@POST
@Path("/services/{serviceId}/configurations")
@Timed
public Response addServiceConfiguration(@PathParam("serviceId") Long serviceId, ServiceConfiguration serviceConfiguration, @Context SecurityContext securityContext) {
    SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, getClusterId(serviceId), WRITE);
    // just overwrite the service id to given path param
    serviceConfiguration.setServiceId(serviceId);
    Service service = environmentService.getService(serviceId);
    if (service == null) {
        throw EntityNotFoundException.byId("service: " + serviceId.toString());
    }
    String configurationName = serviceConfiguration.getName();
    ServiceConfiguration result = environmentService.getServiceConfigurationByName(serviceId, configurationName);
    if (result != null) {
        throw EntityAlreadyExistsException.byName("service id " + serviceId + " and configuration name " + configurationName);
    }
    ServiceConfiguration createdConfiguration = environmentService.addServiceConfiguration(serviceConfiguration);
    return WSUtils.respondEntity(createdConfiguration, CREATED);
}
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) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Timed(com.codahale.metrics.annotation.Timed)

Example 8 with ServiceConfiguration

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

the class ServiceConfigurationCatalogResource method removeServiceConfiguration.

@DELETE
@Path("/services/{serviceId}/configurations/{id}")
@Timed
public Response removeServiceConfiguration(@PathParam("serviceId") Long serviceId, @PathParam("id") Long serviceConfigurationId, @Context SecurityContext securityContext) {
    SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, getClusterId(serviceId), WRITE);
    ServiceConfiguration removedConfiguration = environmentService.removeServiceConfiguration(serviceConfigurationId);
    if (removedConfiguration != null) {
        return WSUtils.respondEntity(removedConfiguration, OK);
    }
    throw EntityNotFoundException.byId(serviceConfigurationId.toString());
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Timed(com.codahale.metrics.annotation.Timed)

Example 9 with ServiceConfiguration

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

the class KafkaServiceRegistrar method createServiceConfigurations.

@Override
protected List<ServiceConfiguration> createServiceConfigurations(Config config) {
    ServiceConfiguration serverProperties = buildServerPropertiesServiceConfiguration(config);
    ServiceConfiguration kafkaEnvProperties = buildKafkaEnvServiceConfiguration(config);
    return Lists.newArrayList(serverProperties, kafkaEnvProperties);
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)

Example 10 with ServiceConfiguration

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

the class StormServiceRegistrar method buildStormEnvServiceConfiguration.

private ServiceConfiguration buildStormEnvServiceConfiguration(Config config) {
    Map<String, String> confMap;
    ServiceConfiguration stormEnv = new ServiceConfiguration();
    stormEnv.setName(CONF_STORM_ENV);
    confMap = new HashMap<>();
    if (config.contains(PARAM_NIMBUS_PRINCIPAL_NAME)) {
        confMap.put(PARAM_NIMBUS_PRINCIPAL_NAME, config.get(PARAM_NIMBUS_PRINCIPAL_NAME));
    }
    try {
        String json = objectMapper.writeValueAsString(confMap);
        stormEnv.setConfiguration(json);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
    return stormEnv;
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

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