Search in sources :

Example 1 with ResourceParamDescriptor

use of org.apache.knox.gateway.descriptor.ResourceParamDescriptor in project knox by apache.

the class GatewayFactory method createParams.

private static Map<String, String> createParams(FilterDescriptor filter) {
    Map<String, String> paramMap = new HashMap<>();
    ResourceDescriptor resource = filter.up();
    GatewayDescriptor gateway = resource.up();
    for (GatewayParamDescriptor param : gateway.params()) {
        paramMap.put(param.name(), param.value());
    }
    for (ResourceParamDescriptor param : resource.params()) {
        paramMap.put(param.name(), param.value());
    }
    // TODO: Should all elements of the resource and gateway descriptor somehow be added to the filter params?
    // TODO: Should we use some composite params object instead of copying all these name value pairs?
    paramMap.put("pattern", resource.pattern());
    List<FilterParamDescriptor> paramList = filter.params();
    for (FilterParamDescriptor param : paramList) {
        paramMap.put(param.name(), param.value());
    }
    return paramMap;
}
Also used : HashMap(java.util.HashMap) GatewayDescriptor(org.apache.knox.gateway.descriptor.GatewayDescriptor) FilterParamDescriptor(org.apache.knox.gateway.descriptor.FilterParamDescriptor) GatewayParamDescriptor(org.apache.knox.gateway.descriptor.GatewayParamDescriptor) ResourceParamDescriptor(org.apache.knox.gateway.descriptor.ResourceParamDescriptor) ResourceDescriptor(org.apache.knox.gateway.descriptor.ResourceDescriptor)

Example 2 with ResourceParamDescriptor

use of org.apache.knox.gateway.descriptor.ResourceParamDescriptor in project knox by apache.

the class ResourceDescriptorImpl method addParam.

@Override
public ResourceParamDescriptor addParam() {
    ResourceParamDescriptor param = createParam();
    addParam(param);
    return param;
}
Also used : ResourceParamDescriptor(org.apache.knox.gateway.descriptor.ResourceParamDescriptor)

Aggregations

ResourceParamDescriptor (org.apache.knox.gateway.descriptor.ResourceParamDescriptor)2 HashMap (java.util.HashMap)1 FilterParamDescriptor (org.apache.knox.gateway.descriptor.FilterParamDescriptor)1 GatewayDescriptor (org.apache.knox.gateway.descriptor.GatewayDescriptor)1 GatewayParamDescriptor (org.apache.knox.gateway.descriptor.GatewayParamDescriptor)1 ResourceDescriptor (org.apache.knox.gateway.descriptor.ResourceDescriptor)1