X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=eb517fc26eb9334fd1091ce1baaf37c1f4da110c;hb=314be56fa3e4ac53dac18ae0282439559209f4b3;hp=8570e9a3f4beea12bfa77fc445004343e00d2dc5;hpb=23beb35ac87fdb97382a59d5365dd83a5258897b;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 8570e9a..eb517fc 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -135,7 +135,6 @@ public class Core extends AbstractService { public Sone getSone(String soneId) { if (!soneCache.containsKey(soneId)) { Sone sone = new Sone(soneId); - soneDownloader.addSone(sone); soneCache.put(soneId, sone); } return soneCache.get(soneId); @@ -210,6 +209,17 @@ public class Core extends AbstractService { // /** + * Adds a Sone to watch for updates. The Sone needs to be completely + * initialized. + * + * @param sone + * The Sone to watch for updates + */ + public void addSone(Sone sone) { + soneDownloader.addSone(sone); + } + + /** * Adds the given Sone. * * @param sone @@ -219,7 +229,6 @@ public class Core extends AbstractService { if (localSones.add(sone)) { SoneInserter soneInserter = new SoneInserter(freenetInterface, sone); soneInserter.start(); - soneDownloader.removeSone(sone); soneInserters.put(sone, soneInserter); } } @@ -291,6 +300,7 @@ public class Core extends AbstractService { public void loadSone(String requestUri) { try { FetchResult fetchResult = freenetInterface.fetchUri(new FreenetURI(requestUri).setMetaString(new String[] { "sone.xml" })); + soneDownloader.parseSone(null, fetchResult); } catch (MalformedURLException mue1) { logger.log(Level.INFO, "Could not create URI from “" + requestUri + "”.", mue1); }