Ensure a bucket always retains the ordering of its object and common-prefixes items

git-svn-id: http://jclouds.googlecode.com/svn/trunk@872 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
jamurty 2009-05-29 16:50:20 +00:00
parent 60018ae8c8
commit 345e56695d
1 changed files with 8 additions and 7 deletions

View File

@ -26,8 +26,9 @@ package org.jclouds.aws.s3.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
/** /**
* A container that provides namespace, access control and aggregation of * A container that provides namespace, access control and aggregation of
@ -205,8 +206,8 @@ public class S3Bucket {
public static final S3Bucket NOT_FOUND = new S3Bucket("NOT_FOUND"); public static final S3Bucket NOT_FOUND = new S3Bucket("NOT_FOUND");
private Set<S3Object.Metadata> objects = new HashSet<S3Object.Metadata>(); private SortedSet<S3Object.Metadata> objects = new TreeSet<S3Object.Metadata>();
private Set<String> commonPrefixes = new HashSet<String>(); private SortedSet<String> commonPrefixes = new TreeSet<String>();
private String prefix; private String prefix;
private String marker; private String marker;
private String delimiter; private String delimiter;
@ -230,11 +231,11 @@ public class S3Bucket {
/** /**
* @see org.jclouds.aws.s3.S3Connection#listBucket(String) * @see org.jclouds.aws.s3.S3Connection#listBucket(String)
*/ */
public Set<S3Object.Metadata> getContents() { public SortedSet<S3Object.Metadata> getContents() {
return objects; return objects;
} }
public void setContents(Set<S3Object.Metadata> objects) { public void setContents(SortedSet<S3Object.Metadata> objects) {
this.objects = objects; this.objects = objects;
} }
@ -253,7 +254,7 @@ public class S3Bucket {
return metadata; return metadata;
} }
public void setCommonPrefixes(Set<String> commonPrefixes) { public void setCommonPrefixes(SortedSet<String> commonPrefixes) {
this.commonPrefixes = commonPrefixes; this.commonPrefixes = commonPrefixes;
} }
@ -272,7 +273,7 @@ public class S3Bucket {
* *
* @see org.jclouds.aws.s3.commands.options.ListBucketOptions#getPrefix() * @see org.jclouds.aws.s3.commands.options.ListBucketOptions#getPrefix()
*/ */
public Set<String> getCommonPrefixes() { public SortedSet<String> getCommonPrefixes() {
return commonPrefixes; return commonPrefixes;
} }