From 755d51ad27325db385e03b4385e52ec2fbc755e3 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 1 May 2012 21:57:49 -0700 Subject: [PATCH] Remove unused transient blobstore methods Also make some helpers private. Generally, make the transient blobstore more similar to others. --- .../swift/internal/StubSwiftAsyncClient.java | 4 +- .../blobstore/TransientAsyncBlobStore.java | 38 +------------------ 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java index 308a62a2cf..114b3547ff 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java @@ -98,7 +98,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { } public ListenableFuture containerExists(final String container) { - return immediateFuture(blobStore.getContainerToBlobs().containsKey(container)); + return blobStore.containerExists(container); } public ListenableFuture createContainer(String container) { @@ -106,7 +106,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { } public ListenableFuture deleteContainerIfEmpty(String container) { - return blobStore.deleteContainerImpl(container); + return blobStore.deleteContainerIfEmpty(container); } public ListenableFuture disableCDN(String container) { diff --git a/blobstore/src/main/java/org/jclouds/blobstore/TransientAsyncBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/TransientAsyncBlobStore.java index d6d460b3c5..d01f168855 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/TransientAsyncBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/TransientAsyncBlobStore.java @@ -282,13 +282,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore { return immediateFuture(null); } - public ListenableFuture removeBlobAndReturnOld(String container, String key) { - if (getContainerToBlobs().containsKey(container)) { - return immediateFuture(getContainerToBlobs().get(container).remove(key)); - } - return immediateFuture(null); - } - /** * {@inheritDoc} */ @@ -309,7 +302,7 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore { return immediateFuture(null); } - public ListenableFuture deleteContainerImpl(final String container) { + public ListenableFuture deleteContainerIfEmpty(final String container) { Boolean returnVal = true; if (getContainerToBlobs().containsKey(container)) { if (getContainerToBlobs().get(container).size() == 0) @@ -362,20 +355,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore { return immediateFuture(Boolean.TRUE); } - /** - * throws IllegalStateException if the container already exists - */ - public ListenableFuture createContainerInLocationIfAbsent(final Location location, final String name) { - ConcurrentMap container = getContainerToBlobs().putIfAbsent(name, - new ConcurrentHashMap()); - if (container == null) { - getContainerToLocation().put(name, location != null ? location : defaultLocation.get()); - return immediateFuture((Void) null); - } else { - return Futures.immediateFailedFuture(new IllegalStateException("container " + name + " already exists")); - } - } - public String getFirstQueryOrNull(String string, @Nullable HttpRequestOptions options) { if (options == null) return null; @@ -499,19 +478,6 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore { return immediateFuture(Iterables.getOnlyElement(blob.getAllHeaders().get(HttpHeaders.ETAG))); } - public ListenableFuture putBlobAndReturnOld(String containerName, Blob in) { - ConcurrentMap container = getContainerToBlobs().get(containerName); - if (container == null) { - return Futures.immediateFailedFuture(new IllegalStateException("containerName not found: " + containerName)); - } - - Blob blob = createUpdatedCopyOfBlobInContainer(containerName, in); - - Blob old = container.put(blob.getMetadata().getName(), blob); - - return immediateFuture(old); - } - protected Blob createUpdatedCopyOfBlobInContainer(String containerName, Blob in) { checkNotNull(in, "blob"); checkNotNull(in.getPayload(), "blob.payload"); @@ -674,7 +640,7 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore { return getContainerToBlobs().containsKey(container); } - public ConcurrentMap getContainerToLocation() { + private ConcurrentMap getContainerToLocation() { return containerToLocation; }