Example usage for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient

List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient

Introduction

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

Prototype

AmazonDynamoDBClient(AwsSyncClientParams clientParams) 

Source Link

Document

Constructs a new client to invoke service methods on DynamoDB using the specified parameters.

Usage

From source file:com.stockcloud.searchstock.java

License:Open Source License

/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 * /*w w  w. j  ava  2s. c o m*/
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.ProfilesConfigFile
 * @see com.amazonaws.ClientConfiguration
 */
private static void init() throws Exception {
    /*
     * The ProfileCredentialsProvider will return your [default] credential
     * profile by reading from the credentials file located at
     * (~/.aws/credentials).
     */
    AWSCredentials credentials = null;
    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
    // Region usWest2 = Region.getRegion(Regions.US_WEST_2);
    // dynamoDB.setRegion(usWest2);
}

From source file:com.stockcloud.updatestock.java

License:Open Source License

/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 * /*w w  w . ja  va 2 s  .c  o  m*/
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.PropertiesCredentials
 * @see com.amazonaws.ClientConfiguration
 */
private static void init() throws Exception {
    /*
     * This credentials provider implementation loads your AWS credentials
     * from a properties file at the root of your classpath.
     */
    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
    Region usWest2 = Region.getRegion(Regions.US_WEST_2);
    dynamoDB.setRegion(usWest2);

}

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

License:Open Source License

/**
 * Constructor./*from   w  w  w  . j av  a2s .c om*/
 * @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.tremolosecurity.proxy.myvd.inserts.amazon.AmazonDynamoDB.java

License:Apache License

@Override
public void configure(String name, Properties props, NameSpace ns) throws LDAPException {
    this.name = name;
    this.accessKey = props.getProperty("accessKey");
    this.secretKey = props.getProperty("secretKey");
    this.userTable = props.getProperty("userTable");
    this.groupTable = props.getProperty("groupTable");

    this.userDN = new DN("ou=users," + ns.getBase().getDN().toString());
    this.groupDN = new DN("ou=groups," + ns.getBase().getDN().toString());
    this.baseDN = new DN(ns.getBase().getDN().toString());

    this.db = new AmazonDynamoDBClient(new BasicAWSCredentials(accessKey, secretKey));

}

From source file:com.trk.aboutme.DynamoDB.AmazonClientManager.java

License:Open Source License

private void initClients() {
    CognitoCredentialsProvider credentials = new CognitoCredentialsProvider(Constants.ACCOUNT_ID,
            Constants.IDENTITY_POOL_ID, Constants.UNAUTH_ROLE_ARN, Constants.UNAUTH_ROLE_ARN,
            Regions.US_EAST_1);//  w w  w.j  a  va 2s .  c  o m

    ddb = new AmazonDynamoDBClient(credentials);
    ddb.setRegion(Region.getRegion(Regions.US_EAST_1));
}

From source file:com.tsatsatzu.subwar.game.logic.dynamo.DynamoIODriver.java

License:Apache License

/**
 * Instantiates a new dynamo io driver./*from w  w w . jav  a 2s.  c o  m*/
 */
public DynamoIODriver() {
    String accessKey = CredentialsLogic.getProperty("accessKey");
    String secretKey = CredentialsLogic.getProperty("secretKey");
    System.setProperty("aws.accessKeyId", accessKey);
    System.setProperty("aws.secretKey", secretKey);
    mClient = new AmazonDynamoDBClient(new SystemPropertiesCredentialsProvider());
    mSingleThreaded = true;
}

From source file:com.zhang.aws.dynamodb.AmazonDynamoDBSample.java

License:Open Source License

/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 *
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.ProfilesConfigFile
 * @see com.amazonaws.ClientConfiguration
 *///  ww  w . java2s.  c  o  m
private static void init() throws Exception {
    /*
     * The ProfileCredentialsProvider will return your [default]
     * credential profile by reading from the credentials file located at
     * (~/.aws/credentials).
     */
    AWSCredentials credentials = null;
    try {
        credentials = new ProfileCredentialsProvider().getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot load the credentials from the credential profiles file. "
                + "Please make sure that your credentials file is at the correct "
                + "location (~/.aws/credentials), and is in valid format.", e);
    }
    dynamoDB = new AmazonDynamoDBClient(credentials);
    Region usWest2 = Region.getRegion(Regions.US_WEST_2);
    dynamoDB.setRegion(usWest2);
}

From source file:cs.iit.edu.ckmr.worker.TableCreator.java

License:Open Source License

public TableCreator() {

    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
    Region usEast1 = Region.getRegion(Regions.US_EAST_1);
    dynamoDB.setRegion(usEast1);/*w  w  w .  ja  v  a 2  s  . co m*/
}

From source file:Database.CustomerData.java

License:Open Source License

/**
 *
 *
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.ProfilesConfigFile
 * @see com.amazonaws.ClientConfiguration
 *///from ww w.  j  a  v  a2 s . c o m
private static void init() throws Exception {

    AWSCredentials credentials = null;
    try {
        credentials = new ProfileCredentialsProvider().getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot load the credentials from the credential profiles file. "
                + "Please make sure that your credentials file is at the correct "
                + "location (~/.aws/credentials), and is in valid format.", e);
    }
    dynamoDB = new AmazonDynamoDBClient(credentials);
    Region usWest2 = Region.getRegion(Regions.US_WEST_2);
    dynamoDB.setRegion(usWest2);
    dynamoDB.setEndpoint("http://localhost:8000");
}

From source file:edu.brandeis.cs.moseskim.gudfoods.aws.dynamodb.AmazonClientManager.java

License:Open Source License

private void initClients() {
    CognitoCachingCredentialsProvider credentials = new CognitoCachingCredentialsProvider(context,
            Constants.IDENTITY_POOL_ID, Regions.US_EAST_1);

    ddb = new AmazonDynamoDBClient(credentials);
    ddb.setRegion(Region.getRegion(Regions.US_EAST_1));
}