From 921177685a8622866750a3740f94786d88127d95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 29 Jan 2013 06:43:37 +0100 Subject: [PATCH] Move getSones() method to Sone provider interface. --- src/main/java/net/pterodactylus/sone/core/Core.java | 7 +++---- src/main/java/net/pterodactylus/sone/database/SoneProvider.java | 9 +++++++++ src/main/java/net/pterodactylus/sone/web/SearchPage.java | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 4d39c10..de6ba55 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -347,11 +347,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Returns all Sones, remote and local. - * - * @return All Sones + * {@inheritDocs} */ - public Set getSones() { + @Override + public Collection getSones() { synchronized (sones) { return Collections.unmodifiableCollection(sones.values()); } diff --git a/src/main/java/net/pterodactylus/sone/database/SoneProvider.java b/src/main/java/net/pterodactylus/sone/database/SoneProvider.java index bbe0abf..f484aaf 100644 --- a/src/main/java/net/pterodactylus/sone/database/SoneProvider.java +++ b/src/main/java/net/pterodactylus/sone/database/SoneProvider.java @@ -17,6 +17,8 @@ package net.pterodactylus.sone.database; +import java.util.Collection; + import net.pterodactylus.sone.data.Sone; import com.google.common.base.Optional; @@ -38,4 +40,11 @@ public interface SoneProvider { */ public Optional getSone(String soneId); + /** + * Returns all Sones. + * + * @return All Sones + */ + public Collection getSones(); + } diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 320e7cd..01a5ed0 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -131,7 +131,7 @@ public class SearchPage extends SoneTemplatePage { redirectIfNotNull(getImageId(phrase), "imageBrowser.html?image="); } - Set sones = webInterface.getCore().getSones(); + Collection sones = webInterface.getCore().getSones(); Collection> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR); Collection> postHits = hitCache.getUnchecked(phrases); -- 2.7.4