use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class EnvironmentService method createServiceConfiguration.
public ServiceConfiguration createServiceConfiguration(Long serviceId, String confType, String actualFileName, Map<String, String> configuration) throws JsonProcessingException {
ServiceConfiguration conf = new ServiceConfiguration();
conf.setId(this.dao.nextId(SERVICE_CONFIGURATION_NAMESPACE));
conf.setName(confType);
conf.setServiceId(serviceId);
conf.setFilename(actualFileName);
conf.setConfiguration(objectMapper.writeValueAsString(configuration));
conf.setTimestamp(System.currentTimeMillis());
return conf;
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration 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;
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class ServiceConfigurationCatalogResource method getConfigurationById.
@GET
@Path("/services/{serviceId}/configurations/{id}")
@Timed
public Response getConfigurationById(@PathParam("serviceId") Long serviceId, @PathParam("id") Long configurationId, @Context SecurityContext securityContext) {
SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, getClusterId(serviceId), READ);
ServiceConfiguration configuration = environmentService.getServiceConfiguration(configurationId);
if (configuration != null) {
if (configuration.getServiceId() == null || !configuration.getServiceId().equals(serviceId)) {
throw EntityNotFoundException.byId("service: " + serviceId.toString());
}
return WSUtils.respondEntity(configuration, OK);
}
throw EntityNotFoundException.byId(buildMessageForCompositeId(serviceId, configurationId));
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class DruidServiceRegistrar method buildCommonRuntimeServiceConfiguration.
private ServiceConfiguration buildCommonRuntimeServiceConfiguration(Config config) {
ServiceConfiguration commonRuntime = new ServiceConfiguration();
commonRuntime.setName(Constants.Druid.CONF_TYPE_COMMON_RUNTIME);
Map<String, String> confMap = new HashMap<>();
if (config.contains(PARAM_ZOOKEEPER_CONNECTION_STRING)) {
confMap.put(PARAM_ZOOKEEPER_CONNECTION_STRING, config.getString(PARAM_ZOOKEEPER_CONNECTION_STRING));
}
if (config.contains(PARAM_INDEXING_SERVICE_NAME)) {
confMap.put(PARAM_INDEXING_SERVICE_NAME, config.getString(PARAM_INDEXING_SERVICE_NAME));
}
if (config.contains(PARAM_DISCOVERY_CURATOR_PATH)) {
confMap.put(PARAM_DISCOVERY_CURATOR_PATH, config.getString(PARAM_DISCOVERY_CURATOR_PATH));
}
try {
String json = objectMapper.writeValueAsString(confMap);
commonRuntime.setConfiguration(json);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return commonRuntime;
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class EmailServiceRegistrar method createServiceConfigurations.
@Override
protected List<ServiceConfiguration> createServiceConfigurations(Config config) {
ServiceConfiguration serviceConfiguration = new ServiceConfiguration();
serviceConfiguration.setName(Constants.Email.CONF_TYPE_PROPERTIES);
Map<String, String> confMap = new HashMap<>();
confMap.put(PARAM_HOST, config.get(Constants.Email.PROPERTY_KEY_HOST));
confMap.put(PARAM_PORT, String.valueOf((Integer) config.getAny(Constants.Email.PROPERTY_KEY_PORT)));
confMap.put(PARAM_SSL, String.valueOf((Boolean) config.getAny(Constants.Email.PROPERTY_KEY_SSL)));
confMap.put(PARAM_STARTTLS, String.valueOf((Boolean) config.getAny(Constants.Email.PROPERTY_KEY_STARTTLS)));
confMap.put(PARAM_PROTOCOL, config.get(Constants.Email.PROPERTY_KEY_PROTOCOL));
confMap.put(PARAM_AUTH, String.valueOf((Boolean) config.getAny(Constants.Email.PROPERTY_KEY_AUTH)));
ObjectMapper objectMapper = new ObjectMapper();
try {
String json = objectMapper.writeValueAsString(confMap);
serviceConfiguration.setConfiguration(json);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return Collections.singletonList(serviceConfiguration);
}
Aggregations