List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient
@Deprecated
public AmazonDynamoDBClient()
From source file:se.symsoft.codecamp.SmsTerminatorService.java
License:Open Source License
private HttpServer start() throws IOException { AmazonDynamoDBClient amazonDynamoDBClient = new AmazonDynamoDBClient().withRegion(Regions.EU_WEST_1); dynamoDB = new DynamoDBMapper(amazonDynamoDBClient); try {/* ww w . j ava2 s.c o m*/ initCache(); } catch (Exception e) { e.printStackTrace(); System.out.println("Failed to init cache from DynamoDB"); } initSwagger(); Metrics.startGraphiteMetricsReporter(); URI baseUri = UriBuilder.fromUri("http://0.0.0.0").port(PORT).build(); HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, this); server.getServerConfiguration().addHttpHandler( new CLStaticHttpHandler(SmsTerminatorService.class.getClassLoader(), "web/"), "/terminator-ui"); server.getServerConfiguration().addHttpHandler( new CLStaticHttpHandler(SmsTerminatorService.class.getClassLoader(), "swagger/"), "/swagger"); server.getServerConfiguration().addHttpHandler( new CLStaticHttpHandler(SmsTerminatorService.class.getClassLoader(), "swagger/js/"), "/js"); server.getServerConfiguration().addHttpHandler( new CLStaticHttpHandler(SmsTerminatorService.class.getClassLoader(), "swagger/css/"), "/css"); server.start(); System.out.println("Server started on port + " + PORT); return server; }
From source file:showfinder.ShowFinderSpeechlet.java
License:Open Source License
private BeaconDao getBeaconDao() { final AmazonDynamoDBClient amazonDynamoDBClient = new AmazonDynamoDBClient(); final BeaconDynamoDbClient beaconDynamoDbClient = new BeaconDynamoDbClient(amazonDynamoDBClient); final BeaconDao beaconDao = new BeaconDao(beaconDynamoDbClient); return beaconDao; }
From source file:vfma.LoadSensorData.java
License:Open Source License
public ArrayList<RawSensorData> getSensorData(String lastTimestamp) throws VFMException { ArrayList<RawSensorData> rsdlist = new ArrayList<RawSensorData>(); try {/*from w w w .j a va 2 s . c om*/ AmazonDynamoDBClient client = new AmazonDynamoDBClient() .withEndpoint("https://dynamodb.us-west-2.amazonaws.com"); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.getTable("sensorData"); ScanSpec scanSpec = new ScanSpec(); System.out.println("Get sensors..."); ItemCollection<ScanOutcome> items = table.scan(scanSpec); String lastTimeValue; Iterator<Item> iter = items.iterator(); while (iter.hasNext()) { Item item = iter.next(); RawSensorData rsd = new RawSensorData(); rsd.setTimestamp(item.getJSON("pass").replace("\"", "")); final JSONObject rawData = new JSONObject(item.getJSON("payload")); rsd.setSensorId(rawData.getString("sensor_id_time")); rsd.setPassing(rawData.getString("passing")); System.out.println("Read " + rsd.getSensorId()); if (rsd.getTimestamp().compareTo(lastTimestamp) > 0) rsdlist.add(rsd); lastTimeValue = rsd.getTimestamp(); } } catch (Exception e) { System.err.println("Unable to scan the table:"); System.err.println(e.getMessage()); } return rsdlist; }
From source file:ws.salient.aws.AmazonClientProvider.java
License:Apache License
public AmazonClientProvider() { Region region = Regions.getCurrentRegion(); if (region == null) { region = Region.getRegion(Regions.US_EAST_1); }//from w ww . ja v a2 s .c om s3 = new AmazonS3Client().withRegion(region); kms = new AWSKMSClient().withRegion(region); dynamodb = new DynamoDB(new AmazonDynamoDBClient().withRegion(region)); lambda = new AWSLambdaClient().withRegion(region); }