You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Adrian Cole (JIRA)" <ji...@apache.org> on 2014/06/16 17:16:03 UTC

[jira] [Commented] (JCLOUDS-391) can't set user-defined metadata for Azure with multipart blobs

    [ https://issues.apache.org/jira/browse/JCLOUDS-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032527#comment-14032527 ] 

Adrian Cole commented on JCLOUDS-391:
-------------------------------------

There's (at least) 2 ways to solve this.

The patch way would be to set blob metadata on the way out.  (ex. invoke BlobMetadataToBlobProperties and pass that to  sync.setBlobMetadata before returning from putBlob).

The better way would be to modify AzureBlobAsyncClient.putBlockList to accept another parameter, of metadata
`@BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata`
Then add a corresponding parameter to AzureBlobClient.putBlockList

Finally, modify AzureBlobBlockUploadStrategy to use that parameter on the way out.

hope this helps.





Ex. add the line here.

```
      if (options.isMultipart()) {
         String result = multipartUploadStrategy.get().execute(container, blob);
         if (result != null) {
           BlobMetadataToBlobProperties
            sync.setBlobMetadata(container, blob.getName(), 

         return multipartUploadStrategy.get().execute(container, blob);
      }
```

> can't set user-defined metadata for Azure with multipart blobs
> --------------------------------------------------------------
>
>                 Key: JCLOUDS-391
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-391
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 1.6.2
>         Environment: Windows 7, Azure and S3
>            Reporter: Klaus Müller
>            Priority: Critical
>
> Try to set user defined meta data for Azure blob storage. No error setting meta data, but when I try to read them, they were not stored for the given blob.
> my code (small part of it):
>    ...
>    BlobStore blobStore = Context.getBlobStore();
>    BlobBuilder builder = blobStore.blobBuilder("blob001");
>    PayloadBlobBuilder  payload = builder.payload(data);       // data is InputStream
>    payload.contentLength(datalen);
>    Blob blob = payload.build();
>    Map<String, String> keyValueMap = new HashMap<String, String>();
>    keyValueMap.put("testmeta","12345");
>    blob.getMetadata().setUserMetadata(keyValueMap);
>    blobStore.putBlob("container001", blob, multipart() );
> ...
> For S3 it works.
> Is this a known problem with Azure, or something wrong with my code?



--
This message was sent by Atlassian JIRA
(v6.2#6252)