org.gaul.s3proxy.S3Proxy Java Examples
The following examples show how to use
org.gaul.s3proxy.S3Proxy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: S3ProxyImpl.java From pravega with Apache License 2.0 | 6 votes |
public S3ProxyImpl(String endpoint, S3Config s3Config) { URI uri = URI.create(endpoint); Properties properties = new Properties(); properties.setProperty("s3proxy.authorization", "none"); properties.setProperty("s3proxy.endpoint", endpoint); properties.setProperty("jclouds.provider", "filesystem"); properties.setProperty("jclouds.filesystem.basedir", "/tmp/s3proxy"); ContextBuilder builder = ContextBuilder .newBuilder("filesystem") .credentials("x", "x") .modules(ImmutableList.<Module>of(new SLF4JLoggingModule())) .overrides(properties); BlobStoreContext context = builder.build(BlobStoreContext.class); BlobStore blobStore = context.getBlobStore(); s3Proxy = S3Proxy.builder().awsAuthentication(AuthenticationType.AWS_V2_OR_V4, "x", "x") .endpoint(uri) .keyStore("", "") .blobStore(blobStore) .ignoreUnknownHeaders(true) .build(); client = new S3JerseyCopyPartClient(s3Config); }
Example #2
Source File: S3ProxyRule.java From s3proxy with Apache License 2.0 | 5 votes |
private S3ProxyRule(Builder builder) { accessKey = builder.accessKey; secretKey = builder.secretKey; Properties properties = new Properties(); try { blobStoreLocation = Files.createTempDirectory("S3ProxyRule") .toFile(); properties.setProperty("jclouds.filesystem.basedir", blobStoreLocation.getCanonicalPath()); } catch (IOException e) { throw new RuntimeException("Unable to initialize Blob Store", e); } blobStoreContext = ContextBuilder.newBuilder( builder.blobStoreProvider) .credentials(accessKey, secretKey) .overrides(properties).build(BlobStoreContext.class); S3Proxy.Builder s3ProxyBuilder = S3Proxy.builder() .blobStore(blobStoreContext.getBlobStore()) .awsAuthentication(builder.authType, accessKey, secretKey) .ignoreUnknownHeaders(builder.ignoreUnknownHeaders); if (builder.secretStorePath != null || builder.secretStorePassword != null) { s3ProxyBuilder.keyStore(builder.secretStorePath, builder.secretStorePassword); } int port = builder.port < 0 ? 0 : builder.port; endpointFormat = "http://%s:%d"; String endpoint = String.format(endpointFormat, LOCALHOST, port); s3ProxyBuilder.endpoint(URI.create(endpoint)); s3Proxy = s3ProxyBuilder.build(); }