Package com.amazonaws.services.dynamodbv2

Examples of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient


    String secretKey = System.getProperty("AWS_SECRET_KEY");
    String tableName = System.getProperty("PARAM1");
    String regionName = System.getProperty("PARAM2");

    AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
    AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(credentials);
    Region region = Region.getRegion(Regions.fromName(regionName));
    ddb.setRegion(region);

    config = new GeoDataManagerConfiguration(ddb, tableName);
    geoDataManager = new GeoDataManager(config);
  }
View Full Code Here


        // Grab the container's logger
        logger = getContainer().getLogger();

        AWSCredentialsProvider credentialsProvider = initCredentials();
        AmazonDynamoDBClient dynamo = new AmazonDynamoDBClient(credentialsProvider);
        if (this.regionId != null) dynamo.setRegion(RegionUtils.getRegion(this.regionId));
        if (this.endpoint != null) dynamo.setEndpoint(this.endpoint);

        initDynamoTable(dynamo);

        // init session store
        dynamoSessionStore.setDynamoClient(dynamo);
View Full Code Here

    if (ddbClient != null) {
      return ddbClient;
    }

    if (Config.IN_PRODUCTION) {
      ddbClient = new AmazonDynamoDBClient();
      ddbClient.setEndpoint(ENDPOINT);
    } else {
      ddbClient = new AmazonDynamoDBClient(new BasicAWSCredentials("local", "null"));
      ddbClient.setEndpoint(LOCAL_ENDPOINT);
    }

    Para.addDestroyListener(new Para.DestroyListener() {
      public void onDestroy() {
View Full Code Here

    DefaultDynamo() {
        this(
            new Dynamo.Client() {
                @Override
                public AmazonDynamoDB get() {
                    final AmazonDynamoDB aws = new AmazonDynamoDBClient(
                        new BasicAWSCredentials(
                            Manifests.read("S3Auth-AwsDynamoKey"),
                            Manifests.read("S3Auth-AwsDynamoSecret")
                        )
                    );
                    // @checkstyle MultipleStringLiterals (1 line)
                    if (Manifests.exists("S3Auth-AwsDynamoEntryPoint")) {
                        aws.setEndpoint(
                            Manifests.read("S3Auth-AwsDynamoEntryPoint")
                        );
                    }
                    return aws;
                }
View Full Code Here

    public Worker(IRecordProcessorFactory recordProcessorFactory,
            KinesisClientLibConfiguration config,
            ExecutorService execService) {
        this(recordProcessorFactory, config, new AmazonKinesisClient(config.getKinesisCredentialsProvider(),
                config.getKinesisClientConfiguration()),
                new AmazonDynamoDBClient(config.getDynamoDBCredentialsProvider(),
                        config.getDynamoDBClientConfiguration()),
                new AmazonCloudWatchClient(config.getCloudWatchCredentialsProvider(),
                        config.getCloudWatchClientConfiguration()), execService);
    }
View Full Code Here

            KinesisClientLibConfiguration config,
            IMetricsFactory metricsFactory,
            ExecutorService execService) {
        this(recordProcessorFactory, config, new AmazonKinesisClient(config.getKinesisCredentialsProvider(),
                config.getKinesisClientConfiguration()),
                new AmazonDynamoDBClient(config.getDynamoDBCredentialsProvider(),
                        config.getDynamoDBClientConfiguration()), metricsFactory, execService);
    }
View Full Code Here

    if (ddbClient != null) {
      return ddbClient;
    }

    if (Config.IN_PRODUCTION) {
      ddbClient = new AmazonDynamoDBClient();
      ddbClient.setEndpoint(ENDPOINT);
    } else {
      ddbClient = new AmazonDynamoDBClient(new BasicAWSCredentials("local", "null"));
      ddbClient.setEndpoint(LOCAL_ENDPOINT);
    }

    Para.addDestroyListener(new Para.DestroyListener() {
      public void onDestroy() {
View Full Code Here

                if ( getterResult == null && reflector.isAssignableKey(method) ) {
                    onAutoGenerateAssignableKey(method, attributeName);
                }
               
                else {
                    AttributeValue newAttributeValue = getSimpleAttributeValue(method, getterResult);
                    if ( newAttributeValue == null ) {
                        throw new DynamoDBMappingException("Null or empty value for key: " + method);
                    }

                    onKeyAttributeValue(attributeName, newAttributeValue);
                }
            }

            /*
             * Next construct an update for every non-key property
             */
            for ( Method method : reflector.getRelevantGetters(clazz) ) {

                // Skip any key methods, since they are handled separately
                if ( keyGetters.contains(method) )
                    continue;

                Object getterResult = safeInvoke(method, object);
                String attributeName = reflector.getAttributeName(method);

                /*
                 * If this is a versioned field, update it
                 */
                if ( reflector.isVersionAttributeGetter(method) ) {
                    onVersionAttribute(method, getterResult, attributeName);
                    nonKeyAttributePresent = true;
                }

                /*
                 * Otherwise apply the update value for this attribute.
                 */
                else  {
                    AttributeValue currentValue = getSimpleAttributeValue(method, getterResult);
                    if ( currentValue != null ) {
                        onNonKeyAttribute(attributeName, currentValue);
                        nonKeyAttributePresent = true;
                    } else {
                        onNullNonKeyAttribute(attributeName);
View Full Code Here

        protected List<ValueUpdate> getInMemoryUpdates() {
            return inMemoryUpdates;
        }
       
        private void onAutoGenerateAssignableKey(Method method, String attributeName) {
            AttributeValue newVersionValue = getAutoGeneratedKeyAttributeValue(method, null);
           
            updateValues.put(attributeName,
                    new AttributeValueUpdate().withAction("PUT").withValue(newVersionValue));
            inMemoryUpdates.add(new ValueUpdate(method, newVersionValue, object));
           
View Full Code Here

                // update call
                ExpectedAttributeValue expected = new ExpectedAttributeValue();

                // For new objects, insist that the value doesn't exist.
                // For existing ones, insist it has the old value.
                AttributeValue currentValue = getSimpleAttributeValue(method, getterResult);
                expected.setExists(currentValue != null);
                if ( currentValue != null ) {
                    expected.setValue(currentValue);
                }
                expectedValues.put(attributeName, expected);
            }

            AttributeValue newVersionValue = getVersionAttributeValue(method, getterResult);
            updateValues
                    .put(attributeName, new AttributeValueUpdate().withAction("PUT").withValue(newVersionValue));
            inMemoryUpdates.add(new ValueUpdate(method, newVersionValue, object));
        }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.