use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class NifiServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
String hostname = role.getHostRef().getHostname();
String scheme;
String port;
boolean sslEnabled = Boolean.parseBoolean(getRoleConfigValue(roleConfig, SSL_ENABLED));
if (sslEnabled) {
scheme = "https";
port = getRoleConfigValue(roleConfig, HTTPS_PORT);
} else {
scheme = "http";
port = getRoleConfigValue(roleConfig, HTTP_PORT);
}
ServiceModel model = new ServiceModel(getModelType(), getService(), getServiceType(), getRoleType(), String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port));
model.addRoleProperty(getRoleType(), SSL_ENABLED, getRoleConfigValue(roleConfig, SSL_ENABLED));
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 RangerServiceModelGenerator 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 = getRoleConfigValue(roleConfig, SSL_ENABLED);
if (Boolean.parseBoolean(sslEnabled)) {
scheme = "https";
port = getServiceConfigValue(serviceConfig, HTTPS_PORT);
} else {
scheme = "http";
port = getServiceConfigValue(serviceConfig, HTTP_PORT);
}
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port));
model.addServiceProperty(HTTP_PORT, getServiceConfigValue(serviceConfig, HTTP_PORT));
model.addServiceProperty(HTTPS_PORT, getServiceConfigValue(serviceConfig, HTTPS_PORT));
model.addRoleProperty(getRoleType(), SSL_ENABLED, sslEnabled);
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class ResourceManagerApiServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
String hostname = role.getHostRef().getHostname();
String port = getRoleConfigValue(roleConfig, RM_PORT);
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "rpc://%s:%s", hostname, port));
model.addRoleProperty(getRoleType(), RM_PORT, port);
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class JobTrackerServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
String hostname = role.getHostRef().getHostname();
String port = getRoleConfigValue(roleConfig, RM_PORT);
ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "rpc://%s:%s", hostname, port));
model.addRoleProperty(getRoleType(), RM_PORT, port);
return model;
}
use of org.apache.knox.gateway.topology.discovery.cm.ServiceModel in project knox by apache.
the class YarnUIServiceModelGenerator method generateService.
@Override
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) throws ApiException {
ServiceModel model = createServiceModel(generateURL(service, serviceConfig, role, roleConfig));
model.addRoleProperty(getRoleType(), RM_HTTP_PORT, getRoleConfigValue(roleConfig, RM_HTTP_PORT));
model.addRoleProperty(getRoleType(), RM_HTTPS_PORT, getRoleConfigValue(roleConfig, RM_HTTPS_PORT));
return model;
}
Aggregations