Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
JCLOUDS-930: Add prefix option to OpenStack Swift.
Browse files Browse the repository at this point in the history
Plumbs the prefix option to the openstack-swift provider. In the
process, the support for the recursive option is modified to avoid
setting the _path_ parameter, but rather use the delimiter if required
(setting the delimiter is sufficient for a non-recursive listing).
  • Loading branch information
timuralp committed Jun 30, 2015
1 parent c409c19 commit 1cb0822
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@ public class ToListContainerOptions implements
@Override
public org.jclouds.openstack.swift.v1.options.ListContainerOptions apply(ListContainerOptions from) {
checkNotNull(from, "set options to instance NONE instead of passing null");
org.jclouds.openstack.swift.v1.options.ListContainerOptions options = new org.jclouds.openstack.swift.v1.options.ListContainerOptions();
if ((from.getDir() == null) && (from.isRecursive())) {
options.prefix("");
if (from.getDir() != null && from.getPrefix() != null) {
throw new IllegalArgumentException("Cannot set both directory and prefix");
}
if ((from.getDir() == null) && (!from.isRecursive())) {
options.path("");
org.jclouds.openstack.swift.v1.options.ListContainerOptions options = new org.jclouds.openstack.swift.v1.options.ListContainerOptions();
if (from.getDir() == null && !from.isRecursive()) {
options.delimiter('/');
}
if ((from.getDir() != null) && (from.isRecursive())) {
options.prefix(from.getDir().endsWith("/") ? from.getDir() : from.getDir() + "/");
}
if ((from.getDir() != null) && (!from.isRecursive())) {
options.path(from.getDir());
}
if (from.getPrefix() != null) {
options.prefix(from.getPrefix());
}
if (from.getMarker() != null) {
options.marker(from.getMarker());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Properties;

import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest;
import org.testng.SkipException;
import org.testng.annotations.Test;

@Test(groups = "live", testName = "SwiftContainerLiveTest")
Expand All @@ -37,9 +36,4 @@ protected Properties setupProperties() {
setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE);
return props;
}

@Override
public void testContainerListWithPrefix() {
throw new SkipException("Prefix option has not been plumbed down to Swift");
}
}

0 comments on commit 1cb0822

Please sign in to comment.