diff options
Diffstat (limited to 'archiva-modules/archiva-web')
2 files changed, 37 insertions, 3 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/CacheEntry.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/CacheEntry.java index 69ebd13af..2f920d9d3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/CacheEntry.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/CacheEntry.java @@ -25,9 +25,9 @@ import java.io.Serializable; * @author Olivier Lamy * @since 1.4-M3 */ -@XmlRootElement( name = "cacheEntry" ) +@XmlRootElement(name = "cacheEntry") public class CacheEntry - implements Serializable + implements Serializable, Comparable { private String key; @@ -108,7 +108,6 @@ public class CacheEntry } /** - * * @return cache size in kb */ public long getInMemorySize() @@ -121,6 +120,39 @@ public class CacheEntry this.inMemorySize = inMemorySize; } + public int compareTo( Object o ) + { + return this.key.compareTo( ( (CacheEntry) o ).key ); + } + + @Override + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + if ( o == null || getClass() != o.getClass() ) + { + return false; + } + + CacheEntry that = (CacheEntry) o; + + if ( !key.equals( that.key ) ) + { + return false; + } + + return true; + } + + @Override + public int hashCode() + { + return key.hashCode(); + } + @Override public String toString() { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java index b258cf954..a2cb8e2f5 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java @@ -134,6 +134,8 @@ public class DefaultSystemStatusService cacheStatistics.getInMemorySize() ) ); } + Collections.sort( cacheEntries ); + return cacheEntries; } |