From 9105ae55fade904fc864119fb68ded4d53ca0345 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 28 Oct 2014 16:02:12 -0700 Subject: [PATCH] Do not require Guava ByteSource in order to create a payload. --- .../jclouds/blobstore/domain/BlobBuilder.java | 6 ------ .../main/java/org/jclouds/http/HttpMessage.java | 6 ------ .../main/java/org/jclouds/http/HttpUtils.java | 3 +-- core/src/main/java/org/jclouds/io/Payloads.java | 16 ---------------- .../jclouds/io/payloads/ByteArrayPayload.java | 4 ---- .../org/jclouds/io/payloads/FilePayload.java | 4 ---- .../org/jclouds/io/payloads/StringPayload.java | 2 -- 7 files changed, 1 insertion(+), 40 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/domain/BlobBuilder.java b/blobstore/src/main/java/org/jclouds/blobstore/domain/BlobBuilder.java index 67f6971b2e..e2d4c62524 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/domain/BlobBuilder.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/domain/BlobBuilder.java @@ -77,9 +77,7 @@ public interface BlobBuilder { * * @param payload * payload you wish to construct the {@link Blob} with. - * @deprecated see payload(ByteSource.wrap(byte[]) */ - @Deprecated PayloadBlobBuilder payload(byte[] payload); /** @@ -91,18 +89,14 @@ public interface BlobBuilder { * * @param payload * payload you wish to construct the {@link Blob} with. - * @deprecated see payload(ByteSource.wrap(String.getBytes())) */ - @Deprecated PayloadBlobBuilder payload(String payload); /** * * @param payload * payload you wish to construct the {@link Blob} with. - * @deprecated see payload(Files.asByteSource(File)) */ - @Deprecated PayloadBlobBuilder payload(File payload); /** diff --git a/core/src/main/java/org/jclouds/http/HttpMessage.java b/core/src/main/java/org/jclouds/http/HttpMessage.java index df3f57814f..fc12fca999 100644 --- a/core/src/main/java/org/jclouds/http/HttpMessage.java +++ b/core/src/main/java/org/jclouds/http/HttpMessage.java @@ -64,9 +64,7 @@ public class HttpMessage extends PayloadEnclosingImpl { /** * @see HttpMessage#getPayload() - * @deprecated see payload(ByteSource.wrap(byte[])) */ - @Deprecated public T payload(byte [] payload) { this.payload = Payloads.newByteArrayPayload(checkNotNull(payload, "payload")); return self(); @@ -82,9 +80,7 @@ public class HttpMessage extends PayloadEnclosingImpl { /** * @see HttpMessage#getPayload() - * @deprecated see payload(Files.asByteSource(File)) */ - @Deprecated public T payload(File payload) { this.payload = Payloads.newFilePayload(checkNotNull(payload, "payload")); return self(); @@ -100,9 +96,7 @@ public class HttpMessage extends PayloadEnclosingImpl { /** * @see HttpMessage#getPayload() - * @deprecated see payload(ByteSource.wrap(String.getBytes())) */ - @Deprecated public T payload(String payload) { this.payload = Payloads.newStringPayload(checkNotNull(payload, "payload")); return self(); diff --git a/core/src/main/java/org/jclouds/http/HttpUtils.java b/core/src/main/java/org/jclouds/http/HttpUtils.java index f775607575..5c026de3ea 100644 --- a/core/src/main/java/org/jclouds/http/HttpUtils.java +++ b/core/src/main/java/org/jclouds/http/HttpUtils.java @@ -64,7 +64,6 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.google.common.collect.ImmutableSet.Builder; -import com.google.common.io.ByteSource; import com.google.common.reflect.Invokable; import com.google.inject.Inject; @@ -159,7 +158,7 @@ public class HttpUtils { public static byte[] closeClientButKeepContentStream(PayloadEnclosing response) { byte[] returnVal = toByteArrayOrNull(response); if (returnVal != null && !response.getPayload().isRepeatable()) { - Payload newPayload = Payloads.newByteSourcePayload(ByteSource.wrap(returnVal)); + Payload newPayload = Payloads.newByteArrayPayload(returnVal); MutableContentMetadata fromMd = response.getPayload().getContentMetadata(); MutableContentMetadata toMd = newPayload.getContentMetadata(); copy(fromMd, toMd); diff --git a/core/src/main/java/org/jclouds/io/Payloads.java b/core/src/main/java/org/jclouds/io/Payloads.java index 1ccacf79d5..542e8a218b 100644 --- a/core/src/main/java/org/jclouds/io/Payloads.java +++ b/core/src/main/java/org/jclouds/io/Payloads.java @@ -35,10 +35,6 @@ public class Payloads { private Payloads() { } - /** - * @deprecated see newPayload(ByteSource) or newPayload(InputStream) - */ - @Deprecated public static Payload newPayload(Object data) { checkNotNull(data, "data"); if (data instanceof Payload) { @@ -62,10 +58,6 @@ public class Payloads { return new InputStreamPayload(checkNotNull(data, "data")); } - /** - * @deprecated see newPayload(ByteSource) - */ - @Deprecated public static ByteArrayPayload newByteArrayPayload(byte[] data) { return new ByteArrayPayload(checkNotNull(data, "data")); } @@ -74,18 +66,10 @@ public class Payloads { return new ByteSourcePayload(checkNotNull(data, "data")); } - /** - * @deprecated see newPayload(ByteSource) - */ - @Deprecated public static StringPayload newStringPayload(String data) { return new StringPayload(checkNotNull(data, "data")); } - /** - * @deprecated see newPayload(ByteSource) - */ - @Deprecated public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); } diff --git a/core/src/main/java/org/jclouds/io/payloads/ByteArrayPayload.java b/core/src/main/java/org/jclouds/io/payloads/ByteArrayPayload.java index 5bcf514648..109fe711b8 100644 --- a/core/src/main/java/org/jclouds/io/payloads/ByteArrayPayload.java +++ b/core/src/main/java/org/jclouds/io/payloads/ByteArrayPayload.java @@ -22,10 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.io.ByteArrayInputStream; import java.io.InputStream; -/** - * @deprecated see ByteSourcePayload - */ -@Deprecated public class ByteArrayPayload extends BasePayload { public ByteArrayPayload(byte[] content) { this(content, null); diff --git a/core/src/main/java/org/jclouds/io/payloads/FilePayload.java b/core/src/main/java/org/jclouds/io/payloads/FilePayload.java index ee5756cc40..493694f410 100644 --- a/core/src/main/java/org/jclouds/io/payloads/FilePayload.java +++ b/core/src/main/java/org/jclouds/io/payloads/FilePayload.java @@ -24,10 +24,6 @@ import java.io.InputStream; import java.io.IOException; -/** - * @deprecated see ByteSourcePayload - */ -@Deprecated public class FilePayload extends BasePayload { public FilePayload(File content) { diff --git a/core/src/main/java/org/jclouds/io/payloads/StringPayload.java b/core/src/main/java/org/jclouds/io/payloads/StringPayload.java index 38650622af..c92ccd6378 100644 --- a/core/src/main/java/org/jclouds/io/payloads/StringPayload.java +++ b/core/src/main/java/org/jclouds/io/payloads/StringPayload.java @@ -25,9 +25,7 @@ import com.google.common.base.Charsets; * This implementation converts the String to a byte array using UTF-8 encoding. If you wish to use * a different encoding, please use {@link ByteArrayPayload}. * - * @deprecated see ByteSourcePayload */ -@Deprecated public class StringPayload extends BasePayload { private final byte[] bytes;