• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GetAuthsRequest类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest的典型用法代码示例。如果您正苦于以下问题:Java GetAuthsRequest类的具体用法?Java GetAuthsRequest怎么用?Java GetAuthsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GetAuthsRequest类属于org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos包,在下文中一共展示了GetAuthsRequest类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAuths

点赞 3

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
@Override
public synchronized void getAuths(RpcController controller, GetAuthsRequest request,
    RpcCallback<GetAuthsResponse> done) {
  byte[] user = request.getUser().toByteArray();
  GetAuthsResponse.Builder response = GetAuthsResponse.newBuilder();
  response.setUser(request.getUser());
  try {
    List<String> labels = getUserAuthsFromLabelsTable(user);
    for (String label : labels) {
      response.addAuth(HBaseZeroCopyByteString.wrap(Bytes.toBytes(label)));
    }
  } catch (IOException e) {
    ResponseConverter.setControllerException(controller, e);
  }
  done.run(response.build());
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:17,
代码来源:VisibilityController.java

示例2: getAuths

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
/**
 * @param connection the Connection instance to use.
 * @param user
 * @return labels, the given user is globally authorized for.
 * @throws Throwable
 */
public static GetAuthsResponse getAuths(Connection connection, final String user)
    throws Throwable {
    try (Table table = connection.getTable(LABELS_TABLE_NAME)) {
      Batch.Call<VisibilityLabelsService, GetAuthsResponse> callable =
          new Batch.Call<VisibilityLabelsService, GetAuthsResponse>() {
        ServerRpcController controller = new ServerRpcController();
        BlockingRpcCallback<GetAuthsResponse> rpcCallback =
            new BlockingRpcCallback<GetAuthsResponse>();

        public GetAuthsResponse call(VisibilityLabelsService service) throws IOException {
          GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder();
          getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
          service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback);
          GetAuthsResponse response = rpcCallback.get();
          if (controller.failedOnException()) {
            throw controller.getFailedOn();
          }
          return response;
        }
      };
      Map<byte[], GetAuthsResponse> result =
        table.coprocessorService(VisibilityLabelsService.class,
          HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, callable);
      return result.values().iterator().next(); // There will be exactly one region for labels
      // table and so one entry in result Map.
    }
}
 

开发者ID:fengchen8086,
项目名称:ditb,
代码行数:34,
代码来源:VisibilityClient.java

示例3: getAuths

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
/**
 * @param conf
 * @param user
 * @return labels, the given user is globally authorized for.
 * @throws Throwable
 */
public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable {
  // TODO: Make it so caller passes in a Connection rather than have us do this expensive
  // setup each time.  This class only used in test and shell at moment though.
  try (Connection connection = ConnectionFactory.createConnection(conf)) {
    try (Table table = connection.getTable(LABELS_TABLE_NAME)) {
      Batch.Call<VisibilityLabelsService, GetAuthsResponse> callable =
          new Batch.Call<VisibilityLabelsService, GetAuthsResponse>() {
        ServerRpcController controller = new ServerRpcController();
        BlockingRpcCallback<GetAuthsResponse> rpcCallback =
            new BlockingRpcCallback<GetAuthsResponse>();

        public GetAuthsResponse call(VisibilityLabelsService service) throws IOException {
          GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder();
          getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
          service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback);
          GetAuthsResponse response = rpcCallback.get();
          if (controller.failedOnException()) {
            throw controller.getFailedOn();
          }
          return response;
        }
      };
      Map<byte[], GetAuthsResponse> result =
        table.coprocessorService(VisibilityLabelsService.class,
          HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, callable);
      return result.values().iterator().next(); // There will be exactly one region for labels
      // table and so one entry in result Map.
    }
  }
}
 

开发者ID:grokcoder,
项目名称:pbase,
代码行数:37,
代码来源:VisibilityClient.java

示例4: getAuths

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
/**
 * @param conf
 * @param user
 * @return labels, the given user is globally authorized for.
 * @throws Throwable
 */
public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable {
  HTable ht = null;
  try {
    ht = new HTable(conf, LABELS_TABLE_NAME.getName());
    Batch.Call<VisibilityLabelsService, GetAuthsResponse> callable = 
        new Batch.Call<VisibilityLabelsService, GetAuthsResponse>() {
      ServerRpcController controller = new ServerRpcController();
      BlockingRpcCallback<GetAuthsResponse> rpcCallback = 
          new BlockingRpcCallback<GetAuthsResponse>();

      public GetAuthsResponse call(VisibilityLabelsService service) throws IOException {
        GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder();
        getAuthReqBuilder.setUser(HBaseZeroCopyByteString.wrap(Bytes.toBytes(user)));
        service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback);
        return rpcCallback.get();
      }
    };
    Map<byte[], GetAuthsResponse> result = ht.coprocessorService(VisibilityLabelsService.class,
        HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, callable);
    return result.values().iterator().next(); // There will be exactly one region for labels
                                              // table and so one entry in result Map.
  } finally {
    if (ht != null) {
      ht.close();
    }
  }
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:34,
代码来源:VisibilityClient.java

示例5: getAuths

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
/**
 * @param connection the Connection instance to use.
 * @param user
 * @return labels, the given user is globally authorized for.
 * @throws Throwable
 */
public static GetAuthsResponse getAuths(Connection connection, final String user)
    throws Throwable {
  try (Table table = connection.getTable(LABELS_TABLE_NAME)) {
    Batch.Call<VisibilityLabelsService, GetAuthsResponse> callable =
        new Batch.Call<VisibilityLabelsService, GetAuthsResponse>() {
      ServerRpcController controller = new ServerRpcController();
      CoprocessorRpcUtils.BlockingRpcCallback<GetAuthsResponse> rpcCallback =
          new CoprocessorRpcUtils.BlockingRpcCallback<>();

      @Override
      public GetAuthsResponse call(VisibilityLabelsService service) throws IOException {
        GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder();
        getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
        service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback);
        GetAuthsResponse response = rpcCallback.get();
        if (controller.failedOnException()) {
          throw controller.getFailedOn();
        }
        return response;
      }
    };
    Map<byte[], GetAuthsResponse> result =
        table.coprocessorService(VisibilityLabelsService.class, HConstants.EMPTY_BYTE_ARRAY,
            HConstants.EMPTY_BYTE_ARRAY, callable);
    return result.values().iterator().next(); // There will be exactly one region for labels
    // table and so one entry in result Map.
  }
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:35,
代码来源:VisibilityClient.java

示例6: getAuths

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.GetAuthsRequest; //导入依赖的package包/类
@Override
public void getAuths(RpcController controller, GetAuthsRequest request,
    RpcCallback<GetAuthsResponse> done) {
}
 

开发者ID:apache,
项目名称:hbase,
代码行数:5,
代码来源:TestMasterCoprocessorServices.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)