use of com.jd.blockchain.tools.initializer.LedgerBindingConfig in project jdchain-core by blockchain-jd-com.
the class LedgerLoadTimer method loadLedgerBindingConfig.
private LedgerBindingConfig loadLedgerBindingConfig() throws Exception {
LedgerBindingConfig ledgerBindingConfig = null;
String ledgerBindConfigFile = PeerServerBooter.ledgerBindConfigFile;
LOGGER.debug("--- Load " + LEDGER_BIND_CONFIG_NAME + " path = {}", ledgerBindConfigFile == null ? "Default" : ledgerBindConfigFile);
if (ledgerBindConfigFile == null) {
ClassPathResource configResource = new ClassPathResource(LEDGER_BIND_CONFIG_NAME);
if (configResource.exists()) {
try (InputStream in = configResource.getInputStream()) {
ledgerBindingConfig = LedgerBindingConfig.resolve(in);
} catch (LedgerBindingConfigException e) {
LOGGER.debug("Load ledgerBindConfigFile content is empty !!!");
}
}
} else {
File file = new File(ledgerBindConfigFile);
if (file.exists()) {
try {
ledgerBindingConfig = LedgerBindingConfig.resolve(file);
} catch (LedgerBindingConfigException e) {
LOGGER.debug("Load ledgerBindConfigFile content is empty !!!");
}
}
}
return ledgerBindingConfig;
}
Aggregations