Search in sources :

Example 6 with LedgerBindingConfig

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;
}
Also used : InputStream(java.io.InputStream) LedgerBindingConfigException(com.jd.blockchain.tools.initializer.web.LedgerBindingConfigException) LedgerBindingConfig(com.jd.blockchain.tools.initializer.LedgerBindingConfig) File(java.io.File) ClassPathResource(org.springframework.core.io.ClassPathResource)

Aggregations

LedgerBindingConfig (com.jd.blockchain.tools.initializer.LedgerBindingConfig)6 LedgerBindingConfigException (com.jd.blockchain.tools.initializer.web.LedgerBindingConfigException)3 InputStream (java.io.InputStream)3 ClassPathResource (org.springframework.core.io.ClassPathResource)3 HashDigest (com.jd.blockchain.crypto.HashDigest)2 File (java.io.File)2 DataContractRegistry (com.jd.binaryproto.DataContractRegistry)1 ClientCredential (com.jd.blockchain.consensus.ClientCredential)1 ClientIncomingSettings (com.jd.blockchain.consensus.ClientIncomingSettings)1 ConsensusViewSettings (com.jd.blockchain.consensus.ConsensusViewSettings)1 NodeNetworkAddress (com.jd.blockchain.consensus.NodeNetworkAddress)1 NodeNetworkAddresses (com.jd.blockchain.consensus.NodeNetworkAddresses)1 NodeSettings (com.jd.blockchain.consensus.NodeSettings)1 ActionRequest (com.jd.blockchain.consensus.action.ActionRequest)1 ActionResponse (com.jd.blockchain.consensus.action.ActionResponse)1 BftsmartClientIncomingSettings (com.jd.blockchain.consensus.bftsmart.BftsmartClientIncomingSettings)1 BftsmartConsensusViewSettings (com.jd.blockchain.consensus.bftsmart.BftsmartConsensusViewSettings)1 BftsmartNodeSettings (com.jd.blockchain.consensus.bftsmart.BftsmartNodeSettings)1 MsgQueueBlockSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueBlockSettings)1 MsgQueueClientIncomingSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueClientIncomingSettings)1