From 0c690f686fa0a386cefdba0402a2aaab3e8144cd Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 6 Nov 2010 09:44:05 +0100 Subject: [PATCH] Issue 396: added peer1-storage provider --- README.txt | 18 ++++++++++------- atmos/pom.xml | 20 +++++++++++++++++++ .../saas/AtmosStorageAsyncClient.java | 2 ++ .../atmosonline/saas/filters/SignRequest.java | 2 +- .../saas/AtmosStorageAsyncClientTest.java | 2 +- .../main/clojure/org/jclouds/blobstore.clj | 3 ++- .../internal/RestAnnotationProcessor.java | 6 +++++- core/src/main/resources/rest.properties | 6 +++++- .../internal/RestAnnotationProcessorTest.java | 14 ++++++++++++- 9 files changed, 60 insertions(+), 13 deletions(-) diff --git a/README.txt b/README.txt index 4a000b28d2..d5bc557537 100644 --- a/README.txt +++ b/README.txt @@ -19,22 +19,26 @@ Overview: -jclouds is an open source framework that helps you get started in the cloud +jclouds is an open source library that helps you get started in the cloud and reuse your java and clojure development skills. Our api allows you to -freedom to use portable abstractions or cloud-specific features. +freedom to use portable abstractions or cloud-specific features. We have +two abstractions at the moment: compute and blobstore. compute helps you +bootstrap machines in the cloud. blobstore helps you manage key-value +data. our current version is 1.0-beta-7 our dev version is 1.0-SNAPSHOT -our compute api supports: ec2, gogrid, rackspace, rimuhosting, vcloud, trmk-ecloud, - trmk-vcloudexpress, eucalyptus, bluelock-vclouddirector, - bluelock-vcloudexpress, slicehost, stub (in-memory) +our compute api supports: ec2, gogrid, cloudservers (rackspace), rimuhosting, vcloud, + trmk-ecloud, trmk-vcloudexpress, eucalyptus, + bluelock-vclouddirector, slicehost, stub (in-memory) * note * the pom dependency org.jclouds/jclouds-allcompute gives you access to to all of these providers -our blobstore api supports: s3, rackspace, azure, atmos online, att synaptic, - walrus, googlestorage, transient (in-memory), filesystem (on-disk) +our blobstore api supports: s3, cloudfiles (rackspace), azurestorage, atmosonline, + synaptic, peer1-storage, walrus, googlestorage, + transient (in-memory), filesystem (on-disk) * note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to to all of these providers diff --git a/atmos/pom.xml b/atmos/pom.xml index aec222e1a4..3846cd76dd 100644 --- a/atmos/pom.xml +++ b/atmos/pom.xml @@ -36,6 +36,10 @@ 1.3.0 FIXME FIXME + https://cloudonestorage.peer1.com + 1.3.0 + FIXME + FIXME https://storage.synaptic.att.com 1.3.0 FIXME @@ -107,6 +111,22 @@ test.atmosonline.credential ${test.atmosonline.credential} + + test.peer1-storage.endpoint + ${test.peer1-storage.endpoint} + + + test.peer1-storage.apiversion + ${test.peer1-storage.apiversion} + + + test.peer1-storage.identity + ${test.peer1-storage.identity} + + + test.peer1-storage.credential + ${test.peer1-storage.credential} + test.synaptic.endpoint ${test.synaptic.endpoint} diff --git a/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java b/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java index 2ba7495fb2..ec9a939907 100644 --- a/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java +++ b/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java @@ -29,6 +29,7 @@ import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.jclouds.atmosonline.saas.binders.BindMetadataToHeaders; @@ -103,6 +104,7 @@ public interface AtmosStorageAsyncClient { @POST @Path("/{directoryName}/") @ExceptionParser(ReturnEndpointIfAlreadyExists.class) + @Produces(MediaType.APPLICATION_OCTET_STREAM) @Consumes(MediaType.WILDCARD) ListenableFuture createDirectory(@PathParam("directoryName") String directoryName); diff --git a/atmos/src/main/java/org/jclouds/atmosonline/saas/filters/SignRequest.java b/atmos/src/main/java/org/jclouds/atmosonline/saas/filters/SignRequest.java index 861f84ed80..23a5ef0c3e 100644 --- a/atmos/src/main/java/org/jclouds/atmosonline/saas/filters/SignRequest.java +++ b/atmos/src/main/java/org/jclouds/atmosonline/saas/filters/SignRequest.java @@ -148,7 +148,7 @@ public class SignRequest implements HttpRequestFilter { // TreeSet == Sort the headers alphabetically. Set headers = new TreeSet(request.getHeaders().keySet()); for (String header : headers) { - if (header.startsWith("x-emc-")) { + if (header.startsWith("x-emc-") && !header.equals(AtmosStorageHeaders.SIGNATURE)) { // Convert all header names to lowercase. toSign.append(header.toLowerCase()).append(":"); // For headers with values that span multiple lines, convert them into one line by diff --git a/atmos/src/test/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClientTest.java b/atmos/src/test/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClientTest.java index d30356c52c..14a229ef48 100644 --- a/atmos/src/test/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClientTest.java +++ b/atmos/src/test/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClientTest.java @@ -140,7 +140,7 @@ public class AtmosStorageAsyncClientTest extends RestClientTest { payload = new MultipartForm(BOUNDARY, parts); } else if (formParams.size() > 0) { payload = Payloads.newUrlEncodedFormPayload(formParams, skips); + } else if (headers.containsKey(CONTENT_TYPE)) { + payload = Payloads.newByteArrayPayload(new byte[]{}); + payload.getContentMetadata().setContentType(Iterables.get(headers.get(CONTENT_TYPE),0)); } if (payload != null) { request.setPayload(payload); diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index 32844739b3..7fb01d36cc 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -104,7 +104,11 @@ synaptic.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder synaptic.endpoint=https://storage.synaptic.att.com synaptic.apiversion=1.3.0 -# TODO peer1 and hostedsolutions use atmos +peer1-storage.contextbuilder=org.jclouds.atmosonline.saas.AtmosStorageContextBuilder +peer1-storage.endpoint=https://storage.synaptic.att.com +peer1-storage.apiversion=1.3.0 + +# TODO hostedsolutions use atmos cloudfiles.contextbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder cloudfiles.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java index 7b2d4fa9f0..b107347cb6 100755 --- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java +++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java @@ -373,10 +373,22 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest { @POST @Path("") public void post(HttpRequestOptions options); - + + @POST + @Path("") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public void post(); } public void testHttpRequestOptionsPayloadParam() throws SecurityException, NoSuchMethodException, IOException { + Method method = TestPayloadParamVarargs.class.getMethod("post"); + HttpRequest request = factory(TestQuery.class).createRequest(method); + assertRequestLineEquals(request, "POST http://localhost:9999?x-ms-version=2009-07-17 HTTP/1.1"); + assertNonPayloadHeadersEqual(request, ""); + assertPayloadEquals(request, "", "application/octet-stream", false); + } + + public void testHttpRequestWithOnlyContentType() throws SecurityException, NoSuchMethodException, IOException { Method method = TestPayloadParamVarargs.class.getMethod("post", HttpRequestOptions.class); verifyTestPostOptions(method); }