diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index 8078402d8617..9ac62c8a64c6 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: AWS SDK for Java Bundle-SymbolicName: com.amazonaws.sdk;singleton:=true -Bundle-Version: 1.6.11 +Bundle-Version: 1.6.12 Bundle-Vendor: Amazon Technologies, Inc Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: org.apache.commons.codec;bundle-version="1.3.0", diff --git a/pom.xml b/pom.xml index 3162e7caf1e6..d18f5e04e5d7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ aws-java-sdk jar AWS SDK for Java - 1.6.11 + 1.6.12 The Amazon Web Services SDK for Java provides Java APIs for building software on AWS’ cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc). https://aws.amazon.com/sdkforjava diff --git a/src/main/java/com/amazonaws/AmazonWebServiceClient.java b/src/main/java/com/amazonaws/AmazonWebServiceClient.java index 413625bde614..41f0bef6dbb6 100644 --- a/src/main/java/com/amazonaws/AmazonWebServiceClient.java +++ b/src/main/java/com/amazonaws/AmazonWebServiceClient.java @@ -279,9 +279,20 @@ public void setRegion(Region region) throws IllegalArgumentException { setEndpoint(serviceEndpoint, serviceName, region.getName()); } + /** + * @deprecated by client configuration via the constructor. + * This method will be removed later on. + */ + @Deprecated public void setConfiguration(ClientConfiguration clientConfiguration) { + AmazonHttpClient existingClient = this.client; + RequestMetricCollector requestMetricCollector = null; + if (existingClient != null) { + requestMetricCollector = existingClient.getRequestMetricCollector(); + existingClient.shutdown(); + } this.clientConfiguration = clientConfiguration; - client = new AmazonHttpClient(clientConfiguration); + this.client = new AmazonHttpClient(clientConfiguration, requestMetricCollector); } /** diff --git a/src/main/java/com/amazonaws/services/cloudtrail/AWSCloudTrailClient.java b/src/main/java/com/amazonaws/services/cloudtrail/AWSCloudTrailClient.java index fa9752d96ddd..c3fe449d420b 100644 --- a/src/main/java/com/amazonaws/services/cloudtrail/AWSCloudTrailClient.java +++ b/src/main/java/com/amazonaws/services/cloudtrail/AWSCloudTrailClient.java @@ -145,7 +145,7 @@ public AWSCloudTrailClient(AWSCredentials awsCredentials) { * (ex: proxy settings, retry counts, etc.). */ public AWSCloudTrailClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { - super(clientConfiguration); + super(adjustClientConfiguration(clientConfiguration)); this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials); @@ -208,7 +208,7 @@ public AWSCloudTrailClient(AWSCredentialsProvider awsCredentialsProvider, Client public AWSCloudTrailClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { - super(clientConfiguration, requestMetricCollector); + super(adjustClientConfiguration(clientConfiguration), requestMetricCollector); this.awsCredentialsProvider = awsCredentialsProvider; @@ -239,6 +239,12 @@ private void init() { "/com/amazonaws/services/cloudtrail/request.handler2s")); } + private static ClientConfiguration adjustClientConfiguration(ClientConfiguration orig) { + ClientConfiguration config = orig; + + return config; + } + /** *

* Returns a JSON-formatted list of information about the specified diff --git a/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java b/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java index 137701ae24c5..af3c41d6065f 100644 --- a/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java +++ b/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java @@ -245,7 +245,7 @@ public AmazonDynamoDBClient(AWSCredentials awsCredentials, ClientConfiguration c public AmazonDynamoDBClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { - super(clientConfiguration, requestMetricCollector); + super(adjustClientConfiguration(clientConfiguration), requestMetricCollector); this.awsCredentialsProvider = new StaticCredentialsProvider( awsCredentials); init(); @@ -309,7 +309,7 @@ public AmazonDynamoDBClient(AWSCredentialsProvider awsCredentialsProvider, Clien public AmazonDynamoDBClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { - super(clientConfiguration, requestMetricCollector); + super(adjustClientConfiguration(clientConfiguration), requestMetricCollector); this.awsCredentialsProvider = awsCredentialsProvider; init(); } @@ -330,17 +330,19 @@ private void init() { signer.setServiceName("dynamodb"); - HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain( "/com/amazonaws/services/dynamodb/request.handlers")); + } - - clientConfiguration = new ClientConfiguration(clientConfiguration); - if (clientConfiguration.getRetryPolicy() == com.amazonaws.retry.PredefinedRetryPolicies.DEFAULT) { - clientConfiguration.setRetryPolicy(com.amazonaws.retry.PredefinedRetryPolicies.DYNAMODB_DEFAULT); + private static ClientConfiguration adjustClientConfiguration(ClientConfiguration orig) { + ClientConfiguration config = orig; + if (config.getRetryPolicy() == com.amazonaws.retry.PredefinedRetryPolicies.DEFAULT) { + config = new ClientConfiguration(orig); + config.setRetryPolicy( + com.amazonaws.retry.PredefinedRetryPolicies.DYNAMODB_DEFAULT); } - setConfiguration(clientConfiguration); + return config; } /** @@ -943,6 +945,7 @@ public void setEndpoint(String endpoint, String serviceName, String regionId) th signer.setRegionName(regionId); } + @Override protected String getServiceAbbreviation() { return "dynamodb"; } diff --git a/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/AttributeTransformerChain.java b/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/AttributeTransformerChain.java new file mode 100644 index 000000000000..30e6da0b8a7b --- /dev/null +++ b/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/AttributeTransformerChain.java @@ -0,0 +1,163 @@ +/* + * Copyright 2013-2014 Amazon Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://aws.amazon.com/apache2.0 + * + * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and + * limitations under the License. + */ +package com.amazonaws.services.dynamodbv2.datamodeling; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import com.amazonaws.services.dynamodbv2.model.AttributeValue; + +/** + * A virtual {@code AttributeTransformer} that transforms and untransforms + * attributes by running them through a cascading series of child + * {@code AttributeTransformer} instances. + */ +public class AttributeTransformerChain implements AttributeTransformer { + + private final List transformers; + + /** + * Creates a new transformer chain from the given array of transformers. + * When transforming attributes, these transformers are invoked from first + * to last; when untransforming they are invoked in the opposite order. + * + * @param transformers the chain of transformers. + */ + public AttributeTransformerChain( + final AttributeTransformer... transformers) { + + this(Arrays.asList(transformers)); + } + + /** + * Creates a new transformer chain from the given list of transformers. + * When transforming attributes, these transformers are invoked from first + * to last; when untransforming they are invoked in the opposite order. + * + * @param transformers the chain of transformers. + */ + public AttributeTransformerChain( + final List transformers) { + + this.transformers = Collections.unmodifiableList( + new ArrayList(transformers)); + } + + /** + * @return the transformers in this chain + */ + public List getTransformers() { + return transformers; + } + + @Override + public Map transform( + final Parameters parameters) { + + ProxyParameters proxy = new ProxyParameters(parameters); + + for (int i = 0; i < transformers.size(); ++i) { + proxy.setAttributeValues(transformers.get(i).transform(proxy)); + } + + return proxy.getAttributeValues(); + } + + @Override + public Map untransform( + final Parameters parameters) { + + ProxyParameters proxy = new ProxyParameters(parameters); + + for (int i = transformers.size() - 1; i >= 0; --i) { + proxy.setAttributeValues(transformers.get(i).untransform(proxy)); + } + + return proxy.getAttributeValues(); + } + + @Override + public String toString() { + return transformers.toString(); + } + + /** + * A {@code Parameters} proxy that intercepts calls to + * {@code getAttributeValues} and overrides the return value. + */ + private static class ProxyParameters implements Parameters { + + private final Parameters delegate; + private Map values; + + /** + * Create a new proxy wrapping the given {@code Parameters} object. + * + * @param delegate the parameters object to wrap + */ + public ProxyParameters(final Parameters delegate) { + this.delegate = delegate; + this.values = delegate.getAttributeValues(); + } + + @Override + public Map getAttributeValues() { + return values; + } + + /** + * Changes the attribute values for this instance. + * + * @param values the new values + */ + public void setAttributeValues( + final Map values) { + this.values = Collections.unmodifiableMap(values); + } + + @Override + public boolean isPartialUpdate() { + return delegate.isPartialUpdate(); + } + + @Override + public Class getModelClass() { + return delegate.getModelClass(); + } + + @Override + public DynamoDBMapperConfig getMapperConfig() { + return delegate.getMapperConfig(); + } + + @Override + public String getTableName() { + return delegate.getTableName(); + } + + @Override + public String getHashKeyName() { + return delegate.getHashKeyName(); + } + + @Override + public String getRangeKeyName() { + return delegate.getRangeKeyName(); + } + } +} diff --git a/src/main/java/com/amazonaws/services/elastictranscoder/AmazonElasticTranscoderClient.java b/src/main/java/com/amazonaws/services/elastictranscoder/AmazonElasticTranscoderClient.java index 476268763f1e..adcd321ca826 100644 --- a/src/main/java/com/amazonaws/services/elastictranscoder/AmazonElasticTranscoderClient.java +++ b/src/main/java/com/amazonaws/services/elastictranscoder/AmazonElasticTranscoderClient.java @@ -131,7 +131,7 @@ public AmazonElasticTranscoderClient(AWSCredentials awsCredentials) { * (ex: proxy settings, retry counts, etc.). */ public AmazonElasticTranscoderClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { - super(clientConfiguration); + super(adjustClientConfiguration(clientConfiguration)); this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials); @@ -194,7 +194,7 @@ public AmazonElasticTranscoderClient(AWSCredentialsProvider awsCredentialsProvid public AmazonElasticTranscoderClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { - super(clientConfiguration, requestMetricCollector); + super(adjustClientConfiguration(clientConfiguration), requestMetricCollector); this.awsCredentialsProvider = awsCredentialsProvider; @@ -221,6 +221,12 @@ private void init() { "/com/amazonaws/services/elastictranscoder/request.handler2s")); } + private static ClientConfiguration adjustClientConfiguration(ClientConfiguration orig) { + ClientConfiguration config = orig; + + return config; + } + /** *

* The UpdatePipelineStatus operation pauses or reactivates a pipeline, diff --git a/src/main/java/com/amazonaws/services/glacier/AmazonGlacier.java b/src/main/java/com/amazonaws/services/glacier/AmazonGlacier.java index 110343ee3383..19b8db641cfa 100644 --- a/src/main/java/com/amazonaws/services/glacier/AmazonGlacier.java +++ b/src/main/java/com/amazonaws/services/glacier/AmazonGlacier.java @@ -24,7 +24,7 @@ * Amazon Glacier is a storage solution for "cold data." *

*

- * Amazon Glacier is an extremely low-cost storage service that provides secure, durable, and easy-to-use storage for data backup and archival. With + * Amazon Glacier is an extremely low-cost storage service that provides secure, durable and easy-to-use storage for data backup and archival. With * Amazon Glacier, customers can store their data cost effectively for months, years, or decades. Amazon Glacier also enables customers to offload the * administrative burdens of operating and scaling storage to AWS, so they don't have to worry about capacity planning, hardware provisioning, data * replication, hardware failure and recovery, or time-consuming hardware migrations. @@ -44,14 +44,14 @@ * *