Search in sources :

Example 1 with GatewayParamDescriptor

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

the class GatewayDescriptorImpl method addParam.

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

Example 2 with GatewayParamDescriptor

use of org.apache.knox.gateway.descriptor.GatewayParamDescriptor 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)

Aggregations

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