Adding isReady()
This commit is contained in:
@@ -9,6 +9,7 @@ import javax.crypto.SecretKey;
|
|||||||
import nodash.exceptions.NoDashFatalException;
|
import nodash.exceptions.NoDashFatalException;
|
||||||
|
|
||||||
public abstract class NoConfigBase implements NoConfigInterface {
|
public abstract class NoConfigBase implements NoConfigInterface {
|
||||||
|
protected boolean ready;
|
||||||
protected SecretKey secretKey;
|
protected SecretKey secretKey;
|
||||||
protected boolean saveDatabase;
|
protected boolean saveDatabase;
|
||||||
protected boolean saveByteSets;
|
protected boolean saveByteSets;
|
||||||
@@ -26,6 +27,7 @@ public abstract class NoConfigBase implements NoConfigInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void construct() {
|
public void construct() {
|
||||||
this.generateSecretKey();
|
this.generateSecretKey();
|
||||||
|
this.ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -79,6 +79,12 @@ public final class NoConfigDefault extends NoConfigBase implements Serializable
|
|||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new NoDashFatalException("Given bytestream does not compile into a configuration object.", e);
|
throw new NoDashFatalException("Given bytestream does not compile into a configuration object.", e);
|
||||||
}
|
}
|
||||||
|
this.ready = true;
|
||||||
return noConfig;
|
return noConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReady() {
|
||||||
|
return this.ready;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ public interface NoConfigInterface {
|
|||||||
public boolean saveByteSets();
|
public boolean saveByteSets();
|
||||||
public void saveNoConfig();
|
public void saveNoConfig();
|
||||||
public NoConfigInterface loadNoConfig() throws IOException;
|
public NoConfigInterface loadNoConfig() throws IOException;
|
||||||
|
public boolean isReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,26 @@ public final class NoCore {
|
|||||||
public static NoConfigInterface config;
|
public static NoConfigInterface config;
|
||||||
public static NoHashSphereInterface hashSphere;
|
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) {
|
public static void setup(NoConfigInterface config, NoHashSphereInterface hashSphere) {
|
||||||
NoCore.setup(config);
|
NoCore.setup(config);
|
||||||
NoCore.setup(hashSphere);
|
NoCore.setup(hashSphere);
|
||||||
|
com.sun.org.apache.xml.internal.security.Init.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setup(NoConfigInterface config) {
|
public static void setup(NoConfigInterface config) {
|
||||||
NoCore.config = config;
|
NoCore.config = config;
|
||||||
|
com.sun.org.apache.xml.internal.security.Init.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setup(NoHashSphereInterface hashSphere) {
|
public static void setup(NoHashSphereInterface hashSphere) {
|
||||||
NoCore.hashSphere = hashSphere;
|
NoCore.hashSphere = hashSphere;
|
||||||
hashSphere.setup();
|
hashSphere.setup();
|
||||||
|
com.sun.org.apache.xml.internal.security.Init.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
@@ -65,6 +73,7 @@ public final class NoCore {
|
|||||||
}
|
}
|
||||||
NoCore.setup(newConfig);
|
NoCore.setup(newConfig);
|
||||||
NoCore.setup(new NoHashSphereDefault());
|
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 {
|
public static byte[] login(byte[] data, char[] password) throws NoUserNotValidException, NoUserAlreadyOnlineException, NoSessionExpiredException {
|
||||||
|
|||||||
Reference in New Issue
Block a user