Use UpdatedSoneProcessor in SoneDownloader
[Sone.git] / src / main / java / net / pterodactylus / sone / core / SoneDownloaderImpl.java
index f3d5068..91bf13b 100644 (file)
@@ -31,7 +31,6 @@ import java.util.logging.Logger;
 
 import javax.inject.Inject;
 
-import net.pterodactylus.sone.core.FreenetInterface.Fetched;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.data.Sone.SoneStatus;
 import net.pterodactylus.util.service.AbstractService;
@@ -46,8 +45,6 @@ import freenet.support.api.Bucket;
 
 /**
  * The Sone downloader is responsible for download Sones as they are updated.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public class SoneDownloaderImpl extends AbstractService implements SoneDownloader {
 
@@ -58,7 +55,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade
        private static final int MAX_PROTOCOL_VERSION = 0;
 
        /** The core. */
-       private final Core core;
+       private final UpdatedSoneProcessor updatedSoneProcessor;
        private final SoneParser soneParser;
 
        /** The Freenet interface. */
@@ -67,19 +64,10 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade
        /** The sones to update. */
        private final Set<Sone> sones = new HashSet<Sone>();
 
-       /**
-        * Creates a new Sone downloader.
-        *
-        * @param core
-        *              The core
-        * @param freenetInterface
-        *              The Freenet interface
-        * @param soneParser
-        */
        @Inject
-       SoneDownloaderImpl(Core core, FreenetInterface freenetInterface, SoneParser soneParser) {
+       SoneDownloaderImpl(UpdatedSoneProcessor updatedSoneProcessor, FreenetInterface freenetInterface, SoneParser soneParser) {
                super("Sone Downloader", false);
-               this.core = core;
+               this.updatedSoneProcessor = updatedSoneProcessor;
                this.freenetInterface = freenetInterface;
                this.soneParser = soneParser;
        }
@@ -173,7 +161,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade
                        if (parsedSone != null) {
                                if (!fetchOnly) {
                                        parsedSone.setStatus((parsedSone.getTime() == 0) ? SoneStatus.unknown : SoneStatus.idle);
-                                       core.updateSone(parsedSone);
+                                       updatedSoneProcessor.updateSone(parsedSone);
                                        addSone(parsedSone);
                                }
                        }