Package org.apache.hadoop.gateway.descriptor

Examples of org.apache.hadoop.gateway.descriptor.ResourceDescriptor


    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl() );
  }

  public void contributeResources( DeploymentContext context, Service service ) throws URISyntaxException {
    ResourceDescriptor rootResource = context.getGatewayDescriptor().addResource();
    rootResource.role( service.getRole() );
    rootResource.pattern( EXTERNAL_PATH );
    addWebAppSecFilters(context, service, rootResource);
    addAuthenticationFilter( context, service, rootResource );
    addRewriteFilter( context, service, rootResource );
    addIdentityAssertionFilter( context, service, rootResource );
    addAuthorizationFilter(context, service, rootResource);
View Full Code Here


    return "tgs";
  }

  @Override
  public void contributeService( DeploymentContext context, Service service ) throws URISyntaxException {
    ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
    resource.role( service.getRole() );
    resource.pattern( TGS_EXTERNAL_PATH + "/accesstoken");
    if (topologyContainsProviderType(context, "authentication")) {
      context.contributeFilter( service, resource, "authentication", null, null );
    }
    if (topologyContainsProviderType(context, "federation")) {
      context.contributeFilter( service, resource, "federation", null, null );
View Full Code Here

    rewrite.template( CLUSTER_URL_FUNCTION + DATANODE_EXTERNAL_PATH + "/{path=**}?{host}&{port}&{**}" );
    rule.addStep( "encode-query" );
  }

  public void contributeNameNodeResource( DeploymentContext context, Service service ) throws URISyntaxException {
    ResourceDescriptor rootResource = context.getGatewayDescriptor().addResource();
    rootResource.role( service.getRole() );
    rootResource.pattern( NAMENODE_EXTERNAL_PATH + "/?**" );
    addAuthenticationFilter( context, service, rootResource );
    addRewriteFilter( context, service, rootResource );
    addIdentityAssertionFilter( context, service, rootResource );
    addDispatchFilter( context, service, rootResource, "dispatch", null );

    ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
    fileResource.role( service.getRole() );
    fileResource.pattern( NAMENODE_EXTERNAL_PATH + "/**?**" );
    addAuthenticationFilter( context, service, fileResource );
    addRewriteFilter( context, service, fileResource );
    addIdentityAssertionFilter( context, service, fileResource );
    addDispatchFilter( context, service, fileResource, "dispatch", null );
  }
View Full Code Here

    addIdentityAssertionFilter( context, service, fileResource );
    addDispatchFilter( context, service, fileResource, "dispatch", null );
  }

  public void contributeDataNodeResource( DeploymentContext context, Service service ) throws URISyntaxException {
    ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
    fileResource.role( service.getRole() );
    fileResource.pattern( DATANODE_EXTERNAL_PATH + "/**?**" );
    addAuthenticationFilter( context, service, fileResource );
    addRewriteFilter( context, service, fileResource );
    addIdentityAssertionFilter( context, service, fileResource );
    addDispatchFilter( context, service, fileResource, "dispatch", null );
  }
View Full Code Here

    GatewayDescriptor descriptor = GatewayDescriptorFactory.load( "xml", reader );

    assertThat( descriptor, notNullValue() );
    assertThat( descriptor.resources().size(), is( 2 ) );

    ResourceDescriptor resource1 = descriptor.resources().get( 0 );
    assertThat( resource1, notNullValue() );
    assertThat( resource1.pattern(), is( "resource1-source" ) );

    assertThat( resource1.filters().size(), is( 2 ) );

    FilterDescriptor filter1 = resource1.filters().get( 0 );
    assertThat( filter1, notNullValue() );
    assertThat( filter1.role(), is( "resource1-filter1-role" ) );
    assertThat( filter1.impl(), is( "resource1-filter1-impl" ) );

    assertThat( filter1.params().size(), is( 2 ) );

    FilterParamDescriptor param1 = filter1.params().get( 0 );
    assertThat( param1, notNullValue() );
    assertThat( param1.name(), is( "resource1-filter1-param1-name" ) );
    assertThat( param1.value(), is( "resource1-filter1-param1-value" ) );

    FilterParamDescriptor param2 = filter1.params().get( 1 );
    assertThat( param2, notNullValue() );
    assertThat( param2.name(), is( "resource1-filter1-param2-name" ) );
    assertThat( param2.value(), is( "resource1-filter1-param2-value" ) );

    FilterDescriptor filter2 = resource1.filters().get( 1 );
    assertThat( filter2, notNullValue() );
    assertThat( filter2.role(), is( "resource1-filter2-role" ) );
    assertThat( filter2.impl(), is( "resource1-filter2-impl" ) );

    ResourceDescriptor resource2 = descriptor.resources().get( 1 );
    assertThat( resource2, notNullValue() );
    assertThat( resource2.pattern(), is( "resource2-source" ) );
  }
View Full Code Here

    GatewayDescriptor descriptor = GatewayDescriptorFactory.load( "xml", reader );

    assertThat( descriptor, notNullValue() );
    assertThat( descriptor.resources().size(), is( 1 ) );
    ResourceDescriptor resource1 = descriptor.resources().get( 0 );
    assertThat( resource1, notNullValue() );
    assertThat( resource1.filters().size(), is( 1 ) );
    FilterDescriptor filter1 = resource1.filters().get( 0 );
    assertThat( filter1, notNullValue() );
    assertThat( filter1.params().size(), is( 1 ) );
    FilterParamDescriptor param1 = filter1.params().get( 0 );
    assertThat( param1, notNullValue() );
  }
View Full Code Here

    return resources;
  }

  @Override
  public ResourceDescriptor addResource() {
    ResourceDescriptor resource = createResource();
    addResource( resource );
    return resource;
  }
View Full Code Here

    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl().toExternalForm() + "/v1/{**}?{**}" );
  }

  public void contributeResources( DeploymentContext context, Service service ) throws URISyntaxException {
    ResourceDescriptor rootResource = context.getGatewayDescriptor().addResource();
    rootResource.role( service.getRole() );
    rootResource.pattern( EXTERNAL_PATH + "/**?**" );
    addAuthenticationFilter( context, service, rootResource );
    addRewriteFilter( context, service, rootResource );
    addIdentityAssertionFilter( context, service, rootResource );
    addDispatchFilter( context, service, rootResource );

    ResourceDescriptor apiResource = context.getGatewayDescriptor().addResource();
    apiResource.role( service.getRole() );
    apiResource.pattern( EXTERNAL_PATH + "/v1/**?**" );
    addAuthenticationFilter( context, service, apiResource );
    addRewriteFilter( context, service, apiResource );
    addIdentityAssertionFilter( context, service, apiResource );
    addDispatchFilter( context, service, apiResource );
  }
View Full Code Here

    gateway.addFilter( filter.up().pattern(), name, filter.impl(), createParams( filter ) );
  }

  private static Map<String, String> createParams( FilterDescriptor filter ) {
    Map<String, String> paramMap = new HashMap<String, String>();
    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;
View Full Code Here

        .directions( "request" )
        .pattern( "*://*:*/**" + TEMPLETON_EXTERNAL_PATH + "/{path=**}?{**}" );
    rewrite = rule.addStep( "rewrite" );
    rewrite.template( service.getUrl().toExternalForm() + "/{path=**}?{**}" );

    ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
    resource.role( service.getRole() );
    resource.pattern( TEMPLETON_EXTERNAL_PATH + "/**?**" );
    if (topologyContainsProviderType(context, "authentication")) {
      context.contributeFilter( service, resource, "authentication", null, null );
    }
    if (topologyContainsProviderType(context, "federation")) {
      context.contributeFilter( service, resource, "federation", null, null );
View Full Code Here

TOP

Related Classes of org.apache.hadoop.gateway.descriptor.ResourceDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.