X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FFreenetInterface.java;h=0fb34b54b98a9abd7accfb177ee7d13445ac173c;hp=946371bcf3b3c6a91e4c43823fad254dadaeb1a0;hb=62573c314957b1851f4fbe693b8746686caa940a;hpb=0347cedd3f539e8b56df12ecf5937a978ecc597d
diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
index 946371b..0fb34b5 100644
--- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
+++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
@@ -32,6 +32,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
+import javax.inject.Inject;
import net.pterodactylus.sone.core.event.ImageInsertAbortedEvent;
import net.pterodactylus.sone.core.event.ImageInsertFailedEvent;
@@ -43,7 +44,6 @@ import net.pterodactylus.sone.data.TemporaryImage;
import com.google.common.base.Function;
import com.google.common.eventbus.EventBus;
-import com.google.inject.Inject;
import com.google.inject.Singleton;
import freenet.client.ClientMetadata;
@@ -78,8 +78,6 @@ import freenet.support.io.ResumeFailedException;
/**
* Contains all necessary functionality for interacting with the Freenet node.
- *
- * @author David âBombeâ Roden
*/
@Singleton
public class FreenetInterface {
@@ -355,59 +353,7 @@ public class FreenetInterface {
}
/**
- * Container for a fetched URI and the {@link FetchResult}.
- *
- * @author David Roden
- */
- public static class Fetched {
-
- /** The fetched URI. */
- private final FreenetURI freenetUri;
-
- /** The fetch result. */
- private final FetchResult fetchResult;
-
- /**
- * Creates a new fetched URI.
- *
- * @param freenetUri
- * The URI that was fetched
- * @param fetchResult
- * The fetch result
- */
- public Fetched(FreenetURI freenetUri, FetchResult fetchResult) {
- this.freenetUri = freenetUri;
- this.fetchResult = fetchResult;
- }
-
- //
- // ACCESSORS
- //
-
- /**
- * Returns the fetched URI.
- *
- * @return The fetched URI
- */
- public FreenetURI getFreenetUri() {
- return freenetUri;
- }
-
- /**
- * Returns the fetch result.
- *
- * @return The fetch result
- */
- public FetchResult getFetchResult() {
- return fetchResult;
- }
-
- }
-
- /**
* Callback for USK watcher events.
- *
- * @author David âBombeâ Roden
*/
public static interface Callback {
@@ -435,7 +381,6 @@ public class FreenetInterface {
* @see ImageInsertStartedEvent
* @see ImageInsertFailedEvent
* @see ImageInsertFinishedEvent
- * @author David âBombeâ Roden
*/
public class InsertToken implements ClientPutCallback {
@@ -558,11 +503,18 @@ public class FreenetInterface {
}
- public class InsertTokenSupplier implements Function {
+ public static class InsertTokenSupplier implements Function {
+
+ private final FreenetInterface freenetInterface;
+
+ @Inject
+ public InsertTokenSupplier(FreenetInterface freenetInterface) {
+ this.freenetInterface = freenetInterface;
+ }
@Override
public InsertToken apply(Image image) {
- return new InsertToken(image);
+ return freenetInterface.new InsertToken(image);
}
}