mirror of https://github.com/apache/jclouds.git
corrected imports
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1432 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
2fb0c79e0f
commit
f5135f3868
|
@ -31,15 +31,13 @@ import org.jclouds.http.HttpHeaders;
|
||||||
import org.jclouds.http.commands.callables.ReturnTrueIf2xx;
|
import org.jclouds.http.commands.callables.ReturnTrueIf2xx;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import sun.util.logging.resources.logging;
|
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
import com.google.inject.name.Named;
|
import com.google.inject.name.Named;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PUT request operation directed at a bucket URI with the "acl" parameter
|
* A PUT request operation directed at a bucket URI with the "acl" parameter sets the Access Control
|
||||||
* sets the Access Control List (ACL) settings for that S3 item.
|
* List (ACL) settings for that S3 item.
|
||||||
* <p />
|
* <p />
|
||||||
* To set a bucket or object's ACL, you must have WRITE_ACP or FULL_CONTROL access to the item.
|
* To set a bucket or object's ACL, you must have WRITE_ACP or FULL_CONTROL access to the item.
|
||||||
*
|
*
|
||||||
|
@ -53,8 +51,7 @@ public class PutBucketAccessControlList extends S3FutureCommand<Boolean> {
|
||||||
@Inject
|
@Inject
|
||||||
public PutBucketAccessControlList(@Named("jclouds.http.address") String amazonHost,
|
public PutBucketAccessControlList(@Named("jclouds.http.address") String amazonHost,
|
||||||
ReturnTrueIf2xx callable, @Assisted("bucketName") String bucket,
|
ReturnTrueIf2xx callable, @Assisted("bucketName") String bucket,
|
||||||
@Assisted AccessControlList acl)
|
@Assisted AccessControlList acl) {
|
||||||
{
|
|
||||||
super("PUT", "/?acl", callable, amazonHost, bucket);
|
super("PUT", "/?acl", callable, amazonHost, bucket);
|
||||||
|
|
||||||
String aclPayload = "";
|
String aclPayload = "";
|
||||||
|
@ -65,8 +62,7 @@ public class PutBucketAccessControlList extends S3FutureCommand<Boolean> {
|
||||||
logger.error(e, "Unable to build XML document for Access Control List: " + acl);
|
logger.error(e, "Unable to build XML document for Access Control List: " + acl);
|
||||||
}
|
}
|
||||||
getRequest().setPayload(aclPayload);
|
getRequest().setPayload(aclPayload);
|
||||||
getRequest().getHeaders().put(
|
getRequest().getHeaders().put(HttpHeaders.CONTENT_LENGTH, aclPayload.getBytes().length + "");
|
||||||
HttpHeaders.CONTENT_LENGTH, aclPayload.getBytes().length + "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -54,7 +54,6 @@ import org.jclouds.aws.s3.commands.options.ListBucketOptions;
|
||||||
import org.jclouds.aws.s3.commands.options.PutBucketOptions;
|
import org.jclouds.aws.s3.commands.options.PutBucketOptions;
|
||||||
import org.jclouds.aws.s3.commands.options.PutObjectOptions;
|
import org.jclouds.aws.s3.commands.options.PutObjectOptions;
|
||||||
import org.jclouds.aws.s3.domain.AccessControlList;
|
import org.jclouds.aws.s3.domain.AccessControlList;
|
||||||
import org.jclouds.aws.s3.domain.CanonicalUser;
|
|
||||||
import org.jclouds.aws.s3.domain.S3Bucket;
|
import org.jclouds.aws.s3.domain.S3Bucket;
|
||||||
import org.jclouds.aws.s3.domain.S3Object;
|
import org.jclouds.aws.s3.domain.S3Object;
|
||||||
import org.jclouds.aws.s3.domain.AccessControlList.CanonicalUserGrantee;
|
import org.jclouds.aws.s3.domain.AccessControlList.CanonicalUserGrantee;
|
||||||
|
@ -77,7 +76,7 @@ import com.google.common.collect.Sets;
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* // TODO: Adrian: Document this!
|
* Implementation of {@link S3Connection} which keeps all data in a local Map object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -354,8 +353,8 @@ public class StubS3Connection implements S3Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.getMaxKeys() != null) {
|
if (options.getMaxKeys() != null) {
|
||||||
SortedSet<S3Object.Metadata> contentsSlice = firstSliceOfSize(
|
SortedSet<S3Object.Metadata> contentsSlice = firstSliceOfSize(contents, Integer
|
||||||
contents, Integer.parseInt(options.getMaxKeys()));
|
.parseInt(options.getMaxKeys()));
|
||||||
returnVal.setMaxKeys(Integer.parseInt(options.getMaxKeys()));
|
returnVal.setMaxKeys(Integer.parseInt(options.getMaxKeys()));
|
||||||
if (!contentsSlice.contains(contents.last())) {
|
if (!contentsSlice.contains(contents.last())) {
|
||||||
// Partial listing
|
// Partial listing
|
||||||
|
@ -455,7 +454,7 @@ public class StubS3Connection implements S3Connection {
|
||||||
|
|
||||||
// Set HTTP headers to match metadata
|
// Set HTTP headers to match metadata
|
||||||
newMd.getAllHeaders().put(HttpConstants.LAST_MODIFIED,
|
newMd.getAllHeaders().put(HttpConstants.LAST_MODIFIED,
|
||||||
dateService.rfc822DateFormat(newMd.getLastModified()));
|
dateService.rfc822DateFormat(newMd.getLastModified()));
|
||||||
newMd.getAllHeaders().put(HttpConstants.CONTENT_MD5, S3Utils.toHexString(md5));
|
newMd.getAllHeaders().put(HttpConstants.CONTENT_MD5, S3Utils.toHexString(md5));
|
||||||
newMd.getAllHeaders().put(HttpConstants.CONTENT_TYPE, newMd.getContentType());
|
newMd.getAllHeaders().put(HttpConstants.CONTENT_TYPE, newMd.getContentType());
|
||||||
newMd.getAllHeaders().put(HttpConstants.CONTENT_LENGTH, newMd.getSize() + "");
|
newMd.getAllHeaders().put(HttpConstants.CONTENT_LENGTH, newMd.getSize() + "");
|
||||||
|
@ -549,12 +548,12 @@ public class StubS3Connection implements S3Connection {
|
||||||
if (aclObj instanceof AccessControlList) {
|
if (aclObj instanceof AccessControlList) {
|
||||||
acl = (AccessControlList) aclObj;
|
acl = (AccessControlList) aclObj;
|
||||||
} else if (aclObj instanceof CannedAccessPolicy) {
|
} else if (aclObj instanceof CannedAccessPolicy) {
|
||||||
acl = AccessControlList.fromCannedAccessPolicy(
|
acl = AccessControlList.fromCannedAccessPolicy((CannedAccessPolicy) aclObj,
|
||||||
(CannedAccessPolicy) aclObj, DEFAULT_OWNER_ID);
|
DEFAULT_OWNER_ID);
|
||||||
} else if (aclObj == null) {
|
} else if (aclObj == null) {
|
||||||
// Default to private access policy
|
// Default to private access policy
|
||||||
acl = AccessControlList.fromCannedAccessPolicy(
|
acl = AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE,
|
||||||
CannedAccessPolicy.PRIVATE, DEFAULT_OWNER_ID);
|
DEFAULT_OWNER_ID);
|
||||||
}
|
}
|
||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
@ -576,10 +575,10 @@ public class StubS3Connection implements S3Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace any AmazonCustomerByEmail grantees with a somewhat-arbitrary canonical user
|
* Replace any AmazonCustomerByEmail grantees with a somewhat-arbitrary canonical user grantee,
|
||||||
* grantee, to match S3 which substitutes each email address grantee with that
|
* to match S3 which substitutes each email address grantee with that user's corresponding ID. In
|
||||||
* user's corresponding ID. In short, although you can PUT email address grantees,
|
* short, although you can PUT email address grantees, these are actually subsequently returned
|
||||||
* these are actually subsequently returned by S3 as canonical user grantees.
|
* by S3 as canonical user grantees.
|
||||||
*
|
*
|
||||||
* @param acl
|
* @param acl
|
||||||
* @return
|
* @return
|
||||||
|
@ -589,8 +588,8 @@ public class StubS3Connection implements S3Connection {
|
||||||
// the acl's owner ID as the surrogate replacement.
|
// the acl's owner ID as the surrogate replacement.
|
||||||
for (Grant grant : acl.getGrants()) {
|
for (Grant grant : acl.getGrants()) {
|
||||||
if (grant.getGrantee() instanceof EmailAddressGrantee) {
|
if (grant.getGrantee() instanceof EmailAddressGrantee) {
|
||||||
grant.setGrantee(new CanonicalUserGrantee(
|
grant.setGrantee(new CanonicalUserGrantee(acl.getOwner().getId(), acl.getOwner()
|
||||||
acl.getOwner().getId(), acl.getOwner().getDisplayName()));
|
.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return acl;
|
return acl;
|
||||||
|
@ -606,8 +605,7 @@ public class StubS3Connection implements S3Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Future<Boolean> putObjectACL(final String bucket, final String objectKey,
|
public Future<Boolean> putObjectACL(final String bucket, final String objectKey,
|
||||||
final AccessControlList acl)
|
final AccessControlList acl) {
|
||||||
{
|
|
||||||
return new FutureBase<Boolean>() {
|
return new FutureBase<Boolean>() {
|
||||||
public Boolean get() throws InterruptedException, ExecutionException {
|
public Boolean get() throws InterruptedException, ExecutionException {
|
||||||
keyToAcl.put(bucket + "/" + objectKey, sanitizeUploadedACL(acl));
|
keyToAcl.put(bucket + "/" + objectKey, sanitizeUploadedACL(acl));
|
||||||
|
|
Loading…
Reference in New Issue