Skip to content

Commit feb4620

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

14 files changed

+1141
-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: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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+
<scm>
16+
<url>https://github.com/awslabs/awslabs/large-payload-offloading-java-common-lib-for-aws.git</url>
17+
</scm>
18+
19+
<licenses>
20+
<license>
21+
<name>Apache License, Version 2.0</name>
22+
<url>https://aws.amazon.com/apache2.0</url>
23+
<distribution>repo</distribution>
24+
</license>
25+
</licenses>
26+
27+
<developers>
28+
<developer>
29+
<id>amazonwebservices</id>
30+
<organization>Amazon Web Services</organization>
31+
<organizationUrl>https://aws.amazon.com</organizationUrl>
32+
<roles>
33+
<role>developer</role>
34+
</roles>
35+
</developer>
36+
</developers>
37+
38+
<properties>
39+
<aws-java-sdk.version>1.11.817</aws-java-sdk.version>
40+
</properties>
41+
42+
<dependencies>
43+
<dependency>
44+
<groupId>com.amazonaws</groupId>
45+
<artifactId>aws-java-sdk-sqs</artifactId>
46+
<version>${aws-java-sdk.version}</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>com.amazonaws</groupId>
50+
<artifactId>aws-java-sdk-s3</artifactId>
51+
<version>${aws-java-sdk.version}</version>
52+
</dependency>
53+
<dependency>
54+
<groupId>junit</groupId>
55+
<artifactId>junit</artifactId>
56+
<version>4.12</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.mockito</groupId>
61+
<artifactId>mockito-core</artifactId>
62+
<version>3.3.3</version>
63+
<scope>test</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.hamcrest</groupId>
67+
<artifactId>hamcrest-all</artifactId>
68+
<version>1.3</version>
69+
<scope>test</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>pl.pragmatists</groupId>
73+
<artifactId>JUnitParams</artifactId>
74+
<version>1.1.1</version>
75+
<scope>test</scope>
76+
</dependency>
77+
</dependencies>
78+
79+
<build>
80+
<pluginManagement>
81+
<plugins>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-compiler-plugin</artifactId>
85+
<version>3.8.1</version>
86+
<configuration>
87+
<source>1.8</source>
88+
<target>1.8</target>
89+
<encoding>UTF-8</encoding>
90+
</configuration>
91+
</plugin>
92+
<plugin>
93+
<groupId>org.sonatype.plugins</groupId>
94+
<artifactId>nexus-staging-maven-plugin</artifactId>
95+
<version>1.6.7</version>
96+
<extensions>true</extensions>
97+
<configuration>
98+
<serverId>ossrh</serverId>
99+
<nexusUrl>https://aws.oss.sonatype.org</nexusUrl>
100+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
101+
</configuration>
102+
</plugin>
103+
</plugins>
104+
</pluginManagement>
105+
</build>
106+
107+
<profiles>
108+
<profile>
109+
<id>publishing</id>
110+
<distributionManagement>
111+
<snapshotRepository>
112+
<id>ossrh</id>
113+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
114+
</snapshotRepository>
115+
<repository>
116+
<id>ossrh</id>
117+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
118+
</repository>
119+
</distributionManagement>
120+
<build>
121+
<plugins>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-gpg-plugin</artifactId>
125+
<version>1.6</version>
126+
<executions>
127+
<execution>
128+
<id>sign-artifacts</id>
129+
<phase>verify</phase>
130+
<goals>
131+
<goal>sign</goal>
132+
</goals>
133+
<configuration>
134+
<gpgArguments>
135+
<gpgArgument>--pinentry-mode</gpgArgument>
136+
<gpgArgument>loopback</gpgArgument>
137+
</gpgArguments>
138+
</configuration>
139+
</execution>
140+
</executions>
141+
</plugin>
142+
</plugins>
143+
</build>
144+
</profile>
145+
</profiles>
146+
</project>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
totalSize += len;
27+
}
28+
29+
public long getTotalSize() {
30+
return totalSize;
31+
}
32+
}
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)