Skip to content

Commit

Permalink
AWS SDK for Java 1.8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
AWS committed Jul 24, 2014
1 parent ce763e2 commit 98de190
Show file tree
Hide file tree
Showing 859 changed files with 9,672 additions and 3,633 deletions.
2 changes: 1 addition & 1 deletion META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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.8.5
Bundle-Version: 1.8.6
Bundle-Vendor: Amazon Technologies, Inc
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.apache.commons.codec;bundle-version="1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>aws-java-sdk</artifactId>
<packaging>jar</packaging>
<name>AWS SDK for Java</name>
<version>1.8.5</version>
<version>1.8.6</version>
<description>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).</description>
<url>https://aws.amazon.com/sdkforjava</url>

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/amazonaws/http/JsonResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.amazonaws.ResponseMetadata;
import com.amazonaws.internal.CRC32MismatchException;
import com.amazonaws.transform.JsonUnmarshallerContext;
import com.amazonaws.transform.JsonUnmarshallerContextImpl;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.VoidJsonUnmarshaller;
import com.amazonaws.util.CRC32ChecksumCalculatingInputStream;
Expand Down Expand Up @@ -98,7 +99,8 @@ public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exceptio

try {
AmazonWebServiceResponse<T> awsResponse = new AmazonWebServiceResponse<T>();
JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContext(jsonParser, response);
JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContextImpl(
jsonParser, response);
registerAdditionalMetadataExpressions(unmarshallerContext);

T result = responseUnmarshaller.unmarshall(unmarshallerContext);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/amazonaws/metrics/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
* href="https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/pool/PoolStats.html"
* >PoolStats</a>. before the connection of a request is obtained</li>
* <li>HttpRequestTime - Number of milliseconds taken for a logical request/response
* round trip to AWS. Captured on a per request type level.< /li>
* round trip to AWS. Captured on a per request type level.</li>
* <li>HttpClientSendRequestTime - Number of milliseconds taken for a physical request
* to get sent to AWS. Captured on a per request type level.< /li>
* to get sent to AWS. Captured on a per request type level.</li>
* <li>HttpClientReceiveResponseTime - Number of milliseconds taken for a physical response
* to get received from AWS. Captured on a per request type level.< /li>
* to get received from AWS. Captured on a per request type level.</li>
* <li>HttpClientRetryCount - Number of retries per physical request. Captured on a per service
* client type level. </li>
* <li>RequestCount - Number of logical requests. Captured on a per service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public BucketInfo unmarshall(JsonUnmarshallerContext context) throws Exception {
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Bucket unmarshall(JsonUnmarshallerContext context) throws Exception {
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public DocumentServiceWarning unmarshall(JsonUnmarshallerContext context) throws
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Hit unmarshall(JsonUnmarshallerContext context) throws Exception {
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Hits unmarshall(JsonUnmarshallerContext context) throws Exception {
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
package com.amazonaws.services.cloudsearchdomain.model.transform;

import static com.amazonaws.util.StringUtils.UTF8;
import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.regex.Pattern;

import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
Expand All @@ -39,47 +43,200 @@
*/
public class SearchRequestMarshaller implements Marshaller<Request<SearchRequest>, SearchRequest> {

public Request<SearchRequest> marshall(SearchRequest searchRequest) {
if (searchRequest == null) {
throw new AmazonClientException("Invalid argument passed to marshall(...)");
private static final String RESOURCE_PATH_TEMPLATE;
private static final Map<String, String> STATIC_QUERY_PARAMS;
private static final Map<String, String> DYNAMIC_QUERY_PARAMS;
static {
String path = "/2013-01-01/search?format=sdk&pretty=true&cursor={Cursor}&expr={Expr}&facet={Facet}&fq={FilterQuery}&highlight={Highlight}&partial={Partial}&q={Query}&q.options={QueryOptions}&q.parser={QueryParser}&return={Return}&size={Size}&sort={Sort}&start={Start}";
Map<String, String> staticMap = new HashMap<String, String>();
Map<String, String> dynamicMap = new HashMap<String, String>();

int index = path.indexOf("?");
if (index != -1) {
String queryString = path.substring(index + 1);
path = path.substring(0, index);

for (String s : queryString.split("[;&]")) {
index = s.indexOf("=");
if (index != -1) {
String name = s.substring(0, index);
String value = s.substring(index + 1);

if (value.startsWith("{") && value.endsWith("}")) {
dynamicMap.put(value.substring(1, value.length() - 1), name);
} else {
staticMap.put(name, value);
}
}
}
}

RESOURCE_PATH_TEMPLATE = path;
STATIC_QUERY_PARAMS = Collections.unmodifiableMap(staticMap);
DYNAMIC_QUERY_PARAMS = Collections.unmodifiableMap(dynamicMap);
}

public Request<SearchRequest> marshall(SearchRequest searchRequest) {
if (searchRequest == null) {
throw new AmazonClientException("Invalid argument passed to marshall(...)");
}

Request<SearchRequest> request = new DefaultRequest<SearchRequest>(searchRequest, "AmazonCloudSearchDomain");
String target = "AmazonCloudSearch2013.Search";
request.addHeader("X-Amz-Target", target);

request.setHttpMethod(HttpMethodName.GET);
String uriResourcePath = "/2013-01-01/search?format=sdk&pretty=true&cursor={Cursor}&expr={Expr}&facet={Facet}&fq={FilterQuery}&highlight={Highlight}&partial={Partial}&q={Query}&q.options={QueryOptions}&q.parser={QueryParser}&return={Return}&size={Size}&sort={Sort}&start={Start}";
uriResourcePath = uriResourcePath.replace("{Cursor}", (searchRequest.getCursor() == null) ? "" : StringUtils.fromString(searchRequest.getCursor()));
uriResourcePath = uriResourcePath.replace("{Expr}", (searchRequest.getExpr() == null) ? "" : StringUtils.fromString(searchRequest.getExpr()));
uriResourcePath = uriResourcePath.replace("{Facet}", (searchRequest.getFacet() == null) ? "" : StringUtils.fromString(searchRequest.getFacet()));
uriResourcePath = uriResourcePath.replace("{FilterQuery}", (searchRequest.getFilterQuery() == null) ? "" : StringUtils.fromString(searchRequest.getFilterQuery()));
uriResourcePath = uriResourcePath.replace("{Highlight}", (searchRequest.getHighlight() == null) ? "" : StringUtils.fromString(searchRequest.getHighlight()));
uriResourcePath = uriResourcePath.replace("{Partial}", (searchRequest.isPartial() == null) ? "" : StringUtils.fromBoolean(searchRequest.isPartial()));
uriResourcePath = uriResourcePath.replace("{Query}", (searchRequest.getQuery() == null) ? "" : StringUtils.fromString(searchRequest.getQuery()));
uriResourcePath = uriResourcePath.replace("{QueryOptions}", (searchRequest.getQueryOptions() == null) ? "" : StringUtils.fromString(searchRequest.getQueryOptions()));
uriResourcePath = uriResourcePath.replace("{QueryParser}", (searchRequest.getQueryParser() == null) ? "" : StringUtils.fromString(searchRequest.getQueryParser()));
uriResourcePath = uriResourcePath.replace("{Return}", (searchRequest.getReturn() == null) ? "" : StringUtils.fromString(searchRequest.getReturn()));
uriResourcePath = uriResourcePath.replace("{Size}", (searchRequest.getSize() == null) ? "" : StringUtils.fromLong(searchRequest.getSize()));
uriResourcePath = uriResourcePath.replace("{Sort}", (searchRequest.getSort() == null) ? "" : StringUtils.fromString(searchRequest.getSort()));
uriResourcePath = uriResourcePath.replace("{Start}", (searchRequest.getStart() == null) ? "" : StringUtils.fromLong(searchRequest.getStart()));

uriResourcePath = uriResourcePath.replaceAll("//", "/");

if (uriResourcePath.contains("?")) {
String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));
String uriResourcePath = RESOURCE_PATH_TEMPLATE;

for (String s : queryString.split("[;&]")) {
String[] nameValuePair = s.split("=");
if (nameValuePair.length == 2) {
if(!(nameValuePair[1].isEmpty()))
request.addParameter(nameValuePair[0], nameValuePair[1]);
}
if (DYNAMIC_QUERY_PARAMS.containsKey("Cursor")) {
String name = DYNAMIC_QUERY_PARAMS.get("Cursor");
String value = (searchRequest.getCursor() == null) ? null : StringUtils.fromString(searchRequest.getCursor());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Cursor}", (searchRequest.getCursor() == null) ? "" : StringUtils.fromString(searchRequest.getCursor()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Expr")) {
String name = DYNAMIC_QUERY_PARAMS.get("Expr");
String value = (searchRequest.getExpr() == null) ? null : StringUtils.fromString(searchRequest.getExpr());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Expr}", (searchRequest.getExpr() == null) ? "" : StringUtils.fromString(searchRequest.getExpr()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Facet")) {
String name = DYNAMIC_QUERY_PARAMS.get("Facet");
String value = (searchRequest.getFacet() == null) ? null : StringUtils.fromString(searchRequest.getFacet());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Facet}", (searchRequest.getFacet() == null) ? "" : StringUtils.fromString(searchRequest.getFacet()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("FilterQuery")) {
String name = DYNAMIC_QUERY_PARAMS.get("FilterQuery");
String value = (searchRequest.getFilterQuery() == null) ? null : StringUtils.fromString(searchRequest.getFilterQuery());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{FilterQuery}", (searchRequest.getFilterQuery() == null) ? "" : StringUtils.fromString(searchRequest.getFilterQuery()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Highlight")) {
String name = DYNAMIC_QUERY_PARAMS.get("Highlight");
String value = (searchRequest.getHighlight() == null) ? null : StringUtils.fromString(searchRequest.getHighlight());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Highlight}", (searchRequest.getHighlight() == null) ? "" : StringUtils.fromString(searchRequest.getHighlight()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Partial")) {
String name = DYNAMIC_QUERY_PARAMS.get("Partial");
String value = (searchRequest.isPartial() == null) ? null : StringUtils.fromBoolean(searchRequest.isPartial());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Partial}", (searchRequest.isPartial() == null) ? "" : StringUtils.fromBoolean(searchRequest.isPartial()));
}
request.setResourcePath(uriResourcePath);

if (DYNAMIC_QUERY_PARAMS.containsKey("Query")) {
String name = DYNAMIC_QUERY_PARAMS.get("Query");
String value = (searchRequest.getQuery() == null) ? null : StringUtils.fromString(searchRequest.getQuery());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Query}", (searchRequest.getQuery() == null) ? "" : StringUtils.fromString(searchRequest.getQuery()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("QueryOptions")) {
String name = DYNAMIC_QUERY_PARAMS.get("QueryOptions");
String value = (searchRequest.getQueryOptions() == null) ? null : StringUtils.fromString(searchRequest.getQueryOptions());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{QueryOptions}", (searchRequest.getQueryOptions() == null) ? "" : StringUtils.fromString(searchRequest.getQueryOptions()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("QueryParser")) {
String name = DYNAMIC_QUERY_PARAMS.get("QueryParser");
String value = (searchRequest.getQueryParser() == null) ? null : StringUtils.fromString(searchRequest.getQueryParser());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{QueryParser}", (searchRequest.getQueryParser() == null) ? "" : StringUtils.fromString(searchRequest.getQueryParser()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Return")) {
String name = DYNAMIC_QUERY_PARAMS.get("Return");
String value = (searchRequest.getReturn() == null) ? null : StringUtils.fromString(searchRequest.getReturn());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Return}", (searchRequest.getReturn() == null) ? "" : StringUtils.fromString(searchRequest.getReturn()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Size")) {
String name = DYNAMIC_QUERY_PARAMS.get("Size");
String value = (searchRequest.getSize() == null) ? null : StringUtils.fromLong(searchRequest.getSize());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Size}", (searchRequest.getSize() == null) ? "" : StringUtils.fromLong(searchRequest.getSize()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Sort")) {
String name = DYNAMIC_QUERY_PARAMS.get("Sort");
String value = (searchRequest.getSort() == null) ? null : StringUtils.fromString(searchRequest.getSort());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Sort}", (searchRequest.getSort() == null) ? "" : StringUtils.fromString(searchRequest.getSort()));
}

if (DYNAMIC_QUERY_PARAMS.containsKey("Start")) {
String name = DYNAMIC_QUERY_PARAMS.get("Start");
String value = (searchRequest.getStart() == null) ? null : StringUtils.fromLong(searchRequest.getStart());

if (!(value == null || value.isEmpty())) {
request.addParameter(name, value);
}
} else {
uriResourcePath = uriResourcePath.replace("{Start}", (searchRequest.getStart() == null) ? "" : StringUtils.fromLong(searchRequest.getStart()));
}

request.setResourcePath(uriResourcePath.replaceAll("//", "/"));

for (Map.Entry<String, String> entry : STATIC_QUERY_PARAMS.entrySet()) {
request.addParameter(entry.getKey(), entry.getValue());
}

request.setContent(new ByteArrayInputStream(new byte[0]));

return request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SearchResult unmarshall(JsonUnmarshallerContext context) throws Exception
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SearchStatus unmarshall(JsonUnmarshallerContext context) throws Exception
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SuggestModel unmarshall(JsonUnmarshallerContext context) throws Exception
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;

JsonToken token = context.currentToken;
JsonToken token = context.getCurrentToken();
if (token == null) token = context.nextToken();
if (token == VALUE_NULL) return null;

Expand Down
Loading

0 comments on commit 98de190

Please sign in to comment.