gaul requested changes on this pull request.
> @@ -253,16 +255,52 @@ public void clearContainer(final String container) {
@Override
public void clearContainer(String container, ListContainerOptions options) {
filesystemContainerNameValidator.validate(container);
+ if (options.getDir() != null && options.getPrefix() != null) {
+ Throwables.propagate(new IOException("Cannot use both dir and prefix
at the same time."));
This will read better as `Preconditions.checkArgument`.
> @@ -254,15 +256,48 @@ public void clearContainer(final String container) {
public void clearContainer(String container, ListContainerOptions options) {
filesystemContainerNameValidator.validate(container);
// TODO: these require calling removeDirectoriesTreeOfBlobKey
- checkArgument(options.getDir() == null && options.getPrefix() == null,
"cannot specify directory or prefix");
+ String optsPrefix;
+ // TODO: Pick whichever one is not null? Not sure what to do until
inDirectory is deprecated.
Need to remove the stale TODO.
> + // should also get deleted
+ delete(object);
+ }
+ else if (object.isDirectory() & (optsPrefix.endsWith(File.separator)
| isNullOrEmpty(optsPrefix))) {
+ // S3 blobstores will only match prefixes that end with a trailing
slash/file separator
+ // For insance, if we have a blob at /path/1/2/a, a prefix of
/path/1/2 will not list /path/1/2/a
+ // but a prefix of /path/1/2/ will
+ File containerFile = openFolder(container + File.separator +
normalizedOptsPath);
+ File[] children = containerFile.listFiles();
+ if (null != children) {
+ for (File child : children) {
+ if (options.isRecursive()) {
+ Utils.deleteRecursively(child);
+ } else {
+ if (child.isFile()) {
+ Utils.delete(child);
I guess this is the best we can do.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1258#pullrequestreview-189471713