From 345e56695de17267f7d74adaa82c34d61b66dd82 Mon Sep 17 00:00:00 2001 From: jamurty Date: Fri, 29 May 2009 16:50:20 +0000 Subject: [PATCH] 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 --- .../java/org/jclouds/aws/s3/domain/S3Bucket.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aws/s3/core/src/main/java/org/jclouds/aws/s3/domain/S3Bucket.java b/aws/s3/core/src/main/java/org/jclouds/aws/s3/domain/S3Bucket.java index 333542abae..574cef26be 100644 --- a/aws/s3/core/src/main/java/org/jclouds/aws/s3/domain/S3Bucket.java +++ b/aws/s3/core/src/main/java/org/jclouds/aws/s3/domain/S3Bucket.java @@ -26,8 +26,9 @@ package org.jclouds.aws.s3.domain; import static com.google.common.base.Preconditions.checkNotNull; import org.joda.time.DateTime; -import java.util.HashSet; import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; /** * 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"); - private Set objects = new HashSet(); - private Set commonPrefixes = new HashSet(); + private SortedSet objects = new TreeSet(); + private SortedSet commonPrefixes = new TreeSet(); private String prefix; private String marker; private String delimiter; @@ -230,11 +231,11 @@ public class S3Bucket { /** * @see org.jclouds.aws.s3.S3Connection#listBucket(String) */ - public Set getContents() { + public SortedSet getContents() { return objects; } - public void setContents(Set objects) { + public void setContents(SortedSet objects) { this.objects = objects; } @@ -253,7 +254,7 @@ public class S3Bucket { return metadata; } - public void setCommonPrefixes(Set commonPrefixes) { + public void setCommonPrefixes(SortedSet commonPrefixes) { this.commonPrefixes = commonPrefixes; } @@ -272,7 +273,7 @@ public class S3Bucket { * * @see org.jclouds.aws.s3.commands.options.ListBucketOptions#getPrefix() */ - public Set getCommonPrefixes() { + public SortedSet getCommonPrefixes() { return commonPrefixes; }