mirror of https://github.com/apache/jclouds.git
JCLOUDS-930: Add prefix option to OpenStack Swift.
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).
This commit is contained in:
parent
c409c19ff3
commit
1cb0822972
|
@ -28,12 +28,12 @@ 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() + "/");
|
||||
|
@ -41,6 +41,9 @@ public class ToListContainerOptions implements
|
|||
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());
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CRED
|
|||
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")
|
||||
|
@ -37,9 +36,4 @@ public class SwiftContainerLiveTest extends BaseContainerLiveTest {
|
|||
setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE);
|
||||
return props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testContainerListWithPrefix() {
|
||||
throw new SkipException("Prefix option has not been plumbed down to Swift");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue