/*
- * Sone - SoneDownloaderImpl.java - Copyright © 2010–2016 David Roden
+ * Sone - SoneDownloaderImpl.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
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. */
private final FreenetInterface freenetInterface;
/** The sones to update. */
- private final Set<Sone> sones = new HashSet<Sone>();
+ private final Set<Sone> sones = new HashSet<>();
- /**
- * 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;
}
if (parsedSone != null) {
if (!fetchOnly) {
parsedSone.setStatus((parsedSone.getTime() == 0) ? SoneStatus.unknown : SoneStatus.idle);
- core.updateSone(parsedSone);
+ updatedSoneProcessor.updateSone(parsedSone);
addSone(parsedSone);
}
}
Sone parsedSone = soneParser.parseSone(originalSone,
soneInputStream);
if (parsedSone != null) {
+ logger.log(Level.FINER, "Sone %s was successfully parsed.", parsedSone);
parsedSone.setLatestEdition(requestUri.getEdition());
}
return parsedSone;