diff --git a/src/nodash/core/NoConfigBase.java b/src/nodash/core/NoConfigBase.java index 1e30424..cfc234f 100644 --- a/src/nodash/core/NoConfigBase.java +++ b/src/nodash/core/NoConfigBase.java @@ -9,6 +9,7 @@ import javax.crypto.SecretKey; import nodash.exceptions.NoDashFatalException; public abstract class NoConfigBase implements NoConfigInterface { + protected boolean ready; protected SecretKey secretKey; protected boolean saveDatabase; protected boolean saveByteSets; @@ -26,6 +27,7 @@ public abstract class NoConfigBase implements NoConfigInterface { @Override public void construct() { this.generateSecretKey(); + this.ready = true; } @Override diff --git a/src/nodash/core/NoConfigDefault.java b/src/nodash/core/NoConfigDefault.java index 8d06c99..09e8f52 100644 --- a/src/nodash/core/NoConfigDefault.java +++ b/src/nodash/core/NoConfigDefault.java @@ -79,6 +79,12 @@ public final class NoConfigDefault extends NoConfigBase implements Serializable } catch (ClassNotFoundException e) { throw new NoDashFatalException("Given bytestream does not compile into a configuration object.", e); } + this.ready = true; return noConfig; } + + @Override + public boolean isReady() { + return this.ready; + } } diff --git a/src/nodash/core/NoConfigInterface.java b/src/nodash/core/NoConfigInterface.java index 82f910b..c6aee6e 100644 --- a/src/nodash/core/NoConfigInterface.java +++ b/src/nodash/core/NoConfigInterface.java @@ -11,4 +11,5 @@ public interface NoConfigInterface { public boolean saveByteSets(); public void saveNoConfig(); public NoConfigInterface loadNoConfig() throws IOException; + public boolean isReady(); } diff --git a/src/nodash/core/NoCore.java b/src/nodash/core/NoCore.java index b9520b8..763f2a6 100644 --- a/src/nodash/core/NoCore.java +++ b/src/nodash/core/NoCore.java @@ -42,18 +42,26 @@ public final class NoCore { public static NoConfigInterface config; public static NoHashSphereInterface hashSphere; + public static boolean isReady() { + return (config != null && config.isReady()) && + (hashSphere != null && hashSphere.isReady()); + } + public static void setup(NoConfigInterface config, NoHashSphereInterface hashSphere) { NoCore.setup(config); NoCore.setup(hashSphere); + com.sun.org.apache.xml.internal.security.Init.init(); } public static void setup(NoConfigInterface config) { NoCore.config = config; + com.sun.org.apache.xml.internal.security.Init.init(); } public static void setup(NoHashSphereInterface hashSphere) { NoCore.hashSphere = hashSphere; hashSphere.setup(); + com.sun.org.apache.xml.internal.security.Init.init(); } public static void setup() { @@ -65,6 +73,7 @@ public final class NoCore { } NoCore.setup(newConfig); NoCore.setup(new NoHashSphereDefault()); + com.sun.org.apache.xml.internal.security.Init.init(); } public static byte[] login(byte[] data, char[] password) throws NoUserNotValidException, NoUserAlreadyOnlineException, NoSessionExpiredException {