Handle empty prefix on Atmos

This commit is contained in:
Andrew Gaul 2017-10-28 11:06:25 -07:00
parent 57dceaf56f
commit 17c8e31546
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,7 @@
*/ */
package org.jclouds.atmos.blobstore; package org.jclouds.atmos.blobstore;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.atmos.options.PutOptions.Builder.publicRead; import static org.jclouds.atmos.options.PutOptions.Builder.publicRead;
@ -58,6 +59,7 @@ import org.jclouds.http.options.GetOptions;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
import org.jclouds.io.PayloadSlicer; import org.jclouds.io.PayloadSlicer;
import com.google.common.base.Strings;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.cache.CacheLoader; import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
@ -218,6 +220,7 @@ public class AtmosBlobStore extends BaseBlobStore {
@Override @Override
public PageSet<? extends StorageMetadata> list(String container, public PageSet<? extends StorageMetadata> list(String container,
org.jclouds.blobstore.options.ListContainerOptions options) { org.jclouds.blobstore.options.ListContainerOptions options) {
checkArgument(Strings.isNullOrEmpty(options.getPrefix()), "does not support prefixes");
container = AtmosUtils.adjustContainerIfDirOptionPresent(container, options); container = AtmosUtils.adjustContainerIfDirOptionPresent(container, options);
ListOptions nativeOptions = container2ContainerListOptions.apply(options); ListOptions nativeOptions = container2ContainerListOptions.apply(options);
// until includeMeta() option works for namespace interface // until includeMeta() option works for namespace interface

View File

@ -23,6 +23,7 @@ import javax.inject.Singleton;
import org.jclouds.blobstore.options.ListContainerOptions; import org.jclouds.blobstore.options.ListContainerOptions;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Strings;
@Singleton @Singleton
public class BlobStoreListOptionsToListOptions implements public class BlobStoreListOptionsToListOptions implements
@ -31,7 +32,7 @@ public class BlobStoreListOptionsToListOptions implements
public org.jclouds.atmos.options.ListOptions apply(ListContainerOptions from) { public org.jclouds.atmos.options.ListOptions apply(ListContainerOptions from) {
checkNotNull(from, "set options to instance NONE instead of passing null"); checkNotNull(from, "set options to instance NONE instead of passing null");
org.jclouds.atmos.options.ListOptions httpOptions = new org.jclouds.atmos.options.ListOptions(); org.jclouds.atmos.options.ListOptions httpOptions = new org.jclouds.atmos.options.ListOptions();
if (from.getMarker() != null) { if (!Strings.isNullOrEmpty(from.getMarker())) {
httpOptions.token(from.getMarker()); httpOptions.token(from.getMarker());
} }
if (from.getMaxResults() != null) { if (from.getMaxResults() != null) {