Java 类com.amazonaws.services.dynamodb.AmazonDynamoDBClient 实例源码

项目:gora-boot    文件:DynamoDBStore.java   
/**
  * Method to create the specific client to be used
  * @param clientType
  * @param credentials
  * @return
  */
public AmazonDynamoDB getClient(String clientType, AWSCredentials credentials){
  if (clientType.equals("sync"))
    return new AmazonDynamoDBClient(credentials);
  if (clientType.equals("async"))
    return new AmazonDynamoDBAsyncClient(credentials);
  return null;
}
项目:pig-dynamodb    文件:DynamoDBStorage.java   
DynamoDBStorage(String tableName, String awsAccessKeyId, String awsSecretKey, 
        AmazonDynamoDBClient dynamo, HadoopJobInfo hadoopJobInfo) {
    this.tableName = tableName;
    this.awsAccessKeyId = awsAccessKeyId;
    this.awsSecretKey = awsSecretKey;
    this.dynamo = dynamo;
    this.hadoopJobInfo = hadoopJobInfo;
}
项目:pig-dynamodb    文件:DynamoDBStorage.java   
private AmazonDynamoDBClient loadDynamoDB() {
    if (this.dynamo == null) {
        this.dynamo = new AmazonDynamoDBClient(new BasicAWSCredentials(
                this.awsAccessKeyId, this.awsSecretKey));
    }
    return this.dynamo;
}
项目:pig-dynamodb    文件:TestDynamoDBStorage.java   
@Test
public void testMissingPrimaryKey() throws IOException, InterruptedException {
    String tableName = "mortar_test_foo_table";
    String awsAccessKeyId = "XXXXXXXXXXXXX";
    String awsSecretKey = "YYYYYYYYYYYYYY";
    ResourceSchema schema = 
            new ResourceSchema(Utils.getSchemaFromString("my_field:int"));

 // mock dynamo client
    AmazonDynamoDBClient dynamo = mock(AmazonDynamoDBClient.class);
    DescribeTableResult describeResult = new DescribeTableResult()
        .withTable(
            new TableDescription()
                .withProvisionedThroughput(
                    new ProvisionedThroughputDescription().withWriteCapacityUnits(50L))
                .withKeySchema(new KeySchema()
                    .withHashKeyElement(new KeySchemaElement()
                        .withAttributeName("not_the_key_you_will_find")
                        .withAttributeType(ScalarAttributeType.N))));

    when(dynamo.describeTable(any(DescribeTableRequest.class))).thenReturn(describeResult);
    DynamoDBStorage storage = 
            new DynamoDBStorage(tableName, awsAccessKeyId, awsSecretKey, dynamo, null);
    try {
        storage.checkSchema(schema);
        Assert.fail("Expected schema validation to fail");
    } catch(IOException e) {
        Assert.assertTrue("Expected " + e.getMessage() + " to contain hash msg", e.getMessage().contains("hash primary key"));
    }
}
项目:gora-oraclenosql    文件:DynamoDBStore.java   
/**
  * Method to create the specific client to be used
  * @param clientType
  * @param credentials
  * @return
  */
public AmazonDynamoDB getClient(String clientType, AWSCredentials credentials){
  if (clientType.equals("sync"))
    return new AmazonDynamoDBClient(credentials);
  if (clientType.equals("async"))
    return new AmazonDynamoDBAsyncClient(credentials);
  return null;
}
项目:s3mper    文件:DynamoDBMetastore.java   
/**
 * Creates the metastore table in DynamoDB if it doesn't exist with the configured
 * read and write units.
 * 
 * @param uri
 * @param conf
 * @throws Exception 
 */
@Override
public void initalize(URI uri, Configuration conf) throws Exception {
    scheme = uri.getScheme();

    String keyId = conf.get("fs."+uri.getScheme()+".awsAccessKeyId");
    String keySecret = conf.get("fs."+uri.getScheme()+".awsSecretAccessKey");

    //An override option for accessing across accounts
    keyId = conf.get("s3mper.override.awsAccessKeyId", keyId);
    keySecret = conf.get("s3mper.override.awsSecretAccessKey", keySecret);

    db = new AmazonDynamoDBClient(new BasicAWSCredentials(keyId, keySecret));

    readUnits = conf.getLong("s3mper.metastore.read.units", readUnits);
    writeUnits = conf.getLong("s3mper.metastore.write.units", writeUnits);

    retryCount = conf.getInt("s3mper.metastore.retry", retryCount);
    timeout = conf.getInt("s3mper.metastore.timeout", timeout);

    tableName = conf.get("s3mper.metastore.name", tableName);

    deleteMarkerEnabled = conf.getBoolean("s3mper.metastore.deleteMarker.enabled", false);

    boolean checkTableExists = conf.getBoolean("s3mper.metastore.create", false);

    if(checkTableExists) {
        ListTablesResult tables = db.listTables();

        if(!tables.getTableNames().contains(tableName)) {
            createTable();
        }
    }
}
项目:s3mper    文件:MetastoreJanitor.java   
public void initalize(URI uri, Configuration conf) throws Exception {
    String keyId = conf.get("fs."+uri.getScheme()+".awsAccessKeyId");
    String keySecret = conf.get("fs."+uri.getScheme()+".awsSecretAccessKey");

    //An override option for accessing across accounts
    keyId = conf.get("s3mper.override.awsAccessKeyId", keyId);
    keySecret = conf.get("s3mper.override.awsSecretAccessKey", keySecret);

    db = new AmazonDynamoDBClient(new BasicAWSCredentials(keyId, keySecret));

    tableName = conf.get("s3mper.metastore.name", tableName);

    metastore = new DynamoDBMetastore();
    metastore.initalize(uri, conf);
}
项目:s3mper    文件:TimeseriesScannerTask.java   
public TimeseriesScannerTask(AmazonDynamoDBClient db, RateLimiter limiter, BlockingQueue<Key> deleteQueue, int queueSize, long age) {
    super(db, limiter);
    this.deleteQueue = deleteQueue;
    this.queueSize = queueSize;
    this.age = age;
}
项目:s3mper    文件:AbstractScannerTask.java   
public AbstractScannerTask(AmazonDynamoDBClient db, RateLimiter limiter) {
    super(db, limiter);
}
项目:s3mper    文件:PathScannerTask.java   
public PathScannerTask(AmazonDynamoDBClient db, RateLimiter limiter, BlockingQueue<Key> deleteQueue, int queueSize, long age) {
    super(db, limiter);
    this.deleteQueue = deleteQueue;
    this.age = age;
    this.queueSize = queueSize;
}
项目:s3mper    文件:DeleteWriterTask.java   
public DeleteWriterTask(AmazonDynamoDBClient db, RateLimiter limiter, BlockingQueue<Key> deleteQueue) {
    super(db, limiter);
    this.deleteQueue = deleteQueue;
}
项目:s3mper    文件:AbstractDynamoDBTask.java   
public AbstractDynamoDBTask(AmazonDynamoDBClient db, RateLimiter limiter) {
    this.db = db;
    this.limiter = limiter;
}
项目:s3mper    文件:AbstractDynamoDBTask.java   
public AmazonDynamoDBClient getDb() {
    return db;
}
项目:s3mper    文件:AbstractDynamoDBTask.java   
public void setDb(AmazonDynamoDBClient db) {
    this.db = db;
}
项目:gora-boot    文件:GoraDynamoDBTestDriver.java   
/**
 * Gets DynamoDBClient to be used
 * @return
 */
public AmazonDynamoDBClient getDynamoDBClient() {
  return dynamoDBClient;
}
项目:gora-oraclenosql    文件:GoraDynamoDBTestDriver.java   
/**
 * Gets DynamoDBClient to be used
 * @return
 */
public AmazonDynamoDBClient getDynamoDBClient() {
  return dynamoDBClient;
}