Search in sources :

Example 1 with FileBasedHostMapper

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);
        }
    }
}
Also used : GatewayServices(org.apache.knox.gateway.services.GatewayServices) FileBasedHostMapper(org.apache.knox.gateway.services.hostmap.FileBasedHostMapper) URL(java.net.URL)

Aggregations

URL (java.net.URL)1 GatewayServices (org.apache.knox.gateway.services.GatewayServices)1 FileBasedHostMapper (org.apache.knox.gateway.services.hostmap.FileBasedHostMapper)1