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

项目: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-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);
}
项目: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-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!");
}