Package org.apache.hadoop.gateway.descriptor

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


    contributeResource( context, service, PROXY_PATH + "/*/ws/v1/mapreduce/jobs/*/tasks/*/attempts/*", filterParams );
  }

  private void contributeResource( DeploymentContext context, Service service, String pattern, Map<String, String> filterParams ) throws URISyntaxException {
    List<FilterParamDescriptor> params = new ArrayList<FilterParamDescriptor>();
    ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
    resource.role( service.getRole() );
    resource.pattern( pattern );
    addWebAppSecFilters( context, service, resource );
    addAuthenticationFilter( context, service, resource );
    addIdentityAssertionFilter( context, service, resource );
    addAuthorizationFilter( context, service, resource );
    if ( filterParams != null ) {
      for( Entry<String, String> filterParam : filterParams.entrySet() ) {
        params.add( resource.createFilterParam().name( filterParam.getKey() ).value( filterParam.getValue() ) );
      }
    }
    addRewriteFilter( context, service, resource, params );
    addDispatchFilter( context, service, resource, "dispatch", "http-client" );
  }
View Full Code Here


    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 );
View Full Code Here

    addDispatchFilter( context, service, homeFileResource, dispatchRole, dispatchName );
  }

  public void contributeDataNodeResource( DeploymentContext context, Service service ) throws URISyntaxException {
    List<FilterParamDescriptor> params;
    ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
    fileResource.role( service.getRole() );
    fileResource.pattern( DATANODE_EXTERNAL_PATH + "/**?**" );
    addWebAppSecFilters(context, service, fileResource);
    addAuthenticationFilter( context, service, fileResource );
    addIdentityAssertionFilter( context, service, fileResource );
    addAuthorizationFilter( context, service, fileResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( fileResource.createFilterParam().
        name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/datanode" ) );
    addRewriteFilter( context, service, fileResource, params );
    addDispatchFilter( context, service, fileResource, "dispatch", "http-client" );
  }
View Full Code Here

    service.setName( "test-service-name" );
    service.addUrl( "http://test-service-host:777/test-service-path" );

    // This should end up calling providerContributor.contributeFilter
    serviceContributor.contributeService( context, service );
    ResourceDescriptor resource = context.getGatewayDescriptor().resources().get( 0 );

    // Just make sure they don't blow up.
    serviceContributor.finalizeContribution( context );
    providerContributor.finalizeContribution( context );

    /*
    GatewayDescriptorFactory.store( descriptor, "xml", new PrintWriter( System.out ) );
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <gateway>
      <resource>
        <role>test-service-role</role>
        <pattern>test-service/?**</pattern>
        <filter>
          <role>dispatch</role>
          <name>jersey</name>
          <class>org.glassfish.jersey.servlet.ServletContainer</class>
          <param>
            <name>jersey.config.server.provider.packages</name>
            <value>test-package-1;test-package-2</value>
          </param>
        </filter>
      </resource>
      <resource>
        <role>test-service-role</role>
        <pattern>test-service/**?**</pattern>
        <filter>
          <role>dispatch</role>
          <name>jersey</name>
          <class>org.glassfish.jersey.servlet.ServletContainer</class>
          <param>
            <name>jersey.config.server.provider.packages</name>
            <value>test-package-1;test-package-2</value>
          </param>
        </filter>
      </resource>
    </gateway>
    */
    List<ResourceDescriptor> resources = context.getGatewayDescriptor().resources();
    assertThat( resources.size(), is( 2 ) );

    resource = resources.get( 0 );
    assertThat( resource.role(), is( "test-service-role" ) );
    assertThat( resource.pattern(), is( "test-service/?**" ) );
    List<FilterDescriptor> filters = resource.filters();
    assertThat( filters.size(), is( 1 ) );
    FilterDescriptor filter = filters.get( 0 );
    assertThat( filter.role(), is( "pivot") );
    assertThat( filter.name(), is( "jersey" ) );
    assertThat( filter.impl(), is( "org.glassfish.jersey.servlet.ServletContainer" ) );
    List<FilterParamDescriptor> params = filter.params();
    assertThat( params.size(), is( 1 ) );
    FilterParamDescriptor param = params.get( 0 );
    assertThat( param.name(), is( "jersey.config.server.provider.packages" ) );
    assertThat( param.value(), is( "test-package-1;test-package-2"  ) );

    resource = resources.get( 1 );
    assertThat( resource.role(), is( "test-service-role" ) );
    assertThat( resource.pattern(), is( "test-service/**?**" ) );
    filters = resource.filters();
    assertThat( filters.size(), is( 1 ) );
    filter = filters.get( 0 );
    assertThat( filter.role(), is( "pivot") );
    assertThat( filter.name(), is( "jersey" ) );
    assertThat( filter.impl(), is( "org.glassfish.jersey.servlet.ServletContainer" ) );
View Full Code Here

  protected abstract String[] getPatterns();

  public void contributeService( DeploymentContext context, Service service ) throws Exception {
    String packages = StringUtils.join( getPackages(), ";" );
    for( String pattern : getPatterns() ) {
      ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
      resource.role( service.getRole() );
      resource.pattern( pattern );
      addAuthenticationFilter( context, service, resource );
      addIdentityAssertionFilter( context, service, resource );
      addAuthorizationFilter( context, service, resource );
      // addRewriteFilter( context, service, resource, null );
      List<FilterParamDescriptor> params = new ArrayList<FilterParamDescriptor>();
      FilterParamDescriptor param = resource.createFilterParam();
      param.name( PACKAGES_PARAM );
      param.value( packages );
      params.add( param );
//      FilterParamDescriptor trace = resource.createFilterParam();
//      param.name( TRACE_LOGGING_PARAM );
View Full Code Here

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

    ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
    resource.role( service.getRole() );
    resource.pattern( WEBHCAT_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

    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 );
    addAuthenticationFilter( context, service, rootResource );
    addRewriteFilter( context, service, rootResource );
    addIdentityAssertionFilter( context, service, rootResource );
    addAuthorizationFilter(context, service, rootResource);
    addDispatchFilter( context, service, rootResource );
View Full Code Here

  }

  private void contributeResources( DeploymentContext context, Service service ) throws URISyntaxException {
    List<FilterParamDescriptor> params;

    ResourceDescriptor rootResource = context.getGatewayDescriptor().addResource();
    rootResource.role( service.getRole() );
    rootResource.pattern( EXTERNAL_PATH + "/?**" );
    addAuthenticationFilter( context, service, rootResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( rootResource.createFilterParam().name( "response.headers" ).value( getQualifiedName() + "/headers/outbound" ) );
    addRewriteFilter( context, service, rootResource, params );
    addIdentityAssertionFilter( context, service, rootResource );
    addDispatchFilter( context, service, rootResource );
   
    ResourceDescriptor pathResource = context.getGatewayDescriptor().addResource();
    pathResource.role( service.getRole() );
    pathResource.pattern( EXTERNAL_PATH + "/**?**" );
    addAuthenticationFilter( context, service, pathResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( rootResource.createFilterParam().name( "response.headers" ).value( getQualifiedName() + "/headers/outbound" ) );
    addRewriteFilter( context, service, pathResource, params );
    addIdentityAssertionFilter( context, service, pathResource );
    addAuthorizationFilter(context, service, pathResource);
    addDispatchFilter( context, service, pathResource );

    ResourceDescriptor statusResource = context.getGatewayDescriptor().addResource();
    statusResource.role( service.getRole() );
    statusResource.pattern( EXTERNAL_PATH + "/status/cluster?**" );
    addAuthenticationFilter( context, service, statusResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( statusResource.createFilterParam().name( "response.body" ).value( getQualifiedName() + "/status/outbound" ) );
    addRewriteFilter( context, service, statusResource, params );
    addIdentityAssertionFilter( context, service, statusResource );
    addAuthorizationFilter(context, service, statusResource);
    addDispatchFilter( context, service, statusResource );

    ResourceDescriptor regionResource = context.getGatewayDescriptor().addResource();
    regionResource.role( service.getRole() );
    regionResource.pattern( EXTERNAL_PATH + "/*/regions?**" );
    addAuthenticationFilter( context, service, regionResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( regionResource.createFilterParam().name( "response.body" ).value( getQualifiedName() + "/regions/outbound" ) );
    addRewriteFilter( context, service, regionResource, params );
    addIdentityAssertionFilter( context, service, regionResource );
    addAuthorizationFilter(context, service, regionResource);
    addDispatchFilter( context, service, regionResource );
  }
View Full Code Here

    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 + "/?**" );
    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 );
    addDispatchFilter( context, service, rootResource, "dispatch", null );

    ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
    fileResource.role( service.getRole() );
    fileResource.pattern( WEBHDFS_EXTERNAL_PATH + "/**?**" );
    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, "dispatch", null );

    ResourceDescriptor homeResource = context.getGatewayDescriptor().addResource();
    homeResource.role( service.getRole() );
    homeResource.pattern( WEBHDFS_EXTERNAL_PATH + "/~?**" );
    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, "dispatch", null );

    ResourceDescriptor homeFileResource = context.getGatewayDescriptor().addResource();
    homeFileResource.role( service.getRole() );
    homeFileResource.pattern( WEBHDFS_EXTERNAL_PATH + "/~/**?**" );
    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, "dispatch", null );
View Full Code Here

    addDispatchFilter( context, service, homeFileResource, "dispatch", null );
  }

  public void contributeDataNodeResource( DeploymentContext context, Service service ) throws URISyntaxException {
    List<FilterParamDescriptor> params;
    ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
    fileResource.role( service.getRole() );
    fileResource.pattern( DATANODE_EXTERNAL_PATH + "/**?**" );
    addAuthenticationFilter( context, service, fileResource );
    addIdentityAssertionFilter( context, service, fileResource );
    addAuthorizationFilter( context, service, fileResource );
    params = new ArrayList<FilterParamDescriptor>();
    params.add( fileResource.createFilterParam().
        name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName() + "/inbound/datanode" ) );
    addRewriteFilter( context, service, fileResource, params );
    addDispatchFilter( context, service, fileResource, "dispatch", 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.