You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2015/12/23 07:38:12 UTC
[3/6] jclouds git commit: JCLOUDS-844: Local blobstore putBlob ACLs
JCLOUDS-844: Local blobstore putBlob ACLs
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c0d72b6f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c0d72b6f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c0d72b6f
Branch: refs/heads/master
Commit: c0d72b6f5316a78695fa4effcdc61946f2c83157
Parents: 86491bc
Author: Andrew Gaul <ga...@apache.org>
Authored: Mon Dec 21 16:52:13 2015 -0800
Committer: Andrew Gaul <ga...@apache.org>
Committed: Tue Dec 22 00:46:33 2015 -0800
----------------------------------------------------------------------
.../blobstore/config/LocalBlobStore.java | 49 ++++++++++----------
1 file changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/c0d72b6f/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
----------------------------------------------------------------------
diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
index 214dd5d..06b3367 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
@@ -520,28 +520,7 @@ public final class LocalBlobStore implements BlobStore {
@Override
public String putBlob(String containerName, Blob blob) {
- checkNotNull(containerName, "containerName must be set");
- checkNotNull(blob, "blob must be set");
- String blobKey = blob.getMetadata().getName();
-
- logger.debug("Put blob with key [%s] to container [%s]", blobKey, containerName);
- if (!storageStrategy.containerExists(containerName)) {
- throw cnfe(containerName);
- }
-
- try {
- return storageStrategy.putBlob(containerName, blob);
- } catch (IOException e) {
- String message = e.getMessage();
- if (message != null && message.startsWith("MD5 hash code mismatch")) {
- HttpResponseException exception = returnResponseException(400);
- exception.initCause(e);
- throw exception;
- }
- logger.error(e, "An error occurred storing the new blob with name [%s] to container [%s].", blobKey,
- containerName);
- throw propagate(e);
- }
+ return putBlob(containerName, blob, PutOptions.NONE);
}
@Override
@@ -740,8 +719,30 @@ public final class LocalBlobStore implements BlobStore {
@Override
public String putBlob(String containerName, Blob blob, PutOptions options) {
- // TODO implement options
- return putBlob(containerName, blob);
+ checkNotNull(containerName, "containerName must be set");
+ checkNotNull(blob, "blob must be set");
+ String blobKey = blob.getMetadata().getName();
+
+ logger.debug("Put blob with key [%s] to container [%s]", blobKey, containerName);
+ if (!storageStrategy.containerExists(containerName)) {
+ throw cnfe(containerName);
+ }
+
+ try {
+ String eTag = storageStrategy.putBlob(containerName, blob);
+ setBlobAccess(containerName, blobKey, options.getBlobAccess());
+ return eTag;
+ } catch (IOException e) {
+ String message = e.getMessage();
+ if (message != null && message.startsWith("MD5 hash code mismatch")) {
+ HttpResponseException exception = returnResponseException(400);
+ exception.initCause(e);
+ throw exception;
+ }
+ logger.error(e, "An error occurred storing the new blob with name [%s] to container [%s].", blobKey,
+ containerName);
+ throw propagate(e);
+ }
}
@Override