From ca0d9d2f705bc8304f4bcd1fea1f38dec3f661e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 12 Oct 2010 14:10:46 +0200 Subject: [PATCH] Set Freenet interface in core. --- src/main/java/net/pterodactylus/sone/core/Core.java | 15 +++++++++++++++ src/main/java/net/pterodactylus/sone/main/SonePlugin.java | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 84e813e..f56c1ce 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -46,6 +46,9 @@ public class Core extends AbstractService { /** The configuration. */ private Configuration configuration; + /** Interface to freenet. */ + private FreenetInterface freenetInterface; + /** The local Sones. */ private final Set localSones = new HashSet(); @@ -72,6 +75,18 @@ public class Core extends AbstractService { return this; } + /** + * Sets the Freenet interface to use. + * + * @param freenetInterface + * The Freenet interface to use + * @return This core (for method chaining) + */ + public Core freenetInterface(FreenetInterface freenetInterface) { + this.freenetInterface = freenetInterface; + return this; + } + // // ACTIONS // diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index be4f1fb..f1cda58 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -23,6 +23,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.sone.core.Core; +import net.pterodactylus.sone.core.FreenetInterface; import net.pterodactylus.sone.freenet.PluginStoreConfigurationBackend; import net.pterodactylus.util.config.Configuration; import net.pterodactylus.util.config.ConfigurationException; @@ -76,9 +77,13 @@ public class SonePlugin implements FredPlugin { } } + /* create freenet interface. */ + FreenetInterface freenetInterface = new FreenetInterface(pluginRespirator.getNode()); + /* create core. */ core = new Core(); core.configuration(configuration); + core.freenetInterface(freenetInterface); /* start core! */ core.start(); -- 2.7.4