was apparently removed in Jclouds 1.6. I think I can work around this using
contextBuilder.buildApi(S3Client.class) and the S3Object class to set the
ACL.
But then if I have to use an S3-specific API to set an ACL, why not just
use the com.amazonaws.services.s3.AmazonS3Client client directly? How is
Jclouds actually benefitting me, if I'm using it to code directly to the S3
provider?
The challenge here is that ACLs are not something that is supported by
all the blobstores jclouds supports, so is not included in the
BlobStore abstraction. In other words, coding with ACLs on blobs is
implicitly making your code provider-dependent already.
In order to support provider-specific features like that, jclouds
indeed supports access to the underlying API, as you describe (see [1]
for more details). This is indeed not all that different from using
the provider client directly, but if the number of provider-specific
calls you need to make are small, using jclouds will allow you to move
to another provider relatively easily if you can re-implement the
provider-specific calls or remove them.
A "middle-ground approach" that jclouds takes for some options is the
ability to pass provider-specific options to the abstract interface.
E.g. something like:
Blob myBlob = ...
PutOptions options = AWSS3PutOptions.Builder.storageClass(...).otherOption...;
blobstore.putBlob("myContainer", myBlob, options); // [2]
This is *also* AWS-specific code, but not quite as tied to the
specific underlying API. Unfortunately, "withAcl" is not an option
currently supported on AWSS3PutOptions [3] (it *is* supported on
PutObjectOptions [4], but that's the options class for the S3-specific
call).
That should be a relatively easy fix, though - would you be interested
in submitting a PR for that?
Hope that helps!
ap
[1] http://jclouds.apache.org/start/concepts/
[2]
http://javadocs.jclouds.cloudbees.net/org/jclouds/blobstore/BlobStore.html#putBlob(java.lang.String, org.jclouds.blobstore.domain.Blob,
org.jclouds.blobstore.options.PutOptions)
[3]
http://javadocs.jclouds.cloudbees.net/org/jclouds/aws/s3/blobstore/options/AWSS3PutOptions.html
[4]
http://javadocs.jclouds.cloudbees.net/org/jclouds/s3/options/PutObjectOptions.html