Java 类com.amazonaws.services.dynamodb.model.CreateTableRequest 实例源码

项目:s3mper    文件:DynamoDBMetastore.java   
/**
 * Creates the table in DynamoDB. The hash+range key is:
 * 
 *           Hash (String)        |    Range (String)
 *             File Path                 File Name
 * Example:  s3n://netflix/data           test.xml
 *   
 * The table also includes one attribute for epoch (time created), but
 * that is only defined during the put operation (see add()).
 *
 */
private void createTable() {
    log.info("Creating table in DynamoDB: " + tableName);

    CreateTableRequest createRequest = new CreateTableRequest();
    createRequest.withTableName(tableName);

    //Key
    KeySchemaElement pathKey = new KeySchemaElement().withAttributeName(HASH_KEY).withAttributeType(ScalarAttributeType.S);
    KeySchemaElement fileKey = new KeySchemaElement().withAttributeName(RANGE_KEY).withAttributeType(ScalarAttributeType.S);
    KeySchema schema = new KeySchema();
    schema.setHashKeyElement(pathKey);
    schema.setRangeKeyElement(fileKey);
    createRequest.setKeySchema(schema);

    //Throughput
    ProvisionedThroughput tp = new ProvisionedThroughput();
    tp.setReadCapacityUnits(readUnits);
    tp.setWriteCapacityUnits(writeUnits);

    createRequest.setProvisionedThroughput(tp);

    db.createTable(createRequest);
}
项目:gora-boot    文件:DynamoDBStore.java   
/**
 * Executes a create table request using the DynamoDB client and waits
 * the default time until it's been created.
 * @param tableName
 */
private void executeCreateTableRequest(String tableName){
  CreateTableRequest createTableRequest = getCreateTableRequest(tableName,
    mapping.getKeySchema(tableName), mapping.getProvisionedThroughput(tableName));
  // use the client to perform the request
  dynamoDBClient.createTable(createTableRequest).getTableDescription();
  // wait for table to become active
  waitForTableToBecomeAvailable(tableName);
  LOG.info(tableName + "Schema now available");
}
项目:gora-boot    文件:DynamoDBStore.java   
/**
 * Builds the necessary requests to create tables 
 * @param tableName
 * @param keySchema
 * @param proThrou
 * @return
 */
private CreateTableRequest getCreateTableRequest(String tableName, KeySchema keySchema, ProvisionedThroughput proThrou){
  CreateTableRequest createTableRequest = new CreateTableRequest();
  createTableRequest.setTableName(tableName);
  createTableRequest.setKeySchema(keySchema);
  createTableRequest.setProvisionedThroughput(proThrou);
  return createTableRequest;
}
项目:gora-oraclenosql    文件:DynamoDBStore.java   
/**
 * Executes a create table request using the DynamoDB client and waits
 * the default time until it's been created.
 * @param tableName
 */
private void executeCreateTableRequest(String tableName){
  CreateTableRequest createTableRequest = getCreateTableRequest(tableName,
    mapping.getKeySchema(tableName), mapping.getProvisionedThroughput(tableName));
  // use the client to perform the request
  dynamoDBClient.createTable(createTableRequest).getTableDescription();
  // wait for table to become active
  waitForTableToBecomeAvailable(tableName);
  LOG.info(tableName + "Schema now available");
}
项目:gora-oraclenosql    文件:DynamoDBStore.java   
/**
 * Builds the necessary requests to create tables 
 * @param tableName
 * @param keySchema
 * @param proThrou
 * @return
 */
private CreateTableRequest getCreateTableRequest(String tableName, KeySchema keySchema, ProvisionedThroughput proThrou){
  CreateTableRequest createTableRequest = new CreateTableRequest();
  createTableRequest.setTableName(tableName);
  createTableRequest.setKeySchema(keySchema);
  createTableRequest.setProvisionedThroughput(proThrou);
  return createTableRequest;
}