/** * Deletes the table and ignores any errors if it doesn't exist. * * @param dynamo The Dynamo client to use. * @param deleteTableRequest The delete table request. * @return True if deleted, false otherwise. */ public static final boolean deleteTableIfExists( final AmazonDynamoDB dynamo, final DeleteTableRequest deleteTableRequest) { try { dynamo.deleteTable(deleteTableRequest); return true; } catch (final ResourceNotFoundException e) { if (LOG.isTraceEnabled()) { LOG.trace("Table " + deleteTableRequest.getTableName() + " does not exist", e); } } return false; }
@Override public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) { this.deleteTableRequest = deleteTableRequest; return new DeleteTableResult() .withTableDescription( new TableDescription() .withProvisionedThroughput(new ProvisionedThroughputDescription()) .withTableName(deleteTableRequest.getTableName()) .withCreationDateTime(new Date(NOW)) .withItemCount(10L) .withKeySchema(new ArrayList<KeySchemaElement>()) .withTableSizeBytes(20L) .withTableStatus(TableStatus.ACTIVE)); }