Java 类org.apache.hadoop.hbase.protobuf.generated.SecureBulkLoadProtos 实例源码

项目:ditb    文件:SecureBulkLoadClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();

    SecureBulkLoadProtos.CleanupBulkLoadRequest request =
        SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
            .setBulkToken(bulkToken).build();

    instance.cleanupBulkLoad(controller,
        request,
        rpcCallback);

    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:pbase    文件:SecureBulkLoadClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();

    SecureBulkLoadProtos.CleanupBulkLoadRequest request =
        SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
            .setBulkToken(bulkToken).build();

    instance.cleanupBulkLoad(controller,
        request,
        rpcCallback);

    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:hbase    文件:SecureBulkLoadEndpointClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    CoprocessorRpcUtils.BlockingRpcCallback<CleanupBulkLoadResponse> rpcCallback =
        new CoprocessorRpcUtils.BlockingRpcCallback<>();

    CleanupBulkLoadRequest request =
        CleanupBulkLoadRequest.newBuilder()
            .setBulkToken(bulkToken).build();

    instance.cleanupBulkLoad(controller,
        request,
        rpcCallback);

    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:ditb    文件:SecureBulkLoadClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse>();

    SecureBulkLoadProtos.PrepareBulkLoadRequest request =
        SecureBulkLoadProtos.PrepareBulkLoadRequest.newBuilder()
        .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

    instance.prepareBulkLoad(controller,
        request,
        rpcCallback);

    SecureBulkLoadProtos.PrepareBulkLoadResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }

    return response.getBulkToken();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:pbase    文件:SecureBulkLoadClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse>();

    SecureBulkLoadProtos.PrepareBulkLoadRequest request =
        SecureBulkLoadProtos.PrepareBulkLoadRequest.newBuilder()
        .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

    instance.prepareBulkLoad(controller,
        request,
        rpcCallback);

    SecureBulkLoadProtos.PrepareBulkLoadResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }

    return response.getBulkToken();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:HIndex    文件:SecureBulkLoadClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    return
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
        EMPTY_START_ROW,
        LAST_ROW,
        new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService,String>() {
          @Override
          public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
            ServerRpcController controller = new ServerRpcController();

            BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse> rpcCallback =
                new BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse>();

            SecureBulkLoadProtos.PrepareBulkLoadRequest request =
                SecureBulkLoadProtos.PrepareBulkLoadRequest.newBuilder()
                .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

            instance.prepareBulkLoad(controller,
                request,
                rpcCallback);

            SecureBulkLoadProtos.PrepareBulkLoadResponse response = rpcCallback.get();
            if (controller.failedOnException()) {
              throw controller.getFailedOn();
            }
            return response.getBulkToken();
          }
        }).entrySet().iterator().next().getValue();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:HIndex    文件:SecureBulkLoadClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
          EMPTY_START_ROW,
          LAST_ROW,
          new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService, String>() {

            @Override
            public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
              ServerRpcController controller = new ServerRpcController();

              BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
                  new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();

              SecureBulkLoadProtos.CleanupBulkLoadRequest request =
                  SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
                      .setBulkToken(bulkToken).build();

              instance.cleanupBulkLoad(controller,
                  request,
                  rpcCallback);

              if (controller.failedOnException()) {
                throw controller.getFailedOn();
              }
              return null;
            }
          });
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:hbase    文件:SecureBulkLoadEndpointClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    ServerRpcController controller = new ServerRpcController();

    CoprocessorRpcUtils.BlockingRpcCallback<PrepareBulkLoadResponse> rpcCallback =
        new CoprocessorRpcUtils.BlockingRpcCallback<>();

    PrepareBulkLoadRequest request =
        PrepareBulkLoadRequest.newBuilder()
        .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

    instance.prepareBulkLoad(controller, request, rpcCallback);

    PrepareBulkLoadResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }

    return response.getBulkToken();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:PyroDB    文件:SecureBulkLoadClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    return
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
        EMPTY_START_ROW,
        LAST_ROW,
        new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService,String>() {
          @Override
          public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
            ServerRpcController controller = new ServerRpcController();

            BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse> rpcCallback =
                new BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse>();

            SecureBulkLoadProtos.PrepareBulkLoadRequest request =
                SecureBulkLoadProtos.PrepareBulkLoadRequest.newBuilder()
                .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

            instance.prepareBulkLoad(controller,
                request,
                rpcCallback);

            SecureBulkLoadProtos.PrepareBulkLoadResponse response = rpcCallback.get();
            if (controller.failedOnException()) {
              throw controller.getFailedOn();
            }
            return response.getBulkToken();
          }
        }).entrySet().iterator().next().getValue();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:PyroDB    文件:SecureBulkLoadClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
          EMPTY_START_ROW,
          LAST_ROW,
          new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService, String>() {

            @Override
            public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
              ServerRpcController controller = new ServerRpcController();

              BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
                  new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();

              SecureBulkLoadProtos.CleanupBulkLoadRequest request =
                  SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
                      .setBulkToken(bulkToken).build();

              instance.cleanupBulkLoad(controller,
                  request,
                  rpcCallback);

              if (controller.failedOnException()) {
                throw controller.getFailedOn();
              }
              return null;
            }
          });
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:c5    文件:SecureBulkLoadClient.java   
public String prepareBulkLoad(final TableName tableName) throws IOException {
  try {
    return
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
        EMPTY_START_ROW,
        LAST_ROW,
        new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService,String>() {
          @Override
          public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
            ServerRpcController controller = new ServerRpcController();

            BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse> rpcCallback =
                new BlockingRpcCallback<SecureBulkLoadProtos.PrepareBulkLoadResponse>();

            SecureBulkLoadProtos.PrepareBulkLoadRequest request =
                SecureBulkLoadProtos.PrepareBulkLoadRequest.newBuilder()
                .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();

            instance.prepareBulkLoad(controller,
                request,
                rpcCallback);

            SecureBulkLoadProtos.PrepareBulkLoadResponse response = rpcCallback.get();
            if (controller.failedOnException()) {
              throw controller.getFailedOn();
            }
            return response.getBulkToken();
          }
        }).entrySet().iterator().next().getValue();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:c5    文件:SecureBulkLoadClient.java   
public void cleanupBulkLoad(final String bulkToken) throws IOException {
  try {
      table.coprocessorService(SecureBulkLoadProtos.SecureBulkLoadService.class,
          EMPTY_START_ROW,
          LAST_ROW,
          new Batch.Call<SecureBulkLoadProtos.SecureBulkLoadService, String>() {

            @Override
            public String call(SecureBulkLoadProtos.SecureBulkLoadService instance) throws IOException {
              ServerRpcController controller = new ServerRpcController();

              BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
                  new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();

              SecureBulkLoadProtos.CleanupBulkLoadRequest request =
                  SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
                      .setBulkToken(bulkToken).build();

              instance.cleanupBulkLoad(controller,
                  request,
                  rpcCallback);

              if (controller.failedOnException()) {
                throw controller.getFailedOn();
              }
              return null;
            }
          });
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:ditb    文件:SecureBulkLoadClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    SecureBulkLoadProtos.DelegationToken protoDT =
        SecureBulkLoadProtos.DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          SecureBulkLoadProtos.DelegationToken.newBuilder()
            .setIdentifier(ByteStringer.wrap(userToken.getIdentifier()))
            .setPassword(ByteStringer.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<ClientProtos.BulkLoadHFileRequest.FamilyPath>();
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(ByteStringer.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:pbase    文件:SecureBulkLoadClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    SecureBulkLoadProtos.DelegationToken protoDT =
        SecureBulkLoadProtos.DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          SecureBulkLoadProtos.DelegationToken.newBuilder()
            .setIdentifier(ByteStringer.wrap(userToken.getIdentifier()))
            .setPassword(ByteStringer.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<ClientProtos.BulkLoadHFileRequest.FamilyPath>();
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(ByteStringer.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:HIndex    文件:SecureBulkLoadClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    SecureBulkLoadProtos.DelegationToken protoDT =
        SecureBulkLoadProtos.DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          SecureBulkLoadProtos.DelegationToken.newBuilder()
            .setIdentifier(HBaseZeroCopyByteString.wrap(userToken.getIdentifier()))
            .setPassword(HBaseZeroCopyByteString.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<ClientProtos.BulkLoadHFileRequest.FamilyPath>();
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(HBaseZeroCopyByteString.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:hbase    文件:SecureBulkLoadEndpointClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    DelegationToken protoDT =
        DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          DelegationToken.newBuilder()
            .setIdentifier(ByteStringer.wrap(userToken.getIdentifier()))
            .setPassword(ByteStringer.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<>(familyPaths.size());
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(ByteStringer.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    CoprocessorRpcUtils.BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>
          rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:PyroDB    文件:SecureBulkLoadClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    SecureBulkLoadProtos.DelegationToken protoDT =
        SecureBulkLoadProtos.DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          SecureBulkLoadProtos.DelegationToken.newBuilder()
            .setIdentifier(HBaseZeroCopyByteString.wrap(userToken.getIdentifier()))
            .setPassword(HBaseZeroCopyByteString.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<ClientProtos.BulkLoadHFileRequest.FamilyPath>();
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(HBaseZeroCopyByteString.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
项目:c5    文件:SecureBulkLoadClient.java   
public boolean bulkLoadHFiles(final List<Pair<byte[], String>> familyPaths,
                       final Token<?> userToken,
                       final String bulkToken,
                       final byte[] startRow) throws IOException {
  // we never want to send a batch of HFiles to all regions, thus cannot call
  // HTable#coprocessorService methods that take start and end rowkeys; see HBASE-9639
  try {
    CoprocessorRpcChannel channel = table.coprocessorService(startRow);
    SecureBulkLoadProtos.SecureBulkLoadService instance =
        ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);

    SecureBulkLoadProtos.DelegationToken protoDT =
        SecureBulkLoadProtos.DelegationToken.newBuilder().build();
    if(userToken != null) {
      protoDT =
          SecureBulkLoadProtos.DelegationToken.newBuilder()
            .setIdentifier(ZeroCopyLiteralByteString.wrap(userToken.getIdentifier()))
            .setPassword(ZeroCopyLiteralByteString.wrap(userToken.getPassword()))
            .setKind(userToken.getKind().toString())
            .setService(userToken.getService().toString()).build();
    }

    List<ClientProtos.BulkLoadHFileRequest.FamilyPath> protoFamilyPaths =
        new ArrayList<ClientProtos.BulkLoadHFileRequest.FamilyPath>();
    for(Pair<byte[], String> el: familyPaths) {
      protoFamilyPaths.add(ClientProtos.BulkLoadHFileRequest.FamilyPath.newBuilder()
        .setFamily(ZeroCopyLiteralByteString.wrap(el.getFirst()))
        .setPath(el.getSecond()).build());
    }

    SecureBulkLoadProtos.SecureBulkLoadHFilesRequest request =
        SecureBulkLoadProtos.SecureBulkLoadHFilesRequest.newBuilder()
          .setFsToken(protoDT)
          .addAllFamilyPath(protoFamilyPaths)
          .setBulkToken(bulkToken).build();

    ServerRpcController controller = new ServerRpcController();
    BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse> rpcCallback =
        new BlockingRpcCallback<SecureBulkLoadProtos.SecureBulkLoadHFilesResponse>();
    instance.secureBulkLoadHFiles(controller,
      request,
      rpcCallback);

    SecureBulkLoadProtos.SecureBulkLoadHFilesResponse response = rpcCallback.get();
    if (controller.failedOnException()) {
      throw controller.getFailedOn();
    }
    return response.getLoaded();
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}