X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=9ccaa799868f05189150c5162fab46c01dcd9d9f;hp=b2188e0c1d89a1d3e88b4fd6f93dd9a0fc85b81b;hb=10fa1478fef15624a873c0878ed017603742bcfe;hpb=ebc0b716ae43fa19036497517d55d431a4765f70 diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index b2188e0..9ccaa79 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -347,12 +347,13 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Returns all Sones, remote and local. - * - * @return All Sones + * {@inheritDocs} */ - public Set getSones() { - return new HashSet(sones.values()); + @Override + public Collection getSones() { + synchronized (sones) { + return Collections.unmodifiableCollection(sones.values()); + } } /** @@ -372,24 +373,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Checks whether the core knows a Sone with the given ID. - * - * @param id - * The ID of the Sone - * @return {@code true} if there is a Sone with the given ID, {@code false} - * otherwise - */ - public boolean hasSone(String id) { - synchronized (sones) { - return sones.containsKey(id); - } - } - - /** - * Returns all local Sones. - * - * @return All local Sones + * {@inheritDocs} */ + @Override public Collection getLocalSones() { synchronized (sones) { return Collections2.filter(sones.values(), new Predicate() { @@ -428,10 +414,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Returns all remote Sones. - * - * @return All remote Sones + * {@inheritDocs} */ + @Override public Collection getRemoteSones() { synchronized (sones) { return Collections2.filter(sones.values(), new Predicate() { @@ -527,6 +512,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** + * {@inheritDocs} + */ + @Override + public Collection getPosts(String soneId) { + return postDatabase.getPosts(soneId); + } + + /** * {@inheritDoc} */ @Override @@ -1106,6 +1099,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } } synchronized (sones) { + sone.setOptions(storedSone.get().getOptions()); sones.put(sone.getId(), sone); } }