本文整理了Java中com.amazonaws.services.dynamodbv2.document.DynamoDB.getTable()
方法的一些代码示例,展示了DynamoDB.getTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DynamoDB.getTable()
方法的具体详情如下:
包路径:com.amazonaws.services.dynamodbv2.document.DynamoDB
类名称:DynamoDB
方法名:getTable
[英]Returns the specified DynamoDB table. No network call is involved.
[中]返回指定的DynamoDB表。不涉及网络呼叫。
代码示例来源:origin: spring-projects/spring-integration-aws
public DynamoDbMetadataStore(AmazonDynamoDBAsync dynamoDB, String tableName) {
Assert.notNull(dynamoDB, "'dynamoDB' must not be null.");
Assert.hasText(tableName, "'tableName' must not be empty.");
this.dynamoDB = dynamoDB;
this.table =
new DynamoDB(this.dynamoDB)
.getTable(tableName);
}
代码示例来源:origin: org.springframework.integration/spring-integration-aws
public DynamoDbMetadataStore(AmazonDynamoDBAsync dynamoDB, String tableName) {
Assert.notNull(dynamoDB, "'dynamoDB' must not be null.");
Assert.hasText(tableName, "'tableName' must not be empty.");
this.dynamoDB = dynamoDB;
this.table =
new DynamoDB(this.dynamoDB)
.getTable(tableName);
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void deleteItem(String threadId, String replyDateTime) {
Table table = dynamoDB.getTable(tableName);
table.deleteItem("Id", threadId, "ReplyDateTime", replyDateTime);
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
private static void retrieveItem() {
Table table = dynamoDB.getTable(tableName);
try {
Item item = table.getItem("Id", 120, "Id, ISBN, Title, Authors", null);
System.out.println("Printing item after retrieving it....");
System.out.println(item.toJSONPretty());
} catch (Exception e) {
System.err.println("GetItem failed.");
System.err.println(e.getMessage());
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
private static void deleteTable(String tableName){
try {
Table table = dynamoDB.getTable(tableName);
table.delete();
System.out.println("Waiting for " + tableName
+ " to be deleted...this may take a while...");
table.waitForDelete();
} catch (Exception e) {
System.err.println("Failed to delete table " + tableName);
e.printStackTrace(System.err);
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
static void deleteExampleTable() {
Table table = dynamoDB.getTable(tableName);
try {
System.out.println("Issuing DeleteTable request for " + tableName);
table.delete();
System.out.println("Waiting for " + tableName
+ " to be deleted...this may take a while...");
table.waitForDelete();
} catch (Exception e) {
System.err.println("DeleteTable request failed for " + tableName);
System.err.println(e.getMessage());
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
private static void deleteTable(String tableName) {
Table table = dynamoDB.getTable(tableName);
try {
System.out.println("Issuing DeleteTable request for " + tableName);
table.delete();
System.out.println("Waiting for " + tableName
+ " to be deleted...this may take a while...");
table.waitForDelete();
} catch (Exception e) {
System.err.println("DeleteTable request failed for " + tableName);
System.err.println(e.getMessage());
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void deleteTable(String tableName) {
Table table = dynamoDB.getTable(tableName);
System.out.println("Deleting table " + tableName + "...");
table.delete();
// Wait for table to be deleted
System.out.println("Waiting for " + tableName + " to be deleted...");
try {
table.waitForDelete();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void deleteTable(String tableName) {
System.out.println("Deleting table " + tableName + "...");
Table table = dynamoDB.getTable(tableName);
table.delete();
// Wait for table to be deleted
System.out.println("Waiting for " + tableName + " to be deleted...");
try {
table.waitForDelete();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
private static void getBook(int id, String tableName) {
Table table = dynamoDB.getTable(tableName);
Item item = table.getItem("Id", // attribute name
id, // attribute value
"Id, ISBN, Title, Authors", // projection expression
null); // name map - don't need this
System.out.println("GetItem: printing results...");
System.out.println(item.toJSONPretty());
}
代码示例来源:origin: johnewart/gearman-java
@Override
public void delete(String functionName, String uniqueID) {
Table table = dynamoDB.getTable(tableName);
table.deleteItem("JobKey", jobIdKey(functionName, uniqueID));
}
代码示例来源:origin: wildfly-extras/wildfly-camel
public static void deleteTable(AmazonDynamoDB client, String tableName) throws InterruptedException {
new DynamoDB(client).getTable(tableName).delete();
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
static void updateExampleTable() {
Table table = dynamoDB.getTable(tableName);
System.out.println("Modifying provisioned throughput for " + tableName);
try {
table.updateTable(new ProvisionedThroughput()
.withReadCapacityUnits(6L).withWriteCapacityUnits(7L));
table.waitForActive();
} catch (Exception e) {
System.err.println("UpdateTable request failed for " + tableName);
System.err.println(e.getMessage());
}
}
代码示例来源:origin: org.wildfly.camel/wildfly-camel-itests-common
public static void deleteTable(AmazonDynamoDB client, String tableName) throws InterruptedException {
new DynamoDB(client).getTable(tableName).delete();
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void main(String[] args) {
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.setEndpoint("http://localhost:8000");
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.getTable("Movies");
table.delete();
System.out.println("Table is being deleted");
}
}
代码示例来源:origin: johnewart/gearman-java
@Override
public Job findJob(String functionName, String uniqueID) {
Table table = dynamoDB.getTable(tableName);
Item item = table.getItem("JobKey", jobIdKey(functionName, uniqueID));
return jobFromItem(item);
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
private static void findRepliesForAThread(String forumName, String threadSubject) {
Table table = dynamoDB.getTable(tableName);
String replyId = forumName + "#" + threadSubject;
QuerySpec spec = new QuerySpec()
.withKeyConditionExpression("Id = :v_id")
.withValueMap(new ValueMap()
.withString(":v_id", replyId));
ItemCollection<QueryOutcome> items = table.query(spec);
System.out.println("\nfindRepliesForAThread results:");
Iterator<Item> iterator = items.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next().toJSONPretty());
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
static void getTableInformation() {
System.out.println("Describing " + tableName);
TableDescription tableDescription = dynamoDB.getTable(tableName).describe();
System.out.format("Name: %s:\n" + "Status: %s \n"
+ "Provisioned Throughput (read capacity units/sec): %d \n"
+ "Provisioned Throughput (write capacity units/sec): %d \n",
tableDescription.getTableName(),
tableDescription.getTableStatus(),
tableDescription.getProvisionedThroughput().getReadCapacityUnits(),
tableDescription.getProvisionedThroughput().getWriteCapacityUnits());
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void retrieveItem(String threadId, String replyDateTime) throws IOException {
Table table = dynamoDB.getTable(tableName);
GetItemSpec spec = new GetItemSpec()
.withPrimaryKey("Id", threadId, "ReplyDateTime", replyDateTime)
.withConsistentRead(true);
Item item = table.getItem(spec);
// Uncompress the reply message and print
String uncompressed = uncompressString(ByteBuffer.wrap(item.getBinary("ExtendedMessage")));
System.out.println("Reply message:\n"
+ " Id: " + item.getString("Id") + "\n"
+ " ReplyDateTime: " + item.getString("ReplyDateTime") + "\n"
+ " PostedBy: " + item.getString("PostedBy") + "\n"
+ " Message: " + item.getString("Message") + "\n"
+ " ExtendedMessage (uncompressed): " + uncompressed + "\n");
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void createItem(String threadId, String replyDateTime) throws IOException {
Table table = dynamoDB.getTable(tableName);
// Craft a long message
String messageInput = "Long message to be compressed in a lengthy forum reply";
// Compress the long message
ByteBuffer compressedMessage = compressString(messageInput.toString());
table.putItem(new Item()
.withPrimaryKey("Id", threadId)
.withString("ReplyDateTime", replyDateTime)
.withString("Message", "Long message follows")
.withBinary("ExtendedMessage", compressedMessage)
.withString("PostedBy", "User A"));
}
内容来源于网络,如有侵权,请联系作者删除!