Java 类org.apache.hadoop.hbase.security.visibility.VisibilityClient 实例源码

项目:ditb    文件:TestImportTSVWithVisibilityLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
        LOG.info("Added labels ");
      } catch (Throwable t) {
        LOG.error("Error in adding labels" , t);
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:Gaffer    文件:MiniHBaseStore.java   
@SuppressFBWarnings("SIC_INNER_SHOULD_BE_STATIC_ANON")
public void addLabels(final String... visibilities) throws IOException, InterruptedException {
    if (visibilities.length > 0) {
        PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse> action =
                new PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse>() {
                    @Override
                    public VisibilityLabelsProtos.VisibilityLabelsResponse run() throws Exception {
                        try (Connection conn = ConnectionFactory.createConnection(utility.getConfiguration())) {
                            VisibilityClient.addLabels(conn, visibilities);
                        } catch (final Throwable t) {
                            throw new IOException(t);
                        }
                        return null;
                    }
                };

        final User superUser = User.createUserForTesting(getConfiguration(), "admin", new String[]{"supergroup"});
        superUser.runAs(action);
    }
}
项目:pbase    文件:TestImportTSVWithVisibilityLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE };
      try {
        VisibilityClient.addLabels(conf, labels);
        LOG.info("Added labels ");
      } catch (Throwable t) {
        LOG.error("Error in adding labels" , t);
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:HIndex    文件:TestImportTSVWithVisibilityLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE };
      try {
        VisibilityClient.addLabels(conf, labels);
        LOG.info("Added labels ");
      } catch (Throwable t) {
        LOG.error("Error in adding labels" , t);
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:hbase    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:hbase    文件:TestImportTSVWithVisibilityLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
        LOG.info("Added labels ");
      } catch (Throwable t) {
        LOG.error("Error in adding labels" , t);
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:PyroDB    文件:TestImportTSVWithVisibilityLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action =
      new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE };
      try {
        VisibilityClient.addLabels(conf, labels);
        LOG.info("Added labels ");
      } catch (Throwable t) {
        LOG.error("Error in adding labels" , t);
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:ditb    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:ditb    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void setAuths() throws IOException {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(UTIL.getConnection(), labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:ditb    文件:IntegrationTestIngestWithVisibilityLabels.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), LABELS);
    VisibilityClient.setAuths(util.getConnection(), LABELS, User.getCurrent().getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:ditb    文件:IntegrationTestWithCellVisibilityLoadAndVerify.java   
private void addLabelsAndAuths() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), LABELS);
    VisibilityClient.setAuths(util.getConnection(), new String[] { CONFIDENTIAL, TOPSECRET,
        SECRET, PRIVATE }, USER1.getName());
    VisibilityClient.setAuths(util.getConnection(), new String[] { PUBLIC },
        USER2.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:ditb    文件:IntegrationTestBigLinkedListWithVisibility.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), labels.split(COMMA));
    VisibilityClient.setAuths(util.getConnection(), labels.split(COMMA), USER.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:ditb    文件:TestScannersWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:ditb    文件:TestScannersWithLabels.java   
private static void setAuths() throws Exception {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try (Connection conn = ConnectionFactory.createConnection(conf)) {
    VisibilityClient.setAuths(conn, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:HIndex    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try {
        VisibilityClient.addLabels(conf, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:HIndex    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void setAuths() throws IOException {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:HIndex    文件:TestScannersWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try {
        VisibilityClient.addLabels(conf, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:HIndex    文件:TestScannersWithLabels.java   
private static void setAuths() throws Exception {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:HIndex    文件:IntegrationTestIngestWithVisibilityLabels.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConfiguration(), LABELS);
    VisibilityClient.setAuths(util.getConfiguration(), LABELS, User.getCurrent().getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:HIndex    文件:IntegrationTestWithCellVisibilityLoadAndVerify.java   
private void addLabelsAndAuths() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConfiguration(), LABELS);
    VisibilityClient.setAuths(util.getConfiguration(), new String[] { CONFIDENTIAL, TOPSECRET,
        SECRET, PRIVATE }, USER1.getName());
    VisibilityClient.setAuths(util.getConfiguration(), new String[] { PUBLIC },
        USER2.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:hbase    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void setAuths() throws IOException {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(UTIL.getConnection(), labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:hbase    文件:TestSecureExport.java   
private static void addLabels(final Configuration conf, final List<String> users, final List<String> labels) throws Exception {
  PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse> action
    = () -> {
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels.toArray(new String[labels.size()]));
        for (String user : users) {
          VisibilityClient.setAuths(conn, labels.toArray(new String[labels.size()]), user);
        }
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    };
  getUserByLogin(USER_ADMIN).runAs(action);
}
项目:hbase    文件:IntegrationTestIngestWithVisibilityLabels.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), LABELS);
    VisibilityClient.setAuths(util.getConnection(), LABELS, User.getCurrent().getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:hbase    文件:IntegrationTestWithCellVisibilityLoadAndVerify.java   
private void addLabelsAndAuths() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), LABELS);
    VisibilityClient.setAuths(util.getConnection(), new String[] { CONFIDENTIAL, TOPSECRET,
        SECRET, PRIVATE }, USER1.getName());
    VisibilityClient.setAuths(util.getConnection(), new String[] { PUBLIC },
        USER2.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:hbase    文件:IntegrationTestBigLinkedListWithVisibility.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConnection(), labels.split(COMMA));
    VisibilityClient.setAuths(util.getConnection(), labels.split(COMMA), USER.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:hbase    文件:TestScannersWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    @Override
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try (Connection conn = ConnectionFactory.createConnection(conf)) {
        VisibilityClient.addLabels(conn, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:hbase    文件:TestScannersWithLabels.java   
private static void setAuths() throws Exception {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try (Connection conn = ConnectionFactory.createConnection(conf)) {
    VisibilityClient.setAuths(conn, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:PyroDB    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try {
        VisibilityClient.addLabels(conf, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:PyroDB    文件:TestThriftHBaseServiceHandlerWithLabels.java   
private static void setAuths() throws IOException {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:PyroDB    文件:TestScannersWithLabels.java   
private static void createLabels() throws IOException, InterruptedException {
  PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
    public VisibilityLabelsResponse run() throws Exception {
      String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
      try {
        VisibilityClient.addLabels(conf, labels);
      } catch (Throwable t) {
        throw new IOException(t);
      }
      return null;
    }
  };
  SUPERUSER.runAs(action);
}
项目:PyroDB    文件:TestScannersWithLabels.java   
private static void setAuths() throws Exception {
  String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
  try {
    VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:PyroDB    文件:IntegrationTestIngestWithVisibilityLabels.java   
private void addLabels() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConfiguration(), LABELS);
    VisibilityClient.setAuths(util.getConfiguration(), LABELS, User.getCurrent().getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}
项目:PyroDB    文件:IntegrationTestWithCellVisibilityLoadAndVerify.java   
private void addLabelsAndAuths() throws Exception {
  try {
    VisibilityClient.addLabels(util.getConfiguration(), LABELS);
    VisibilityClient.setAuths(util.getConfiguration(), LABELS, User.getCurrent().getName());
    VisibilityClient.setAuths(util.getConfiguration(), new String[] { CONFIDENTIAL, TOPSECRET,
        SECRET, PRIVATE }, ADMIN.getName());
    VisibilityClient.setAuths(util.getConfiguration(), new String[] { PUBLIC },
        NORMAL_USER.getName());
  } catch (Throwable t) {
    throw new IOException(t);
  }
}