tableNames = accumuloClient.tableOperations().list(); } catch (Exception e) { log.debug("Unable to obtain list of tables", e);
public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(VerifyTabletAssignments.class.getName(), args); try (AccumuloClient client = opts.createClient()) { for (String table : client.tableOperations().list()) checkTable((ClientContext) client, opts, table, null); } }
for (String table : shellState.getAccumuloClient().tableOperations().list()) { if (table.matches(cl.getOptionValue(optTablePattern.getOpt()))) { tables.add(table);
if (cl.hasOption(optTablePattern.getOpt())) { String tablePattern = cl.getOptionValue(optTablePattern.getOpt()); for (String table : shellState.getAccumuloClient().tableOperations().list()) if (table.matches(tablePattern)) { tableSet.add(table);
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "code runs in same security context as user who provided input") private static void printUserConfiguration(AccumuloClient accumuloClient, String user, File outputDirectory) throws IOException, AccumuloException, AccumuloSecurityException { File userScript = new File(outputDirectory, user + USER_FILE_SUFFIX); FileWriter userWriter = new FileWriter(userScript); userWriter.write(createUserFormat.format(new String[] {user})); Authorizations auths = accumuloClient.securityOperations().getUserAuthorizations(user); userWriter.write(userAuthsFormat.format(new String[] {user, auths.toString()})); for (SystemPermission sp : SystemPermission.values()) { if (accumuloClient.securityOperations().hasSystemPermission(user, sp)) { userWriter.write(sysPermFormat.format(new String[] {sp.name(), user})); } } for (String namespace : accumuloClient.namespaceOperations().list()) { for (NamespacePermission np : NamespacePermission.values()) { if (accumuloClient.securityOperations().hasNamespacePermission(user, namespace, np)) { userWriter.write(nsPermFormat.format(new String[] {np.name(), namespace, user})); } } } for (String tableName : accumuloClient.tableOperations().list()) { for (TablePermission perm : TablePermission.values()) { if (accumuloClient.securityOperations().hasTablePermission(user, tableName, perm)) { userWriter.write(tablePermFormat.format(new String[] {perm.name(), tableName, user})); } } } userWriter.close(); }
Map<Table.ID,String> tableIdToName = invert(tableNameToId); for (String table : tops.list()) { if (MetadataTable.NAME.equals(table) || RootTable.NAME.equals(table)) { continue;
try { for (String table : t.list()) { LOG.debug("Checking for out of bounds tablets for table {}", table); String tablePoolName = getPoolNameForTable(table);
protected void doTableOp(final Shell shellState, final String namespace, boolean force) throws Exception { boolean resetContext = false; String currentTable = shellState.getTableName(); Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(), namespace); List<String> tables = Namespaces.getTableNames(shellState.getContext(), namespaceId); resetContext = tables.contains(currentTable); if (force) for (String table : shellState.getAccumuloClient().tableOperations().list()) if (table.startsWith(namespace + ".")) shellState.getAccumuloClient().tableOperations().delete(table); shellState.getAccumuloClient().namespaceOperations().delete(namespace); if (resetContext) { shellState.setTableName(""); } }
SortedSet<String> tableNames = context.tableOperations().list(); for (String tableName : tableNames) { printTableConfiguration(context, tableName, outputDirectory);
private List<String> getTablesToBackup(Connector conn, String tableNamePrefix) { ArrayList<String> results = new ArrayList<String>(); for (String tableName : conn.tableOperations().list()) { if (tableName.startsWith(tableNamePrefix)) { results.add(tableName); } } return results; }
public void cleanupTables() throws Exception { final String tablePrefix = this.getClass().getSimpleName() + "_"; final TableOperations tops = getConnector().tableOperations(); for (String table : tops.list()) { if (table.startsWith(tablePrefix)) { log.debug("Removing table {}", table); tops.delete(table); } } }
public void deleteAllTables() throws AccumuloSecurityException, AccumuloException, TableNotFoundException { for (String table : connector.tableOperations().list()) { if (table.startsWith("accumulo.")) { continue; } connector.tableOperations().delete(table); } }
for (String t : shellState.getAccumuloClient().tableOperations().list()) { delim = ""; for (TablePermission p : TablePermission.values()) {
@After public void deleteTables() throws Exception { Connector c = getConnector(); for (String table : c.tableOperations().list()) { if (!table.startsWith(Namespaces.ACCUMULO_NAMESPACE + ".") && !table.equals("trace")) try { c.tableOperations().delete(table); } catch (TableNotFoundException e) { // don't care } } }
@Override public Void run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), delegationToken1); assertTrue("Could not get tables with delegation token", conn.tableOperations().list().size() > 0); return null; } });
@Override public Set<String> listTables(ByteBuffer login) throws TException { try { return getConnector(login).tableOperations().list(); } catch (Exception e) { throw new TException(e); } }
public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(VerifyTabletAssignments.class.getName(), args); Connector conn = opts.getConnector(); for (String table : conn.tableOperations().list()) checkTable(opts, table, null); }
@Override public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); AuthenticationToken token = conn.securityOperations() .getDelegationToken(new DelegationTokenConfig()); assertTrue("Could not get tables with delegation token", mac .getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0); return token; } });
@Override public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); AuthenticationToken token = conn.securityOperations() .getDelegationToken(new DelegationTokenConfig()); assertTrue("Could not get tables with delegation token", mac .getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0); return token; } });
public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(VerifyTabletAssignments.class.getName(), args); ClientContext context = new ClientContext(opts.getInstance(), new Credentials(opts.getPrincipal(), opts.getToken()), opts.getClientConfiguration()); Connector conn = opts.getConnector(); for (String table : conn.tableOperations().list()) checkTable(context, opts, table, null); }