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

项目:ditb    文件:SecureTestUtil.java   
public static void checkTablePerms(Configuration conf, TableName table, Permission... perms)
throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  try (Connection connection = ConnectionFactory.createConnection(conf)) {
    try (Table acl = connection.getTable(table)) {
      AccessControlService.BlockingInterface protocol =
          AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
      try {
        protocol.checkPermissions(null, request.build());
      } catch (ServiceException se) {
        ProtobufUtil.toIOException(se);
      }
    }
  }
}
项目:ditb    文件:SecureTestUtil.java   
public static void checkGlobalPerms(HBaseTestingUtility testUtil, Permission.Action... actions)
    throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(ProtobufUtil.toPermissionAction(a)).build()));
  }
  try(Connection conn = ConnectionFactory.createConnection(testUtil.getConfiguration());
      Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  }
}
项目:ditb    文件:SecureTestUtil.java   
public static void checkTablePerms(HBaseTestingUtility testUtil, TableName table,
    Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }

  try(Connection conn = ConnectionFactory.createConnection(testUtil.getConfiguration());
      Table acl = conn.getTable(table)) {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  }
}
项目:pbase    文件:SecureTestUtil.java   
public static void checkTablePerms(Configuration conf, TableName table, Permission... perms)
throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  try (Connection connection = ConnectionFactory.createConnection(conf)) {
    try (Table acl = connection.getTable(table)) {
      AccessControlService.BlockingInterface protocol =
          AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
      try {
        protocol.checkPermissions(null, request.build());
      } catch (ServiceException se) {
        ProtobufUtil.toIOException(se);
      }
    }
  }
}
项目:pbase    文件:TestAccessController.java   
public void checkTablePerms(TableName table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  Table acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:HIndex    文件:SecureTestUtil.java   
public static void checkTablePerms(Configuration conf, byte[] table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:HIndex    文件:TestAccessController.java   
public void checkTablePerms(TableName table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:hbase    文件:SecureTestUtil.java   
public static void checkTablePerms(Configuration conf, TableName table, Permission... perms)
throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(AccessControlUtil.toPermission(p));
  }
  try (Connection connection = ConnectionFactory.createConnection(conf)) {
    try (Table acl = connection.getTable(table)) {
      AccessControlService.BlockingInterface protocol =
          AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
      try {
        protocol.checkPermissions(null, request.build());
      } catch (ServiceException se) {
        ProtobufUtil.toIOException(se);
      }
    }
  }
}
项目:hbase    文件:SecureTestUtil.java   
public static void checkGlobalPerms(HBaseTestingUtility testUtil, Permission.Action... actions)
    throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(AccessControlUtil.toPermissionAction(a)).build()));
  }
  try(Connection conn = ConnectionFactory.createConnection(testUtil.getConfiguration());
      Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  }
}
项目:hbase    文件:SecureTestUtil.java   
public static void checkTablePerms(HBaseTestingUtility testUtil, TableName table,
    Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(AccessControlUtil.toPermission(p));
  }

  try(Connection conn = ConnectionFactory.createConnection(testUtil.getConfiguration());
      Table acl = conn.getTable(table)) {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  }
}
项目:PyroDB    文件:SecureTestUtil.java   
public static void checkTablePerms(Configuration conf, byte[] table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:PyroDB    文件:TestAccessController.java   
public void checkTablePerms(TableName table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:c5    文件:SecureTestUtil.java   
public void checkTablePerms(Configuration conf, byte[] table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:c5    文件:TestAccessController.java   
public void checkTablePerms(TableName table, Permission... perms) throws IOException {
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  HTable acl = new HTable(conf, table);
  try {
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:DominoHBase    文件:TestAccessController.java   
public void checkGlobalPerms(Permission.Action... actions) throws IOException {
  HTable acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
  BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
  AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);

  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }

  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .addAction(ProtobufUtil.toPermissionAction(a)).build());
  }
  try {
    protocol.checkPermissions(null, request.build());
  } catch (ServiceException se) {
    ProtobufUtil.toIOException(se);
  }
}
项目:pbase    文件:TestAccessController.java   
public void checkGlobalPerms(Permission.Action... actions) throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(ProtobufUtil.toPermissionAction(a)).build()));
  }
  Table acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
  try {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:HIndex    文件:TestAccessController.java   
public void checkGlobalPerms(Permission.Action... actions) throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(ProtobufUtil.toPermissionAction(a)).build()));
  }
  HTable acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
  try {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:PyroDB    文件:TestAccessController.java   
public void checkGlobalPerms(Permission.Action... actions) throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(ProtobufUtil.toPermissionAction(a)).build()));
  }
  HTable acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
  try {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:c5    文件:TestAccessController.java   
public void checkGlobalPerms(Permission.Action... actions) throws IOException {
  Permission[] perms = new Permission[actions.length];
  for (int i = 0; i < actions.length; i++) {
    perms[i] = new Permission(actions[i]);
  }
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Action a : actions) {
    request.addPermission(AccessControlProtos.Permission.newBuilder()
        .setType(AccessControlProtos.Permission.Type.Global)
        .setGlobalPermission(
            AccessControlProtos.GlobalPermission.newBuilder()
                .addAction(ProtobufUtil.toPermissionAction(a)).build()));
  }
  HTable acl = new HTable(conf, AccessControlLists.ACL_TABLE_NAME);
  try {
    BlockingRpcChannel channel = acl.coprocessorService(new byte[0]);
    AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(channel);
    try {
      protocol.checkPermissions(null, request.build());
    } catch (ServiceException se) {
      ProtobufUtil.toIOException(se);
    }
  } finally {
    acl.close();
  }
}
项目:DominoHBase    文件:TestAccessController.java   
public void checkTablePerms(byte[] table, Permission... perms) throws IOException {
  HTable acl = new HTable(conf, table);
  AccessControlService.BlockingInterface protocol =
      AccessControlService.newBlockingStub(acl.coprocessorService(new byte[0]));
  CheckPermissionsRequest.Builder request = CheckPermissionsRequest.newBuilder();
  for (Permission p : perms) {
    request.addPermission(ProtobufUtil.toPermission(p));
  }
  try {
    protocol.checkPermissions(null, request.build());
  } catch (ServiceException se) {
    ProtobufUtil.toIOException(se);
  }
}
项目:hbase    文件:TestMasterCoprocessorServices.java   
@Override
public void checkPermissions(RpcController controller, CheckPermissionsRequest request,
    RpcCallback<CheckPermissionsResponse> done) {}