Fix ApiService to use new org.qora.* package names

Also add missing default for blockchain config file to Settings
This commit is contained in:
catbref 2019-01-04 16:00:37 +00:00
parent 5c6e239d76
commit 17f3958ad6
3 changed files with 19 additions and 20 deletions

View File

@ -2,6 +2,5 @@ eclipse.preferences.version=1
encoding//src/main/java=UTF-8 encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8 encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8 encoding//src/test/java=UTF-8
encoding//target/generated-sources/package-info=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8
encoding/src=UTF-8 encoding/src=UTF-8

View File

@ -25,7 +25,7 @@ public class ApiService {
public ApiService() { public ApiService() {
config = new ResourceConfig(); config = new ResourceConfig();
config.packages("api.resource"); config.packages("org.qora.api.resource");
config.register(OpenApiResource.class); config.register(OpenApiResource.class);
config.register(ApiDefinition.class); config.register(ApiDefinition.class);
config.register(AnnotationPostProcessor.class); config.register(AnnotationPostProcessor.class);

View File

@ -27,6 +27,7 @@ public class Settings {
private String userpath = ""; private String userpath = "";
private boolean useBitcoinTestNet = false; private boolean useBitcoinTestNet = false;
private boolean wipeUnconfirmedOnStart = true; private boolean wipeUnconfirmedOnStart = true;
private String blockchainConfigPath = "blockchain.json";
// RPC // RPC
private int rpcPort = 9085; private int rpcPort = 9085;
@ -132,16 +133,16 @@ public class Settings {
// Blockchain config // Blockchain config
if (json.containsKey("wipeUnconfirmedOnStart")) { if (json.containsKey("wipeUnconfirmedOnStart"))
this.wipeUnconfirmedOnStart = (Boolean) getTypedJson(json, "wipeUnconfirmedOnStart", Boolean.class); this.wipeUnconfirmedOnStart = (Boolean) getTypedJson(json, "wipeUnconfirmedOnStart", Boolean.class);
}
if (json.containsKey("blockchainConfig")) { if (json.containsKey("blockchainConfig"))
String filename = (String) json.get("blockchainConfig"); blockchainConfigPath = (String) getTypedJson(json, "blockchainConfig", String.class);
File file = new File(this.userpath + filename);
File file = new File(this.userpath + blockchainConfigPath);
if (!file.exists()) { if (!file.exists()) {
LOGGER.info("Blockchain config file not found: " + this.userpath + filename); LOGGER.info("Blockchain config file not found: " + this.userpath + blockchainConfigPath);
throw new RuntimeException("Unable to read blockchain config file"); throw new RuntimeException("Unable to read blockchain config file");
} }
@ -150,11 +151,10 @@ public class Settings {
JSONObject blockchainJSON = (JSONObject) JSONValue.parse(String.join("\n", lines)); JSONObject blockchainJSON = (JSONObject) JSONValue.parse(String.join("\n", lines));
BlockChain.fromJSON(blockchainJSON); BlockChain.fromJSON(blockchainJSON);
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Unable to parse blockchain config file: " + this.userpath + filename); LOGGER.error("Unable to parse blockchain config file: " + this.userpath + blockchainConfigPath);
throw new RuntimeException("Unable to parse blockchain config file", e); throw new RuntimeException("Unable to parse blockchain config file", e);
} }
} }
}
// Getters / setters // Getters / setters