Skip to content

Commit 8ba8178

Browse files
committed
Version 1.0.0 of the Large payload offloading common library for AWS
1 parent 561daf5 commit 8ba8178

14 files changed

+1092
-5
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
## My Project
1+
## Large Payload Offloading Java Common Library For AWS
22

3-
TODO: Fill this README out!
3+
The **Large Payload Offloading Java Common Library For AWS** enables you to manage payloads with Amazon S3.
4+
This is especially useful for storing and retrieving payloads with size greater than the current SQS/SNS limit of 256 KB, up to a maximum of 2 GB. Specifically, you can use this library to:
45

5-
Be sure to:
6+
* Specify whether payloads are always stored in Amazon S3 or only when a payload's size exceeds 256 KB.
67

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
8+
* Get the corresponding payload object from an Amazon S3 bucket.
9+
10+
* Delete the corresponding payload object from an Amazon S3 bucket.
11+
12+
You can download release builds through the [releases section of this](https://github.com/awslabs/large-payload-offloading-java-common-lib-for-aws/releases) project.
13+
14+
## Getting Started
15+
16+
* **Sign up for AWS** -- Before using this library with Amazon services, you need an AWS account. For more information about creating an AWS account and retrieving your AWS credentials, see [AWS Account and Credentials](http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-setup.html) in the AWS SDK for Java Developer Guide.
17+
* **Minimum requirements** -- You'll need Java 8 (or later) and [Maven 3](http://maven.apache.org/).
18+
* **Download** -- Download the [latest preview release](https://github.com/awslabs/amazon-sqs-java-extended-client-lib/releases) or pick it up from Maven:
19+
20+
```xml
21+
<dependency>
22+
<groupId>com.amazonaws</groupId>
23+
<artifactId>large-payload-offloading-java-common-lib-for-aws</artifactId>
24+
<version>1.0.0</version>
25+
<type>jar</type>
26+
</dependency>
27+
```
928

1029
## Security
1130

pom.xml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>large-payload-offloading-java-common-lib-for-aws</artifactId>
9+
<version>1.0.0</version>
10+
<packaging>jar</packaging>
11+
<name>Large payload offloading common library for AWS</name>
12+
<description>Common library between extended Amazon AWS clients to save payloads up to 2GB on Amazon S3.</description>
13+
<url>https://github.com/awslabs/large-payload-offloading-java-common-lib-for-aws</url>
14+
15+
16+
<scm>
17+
<url>https://github.com/awslabs/awslabs/large-payload-offloading-java-common-lib-for-aws.git</url>
18+
</scm>
19+
20+
<licenses>
21+
<license>
22+
<name>Apache License, Version 2.0</name>
23+
<url>https://aws.amazon.com/apache2.0</url>
24+
<distribution>repo</distribution>
25+
</license>
26+
</licenses>
27+
28+
<developers>
29+
<developer>
30+
<id>amazonwebservices</id>
31+
<organization>Amazon Web Services</organization>
32+
<organizationUrl>https://aws.amazon.com</organizationUrl>
33+
<roles>
34+
<role>developer</role>
35+
</roles>
36+
</developer>
37+
</developers>
38+
39+
<properties>
40+
<aws-java-sdk.version>1.11.817</aws-java-sdk.version>
41+
</properties>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.amazonaws</groupId>
46+
<artifactId>aws-java-sdk-sqs</artifactId>
47+
<version>${aws-java-sdk.version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.amazonaws</groupId>
51+
<artifactId>aws-java-sdk-s3</artifactId>
52+
<version>${aws-java-sdk.version}</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>junit</groupId>
56+
<artifactId>junit</artifactId>
57+
<version>4.12</version>
58+
<scope>test</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.mockito</groupId>
62+
<artifactId>mockito-core</artifactId>
63+
<version>3.3.3</version>
64+
<scope>test</scope>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.hamcrest</groupId>
68+
<artifactId>hamcrest-all</artifactId>
69+
<version>1.3</version>
70+
<scope>test</scope>
71+
</dependency>
72+
<dependency>
73+
<groupId>pl.pragmatists</groupId>
74+
<artifactId>JUnitParams</artifactId>
75+
<version>1.1.1</version>
76+
<scope>test</scope>
77+
</dependency>
78+
</dependencies>
79+
80+
<build>
81+
<pluginManagement>
82+
<plugins>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-compiler-plugin</artifactId>
86+
<version>3.8.1</version>
87+
<configuration>
88+
<source>1.8</source>
89+
<target>1.8</target>
90+
<encoding>UTF-8</encoding>
91+
</configuration>
92+
</plugin>
93+
</plugins>
94+
</pluginManagement>
95+
</build>
96+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.amazonaws.largepayloadoffloading;
2+
3+
import java.io.OutputStream;
4+
5+
/**
6+
* This class is used for checking the size of a string without copying the
7+
* whole string into memory and converting it to bytes array. Compared to
8+
* String.getBytes().length, it is more efficient and reliable for large
9+
* strings.
10+
*/
11+
class CountingOutputStream extends OutputStream {
12+
private long totalSize;
13+
14+
@Override
15+
public void write(int b) {
16+
++totalSize;
17+
}
18+
19+
@Override
20+
public void write(byte[] b) {
21+
totalSize += b.length;
22+
}
23+
24+
@Override
25+
public void write(byte[] b, int offset, int len) {
26+
27+
totalSize += len;
28+
}
29+
30+
public long getTotalSize() {
31+
return totalSize;
32+
}
33+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.amazonaws.largepayloadoffloading;
2+
3+
import com.amazonaws.annotation.NotThreadSafe;
4+
5+
/**
6+
* Amazon extended client configuration options such as Amazon S3 client,
7+
* bucket name, and payload size threshold for large payloads.
8+
*/
9+
@NotThreadSafe
10+
public class ExtendedClientConfiguration extends ExtendedClientConfigurationBase<ExtendedClientConfiguration> {
11+
12+
public ExtendedClientConfiguration() {
13+
super();
14+
}
15+
16+
public ExtendedClientConfiguration(ExtendedClientConfiguration other) {
17+
super(other);
18+
}
19+
}

0 commit comments

Comments
 (0)