Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest


     *        The expected hashkey for the Amazon DynamoDB table
     * @return true if the Amazon DynamoDB table exists and the expected hashkey matches the table schema,
     *         otherwise return false
     */
    private static boolean tableHasCorrectSchema(AmazonDynamoDBClient client, String tableName, String key) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        DescribeTableResult describeTableResult = client.describeTable(describeTableRequest);
        TableDescription tableDescription = describeTableResult.getTable();
        if (tableDescription.getAttributeDefinitions().size() != 1) {
            LOG.error("The number of attribute definitions does not match the existing table.");
            return false;
View Full Code Here


     * @param tableName
     *        The Amazon DynamoDB table to check for
     * @return true if the Amazon DynamoDB table exists, otherwise return false
     */
    private static boolean tableExists(AmazonDynamoDBClient client, String tableName) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        try {
            client.describeTable(describeTableRequest);
            return true;
        } catch (ResourceNotFoundException e) {
            return false;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean leaseTableExists() throws DependencyException {
        DescribeTableRequest request = new DescribeTableRequest();

        request.setTableName(table);

        DescribeTableResult result;
        try {
            result = dynamoDBClient.describeTable(request);
        } catch (ResourceNotFoundException e) {
View Full Code Here

     * Meant to be called as infrequently as possible to avoid throttling
     * exception from the server side.
     */
    public TableDescription describe() {
        DescribeTableResult result = client.describeTable(
                InternalUtils.applyUserAgent(new DescribeTableRequest(tableName)));
        return tableDescription = result.getTable();
    }
View Full Code Here

  public void setupTable() {
    setupGeoDataManager();

    GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();
    DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());

    try {
      config.getDynamoDBClient().describeTable(describeTableRequest);

      if (status == Status.NOT_STARTED) {
View Full Code Here

    }

    private void waitForTableToBeReady() {
      GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();

      DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());
      DescribeTableResult describeTableResult = config.getDynamoDBClient().describeTable(describeTableRequest);

      while (!describeTableResult.getTable().getTableStatus().equalsIgnoreCase("ACTIVE")) {
        try {
          Thread.sleep(2000);
View Full Code Here

    }

    @Override
    public int getSize() throws IOException {
        // The item count from describeTable is updated every ~6 hours
        TableDescription table = dynamo.describeTable(new DescribeTableRequest().withTableName(sessionTableName)).getTable();
        long itemCount = table.getItemCount();

        return (int)itemCount;
    }
View Full Code Here

        }
    }

    public static boolean doesTableExist(AmazonDynamoDBClient dynamo, String tableName) {
        try {
            DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
            addClientMarker(request);

            TableDescription table = dynamo.describeTable(request).getTable();
            if (table == null) return false;
            else return true;
View Full Code Here

    public static void waitForTableToBecomeActive(AmazonDynamoDBClient dynamo, String tableName) {
        long startTime = System.currentTimeMillis();
        long endTime = startTime + (10 * 60 * 1000);
        while (System.currentTimeMillis() < endTime) {
            try {
                DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
                addClientMarker(request);

                TableDescription tableDescription = dynamo.describeTable(request).getTable();
                if (tableDescription == null) continue;

View Full Code Here

     * @return True if a table already exists with the specified name, otherwise
     *         false.
     */
    public static boolean doesTableExist(AmazonDynamoDB dynamo, String tableName) {
        try {
            TableDescription table = dynamo.describeTable(new DescribeTableRequest(tableName)).getTable();
            return TableStatus.ACTIVE.toString().equals(table.getTableStatus());
        } catch (ResourceNotFoundException rnfe) {
            // This means the table doesn't exist in the account yet
            return false;
        }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.