Browse Source

1、Fixed get consensus file error !

tags/1.0.0
shaozhuguang 6 years ago
parent
commit
4edfe964ec
6 changed files with 2118 additions and 6 deletions
  1. +2
    -2
      source/contract/contract-jvm/src/main/java/com/jd/blockchain/contract/jvm/JavaContractCode.java
  2. +2
    -1
      source/deployment/deployment-gateway/src/main/resources/config/gateway.conf
  3. +2083
    -0
      source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.4.MD
  4. +1
    -1
      source/deployment/deployment-peer/src/main/resources/config/init/ledger.init
  5. +7
    -2
      source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java
  6. +23
    -0
      source/utils/utils-common/src/main/java/com/jd/blockchain/utils/io/FileUtils.java

+ 2
- 2
source/contract/contract-jvm/src/main/java/com/jd/blockchain/contract/jvm/JavaContractCode.java View File

@@ -68,7 +68,7 @@ public class JavaContractCode extends AbstractContractCode {
@Override
public BytesValue processEvent(ContractEventContext eventContext) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Start processing event[%s] of contract[%s]...", eventContext.getEvent(), address.toString());
LOGGER.debug("Start processing event{} of contract{}...", eventContext.getEvent(), address.toString());
}
try {
return codeModule.call(new ContractExecution(eventContext));
@@ -78,7 +78,7 @@ public class JavaContractCode extends AbstractContractCode {
throw ex;
} finally {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("End processing event[%s] of contract[%s]. ", eventContext.getEvent(), address.toString());
LOGGER.debug("End processing event{} of contract{}. ", eventContext.getEvent(), address.toString());
}
}
}


+ 2
- 1
source/deployment/deployment-gateway/src/main/resources/config/gateway.conf View File

@@ -1,4 +1,4 @@
#网关的HTTP服务地址;
#网关的HTTP服务地址,建议直接使用0.0.0.0
http.host=0.0.0.0
#网关的HTTP服务端口;
http.port=8081
@@ -18,6 +18,7 @@ peer.providers=com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider

#数据检索服务对应URL,格式:http://{ip}:{port},例如:http://127.0.0.1:10001
#若该值不配置或配置不正确,则浏览器模糊查询部分无法正常显示
#数据检索服务模块(Argus)需单独部署,若不部署其他功能仍可正常使用
data.retrieval.url=http://127.0.0.1:10001

#默认公钥的内容(Base58编码数据);


+ 2083
- 0
source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.4.MD
File diff suppressed because it is too large
View File


+ 1
- 1
source/deployment/deployment-peer/src/main/resources/config/init/ledger.init View File

@@ -10,7 +10,7 @@ created-time=2019-08-01 14:26:58.069+0800
#共识服务提供者;必须;
consensus.service-provider=com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider

#共识服务的参数配置;必须;
#共识服务的参数配置;推荐使用绝对路径;必须;
consensus.conf=classpath:bftsmart.config

#密码服务提供者列表,以英文逗点“,”分隔;必须;


+ 7
- 2
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java View File

@@ -141,7 +141,8 @@ public class LedgerInitProperties {

public static LedgerInitProperties resolve(String initSettingFile) {
Properties props = FileUtils.readProperties(initSettingFile, "UTF-8");
return resolve(props);
File realFile = new File(initSettingFile);
return resolve(realFile.getParentFile().getPath(), props);
}

public static LedgerInitProperties resolve(InputStream in) {
@@ -150,6 +151,10 @@ public class LedgerInitProperties {
}

public static LedgerInitProperties resolve(Properties props) {
return resolve(null, props);
}

public static LedgerInitProperties resolve(String dir, Properties props) {
String hexLedgerSeed = PropertiesUtils.getRequiredProperty(props, LEDGER_SEED).replace("-", "");
byte[] ledgerSeed = HexUtils.decode(hexLedgerSeed);
LedgerInitProperties initProps = new LedgerInitProperties(ledgerSeed);
@@ -166,7 +171,7 @@ public class LedgerInitProperties {
initProps.consensusProvider = PropertiesUtils.getRequiredProperty(props, CONSENSUS_SERVICE_PROVIDER);
String consensusConfigFilePath = PropertiesUtils.getRequiredProperty(props, CONSENSUS_CONFIG);
try {
File consensusConfigFile = ResourceUtils.getFile(consensusConfigFilePath);
File consensusConfigFile = FileUtils.getFile(dir, consensusConfigFilePath);
initProps.consensusConfig = FileUtils.readProperties(consensusConfigFile);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException(


+ 23
- 0
source/utils/utils-common/src/main/java/com/jd/blockchain/utils/io/FileUtils.java View File

@@ -16,6 +16,7 @@ import java.io.Reader;
import java.util.ArrayList;
import java.util.Properties;

import com.jd.blockchain.utils.PathUtils;
import org.springframework.util.ResourceUtils;

/**
@@ -482,4 +483,26 @@ public class FileUtils {
}
return path.delete();
}

/**
* 获取指定路径和位置的文件信息
*
* @param dir
* 指定路径,不要以"/"结尾
* @param resourceLocation
* 文件位置信息,可支持绝对路径、相对路径(相对dir)、classpath:前缀
* @return
*
* @throws FileNotFoundException
*/
public static File getFile(String dir, String resourceLocation) throws FileNotFoundException {
if (resourceLocation.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
return ResourceUtils.getFile(resourceLocation);
}
if (resourceLocation.startsWith(PathUtils.PATH_SEPERATOR)) {
return new File(resourceLocation);
}
String totalPath = PathUtils.concatPaths(dir, resourceLocation);
return new File(totalPath);
}
}

Loading…
Cancel
Save