List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient
AmazonDynamoDBClient(AwsSyncClientParams clientParams)
From source file:org.socialsignin.springframework.data.dynamodb.demo.config.SpringDataDynamoDemoConfig.java
License:Apache License
@Bean public AmazonDynamoDB amazonDynamoDB() { AmazonDynamoDB amazonDynamoDB = new AmazonDynamoDBClient(amazonAWSCredentials()); if (StringUtils.isNotEmpty(amazonDynamoDBEndpoint)) { amazonDynamoDB.setEndpoint(amazonDynamoDBEndpoint); }//from w ww. j ava2 s. c o m return amazonDynamoDB; }
From source file:org.springframework.social.connect.springdata.dynamodb.test.DynamoDBTestConfig.java
License:Apache License
@Bean public AmazonDynamoDB amazonDynamoDB() { AmazonDynamoDB amazonDynamoDB = new AmazonDynamoDBClient(amazonAWSCredentials()); String amazonDynamoDBEndpoint = environment.getProperty("amazon.dynamodb.endpoint"); if (StringUtils.isNotEmpty(amazonDynamoDBEndpoint)) { amazonDynamoDB.setEndpoint(amazonDynamoDBEndpoint); }//ww w .ja va 2 s . c o m return amazonDynamoDB; }
From source file:oxwodwebdriver.DynamoHelper.java
public static void UploadProcessedWodDataToDynamoDB(String wod, String cardText) { System.out.println("About to upload data to DynamoDB"); BasicAWSCredentials awsCreds = new BasicAWSCredentials("", ""); AmazonDynamoDBClient client = new AmazonDynamoDBClient(awsCreds).withRegion(Regions.US_EAST_1); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.getTable("OxWod"); Map<String, String> expressionAttributeNames = new HashMap<String, String>(); expressionAttributeNames.put("#W", "Wod"); expressionAttributeNames.put("#C", "CardWod"); Map<String, Object> expressionAttributeValues = new HashMap<String, Object>(); expressionAttributeValues.put(":val1", wod); expressionAttributeValues.put(":val2", cardText); UpdateItemOutcome outcome = table.updateItem("Id", // key attribute name 1, // key attribute value "set #W = :val1, #C = :val2", // UpdateExpression expressionAttributeNames, expressionAttributeValues); System.out.println("Fnished uploading data to DynamoDB"); }
From source file:pa3.RemoteClientSQS.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 *//*from w w w .j a v a2 s .c om*/ private static void initSQSandDynamoDB() throws Exception { /* * The ProfileCredentialsProvider will return your [default] credential * profile by reading from the credentials file located at * (C:\\Users\\HP\\.aws\\credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").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 (C:\\Users\\HP\\.aws\\credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); sqs = new AmazonSQSClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); sqs.setRegion(usWest2); }
From source file:pa3.RemoteWorkerSQS.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. */*from ww w. ja v a2 s.c o m*/ * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration */ private static void initSQSandDynamoDB() throws Exception { /* * The ProfileCredentialsProvider will return your [default] credential * profile by reading from the credentials file located at * (C:\\Users\\HP\\.aws\\credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").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 (C:\\Users\\HP\\.aws\\credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); sqs = new AmazonSQSClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); sqs.setRegion(usWest2); }
From source file:sample.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.PropertiesCredentials * @see com.amazonaws.ClientConfiguration *//*from w ww. j av a 2 s . c o m*/ 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:searchengine.WordToDoc.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 *///www .j av a 2s . c om private static void init() throws Exception { /* * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (/home/cis455/.aws/credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").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 (/home/cis455/.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:tr.com.serkanozal.samba.cache.impl.SambaGlobalCache.java
License:Open Source License
public SambaGlobalCache(CacheChangeListener cacheChangeListener) { try {/* w ww. ja va2 s . c o m*/ Properties sambaProps = getProperties("samba.properties"); String tableName = sambaProps.getProperty("cache.global.tableName"); if (tableName != null) { DYNAMO_DB_TABLE_NAME = tableName; } else { DYNAMO_DB_TABLE_NAME = "___SambaGlobalCache___"; } String readCapacityPerSecond = sambaProps.getProperty("cache.global.readCapacityPerSecond"); if (readCapacityPerSecond != null) { DYNAMO_DB_TABLE_READ_CAPACITY_PER_SECOND = Integer.parseInt(readCapacityPerSecond); } else { DYNAMO_DB_TABLE_READ_CAPACITY_PER_SECOND = 1000; } String writeCapacityPerSecond = sambaProps.getProperty("cache.global.writeCapacityPerSecond"); if (writeCapacityPerSecond != null) { DYNAMO_DB_TABLE_WRITE_CAPACITY_PER_SECOND = Integer.parseInt(writeCapacityPerSecond); } else { DYNAMO_DB_TABLE_WRITE_CAPACITY_PER_SECOND = 100; } ///////////////////////////////////////////////////////////////// Properties awsProps = getProperties("aws-credentials.properties"); AWSCredentials awsCredentials = new BasicAWSCredentials(awsProps.getProperty("aws.accessKey"), awsProps.getProperty("aws.secretKey")); DYNAMO_DB = new AmazonDynamoDBClient(awsCredentials); DYNAMO_DB_STREAMS = new AmazonDynamoDBStreamsClient(awsCredentials); DYNAMO_DB_TABLE = ensureTableAvailable(); } catch (IOException e) { throw new RuntimeException(e); } if (cacheChangeListener != null) { registerCacheChangeListener(cacheChangeListener); } }
From source file:uk.co.keithj.postcodelookup.infrastructure.repository.SpringDataDynamoDBConfigurator.java
License:Apache License
@Bean public AmazonDynamoDB amazonDynamoDB() { AmazonDynamoDB amazonDynamoDB = new AmazonDynamoDBClient(amazonAWSCredentials()); if (StringUtils.isNotEmpty(amazonDynamoDBEndpoint)) { amazonDynamoDB.setEndpoint(amazonDynamoDBEndpoint); }/*from w w w . ja v a 2s . c o m*/ amazonDynamoDB.setRegion(amazonRegion()); return amazonDynamoDB; }