List of usage examples for com.amazonaws.services.dynamodbv2.document DynamoDB DynamoDB
public DynamoDB(Regions regionEnum)
From source file:io.ignitr.dispatchr.manager.core.data.SubscriptionRepository.java
License:Apache License
@Autowired public SubscriptionRepository(AmazonDynamoDBClient dynamoDBClient) { this.dynamoDBClient = dynamoDBClient; this.dynamoDB = new DynamoDB(dynamoDBClient); }
From source file:io.ignitr.dispatchr.manager.core.data.TopicRepository.java
License:Apache License
@Autowired public TopicRepository(AmazonDynamoDBClient dynamoDBClient) { this.dynamoDBClient = dynamoDBClient; this.dynamoDB = new DynamoDB(dynamoDBClient); }
From source file:mx.iteso.desi.cloud.keyvalue.DynamoDBStorage.java
License:Apache License
public DynamoDBStorage(String dbName) { BasicAWSCredentials cred = new BasicAWSCredentials(Config.accessKeyID, Config.secretAccessKey); if (Config.DynamoDbClientType == Config.DYNAMODBCLIENTTYPE.Local) { client = new AmazonDynamoDBClient(cred); client.setRegion(Region.getRegion(Config.amazonRegion)); client.setEndpoint("http://localhost:8000"); } else {//from w w w. j a v a 2 s.co m client = AmazonDynamoDBClientBuilder.standard().withRegion(Config.amazonRegion) .withCredentials(new AWSStaticCredentialsProvider(cred)).build(); } docClient = new DynamoDB(client); this.dbName = dbName; // Create a table CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(dbName) .withKeySchema(new KeySchemaElement().withAttributeName("keyword").withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName("inx").withKeyType(KeyType.RANGE)) .withAttributeDefinitions( new AttributeDefinition().withAttributeName("keyword") .withAttributeType(ScalarAttributeType.S), new AttributeDefinition().withAttributeName("inx").withAttributeType(ScalarAttributeType.N)) .withProvisionedThroughput( new ProvisionedThroughput().withReadCapacityUnits(1L).withWriteCapacityUnits(1L)); // Create table if it does not exist yet TableUtils.createTableIfNotExists(client, createTableRequest); // Wait for the table to move into Active state try { TableUtils.waitUntilActive(client, dbName); } catch (Exception e) { // Do nothing... yet } //requestItems.put(dbName, requestList); }
From source file:org.apache.nifi.processors.aws.dynamodb.AbstractDynamoDBProcessor.java
License:Apache License
protected synchronized DynamoDB getDynamoDB() { if (dynamoDB == null) dynamoDB = new DynamoDB(client); return dynamoDB; }
From source file:org.chodavarapu.jgitaws.aws.DynamoClient.java
License:Eclipse Distribution License
public DynamoClient(AmazonDynamoDB dynamoClient) { this.dynamoClient = dynamoClient; this.dynamoDb = new DynamoDB(dynamoClient); }
From source file:org.diksha.common.dyutils.DyDBUtils.java
License:Apache License
public static DynamoDB getDynamoDB() { AWSCredentials awsCredentials = getAwsCredentials(); DynamoDB dynamoDB = new DynamoDB(new AmazonDynamoDBClient(awsCredentials)); return dynamoDB; }
From source file:org.kmbmicro.chatwebsocket.DbString.java
public static void init() { try {// w w w . j a v a2 s .c o m 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 (/Users/sandiwibowo/.aws/credentials), and is in valid format.", e); } AmazonDynamoDBClient dynamoDBAWS = new AmazonDynamoDBClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDBAWS.setRegion(usWest2); dynamoDB = new DynamoDB(dynamoDBAWS); }
From source file:org.openhab.persistence.dynamodb.internal.DynamoDBClient.java
License:Open Source License
public DynamoDBClient(AWSCredentials credentials, Region region) { client = new AmazonDynamoDBClient(credentials); client.setRegion(region);//w w w .j a v a 2 s . c o m dynamo = new DynamoDB(client); }
From source file:org.springframework.integration.aws.metadata.DynamoDbMetaDataStore.java
License:Apache License
public DynamoDbMetaDataStore(AmazonDynamoDBAsync dynamoDB, String tableName) { Assert.notNull(dynamoDB, "'dynamoDB' must not be null."); Assert.hasText(tableName, "'tableName' must not be empty."); this.dynamoDB = dynamoDB; this.table = new DynamoDB(this.dynamoDB).getTable(tableName); }
From source file:org.wildfly.camel.test.common.aws.DynamoDBUtils.java
License:Apache License
public static TableDescription createTable(AmazonDynamoDB client, String tableName) throws InterruptedException { CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName) .withKeySchema(new KeySchemaElement("Id", KeyType.HASH)) .withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N)) .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L)) .withStreamSpecification(new StreamSpecification().withStreamEnabled(true) .withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES)); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.createTable(tableReq); return table.waitForActive(); }