diff --git a/libs/DOIPSDK-1.0.2-SNAPSHOT.jar b/libs/DOIPSDK-1.0.2-SNAPSHOT.jar new file mode 100644 index 0000000..5b17eda Binary files /dev/null and b/libs/DOIPSDK-1.0.2-SNAPSHOT.jar differ diff --git a/src/main/java/org/bdware/sc/ChainOpener.java b/src/main/java/org/bdware/sc/ChainOpener.java index 9e8c427..9a9ab5b 100644 --- a/src/main/java/org/bdware/sc/ChainOpener.java +++ b/src/main/java/org/bdware/sc/ChainOpener.java @@ -4,6 +4,9 @@ import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.conn.OnHashCallback; public interface ChainOpener { + void reRegister(String doid); + String register(String arg); + void writeContractResultToLocalAndLedger( String result, ContractClient client, diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 413016e..7f03415 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -7,9 +7,6 @@ import io.prometheus.client.Counter; import org.apache.commons.codec.digest.DigestUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.bdware.doip.core.model.handleRecord.DoHandleRecord; -import org.bdware.doip.core.utils.GlobalConfigurations; -import org.bdware.doip.endpoint.irpClient.GlobalIrpClient; import org.bdware.sc.ContractResult.Status; import org.bdware.sc.bean.*; import org.bdware.sc.conn.OnHashCallback; @@ -77,7 +74,7 @@ public class ContractManager { public static ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(10); - public static DoipServiceInfoConfigurer doipConfigurer; + public static int logStage = 0; public static Sigar sigar = null; // 获取network等资源什么 @@ -459,6 +456,7 @@ public class ContractManager { } public ContractClient getContractClientByDoi(String doi) { + ContractMeta meta = statusRecorder.getContractMeta(doi); return statusRecorder.getContractClient(meta.id); } @@ -1033,26 +1031,11 @@ public class ContractManager { if (cm != null && cm.doi != null) { if (!cm.doi.equals("") && !cm.doi.equals("null") - && c.getType() == ContractExecType.Sole) { + && c.getType() == ContractExecType.Sole && chainOpener != null) { c.setDOI(cm.doi); - c.setBuildTime(cm.buildTime); c.setDoipFlag(true); - - DoHandleRecord dohr = - new DoHandleRecord( - GlobalConfigurations.User_Handle, - GlobalConfigurations.DoipServiceID); - dohr.handle = cm.doi; - - threadPool.execute( - () -> { - try { - GlobalIrpClient.getGlobalClient().reRegister(dohr); - } catch (Exception e) { - LOGGER.warn("unable to connect LHS: " + e.getMessage()); - } - }); + chainOpener.reRegister(cm.doi); } } } else { diff --git a/src/main/java/org/bdware/sc/DoipServiceInfoConfigurer.java b/src/main/java/org/bdware/sc/DoipServiceInfoConfigurer.java deleted file mode 100644 index 44754b8..0000000 --- a/src/main/java/org/bdware/sc/DoipServiceInfoConfigurer.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.bdware.sc; - -import org.bdware.doip.application.DoipServiceConfig; -import org.bdware.doip.endpoint.doipServer.DoipServiceInfo; - -public interface DoipServiceInfoConfigurer { - String getServiceHandle(); - - String resetServiceConfig(String configJson); - - DoipServiceConfig getDoipServiceConfig(); - - DoipServiceInfo getDoipServiceInfo(); -}