Created Using S3Proxy in Java projects (markdown)

master
Andrew Gaul 2016-11-08 10:39:09 -08:00
rodzic 29c4bf59d4
commit c8f852bcb8
1 zmienionych plików z 62 dodań i 0 usunięć

@ -0,0 +1,62 @@
# Maven artifacts
Java projects can include the latest S3Proxy release via Maven artifacts:
```xml
<dependency>
<groupId>org.gaul</groupId>
<artifactId>s3proxy</artifactId>
<version>1.4.0</version>
</dependency>
```
Sonatype also provides pre-release snapshots:
```xml
<repositories>
<repository>
<id>apache-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
```
# Usage
Instantiate S3Proxy by creating a backend `BlobStore` object and a frontend `S3Proxy` object. An example configuring the filesystem backend and listening on port 8080:
```java
Properties properties = new Properties();
properties.setProperty("jclouds.filesystem.basedir", "/tmp/blobstore");
BlobStoreContext context = ContextBuilder
.newBuilder("filesystem")
.credentials("identity", "credential")
.overrides(properties)
.build(BlobStoreContext.class);
S3Proxy s3Proxy = S3Proxy.builder()
.blobStore(context.getBlobStore())
.endpoint(URI.create("http://127.0.0.1:8080"))
.build();
s3Proxy.start();
while (!info.s3Proxy.getState().equals(AbstractLifeCycle.STARTED)) {
Thread.sleep(1);
}
```
The S3Proxy Main class and unit tests demonstrate more complicated configurations:
* https://github.com/andrewgaul/s3proxy/blob/master/src/main/java/org/gaul/s3proxy/Main.java
* https://github.com/andrewgaul/s3proxy/blob/master/src/test/java/org/gaul/s3proxy/S3AwsSdkTest.java