diff --git a/README.txt b/README.txt index 82d91005e8..c722d5d8c7 100644 --- a/README.txt +++ b/README.txt @@ -43,7 +43,8 @@ our compute api supports: aws-ec2, gogrid, cloudservers (generic), cloudservers- our blobstore api supports: aws-s3, cloudfiles (generic), cloudfiles-us, cloudfiles-uk, azurestorage, atmosonline (generic), synaptic, peer1-storage, s3 (generic), walrus(generic), googlestorage, scaleup-storage, - ecc-s3, transient (in-mem), filesystem (on-disk) + ecc-s3, swift (generic), transient (in-mem), + filesystem (on-disk) * note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to to all of these providers diff --git a/allblobstore/pom.xml b/allblobstore/pom.xml index 935a8581ee..80347cc79c 100644 --- a/allblobstore/pom.xml +++ b/allblobstore/pom.xml @@ -69,6 +69,11 @@ jclouds-atmos ${project.version} + + org.jclouds.api + swift + ${project.version} + org.jclouds.api cloudfiles diff --git a/apis/cloudfiles/pom.xml b/apis/cloudfiles/pom.xml index 965660d57a..df3c8412ce 100644 --- a/apis/cloudfiles/pom.xml +++ b/apis/cloudfiles/pom.xml @@ -44,13 +44,8 @@ - org.jclouds.common - rackspace-common - ${project.version} - - - org.jclouds - jclouds-blobstore + org.jclouds.api + swift ${project.version} @@ -62,7 +57,7 @@ org.jclouds.common - rackspace-common + openstack-common ${project.version} test-jar test @@ -74,6 +69,13 @@ test-jar test + + org.jclouds.api + swift + ${project.version} + test-jar + test + org.jclouds jclouds-log4j diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java index d07a0e2b02..82ea968583 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java +++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesAsyncClient.java @@ -36,12 +36,12 @@ import javax.ws.rs.core.MediaType; import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404; import org.jclouds.cloudfiles.domain.ContainerCDNMetadata; import org.jclouds.cloudfiles.functions.ParseCdnUriFromHeaders; +import org.jclouds.cloudfiles.functions.ParseContainerCDNMetadataFromHeaders; import org.jclouds.cloudfiles.options.ListCdnContainerOptions; import org.jclouds.cloudfiles.reference.CloudFilesHeaders; import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.Storage; -import org.jclouds.openstack.swift.functions.ParseContainerCDNMetadataFromHeaders; import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.Headers; diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerCDNMetadataFromHeaders.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/functions/ParseContainerCDNMetadataFromHeaders.java similarity index 98% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerCDNMetadataFromHeaders.java rename to apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/functions/ParseContainerCDNMetadataFromHeaders.java index c0735848c6..53ca52519a 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerCDNMetadataFromHeaders.java +++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/functions/ParseContainerCDNMetadataFromHeaders.java @@ -17,7 +17,7 @@ * ==================================================================== */ -package org.jclouds.openstack.swift.functions; +package org.jclouds.cloudfiles.functions; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/apis/cloudservers/pom.xml b/apis/cloudservers/pom.xml index 6e23ac2d58..984e2c7555 100644 --- a/apis/cloudservers/pom.xml +++ b/apis/cloudservers/pom.xml @@ -44,7 +44,7 @@ org.jclouds.common - rackspace-common + openstack-common ${project.version} @@ -61,7 +61,7 @@ org.jclouds.common - rackspace-common + openstack-common ${project.version} test-jar test diff --git a/apis/pom.xml b/apis/pom.xml index e931d1adc8..4ba3ab8d59 100644 --- a/apis/pom.xml +++ b/apis/pom.xml @@ -39,6 +39,7 @@ elb walrus eucalyptus + swift cloudfiles cloudservers diff --git a/apis/swift/pom.xml b/apis/swift/pom.xml new file mode 100644 index 0000000000..6991a4919f --- /dev/null +++ b/apis/swift/pom.xml @@ -0,0 +1,148 @@ + + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.api + swift + jcloud swift api + jclouds components to access an implementation of OpenStack Swift + + + org.jclouds.openstack.swift.blobstore.integration.SwiftTestInitializer + http://localhost:11000 + 1.0 + test:tester + testing + + + + + org.jclouds.common + openstack-common + ${project.version} + + + org.jclouds + jclouds-blobstore + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds.common + openstack-common + ${project.version} + test-jar + test + + + org.jclouds + jclouds-blobstore + ${project.version} + test-jar + test + + + org.jclouds + jclouds-log4j + ${project.version} + test + + + log4j + log4j + 1.2.16 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.swift.endpoint + ${test.swift.endpoint} + + + test.swift.apiversion + ${test.swift.apiversion} + + + test.swift.identity + ${test.swift.identity} + + + test.swift.credential + ${test.swift.credential} + + + test.initializer + ${test.initializer} + + + jclouds.blobstore.httpstream.url + ${jclouds.blobstore.httpstream.url} + + + jclouds.blobstore.httpstream.md5 + ${jclouds.blobstore.httpstream.md5} + + + + + + + + + + + + + + diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/Storage.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/Storage.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/Storage.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/Storage.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/SwiftContextBuilder.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftContextBuilder.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/SwiftContextBuilder.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftContextBuilder.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java similarity index 92% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java index 8ba1ad8576..d261c29c06 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftPropertiesBuilder.java @@ -20,6 +20,7 @@ package org.jclouds.openstack.swift; import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; import java.util.Properties; @@ -34,6 +35,7 @@ public class SwiftPropertiesBuilder extends PropertiesBuilder { @Override protected Properties defaultProperties() { Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_REGIONS, "DEFAULT"); properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-"); return properties; } diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequest.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequest.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequest.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequest.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftAsyncBlobStore.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSigner.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSigner.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSigner.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSigner.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/config/SwiftBlobStoreContextModule.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobStoreListContainerOptionsToListContainerOptions.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobStoreListContainerOptionsToListContainerOptions.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobStoreListContainerOptionsToListContainerOptions.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobStoreListContainerOptionsToListContainerOptions.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObject.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObject.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObject.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObject.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObjectGetOptions.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObjectGetOptions.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObjectGetOptions.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/BlobToObjectGetOptions.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceList.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceList.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceList.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceList.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ContainerToResourceMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlob.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlob.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlob.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlob.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlobMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlobMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlobMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ObjectToBlobMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectInfo.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectInfo.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectInfo.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectInfo.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/config/BaseSwiftRestClientModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/BaseSwiftRestClientModule.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/config/BaseSwiftRestClientModule.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/config/BaseSwiftRestClientModule.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/config/SwiftObjectModule.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftObjectModule.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/config/SwiftObjectModule.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/config/SwiftObjectModule.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/AccountMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/AccountMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/AccountMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/AccountMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/ContainerMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/ContainerMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/ContainerMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/ContainerMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/MutableObjectInfoWithMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/MutableObjectInfoWithMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/MutableObjectInfoWithMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/MutableObjectInfoWithMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/ObjectInfo.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/ObjectInfo.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/ObjectInfo.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/ObjectInfo.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/SwiftObject.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/DelegatingMutableObjectInfoWithMetadata.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/MutableObjectInfoWithMetadataImpl.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/ObjectInfoImpl.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/domain/internal/SwiftObjectImpl.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ObjectName.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java similarity index 66% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java index 7ac91d5325..63c1742b25 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseAccountMetadataResponseFromHeaders.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import org.jclouds.http.HttpResponse; import org.jclouds.openstack.swift.domain.AccountMetadata; -import org.jclouds.cloudfiles.reference.CloudFilesHeaders; +import org.jclouds.openstack.swift.reference.SwiftHeaders; import com.google.common.base.Function; @@ -32,21 +32,16 @@ import com.google.common.base.Function; * * @author James Murty */ -public class ParseAccountMetadataResponseFromHeaders implements - Function { +public class ParseAccountMetadataResponseFromHeaders implements Function { /** * parses the http response headers to create a new {@link AccountMetadata} object. */ public AccountMetadata apply(final HttpResponse from) { - String bytesString = checkNotNull( - from.getFirstHeaderOrNull(CloudFilesHeaders.ACCOUNT_BYTES_USED), - CloudFilesHeaders.ACCOUNT_BYTES_USED); - String containersCountString = checkNotNull( - from.getFirstHeaderOrNull(CloudFilesHeaders.ACCOUNT_CONTAINER_COUNT), - CloudFilesHeaders.ACCOUNT_CONTAINER_COUNT); - return new AccountMetadata( - Long.parseLong(containersCountString), - Long.parseLong(bytesString)); + String bytesString = checkNotNull(from.getFirstHeaderOrNull(SwiftHeaders.ACCOUNT_BYTES_USED), + SwiftHeaders.ACCOUNT_BYTES_USED); + String containersCountString = checkNotNull(from.getFirstHeaderOrNull(SwiftHeaders.ACCOUNT_CONTAINER_COUNT), + SwiftHeaders.ACCOUNT_CONTAINER_COUNT); + return new AccountMetadata(Long.parseLong(containersCountString), Long.parseLong(bytesString)); } } diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectFromHeadersAndHttpContent.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeaders.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ReturnTrueOn404FalseOn409.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ReturnTrueOn404FalseOn409.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/functions/ReturnTrueOn404FalseOn409.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ReturnTrueOn404FalseOn409.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponse.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/options/ListContainerOptions.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftConstants.java diff --git a/apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java similarity index 100% rename from apis/cloudfiles/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java rename to apis/swift/src/main/java/org/jclouds/openstack/swift/reference/SwiftHeaders.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseAuthenticationResponseFromHeadersTest.java b/apis/swift/src/test/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeadersTest.java similarity index 93% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseAuthenticationResponseFromHeadersTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeadersTest.java index 3835a68586..be23447672 100644 --- a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseAuthenticationResponseFromHeadersTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeadersTest.java @@ -17,7 +17,7 @@ * ==================================================================== */ -package org.jclouds.openstack.swift.functions; +package org.jclouds.openstack.functions; import static org.testng.Assert.assertEquals; @@ -29,7 +29,6 @@ import org.jclouds.Constants; import org.jclouds.blobstore.reference.BlobStoreConstants; import org.jclouds.http.HttpResponse; import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse; -import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMap; @@ -61,12 +60,13 @@ public class ParseAuthenticationResponseFromHeadersTest { public void testReplaceLocalhost() { ParseAuthenticationResponseFromHeaders parser = i.getInstance(ParseAuthenticationResponseFromHeaders.class); - + parser = parser.setHostToReplace("fooman"); + HttpResponse response = new HttpResponse(204, "No Content", null, ImmutableMultimap. of( "X-Auth-Token", "token", "X-Storage-Token", "token", "X-Storage-Url", "http://127.0.0.1:8080/v1/token")); AuthenticationResponse md = parser.apply(response); assertEquals(md, new AuthenticationResponse("token", ImmutableMap. of("X-Storage-Url", URI - .create("http://127.0.0.1:8080/v1/token")))); + .create("http://fooman:8080/v1/token")))); } } diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/SwiftClientTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/SwiftClientTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/SwiftClientTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequestTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequestTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequestTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/binders/BindSwiftObjectMetadataToRequestTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSignerTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSignerTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSignerTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobRequestSignerTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ListContainerOptionsToBlobStoreListContainerOptions.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ListContainerOptionsToBlobStoreListContainerOptions.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ListContainerOptionsToBlobStoreListContainerOptions.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ListContainerOptionsToBlobStoreListContainerOptions.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectList.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectList.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectList.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/functions/ResourceToObjectList.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobIntegrationLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobIntegrationLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobIntegrationLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobMapIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobMapIntegrationLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobMapIntegrationLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobMapIntegrationLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobSignerLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobSignerLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobSignerLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftBlobSignerLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftInputStreamMapIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftInputStreamMapIntegrationLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftInputStreamMapIntegrationLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftInputStreamMapIntegrationLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftServiceIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftServiceIntegrationLiveTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftServiceIntegrationLiveTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftServiceIntegrationLiveTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftTestInitializer.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftTestInitializer.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftTestInitializer.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftTestInitializer.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/domain/internal/ParseObjectInfoListFromJsonResponseTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/domain/internal/ParseObjectInfoListFromJsonResponseTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/domain/internal/ParseObjectInfoListFromJsonResponseTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/domain/internal/ParseObjectInfoListFromJsonResponseTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseContainerListFromJsonResponseTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeadersTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeadersTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeadersTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/functions/ParseObjectInfoFromHeadersTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponseTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponseTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponseTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/handlers/ParseSwiftErrorFromHttpResponseTest.java diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java similarity index 94% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java index 073bdd42db..961500b162 100644 --- a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java @@ -39,8 +39,6 @@ import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.PageSet; import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions; import org.jclouds.blobstore.options.ListContainerOptions; -import org.jclouds.cloudfiles.domain.ContainerCDNMetadata; -import org.jclouds.cloudfiles.options.ListCdnContainerOptions; import org.jclouds.concurrent.Futures; import org.jclouds.http.options.GetOptions; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; @@ -126,10 +124,6 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { throw new UnsupportedOperationException(); } - public ListenableFuture getCDNMetadata(String container) { - throw new UnsupportedOperationException(); - } - public ListenableFuture getObject(String container, String key, GetOptions... options) { org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options); return Futures.compose(blobStore.getBlob(container, key, getOptions), blob2Object, service); @@ -148,10 +142,6 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { }, service); } - public ListenableFuture> listCDNContainers(ListCdnContainerOptions... options) { - throw new UnsupportedOperationException(); - } - public ListenableFuture> listContainers( org.jclouds.openstack.swift.options.ListContainerOptions... options) { return immediateFuture(Sets.newHashSet(Iterables.transform(blobStore.getContainerToBlobs().keySet(), diff --git a/apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/options/ListContainerOptionsTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/options/ListContainerOptionsTest.java similarity index 100% rename from apis/cloudfiles/src/test/java/org/jclouds/openstack/swift/options/ListContainerOptionsTest.java rename to apis/swift/src/test/java/org/jclouds/openstack/swift/options/ListContainerOptionsTest.java diff --git a/apis/cloudfiles/src/test/resources/log4j.xml b/apis/swift/src/test/resources/log4j.xml similarity index 100% rename from apis/cloudfiles/src/test/resources/log4j.xml rename to apis/swift/src/test/resources/log4j.xml diff --git a/apis/cloudfiles/src/test/resources/test_list_container.json b/apis/swift/src/test/resources/test_list_container.json similarity index 100% rename from apis/cloudfiles/src/test/resources/test_list_container.json rename to apis/swift/src/test/resources/test_list_container.json diff --git a/blobstore/src/main/clojure/org/jclouds/blobstore.clj b/blobstore/src/main/clojure/org/jclouds/blobstore.clj index 1840c6f2a0..54e95c7820 100644 --- a/blobstore/src/main/clojure/org/jclouds/blobstore.clj +++ b/blobstore/src/main/clojure/org/jclouds/blobstore.clj @@ -23,7 +23,7 @@ Current supported services are: [transient, filesystem, s3, azureblob, atmos, cloudfiles, walrus, googlestorage, synaptic, peer1-storage, aws-s3, ecc-s3, cloudfiles-us, - cloufiles-uk] + cloudfiles-uki, swift] Here's a quick example of how to viewresources in rackspace diff --git a/common/rackspace/README.txt b/common/openstack/README.txt similarity index 100% rename from common/rackspace/README.txt rename to common/openstack/README.txt diff --git a/common/rackspace/pom.xml b/common/openstack/pom.xml similarity index 97% rename from common/rackspace/pom.xml rename to common/openstack/pom.xml index e362d24b44..ab1cee7d68 100644 --- a/common/rackspace/pom.xml +++ b/common/openstack/pom.xml @@ -29,7 +29,7 @@ ../../project/pom.xml org.jclouds.common - rackspace-common + openstack-common jclouds Rackspace Components Core jclouds Core components to access Rackspace apis diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/Authentication.java b/common/openstack/src/main/java/org/jclouds/openstack/Authentication.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/Authentication.java rename to common/openstack/src/main/java/org/jclouds/openstack/Authentication.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/OpenStackAuthAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/OpenStackAuthAsyncClient.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/OpenStackAuthAsyncClient.java rename to common/openstack/src/main/java/org/jclouds/openstack/OpenStackAuthAsyncClient.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java rename to common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/filters/AddTimestampQuery.java b/common/openstack/src/main/java/org/jclouds/openstack/filters/AddTimestampQuery.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/filters/AddTimestampQuery.java rename to common/openstack/src/main/java/org/jclouds/openstack/filters/AddTimestampQuery.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/filters/AuthenticateRequest.java b/common/openstack/src/main/java/org/jclouds/openstack/filters/AuthenticateRequest.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/filters/AuthenticateRequest.java rename to common/openstack/src/main/java/org/jclouds/openstack/filters/AuthenticateRequest.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java b/common/openstack/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java similarity index 62% rename from common/rackspace/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java rename to common/openstack/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java index 6f5ae88ae6..746d728cf9 100755 --- a/common/rackspace/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/functions/ParseAuthenticationResponseFromHeaders.java @@ -28,12 +28,17 @@ import java.net.URI; import java.util.Map.Entry; import javax.annotation.Resource; -import javax.inject.Singleton; +import javax.inject.Inject; +import javax.inject.Provider; +import javax.ws.rs.core.UriBuilder; +import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.jclouds.logging.Logger; import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse; +import org.jclouds.rest.InvocationContext; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; @@ -43,12 +48,20 @@ import com.google.common.collect.ImmutableMap.Builder; * * @author Adrian Cole */ -@Singleton -public class ParseAuthenticationResponseFromHeaders implements Function { +public class ParseAuthenticationResponseFromHeaders implements Function, + InvocationContext { @Resource protected Logger logger = Logger.NULL; + private final Provider uriBuilderProvider; + private String hostToReplace; + + @Inject + public ParseAuthenticationResponseFromHeaders(Provider uriBuilderProvider) { + this.uriBuilderProvider = uriBuilderProvider; + } + /** * parses the http response headers to create a new {@link AuthenticationResponse} object. */ @@ -57,11 +70,32 @@ public class ParseAuthenticationResponseFromHeaders implements Function builder = ImmutableMap. builder(); for (Entry entry : from.getHeaders().entries()) { if (entry.getKey().endsWith(URL_SUFFIX)) - builder.put(entry.getKey(), URI.create(entry.getValue())); + builder.put(entry.getKey(), getURI(entry.getValue())); } AuthenticationResponse response = new AuthenticationResponse(checkNotNull(from.getFirstHeaderOrNull(AUTH_TOKEN), AUTH_TOKEN), builder.build()); logger.debug("will connect to: ", response); return response; } + + // TODO: find the swift configuration or bug related to returning localhost + protected URI getURI(String headerValue) { + if (headerValue == null) + return null; + URI toReturn = URI.create(headerValue); + if (!"127.0.0.1".equals(toReturn.getHost())) + return toReturn; + return uriBuilderProvider.get().uri(toReturn).host(hostToReplace).build(); + } + + @Override + public ParseAuthenticationResponseFromHeaders setContext(HttpRequest request) { + return setHostToReplace(request.getEndpoint().getHost()); + } + + @VisibleForTesting + ParseAuthenticationResponseFromHeaders setHostToReplace(String hostToReplace) { + this.hostToReplace = hostToReplace; + return this; + } } \ No newline at end of file diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/options/BaseListOptions.java b/common/openstack/src/main/java/org/jclouds/openstack/options/BaseListOptions.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/options/BaseListOptions.java rename to common/openstack/src/main/java/org/jclouds/openstack/options/BaseListOptions.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/reference/AuthHeaders.java b/common/openstack/src/main/java/org/jclouds/openstack/reference/AuthHeaders.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/reference/AuthHeaders.java rename to common/openstack/src/main/java/org/jclouds/openstack/reference/AuthHeaders.java diff --git a/common/rackspace/src/main/java/org/jclouds/openstack/reference/package-info.java b/common/openstack/src/main/java/org/jclouds/openstack/reference/package-info.java similarity index 100% rename from common/rackspace/src/main/java/org/jclouds/openstack/reference/package-info.java rename to common/openstack/src/main/java/org/jclouds/openstack/reference/package-info.java diff --git a/common/rackspace/src/test/java/org/jclouds/openstack/OpenStackAuthAsyncClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/OpenStackAuthAsyncClientTest.java similarity index 100% rename from common/rackspace/src/test/java/org/jclouds/openstack/OpenStackAuthAsyncClientTest.java rename to common/openstack/src/test/java/org/jclouds/openstack/OpenStackAuthAsyncClientTest.java diff --git a/common/rackspace/src/test/java/org/jclouds/openstack/TestOpenStackAuthenticationModule.java b/common/openstack/src/test/java/org/jclouds/openstack/TestOpenStackAuthenticationModule.java similarity index 100% rename from common/rackspace/src/test/java/org/jclouds/openstack/TestOpenStackAuthenticationModule.java rename to common/openstack/src/test/java/org/jclouds/openstack/TestOpenStackAuthenticationModule.java diff --git a/common/rackspace/src/test/java/org/jclouds/openstack/filters/AddTimestampQueryTest.java b/common/openstack/src/test/java/org/jclouds/openstack/filters/AddTimestampQueryTest.java similarity index 100% rename from common/rackspace/src/test/java/org/jclouds/openstack/filters/AddTimestampQueryTest.java rename to common/openstack/src/test/java/org/jclouds/openstack/filters/AddTimestampQueryTest.java diff --git a/common/rackspace/src/test/java/org/jclouds/openstack/options/BaseListOptionsTest.java b/common/openstack/src/test/java/org/jclouds/openstack/options/BaseListOptionsTest.java similarity index 100% rename from common/rackspace/src/test/java/org/jclouds/openstack/options/BaseListOptionsTest.java rename to common/openstack/src/test/java/org/jclouds/openstack/options/BaseListOptionsTest.java diff --git a/common/pom.xml b/common/pom.xml index a78344b51d..2b079236cf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -34,6 +34,6 @@ jclouds commons project aws - rackspace + openstack diff --git a/providers/cloudfiles-uk/pom.xml b/providers/cloudfiles-uk/pom.xml index 09920314bf..e803b6d4c3 100644 --- a/providers/cloudfiles-uk/pom.xml +++ b/providers/cloudfiles-uk/pom.xml @@ -49,6 +49,13 @@ ${project.version} jar + + org.jclouds.api + swift + ${project.version} + test-jar + test + org.jclouds.api cloudfiles diff --git a/providers/cloudfiles-us/pom.xml b/providers/cloudfiles-us/pom.xml index 75f4e49632..3fe4ef28b3 100644 --- a/providers/cloudfiles-us/pom.xml +++ b/providers/cloudfiles-us/pom.xml @@ -49,6 +49,13 @@ ${project.version} jar + + org.jclouds.api + swift + ${project.version} + test-jar + test + org.jclouds.api cloudfiles diff --git a/providers/cloudservers-uk/pom.xml b/providers/cloudservers-uk/pom.xml index 68f8884d8e..4a64e8df54 100644 --- a/providers/cloudservers-uk/pom.xml +++ b/providers/cloudservers-uk/pom.xml @@ -44,7 +44,7 @@ org.jclouds.common - rackspace-common + openstack-common ${project.version} diff --git a/providers/cloudservers-us/pom.xml b/providers/cloudservers-us/pom.xml index 8e06e8f701..a69400c87d 100644 --- a/providers/cloudservers-us/pom.xml +++ b/providers/cloudservers-us/pom.xml @@ -44,7 +44,7 @@ org.jclouds.common - rackspace-common + openstack-common ${project.version}