Java 类com.amazonaws.services.dynamodbv2.model.ListTablesResult 实例源码

项目:Tank    文件:AmazonDynamoDatabaseDocApi.java   
/**
 * 
 * @{inheritDoc
 */
@Override
public boolean hasTable(String tableName) {
    String nextTableName = null;
    do {
        ListTablesResult listTables = dynamoDb.listTables(new ListTablesRequest()
                .withExclusiveStartTableName(nextTableName));
        for (String name : listTables.getTableNames()) {
            if (tableName.equalsIgnoreCase(name)) {
                return true;
            }
        }
        nextTableName = listTables.getLastEvaluatedTableName();
    } while (nextTableName != null);
    return false;
}
项目:Tank    文件:AmazonDynamoDatabaseDocApi.java   
/**
 * 
 * @{inheritDoc
 */
@Override
public Set<String> getTables(String regex) {
    Set<String> result = new HashSet<String>();
    String nextTableName = null;
    do {
        ListTablesResult listTables = dynamoDb.listTables(new ListTablesRequest()
                .withExclusiveStartTableName(nextTableName));
        for (String s : listTables.getTableNames()) {
            if (s.matches(regex)) {
                result.add(s);
            }
        }
        nextTableName = listTables.getLastEvaluatedTableName();
    } while (nextTableName != null);

    return result;
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_updateTable() throws Exception {
  createTable();

  DescribeTableResult describeResult = dynamoDb.describeTable(TEST_TABLE_NAME);
  Long readUnits = describeResult.getTable().getProvisionedThroughput().getReadCapacityUnits();

  assertThat(readUnits, equalTo(UNITS));

  UpdateTableResult updateResult = dynamoDb.updateTable(TEST_TABLE_NAME, new ProvisionedThroughput()
    .withReadCapacityUnits(new Long(200))
    .withWriteCapacityUnits(new Long(200)));
  String tableName = updateResult.getTableDescription().getTableName();

  assertThat(tableName, equalTo(TEST_TABLE_NAME));

  ListTablesResult listResult = listTables();

  describeResult = dynamoDb.describeTable(TEST_TABLE_NAME);
  readUnits = describeResult.getTable().getProvisionedThroughput().getReadCapacityUnits();

  assertThat(readUnits, equalTo(new Long(200)));
}
项目:para    文件:AWSDynamoUtils.java   
/**
 * Lists all table names for this account.
 * @return a list of DynamoDB tables
 */
public static List<String> listAllTables() {
    int items = 100;
    ListTablesResult ltr = getClient().listTables(items);
    List<String> tables = new LinkedList<>();
    String lastKey;
    do {
        tables.addAll(ltr.getTableNames());
        lastKey = ltr.getLastEvaluatedTableName();
        logger.info("Found {} tables. Total found: {}.", ltr.getTableNames().size(), tables.size());
        if (lastKey == null) {
            break;
        }
        ltr = getClient().listTables(lastKey, items);
    } while (!ltr.getTableNames().isEmpty());
    return tables;
}
项目:aws-dynamodb-examples    文件:LowLevelTableExample.java   
static void listMyTables() {
    String lastEvaluatedTableName = null;
    do {

        ListTablesRequest listTablesRequest = new ListTablesRequest()
        .withLimit(10)
        .withExclusiveStartTableName(lastEvaluatedTableName);

        ListTablesResult result = client.listTables(listTablesRequest);
        lastEvaluatedTableName = result.getLastEvaluatedTableName();

        for (String name : result.getTableNames()) {
            System.out.println(name);
        }

    } while (lastEvaluatedTableName != null);
}
项目:aws-dynamodb-examples    文件:DynamoDBEmbeddedTest.java   
@Test
public void createTableTest() {
    AmazonDynamoDB ddb = DynamoDBEmbedded.create().amazonDynamoDB();
    try {
        String tableName = "Movies";
        String hashKeyName = "film_id";
        CreateTableResult res = createTable(ddb, tableName, hashKeyName);

        TableDescription tableDesc = res.getTableDescription();
        assertEquals(tableName, tableDesc.getTableName());
        assertEquals("[{AttributeName: " + hashKeyName + ",KeyType: HASH}]", tableDesc.getKeySchema().toString());
        assertEquals("[{AttributeName: " + hashKeyName + ",AttributeType: S}]",
            tableDesc.getAttributeDefinitions().toString());
        assertEquals(Long.valueOf(1000L), tableDesc.getProvisionedThroughput().getReadCapacityUnits());
        assertEquals(Long.valueOf(1000L), tableDesc.getProvisionedThroughput().getWriteCapacityUnits());
        assertEquals("ACTIVE", tableDesc.getTableStatus());
        assertEquals("arn:aws:dynamodb:ddblocal:000000000000:table/Movies", tableDesc.getTableArn());

        ListTablesResult tables = ddb.listTables();
        assertEquals(1, tables.getTableNames().size());
    } finally {
        ddb.shutdown();
    }
}
项目:Tank    文件:AmazonDynamoDatabaseTest.java   
@Test(groups = TestGroups.EXPERIMENTAL)
public void testListTables() {
    ListTablesResult listTables = dynamoDb.listTables();
    for (String s : listTables.getTableNames()) {
        System.out.println(s);
    }

}
项目:dynamodb-janusgraph-storage-backend    文件:ListTablesWorker.java   
@Override
public ListTablesResult next() throws BackendException {
    final ListTablesResult result = delegate.listTables(request);
    if (result.getLastEvaluatedTableName() != null && !result.getLastEvaluatedTableName().isEmpty()) {
        request.setExclusiveStartTableName(result.getLastEvaluatedTableName());
    } else { //done
        markComplete();
    }

    // c add scanned items
    tableNames.addAll(result.getTableNames());
    return result;
}
项目:dynamodb-janusgraph-storage-backend    文件:DynamoDbDelegate.java   
ListTablesResult listTables(final ListTablesRequest request) throws BackendException {
    controlPlaneRateLimiter.acquire();
    final Timer.Context apiTimerContext = getTimerContext(listTablesApiName, null /*tableName*/);
    ListTablesResult result;
    try {
        result = client.listTables(request);
    } catch (final Exception e) {
        throw processDynamoDbApiException(e, LIST_TABLES, null /*tableName*/);
    } finally {
        apiTimerContext.stop();
    }
    return result;
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_listTables_WithNpParameters() throws Exception {
  createTable();

  ListTablesResult result = listTables();
  List<String> tableNames = result.getTableNames();

  assertThat(tableNames.size(), equalTo(1));
  assertThat(tableNames.get(0), equalTo(TEST_TABLE_NAME));
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_listTables_WithExclusiveStartTableName() throws Exception {
  createTable();

  ListTablesResult result = dynamoDb.listTables(TEST_TABLE_NAME);
  List<String> tableNames = result.getTableNames();

  assertThat(tableNames.size(), equalTo(1));
  assertThat(tableNames.get(0), equalTo(TEST_TABLE_NAME));
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_listTables_WithLimit() throws Exception {
  createTable();

  ListTablesResult result = dynamoDb.listTables(new Integer(10));
  List<String> tableNames = result.getTableNames();

  assertThat(tableNames.size(), equalTo(1));
  assertThat(tableNames.get(0), equalTo(TEST_TABLE_NAME));
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_listTables_WithAllParameters() throws Exception {
  createTable();

  ListTablesResult result = dynamoDb.listTables(TEST_TABLE_NAME, new Integer(10));
  List<String> tableNames = result.getTableNames();

  assertThat(tableNames.size(), equalTo(1));
  assertThat(tableNames.get(0), equalTo(TEST_TABLE_NAME));
}
项目:Doradus    文件:DynamoDBService.java   
@Override
public void dropNamespace() {
    if (m_tenantPrefix.length() == 0) {
        m_logger.warn("Drop namespace not supported for legacy DynamoDB instances. "+
                      "Tables for tenant {} must be deleted manually", m_tenant.getName());
        return;
    }
    ListTablesResult tables = m_ddbClient.listTables();
    List<String> tableNames = tables.getTableNames();
    for (String tableName : tableNames) {
        if (tableName.startsWith(m_tenantPrefix)) {
            deleteTable(tableName);
        }
    }
}
项目:aws-dynamodb-examples    文件:DocumentAPITableExample.java   
static void listMyTables() {

        TableCollection<ListTablesResult> tables = dynamoDB.listTables();
        Iterator<Table> iterator = tables.iterator();

        System.out.println("Listing table names");

        while (iterator.hasNext()) {
            Table table = iterator.next();
            System.out.println(table.getTableName());
        }
    }
项目:aws-doc-sdk-examples    文件:ListTables.java   
public static void main(String[] args)
{
    System.out.println("Your DynamoDB tables:\n");

    final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient();

    ListTablesRequest request;

    boolean more_tables = true;
    String last_name = null;

    while(more_tables) {
        try {
            if (last_name == null) {
                request = new ListTablesRequest().withLimit(10);
            }
            else {
                request = new ListTablesRequest()
                        .withLimit(10)
                        .withExclusiveStartTableName(last_name);
            }

            ListTablesResult table_list = ddb.listTables(request);
            List<String> table_names = table_list.getTableNames();

            if (table_names.size() > 0) {
                for (String cur_name : table_names) {
                    System.out.format("* %s\n", cur_name);
                }
            } else {
                System.out.println("No tables found!");
                System.exit(0);
            }

            last_name = table_list.getLastEvaluatedTableName();
            if (last_name == null) {
                more_tables = false;
            }

        } catch (AmazonServiceException e) {
            System.err.println(e.getErrorMessage());
            System.exit(1);
        }
    }
    System.out.println("\nDone!");
}
项目:dynamodb-janusgraph-storage-backend    文件:ListTablesWorker.java   
@Override
protected ListTablesResult getMergedPages() {
    return new ListTablesResult().withTableNames(tableNames);
}
项目:dynamodb-janusgraph-storage-backend    文件:DynamoDbDelegate.java   
public ListTablesResult listAllTables() throws BackendException {
    final ListTablesWorker worker = new ListTablesWorker(this);
    worker.call();
    return worker.getMergedPages();
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
private ListTablesResult listTables() throws Exception {
  ListTablesResult result = dynamoDb.listTables();

  return result;
}
项目:ColumnStoreUnifier    文件:DynamoDbQueryHandler.java   
public static ListTablesResult listTables() {
    return DynamoDbHandler.CLIENT.listTables();
}
项目:ColumnStoreUnifier    文件:DynamoDbHandler.java   
@Override
public List<String> getTableNames() {
    ListTablesResult result = DynamoDbQueryHandler.listTables();
    return result.getTableNames();
}
项目:aws-dynamodb-examples    文件:DynamoDBLocalFixture.java   
public static void listTables(ListTablesResult result, String method) {
    System.out.println("found " + Integer.toString(result.getTableNames().size()) + " tables with " + method);
    for(String table : result.getTableNames()) {
        System.out.println(table);
    }
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_deleteTable() throws Exception {
  createTable();

  DeleteTableResult deleteResult = dynamoDb.deleteTable(TEST_TABLE_NAME);
  String tableName = deleteResult.getTableDescription().getTableName();

  assertThat(tableName, equalTo(TEST_TABLE_NAME));

  ListTablesResult listResult = listTables();

  assertThat(listResult.getTableNames().size(), equalTo(0));
}