Example usage for com.amazonaws.services.dynamodbv2.document DynamoDB DynamoDB

List of usage examples for com.amazonaws.services.dynamodbv2.document DynamoDB DynamoDB

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document DynamoDB DynamoDB.

Prototype

public DynamoDB(Regions regionEnum) 

Source Link

Document

Create a DynamoDB object that talks to the specified AWS region.

Usage

From source file:com.nodestone.ksum.RecordProcessor.java

License:Open Source License

/**
 * Initialize DB connection to DynamoDB//from w  w w.j a  v  a  2  s  . c o m
 */
private void initDBConnection() {
    AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
            .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(DB_ENDPOINT, DB_REGION))
            .build();

    this.dynamoDB = new DynamoDB(client);

    this.dbTable = dynamoDB.getTable(DB_TABLE);
}

From source file:com.optimalbi.AmazonAccount.java

License:Apache License

private void populateDynamoDB() throws AmazonClientException {
    getRegions().stream().filter(region -> region.isServiceSupported(ServiceAbbreviations.Dynamodb))
            .forEach(region -> {//from ww  w.  j a  va  2 s .c  o  m
                AmazonDynamoDBClient DDB = new AmazonDynamoDBClient(credentials.getCredentials());
                DDB.setRegion(region);
                DynamoDB dynamoDB = new DynamoDB(DDB);
                TableCollection<ListTablesResult> tables = dynamoDB.listTables();
                tables.forEach(table -> services.add(new LocalDynamoDBService(table.getTableName(), credentials,
                        region, table.describe(), logger)));
            });
}

From source file:com.telefonica.iot.cygnus.backends.dynamo.DynamoDBBackendImpl.java

License:Open Source License

/**
 * Constructor./*from  w  w w  . ja  v  a  2  s.c  o  m*/
 * @param accessKeyId
 * @param secretAccessKey
 * @param region
 */
public DynamoDBBackendImpl(String accessKeyId, String secretAccessKey, String region) {
    BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKeyId, secretAccessKey);
    AmazonDynamoDBClient client = new AmazonDynamoDBClient(awsCredentials);
    client.setRegion(Region.getRegion(Regions.fromName(region)));
    dynamoDB = new DynamoDB(client);
}

From source file:com.yahoo.athenz.zts.cert.impl.DynamoDBCertRecordStore.java

License:Apache License

public DynamoDBCertRecordStore(AmazonDynamoDB client, final String tableName) {
    dynamoDB = new DynamoDB(client);
    this.tableName = tableName;
}

From source file:io.fineo.drill.exec.store.dynamo.DynamoStoragePlugin.java

License:Apache License

private void ensureModel() {
    if (this.model == null) {
        this.client = new AmazonDynamoDBAsyncClient(config.inflateCredentials());
        config.getEndpoint().configure(client);
        this.model = new DynamoDB(client);
    }/*w w w  .  j  a  v a 2s.  c  o m*/
}

From source file:io.fineo.drill.exec.store.dynamo.physical.DynamoQueryBuilder.java

License:Apache License

public DynamoQuery build(AmazonDynamoDBAsyncClient client) {
    return new DynamoQuery(new DynamoDB(client).getTable(tableDef.getName()),
            columns == null || columns.size() == 0 ? "" : COMMAS.join(columns));
}

From source file:io.fineo.dynamo.LocalDynamoTestUtil.java

License:Apache License

public static void cleanupTables(AmazonDynamoDBClient client) {
    StreamSupport.stream(new DynamoDB(client).listTables().pages().spliterator(), false)
            .flatMap(page -> StreamSupport.stream(page.spliterator(), false)).map(table -> table.getTableName())
            .parallel().peek(name -> LOG.info("Deleting table: " + name))
            .forEach(name -> client.deleteTable(name));

}

From source file:io.helixservice.feature.configuration.dynamo.DynamoConfigResourceLocator.java

License:Open Source License

private void configureDynamoConnection() {
    if (!StringUtils.isNullOrEmpty(accessKey) && !StringUtils.isNullOrEmpty(secretKey)) {
        //set the credentials as system properties
        System.setProperty("aws.accessKeyId", accessKey);
        System.setProperty("aws.secretKey", secretKey);
        LOG.info("accessKeyId and secretKey passed successfully via configuration");
    } else {/*w w w  .j a  va  2s  .co  m*/
        LOG.error("accessKeyId or secretKey not set");
    }

    client = new AmazonDynamoDBClient().withEndpoint(clientEndpoint);
    configTable = new DynamoDB(client).getTable(tableName);
}

From source file:io.ignitr.dispatchr.manager.Application.java

License:Apache License

@Autowired
@Bean
public DynamoDB dynamoDB(AmazonDynamoDBClient amazonDynamoDBClient) {
    return new DynamoDB(amazonDynamoDBClient);
}

From source file:io.ignitr.dispatchr.manager.core.data.ClientRepository.java

License:Apache License

@Autowired
public ClientRepository(AmazonDynamoDBClient dynamoDBClient) {
    this.dynamoDBClient = dynamoDBClient;
    this.dynamoDB = new DynamoDB(dynamoDBClient);
}