From 30c90b123c036e5eca2bc3fdb06efa4f23fbf5f7 Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 21 Dec 2014 00:31:08 +0200 Subject: [PATCH] Changed NoHashSphere to NoHashSphereInterface, allow for default constructor with setup() or to feed new NHSI. --- src/nodash/core/NoCore.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/nodash/core/NoCore.java b/src/nodash/core/NoCore.java index 7244056..c5ed510 100644 --- a/src/nodash/core/NoCore.java +++ b/src/nodash/core/NoCore.java @@ -23,7 +23,8 @@ import java.io.File; import java.security.PublicKey; import nodash.core.spheres.NoByteSetSphere; -import nodash.core.spheres.NoHashSphere; +import nodash.core.spheres.NoHashSphereDefault; +import nodash.core.spheres.NoHashSphereInterface; import nodash.core.spheres.NoSessionSphere; import nodash.exceptions.NoDashSessionBadUUIDException; import nodash.exceptions.NoSessionAlreadyAwaitingConfirmationException; @@ -39,8 +40,9 @@ import nodash.models.NoSession.NoState; public final class NoCore { public static NoConfig config; + private static NoHashSphereInterface hashSphere; - public static void setup() { + public static void setup(NoHashSphereInterface hashSphere) { File configFile = new File(NoConfig.CONFIG_FILENAME); if (configFile.exists()) { config = NoConfig.getNoConfigFromFile(configFile); @@ -48,8 +50,12 @@ public final class NoCore { config = new NoConfig(); config.saveNoConfigToFile(configFile); } - - NoHashSphere.setup(); + NoCore.hashSphere = hashSphere; + hashSphere.setup(); + } + + public static void setup() { + NoCore.setup(new NoHashSphereDefault()); } public static byte[] login(byte[] data, char[] password) throws NoUserNotValidException, NoUserAlreadyOnlineException, NoSessionExpiredException {