clusterRules.addRules( serviceRules );
}
public void contributeNameNodeResource( DeploymentContext context, Service service ) throws URISyntaxException {
List<FilterParamDescriptor> params;
ResourceDescriptor rootResource = context.getGatewayDescriptor().addResource();
rootResource.role( service.getRole() );
rootResource.pattern( WEBHDFS_EXTERNAL_PATH + "/?**" );
addWebAppSecFilters(context, service, rootResource);
addAuthenticationFilter( context, service, rootResource );
params = new ArrayList<FilterParamDescriptor>();
params.add( rootResource.createFilterParam().
name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/namenode/root" ) );
addRewriteFilter( context, service, rootResource, params );
addIdentityAssertionFilter( context, service, rootResource );
addAuthorizationFilter( context, service, rootResource );
String dispatchName = getDispatchNameForNN( context );
String dispatchRole = "dispatch";
addDispatchFilter( context, service, rootResource, dispatchRole, dispatchName );
ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
fileResource.role( service.getRole() );
fileResource.pattern( WEBHDFS_EXTERNAL_PATH + "/**?**" );
addWebAppSecFilters(context, service, fileResource);
addAuthenticationFilter( context, service, fileResource );
params = new ArrayList<FilterParamDescriptor>();
params.add( fileResource.createFilterParam().
name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/namenode/file" ) );
params.add( fileResource.createFilterParam().
name( UrlRewriteServletFilter.RESPONSE_HEADERS_FILTER_PARAM ).value( getQualifiedName() + "/outbound/namenode/headers" ) );
addRewriteFilter( context, service, fileResource, params );
addIdentityAssertionFilter( context, service, fileResource );
addAuthorizationFilter( context, service, fileResource );
addDispatchFilter( context, service, fileResource, dispatchRole, dispatchName );
ResourceDescriptor homeResource = context.getGatewayDescriptor().addResource();
homeResource.role( service.getRole() );
homeResource.pattern( WEBHDFS_EXTERNAL_PATH + "/~?**" );
addWebAppSecFilters(context, service, homeResource);
addAuthenticationFilter( context, service, homeResource );
params = new ArrayList<FilterParamDescriptor>();
params.add( homeResource.createFilterParam().
name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/namenode/home" ) );
addRewriteFilter( context, service, homeResource, params );
addIdentityAssertionFilter( context, service, homeResource );
addAuthorizationFilter( context, service, homeResource );
addDispatchFilter( context, service, homeResource, dispatchRole, dispatchName );
ResourceDescriptor homeFileResource = context.getGatewayDescriptor().addResource();
homeFileResource.role( service.getRole() );
homeFileResource.pattern( WEBHDFS_EXTERNAL_PATH + "/~/**?**" );
addWebAppSecFilters(context, service, homeFileResource);
addAuthenticationFilter( context, service, homeFileResource );
params = new ArrayList<FilterParamDescriptor>();
params.add( homeFileResource.createFilterParam().
name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/namenode/home/file" ) );
params.add( homeFileResource.createFilterParam().
name( UrlRewriteServletFilter.RESPONSE_HEADERS_FILTER_PARAM ).value( getQualifiedName() + "/outbound/namenode/headers" ) );
addRewriteFilter( context, service, homeFileResource, params );
addIdentityAssertionFilter( context, service, homeFileResource );
addAuthorizationFilter( context, service, homeFileResource );
addDispatchFilter( context, service, homeFileResource, dispatchRole, dispatchName );