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