From 841f567a883c4aa32cfd93f027998f45b598e5a3 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Fri, 31 Mar 2023 17:11:40 +0800 Subject: [PATCH] prune old doi logic --- build.gradle | 6 +++--- .../java/org/bdware/sc/ContractProcess.java | 21 +------------------ .../bdware/sc/boundry/JavaScriptEntry.java | 4 ---- .../bdware/sc/boundry/utils/AsyncUtil.java | 1 - 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index f26d2f8..48af4d3 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'org.bdware.bdcontract:sdk-java:1.0.2' - implementation 'org.bdware.doip:doip-audit-tool:1.1.9' + implementation 'org.bdware.doip:doip-audit-tool:1.2.0' implementation 'org.bdware.doip:doip-sdk:1.3.8' implementation fileTree(dir: 'lib', include: '*.jar') testImplementation 'junit:junit:4.13.2' @@ -67,8 +67,8 @@ jar { // uncomment this when publish, // while develop at local use "false" configurations.runtimeClasspath.filter { - it.getAbsolutePath().contains("/lib/") - // false + //it.getAbsolutePath().contains("/lib/") + false }.collect { it.isDirectory() ? it : zipTree(it) } diff --git a/src/main/java/org/bdware/sc/ContractProcess.java b/src/main/java/org/bdware/sc/ContractProcess.java index a3bcfe9..650f2f5 100644 --- a/src/main/java/org/bdware/sc/ContractProcess.java +++ b/src/main/java/org/bdware/sc/ContractProcess.java @@ -718,11 +718,6 @@ public class ContractProcess { onStartingDoipServer.setArg(arg); LOGGER.debug("invoke onStartingDoipServer, param:" + onStartingDoipServer.getArg().toString()); onStartingDoipServer.setRequester(contract.getOwner()); - if (contract.getDoipFlag() && null != contract.getDOI() && !contract.getDOI().isEmpty()) { - onStartingDoipServer.setRequesterDOI(contract.getDOI()); - } else { - onStartingDoipServer.setRequesterDOI("empty"); - } FunctionNode funNode = cn.getFunction("onServerStart"); try { @@ -735,6 +730,7 @@ public class ContractProcess { LOGGER.info("Fetch the onStartingDoipServerRes from router successfully, the result is " + onStartingDoipServerRes); int doipListenPort = DoipClusterServer.startDoipServer(startPort); returnValue.addProperty("doipListenPort", doipListenPort); + this.contract.setDoipPort(doipListenPort); returnValue.addProperty("doipStartPort", startPort); } catch (Exception e) { LOGGER.error("DoipLocalSingleton cannot starts properly, plz check the onServerStart function"); @@ -800,9 +796,6 @@ public class ContractProcess { } JavaScriptEntry.setSM2KeyPair(contract.getPublicKey(), contract.getKey()); - if (null != contract.getDOI() && !contract.getDOI().isEmpty()) { - JavaScriptEntry.doi = contract.getDOI(); - } if (null != contract.getAuthInfoPersistDOI() && !contract.getAuthInfoPersistDOI().isEmpty()) { JavaScriptEntry.authInfoPersistDOI = contract.getAuthInfoPersistDOI(); @@ -819,11 +812,6 @@ public class ContractProcess { onCreate.setArg(arg); LOGGER.debug("invoke onCreate, param:" + onCreate.getArg().toString()); onCreate.setRequester(contract.getOwner()); - if (contract.getDoipFlag() && null != contract.getDOI() && !contract.getDOI().isEmpty()) { - onCreate.setRequesterDOI(contract.getDOI()); - } else { - onCreate.setRequesterDOI("empty"); - } FunctionNode funNode = cn.getFunction("onCreate"); return invoke(onCreate, funNode); } @@ -841,13 +829,6 @@ public class ContractProcess { else onRecover.setArg(arg); onRecover.setRequester(contract.getOwner()); - if (contract.getDoipFlag() - && (contract.getDOI() != null) - && (contract.getDOI().length() > 0)) { - onRecover.setRequesterDOI(contract.getDOI()); - } else { - onRecover.setRequesterDOI("empty"); - } FunctionNode funNode = cn.getFunction("onRecover"); return invoke(onRecover, funNode); } diff --git a/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java b/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java index a3f5159..1b7184a 100644 --- a/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java +++ b/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java @@ -52,7 +52,6 @@ public class JavaScriptEntry { // public static int contractManagerPort; public static Random random; public static long invokeID; - public static String doi; public static String authInfoPersistDOI; public static SocketGet get; // public static CloseableHttpClient httpClient = getHttpClient(); public static int numOfCopies; @@ -180,7 +179,6 @@ public class JavaScriptEntry { if (!app.verifySignature()) { return "{\"status\":\"Exception\",\"data\":\"invalid signature\"}"; } - app.setRequesterDOI(doi); app.setFromDebug(isDebug); if (numOfCopies > 1) { // The caller is special. @@ -237,7 +235,6 @@ public class JavaScriptEntry { ContractRequest app = new ContractRequest(); app.setContractID(contractID).setAction(action).setArg(JSONTool.convertMirrorToJson(arg)); app.doSignature(keyPair); - app.setRequesterDOI(doi); app.setFromDebug(isDebug); ContractExecType type = ContractProcess.instance.getContract().getType(); if (type.needSeq()) { @@ -323,7 +320,6 @@ public class JavaScriptEntry { app.setContractID(contractID).setAction(action).setArg(arg); app.doSignature(keyPair); app.setRequestID((invokeID++) + "_" + random()); - app.setRequesterDOI(doi); get.asyncGet( "dd", "executeContract", diff --git a/src/main/java/org/bdware/sc/boundry/utils/AsyncUtil.java b/src/main/java/org/bdware/sc/boundry/utils/AsyncUtil.java index f2594d2..046be73 100644 --- a/src/main/java/org/bdware/sc/boundry/utils/AsyncUtil.java +++ b/src/main/java/org/bdware/sc/boundry/utils/AsyncUtil.java @@ -93,7 +93,6 @@ public class AsyncUtil { app.setContractID(contractID).setAction(action).setArg(arg); app.doSignature(JavaScriptEntry.getKeyPair()); app.setRequestID((JavaScriptEntry.invokeID++) + "_" + JavaScriptEntry.random()); - app.setRequesterDOI(JavaScriptEntry.doi); JavaScriptEntry.get.asyncGet( "dd", "executeContract",