From 90bd381e91c873af5956da9e5f0cfa2b29675633 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 11 Oct 2007 21:00:12 +0000 Subject: Support sorting of arrays. --- .../java/com/amazon/carbonado/repo/indexed/ManagedIndex.java | 2 +- .../carbonado/repo/replicated/ReplicatedRepository.java | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo') diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java index 73469db..2d7f983 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/ManagedIndex.java @@ -287,7 +287,7 @@ class ManagedIndex implements IndexEntryAccessor { buffer.close(); throw new UniqueConstraintException ("Cannot build unique index because duplicates exist: " - + this); + + this + ", " + last + " == " + obj); } } last = obj; diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java index 2c73200..b28fab5 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java @@ -24,8 +24,6 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.cojen.util.BeanComparator; - import com.amazon.carbonado.CorruptEncodingException; import com.amazon.carbonado.Cursor; import com.amazon.carbonado.FetchException; @@ -49,6 +47,8 @@ import com.amazon.carbonado.capability.ResyncCapability; import com.amazon.carbonado.capability.ShutdownCapability; import com.amazon.carbonado.capability.StorableInfoCapability; +import com.amazon.carbonado.cursor.SortedCursor; + import com.amazon.carbonado.info.Direction; import com.amazon.carbonado.info.StorableInfo; import com.amazon.carbonado.info.StorableIntrospector; @@ -389,11 +389,7 @@ class ReplicatedRepository } } - BeanComparator bc = BeanComparator.forClass(type); - for (String order : orderBy) { - bc = bc.orderBy(order); - bc = bc.caseSensitive(); - } + Comparator comparator = SortedCursor.createComparator(type, orderBy); replicaQuery = replicaQuery.orderBy(orderBy); masterQuery = masterQuery.orderBy(orderBy); @@ -417,7 +413,7 @@ class ReplicatedRepository replicaStorage, replicaQuery, masterStorage, masterQuery, throttle, desiredSpeed, - bc, replicaTxn); + comparator, replicaTxn); replicaTxn.commit(); } finally { -- cgit v1.2.3