mirror of https://github.com/apache/jclouds.git
JCLOUDS-651: Swift support for conditional copies
This commit is contained in:
parent
6cdb1216a7
commit
7eb46cce36
|
@ -253,6 +253,21 @@ public class RegionScopedSwiftBlobStore implements BlobStore {
|
||||||
CopyOptions options) {
|
CopyOptions options) {
|
||||||
ObjectApi objectApi = api.getObjectApi(regionId, toContainer);
|
ObjectApi objectApi = api.getObjectApi(regionId, toContainer);
|
||||||
|
|
||||||
|
org.jclouds.openstack.swift.v1.options.CopyOptions swiftOptions = new org.jclouds.openstack.swift.v1.options.CopyOptions();
|
||||||
|
|
||||||
|
if (options.ifMatch() != null) {
|
||||||
|
swiftOptions.ifMatch(options.ifMatch());
|
||||||
|
}
|
||||||
|
if (options.ifNoneMatch() != null) {
|
||||||
|
throw new UnsupportedOperationException("Swift does not support ifNoneMatch");
|
||||||
|
}
|
||||||
|
if (options.ifModifiedSince() != null) {
|
||||||
|
swiftOptions.ifModifiedSince(options.ifModifiedSince());
|
||||||
|
}
|
||||||
|
if (options.ifUnmodifiedSince() != null) {
|
||||||
|
swiftOptions.ifUnmodifiedSince(options.ifUnmodifiedSince());
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, String> systemMetadata = Maps.newHashMap();
|
Map<String, String> systemMetadata = Maps.newHashMap();
|
||||||
ContentMetadata contentMetadata = options.contentMetadata();
|
ContentMetadata contentMetadata = options.contentMetadata();
|
||||||
Map<String, String> userMetadata = options.userMetadata();
|
Map<String, String> userMetadata = options.userMetadata();
|
||||||
|
@ -307,7 +322,7 @@ public class RegionScopedSwiftBlobStore implements BlobStore {
|
||||||
userMetadata = metadata.getMetadata();
|
userMetadata = metadata.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
objectApi.copy(toName, fromContainer, fromName, userMetadata, systemMetadata);
|
objectApi.copy(toName, fromContainer, fromName, userMetadata, systemMetadata, swiftOptions);
|
||||||
|
|
||||||
// TODO: Swift copy object *appends* user metadata, does not overwrite
|
// TODO: Swift copy object *appends* user metadata, does not overwrite
|
||||||
return objectApi.getWithoutBody(toName).getETag();
|
return objectApi.getWithoutBody(toName).getETag();
|
||||||
|
|
|
@ -100,6 +100,20 @@ public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
super.testPutBlobAccessMultipart();
|
super.testPutBlobAccessMultipart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||||
|
public void testCopyIfNoneMatch() throws Exception {
|
||||||
|
super.testCopyIfNoneMatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||||
|
public void testCopyIfNoneMatchNegative() throws Exception {
|
||||||
|
super.testCopyIfNoneMatchNegative();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: testCopyIfModifiedSinceNegative throws HTTP 304 not 412 error
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected long getMinimumMultipartBlobSize() {
|
protected long getMinimumMultipartBlobSize() {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue