use of org.apache.knox.gateway.services.hostmap.FileBasedHostMapper in project knox by apache.
the class HostmapFunctionProcessor method initialize.
@Override
public void initialize(UrlRewriteEnvironment environment, HostmapFunctionDescriptor descriptor) throws Exception {
URL url = environment.getResource(DESCRIPTOR_DEFAULT_LOCATION);
hostMapper = new FileBasedHostMapper(url);
clusterName = environment.getAttribute(GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE);
GatewayServices services = environment.getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
if (clusterName != null && services != null) {
hostMapperService = services.getService(GatewayServices.HOST_MAPPING_SERVICE);
if (hostMapperService != null) {
hostMapperService.registerHostMapperForCluster(clusterName, hostMapper);
}
}
}
Aggregations