use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class OozieServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) {
String hostname = role.getHostRef().getHostname();
String scheme;
String port;
String sslEnabled = getServiceConfigValue(serviceConfig, USE_SSL);
if (Boolean.parseBoolean(sslEnabled)) {
scheme = "https";
port = getRoleConfigValue(roleConfig, HTTPS_PORT);
} else {
scheme = "http";
port = getRoleConfigValue(roleConfig, HTTP_PORT);
}
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s/oozie/", scheme, hostname, port));
model.addServiceProperty(USE_SSL, sslEnabled);
model.addRoleProperty(getRoleType(), HTTP_PORT, getRoleConfigValue(roleConfig, HTTP_PORT));
model.addRoleProperty(getRoleType(), HTTPS_PORT, getRoleConfigValue(roleConfig, HTTPS_PORT));
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class PhoenixServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) {
String hostname = role.getHostRef().getHostname();
String sslEnabledRaw = getRoleConfigValue(roleConfig, SSL_ENABLED);
String scheme = "http";
if (Boolean.parseBoolean(sslEnabledRaw)) {
scheme = "https";
}
String port = getRoleConfigValue(roleConfig, QUERY_SERVER_PORT);
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port));
model.addRoleProperty(getRoleType(), QUERY_SERVER_PORT, port);
if (sslEnabledRaw != null) {
model.addRoleProperty(getRoleType(), SSL_ENABLED, sslEnabledRaw);
}
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class FlinkServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
final String hostname = role.getHostRef().getHostname();
final String port = getRoleConfigValue(roleConfig, WEB_PORT);
final boolean sslEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig, SSL_ENABLED));
final String scheme = sslEnabled ? "https" : "http";
final ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port));
model.addRoleProperty(getRoleType(), SSL_ENABLED, Boolean.toString(sslEnabled));
model.addRoleProperty(getRoleType(), WEB_PORT, port);
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class WebHBaseServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) {
String hostname = role.getHostRef().getHostname();
String scheme;
String port = getRoleConfigValue(roleConfig, REST_SERVER_PORT);
boolean sslEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig, SSL_ENABLED));
if (sslEnabled) {
scheme = "https";
} else {
scheme = "http";
}
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port));
model.addRoleProperty(getRoleType(), REST_SERVER_PORT, getRoleConfigValue(roleConfig, REST_SERVER_PORT));
model.addRoleProperty(getRoleType(), SSL_ENABLED, getRoleConfigValue(roleConfig, SSL_ENABLED));
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class NameNodeServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
boolean haEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig, AUTOFAILOVER_ENABLED));
String serviceUrl;
if (haEnabled) {
String nameservice = getRoleConfigValue(roleConfig, NN_NAMESERVICE);
serviceUrl = String.format(Locale.getDefault(), "hdfs://%s", nameservice);
} else {
String hostname = role.getHostRef().getHostname();
String port = getRoleConfigValue(roleConfig, NN_PORT);
serviceUrl = String.format(Locale.getDefault(), "hdfs://%s:%s", hostname, port);
}
ServiceModel model = createServiceModel(serviceUrl);
model.addRoleProperty(getRoleType(), AUTOFAILOVER_ENABLED, getRoleConfigValue(roleConfig, AUTOFAILOVER_ENABLED));
model.addRoleProperty(getRoleType(), NN_PORT, getRoleConfigValue(roleConfig, NN_PORT));
if (haEnabled) {
model.addRoleProperty(getRoleType(), NN_NAMESERVICE, getRoleConfigValue(roleConfig, NN_NAMESERVICE));
// Add the nameservice metadata for qualifying the discovery process for this service
model.addQualifyingServiceParam(DISCOVERY_NAMESERVICE, model.getRoleProperties().get(getRoleType()).get(NN_NAMESERVICE));
}
return model;
}
Aggregations