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()));
}
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);
}
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());
}
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);
}
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;
}
Aggregations