Adding isReady()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ public interface NoConfigInterface {
|
||||
public boolean saveByteSets();
|
||||
public void saveNoConfig();
|
||||
public NoConfigInterface loadNoConfig() throws IOException;
|
||||
public boolean isReady();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user