Issue 882: Make aws-s3 provider respect PROPERTY_S3_VIRTUAL_HOST_BUCKETS.

This commit is contained in:
Roman Bogorodskiy 2012-03-27 13:46:43 +04:00
parent ff2982c747
commit ef549235fe
2 changed files with 8 additions and 3 deletions

View File

@ -19,11 +19,14 @@
package org.jclouds.aws.s3.binders; package org.jclouds.aws.s3.binders;
import static org.jclouds.http.utils.ModifyRequest.endpoint; import static org.jclouds.http.utils.ModifyRequest.endpoint;
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_SERVICE_PATH;
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider; import javax.inject.Provider;
import javax.inject.Singleton; import javax.inject.Singleton;
import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilder;
@ -45,9 +48,11 @@ public class AssignCorrectHostnameAndBindAsHostPrefixIfConfigured extends BindAs
@Inject @Inject
public AssignCorrectHostnameAndBindAsHostPrefixIfConfigured(BindAsHostPrefix bindAsHostPrefix, public AssignCorrectHostnameAndBindAsHostPrefixIfConfigured(BindAsHostPrefix bindAsHostPrefix,
@Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
@Named(PROPERTY_S3_SERVICE_PATH) String servicePath,
RegionToEndpointOrProviderIfNull r2, Provider<UriBuilder> uriBuilderProvider, RegionToEndpointOrProviderIfNull r2, Provider<UriBuilder> uriBuilderProvider,
@Bucket Map<String, String> bucketToRegion) { @Bucket Map<String, String> bucketToRegion) {
super(bindAsHostPrefix, true, "/", uriBuilderProvider); super(bindAsHostPrefix, isVhostStyle, servicePath, uriBuilderProvider);
this.bucketToRegion = bucketToRegion; this.bucketToRegion = bucketToRegion;
this.r2 = r2; this.r2 = r2;
} }

View File

@ -58,7 +58,7 @@ public class AssignCorrectHostnameAndBindAsHostPrefixIfConfiguredTest {
HttpRequest request = new HttpRequest("GET", URI.create("https://s3.amazonaws.com")); HttpRequest request = new HttpRequest("GET", URI.create("https://s3.amazonaws.com"));
AssignCorrectHostnameAndBindAsHostPrefixIfConfigured binder = new AssignCorrectHostnameAndBindAsHostPrefixIfConfigured( AssignCorrectHostnameAndBindAsHostPrefixIfConfigured binder = new AssignCorrectHostnameAndBindAsHostPrefixIfConfigured(
new BindAsHostPrefix(uriBuilderProvider), new RegionToEndpointOrProviderIfNull("aws-s3", Suppliers new BindAsHostPrefix(uriBuilderProvider), true, "/", new RegionToEndpointOrProviderIfNull("aws-s3", Suppliers
.ofInstance(URI.create("https://s3.amazonaws.com")), .ofInstance(URI.create("https://s3.amazonaws.com")),
Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("us-standard", Suppliers Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("us-standard", Suppliers
@ -76,7 +76,7 @@ public class AssignCorrectHostnameAndBindAsHostPrefixIfConfiguredTest {
HttpRequest request = new HttpRequest("GET", URI.create("https://s3.amazonaws.com")); HttpRequest request = new HttpRequest("GET", URI.create("https://s3.amazonaws.com"));
AssignCorrectHostnameAndBindAsHostPrefixIfConfigured binder = new AssignCorrectHostnameAndBindAsHostPrefixIfConfigured( AssignCorrectHostnameAndBindAsHostPrefixIfConfigured binder = new AssignCorrectHostnameAndBindAsHostPrefixIfConfigured(
new BindAsHostPrefix(uriBuilderProvider), new RegionToEndpointOrProviderIfNull("aws-s3", Suppliers new BindAsHostPrefix(uriBuilderProvider), true, "/", new RegionToEndpointOrProviderIfNull("aws-s3", Suppliers
.ofInstance(URI.create("https://s3.amazonaws.com")), .ofInstance(URI.create("https://s3.amazonaws.com")),
Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("us-standard", Suppliers Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("us-standard", Suppliers