Example usage for com.amazonaws.services.dynamodbv2.model ListTablesRequest ListTablesRequest

List of usage examples for com.amazonaws.services.dynamodbv2.model ListTablesRequest ListTablesRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model ListTablesRequest ListTablesRequest.

Prototype

public ListTablesRequest() 

Source Link

Document

Default constructor for ListTablesRequest object.

Usage

From source file:com.intuit.tank.persistence.databases.AmazonDynamoDatabaseDocApi.java

License:Open Source License

/**
 * // ww  w  .  j  a v  a 2  s  .co m
 * @{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;
}

From source file:com.intuit.tank.persistence.databases.AmazonDynamoDatabaseDocApi.java

License:Open Source License

/**
 * //from w  w w.j ava  2  s . c  om
 * @{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;
}

From source file:com.makariev.dynamodb.data.tables.ModifyTablesService.java

License:Apache License

public List<TableDescription> showTables() {

    final List<TableDescription> result = new ArrayList<>();

    String lastEvaluatedTableName = null;
    do {//from   www. j a va 2  s  .  c  o m

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

        final ListTablesResult requestResult = client.listTables(listTablesRequest);
        lastEvaluatedTableName = requestResult.getLastEvaluatedTableName();

        for (String tableName : requestResult.getTableNames()) {
            final DescribeTableResult describeResult = client.describeTable(tableName);

            final TableDescription tableDescription = describeResult.getTable();
            result.add(tableDescription);
        }

    } while (lastEvaluatedTableName != null);

    return result;
}

From source file:com.rapid7.diskstorage.dynamodb.ListTablesWorker.java

License:Open Source License

public ListTablesWorker(final DynamoDBDelegate delegate) {
    super(delegate, delegate.getListTablesApiName(), null /*tableName*/);
    this.request = new ListTablesRequest();
    this.returnedCount = 0;
    this.scannedCount = 0;
    this.tableNames = new ArrayList<>();
    this.hasNext = true;
}

From source file:Database.TableFunctions.java

public static String listMyTables() {
        ArrayList nameList = new ArrayList();
        String lastEvaluatedTableName = null;
        do {/* ww w  .ja  va2 s  .c o m*/
            ListTablesRequest listTablesRequest = new ListTablesRequest().withLimit(10)
                    .withExclusiveStartTableName(lastEvaluatedTableName);
            ListTablesResult result = dynamoDB.listTables(listTablesRequest);
            lastEvaluatedTableName = result.getLastEvaluatedTableName();
            for (String name : result.getTableNames()) {
                System.out.println(name);
                nameList.add(name);
            }
        } while (lastEvaluatedTableName != null);
        return nameList.toString();
    }

From source file:io.exemplary.aws.DynamoDBServer.java

License:Apache License

private void deleteAllTables() {
    AmazonDynamoDBClient client = new AmazonDynamoDBClient(new BasicAWSCredentials("accessKey", "secretKey"));
    client.setEndpoint(getEndpoint());//w  w w.  j a  v a 2s. c  o m
    ListTablesResult result = client.listTables(new ListTablesRequest());
    for (String tableName : result.getTableNames()) {
        client.deleteTable(new DeleteTableRequest(tableName));
    }
    client.shutdown();
}