diff --git a/.gitignore b/.gitignore index b0cc273..9a0bb55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +gradle.properties /.DS_Store/ *~ gradlew diff --git a/backend/build.gradle b/backend/build.gradle index 75eda9c..deb5081 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -4,8 +4,8 @@ buildscript { mavenLocal() } dependencies { - classpath "org.bdware.bdcontract:simple-ypk-packer:0.5.3" - classpath "org.bdware.bdcontract:ypk-deploy-tool:0.5.2" + classpath "org.bdware.bdcontract:simple-ypk-packer:0.5.5" + classpath "org.bdware.bdcontract:ypk-deploy-tool:0.7.1" } } @@ -14,7 +14,7 @@ plugins { id 'java' id 'java-library' } -version = "1.3.4" +version = "1.3.92" group = 'org.bdware.sc.controlproxy' tasks.withType(JavaCompile) { @@ -45,11 +45,11 @@ dependencies { api 'org.apache.logging.log4j:log4j-core:2.17.2' api 'org.apache.logging.log4j:log4j-api:2.17.2' api 'com.google.code.gson:gson:2.8.8' - implementation 'org.bdware.sc:cp:1.5.7' - implementation 'org.bdware.doip:doip-audit-tool:0.9.4' - implementation 'org.bdware.bdcontract:sdk-java:1.0.0' + implementation 'org.bdware.sc:cp:1.6.8' + implementation 'org.bdware.doip:doip-audit-tool:1.1.3' + implementation 'org.bdware.bdcontract:sdk-java:1.0.2' testImplementation 'junit:junit:4.13.2' - testImplementation 'org.bdware.bdcontract:ypk-deploy-tool:0.4.0' + testImplementation 'org.bdware.bdcontract:ypk-deploy-tool:0.7.1' } task copyLibs(type: Copy) { @@ -80,9 +80,11 @@ task copyJar(type: Copy, dependsOn: [":backend:jar", ":backend:copyLibs"]) { } } +tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) +tasks.processTestResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) task grepCP(dependsOn: [":backend:copyJar"]) { doLast { - org.bdware.datanet.YPKPacker.grepJarByCPVersion("./backend/build/output/libs", org.bdware.datanet.CPVersion.cp_1_5_7) + org.bdware.datanet.YPKPacker.grepJarByCPVersion("./backend/build/output/libs", org.bdware.datanet.CPVersion.cp_1_6_8) // org.bdware.datanet.YPKPacker.grepCPLibWithFilter("./backend/cplibs/libs/", "./backend/build/output/libs", "./backend/grepcp.list") } } @@ -104,4 +106,13 @@ task deploy(dependsOn: ["buildYPK"]) { doLast { org.bdware.ypkdeploy.HTTPTool.batchRun("./backend/deployconfig.json", true) } +} + +task putPackage(type: Exec, dependsOn: ["buildYPK"]) { + workingDir "./build" + commandLine "pwd" + commandLine "curl", "--user", "${REPO_USRNAME}:${REPO_PASSWORD}", "--upload-file", "./ControlProxy-${project.version}.ypk","${REPO_HOST}api/packages/iod/generic/ControlProxy/${project.version}/ControlProxy-${project.version}.ypk" + doLast { + println "Executed!" + } } \ No newline at end of file diff --git a/backend/debugconf.json b/backend/debugconf.json index 153ed3f..00500f4 100644 --- a/backend/debugconf.json +++ b/backend/debugconf.json @@ -1,15 +1,15 @@ { "agentAddress": "127.0.0.1:18000", "createParam": { - "privateKey": "4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b", - "publicKey": "04f9b9b8f324908464f78a6235e2dd93e4dfdaf045e9b1b5cfd57374516cc61a79a86fc2b42d3321a5b49a0f25381a7bed61901b40b729f72354e716673d551e98", + "privateKey": "d675782acf011dbc01a73c7967ccff9564486f7c3a9f5d5de151caffaa18936", + "publicKey": "04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27", "prefix": "shanxi", "router": "GlobalRouter", - "routerURI": "tcp://39.104.201.40:18041", + "routerURI": "tcp://39.104.209.178:18041", "auditType": "OnlyHash" }, "killBeforeStart": "ControlProxy", - "ypkPath": "/Users/huaqiancai/BDWare/datanet/ControlProxy/backend/build/ControlProxy-1.2.5.ypk", + "ypkPath": "/Users/huaqiancai/BDWare/ControlProxy/backend/build/ControlProxy-1.3.9.ypk", "publicKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd", "privateKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8" } \ No newline at end of file diff --git a/backend/deployconfig.json.backup b/backend/deployconfig.json.backup new file mode 100644 index 0000000..a920cf3 --- /dev/null +++ b/backend/deployconfig.json.backup @@ -0,0 +1,16 @@ +{ + "host": "127.0.0.1", + "privateKey": "d675782acf011dbc01a73c7967ccff9564486f7c3a9f5d5de151caffaa18936", + "publicKey": "04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27", + "ypkPath": "/Users/huaqiancai/BDWare/datanet/ControlProxy/backend/build/ControlProxy-0.9.6.ypk", + "killBeforeStart": "ControlProxy", + "createParam": { + "privateKey": "4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b", + "publicKey": "04f9b9b8f324908464f78a6235e2dd93e4dfdaf045e9b1b5cfd57374516cc61a79a86fc2b42d3321a5b49a0f25381a7bed61901b40b729f72354e716673d551e98", + "prefix": "bdtest", + "router": "GlobalRouter", + "routerURI": "tcp://127.0.0.1:18041", + "auditType": "OnlyHash" + }, + "agentPort": 18010 +} \ No newline at end of file diff --git a/backend/src/main/java/org/bdware/sc/controlproxy/DebugRun.java b/backend/src/main/java/org/bdware/sc/controlproxy/DebugRun.java index c5d6db7..0a16132 100644 --- a/backend/src/main/java/org/bdware/sc/controlproxy/DebugRun.java +++ b/backend/src/main/java/org/bdware/sc/controlproxy/DebugRun.java @@ -3,7 +3,7 @@ package org.bdware.sc.controlproxy; import org.bdware.sc.debugger.DebugMain; public class DebugRun { - public static void main(String[] args){ - DebugMain.main(args); + public static void main(String[] args) { + DebugMain.runWithConf("./backend/debugconf.json"); } } diff --git a/backend/src/main/java/org/bdware/sc/controlproxy/RepoProxy.java b/backend/src/main/java/org/bdware/sc/controlproxy/RepoProxy.java index 22b3379..ec140a5 100644 --- a/backend/src/main/java/org/bdware/sc/controlproxy/RepoProxy.java +++ b/backend/src/main/java/org/bdware/sc/controlproxy/RepoProxy.java @@ -3,9 +3,7 @@ package org.bdware.sc.controlproxy; import com.google.gson.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.bdware.doip.audit.AuditDoaClient; import org.bdware.doip.audit.EndpointConfig; -import org.bdware.doip.audit.SM2Signer; import org.bdware.doip.audit.client.AuditDoipClient; import org.bdware.doip.audit.client.AuditIrpClient; import org.bdware.doip.audit.config.TempConfigStorage; @@ -13,8 +11,8 @@ import org.bdware.doip.audit.writer.AuditConfig; import org.bdware.doip.audit.writer.AuditType; import org.bdware.doip.auditrepo.AutoAuditDO; import org.bdware.doip.codec.doipMessage.DoipMessage; +import org.bdware.doip.encrypt.SM2Signer; import org.bdware.doip.endpoint.client.ClientConfig; -import org.bdware.irp.exception.IrpClientException; import org.bdware.irp.stateinfo.StateInfoBase; import org.bdware.sc.engine.JSONTool; @@ -47,7 +45,6 @@ public class RepoProxy { TempConfigStorage storage = new TempConfigStorage(je.toString()); endpointConfig = storage.loadAsEndpointConfig(); prefix = storage.load().get("prefix").getAsString(); - router = storage.load().get("router").getAsString(); } diff --git a/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java b/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java index 0031afc..40eaf8e 100644 --- a/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java +++ b/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java @@ -5,15 +5,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bdware.client.SmartContractHttpClient; import org.bdware.sc.ContractResult; -import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.boundry.JavaScriptEntry; import org.bdware.sc.engine.JSONTool; import org.bdware.sc.util.JsonUtil; import wrp.jdk.nashorn.api.scripting.ScriptObjectMirror; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; import java.net.URI; -import java.net.URISyntaxException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; public class TopologyCollector { @@ -21,82 +22,94 @@ public class TopologyCollector { public static List getCurrentTopology() { - TopologyGraph graph = new TopologyGraph(); - //通过SearchEngine,可拿到本级的Repo(或下组的SE)与SearchEngine的关系。 - //通过Router,可拿到本级的Repo列表,也可拿到下组Router列表。 - JsonPrimitive arg = new JsonPrimitive("a"); - ContractResult currentRouters = executeContract(RepoProxy.router, "getRouterInfo", arg); - //--------构建Router网 - JsonObject root = JsonUtil.parseStringAsJsonObject(currentRouters.result.getAsJsonObject().get("data").getAsString()); - JsonObject rootNode = new JsonObject(); - rootNode.add("name", root.get("name")); - rootNode.add("doId", root.get("doId")); - rootNode.addProperty("type", "Router"); - rootNode.add("previousNode", new JsonArray()); - graph.addNode(rootNode); - ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", arg); - JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray(); - for (JsonElement je : routersArray) { - JsonObject node = new JsonObject(); - JsonObject from = je.getAsJsonObject(); - if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) { - continue; + try { + TopologyGraph graph = new TopologyGraph(); + //通过SearchEngine,可拿到本级的Repo(或下组的SE)与SearchEngine的关系。 + //通过Router,可拿到本级的Repo列表,也可拿到下组Router列表。 + JsonPrimitive arg = new JsonPrimitive("a"); + ContractResult currentRouters = executeContract(RepoProxy.router, "getRouterInfo", arg); + //--------构建Router网 + JsonElement midResult = currentRouters.result.getAsJsonObject().get("data"); + if (midResult.isJsonPrimitive()) + midResult = JsonParser.parseString(midResult.getAsString()).getAsJsonObject(); + JsonObject root = midResult.getAsJsonObject(); + JsonObject rootNode = new JsonObject(); + rootNode.add("name", root.get("name")); + rootNode.add("doId", root.get("doId")); + rootNode.addProperty("type", "Router"); + rootNode.add("previousNode", new JsonArray()); + graph.addNode(rootNode); + ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", arg); + JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray(); + for (JsonElement je : routersArray) { + JsonObject node = new JsonObject(); + JsonObject from = je.getAsJsonObject(); + if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) { + continue; + } + node.add("name", from.get("name")); + node.add("doId", from.get("doId")); + node.addProperty("type", "Router"); + graph.addNode(node); + graph.addEdge(node.get("doId").getAsString(), root.get("doId").getAsString()); } - node.add("name", from.get("name")); - node.add("doId", from.get("doId")); - node.addProperty("type", "Router"); - graph.addNode(node); - graph.addEdge(node.get("doId").getAsString(), root.get("doId").getAsString()); - } - //--------Router网构建完毕 - //--------构建SearchEngine网----- + //--------Router网构建完毕 + //--------构建SearchEngine网----- - JsonObject searchEngine = new JsonObject(); - searchEngine.addProperty("doId", root.get("doId").getAsString() + "/Registry"); - searchEngine.addProperty("type", "Registry"); - searchEngine.addProperty("name", root.get("name").getAsString() + "搜索引擎"); - graph.addNode(searchEngine); - //下级SearchEngine同步至上级 - for (JsonElement je : routersArray) { - JsonObject node = new JsonObject(); - JsonObject from = je.getAsJsonObject(); - if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) { - continue; + JsonObject searchEngine = new JsonObject(); + searchEngine.addProperty("doId", root.get("doId").getAsString() + "/Registry"); + searchEngine.addProperty("type", "Registry"); + searchEngine.addProperty("name", root.get("name").getAsString() + "搜索引擎"); + graph.addNode(searchEngine); + //下级SearchEngine同步至上级 + for (JsonElement je : routersArray) { + JsonObject node = new JsonObject(); + JsonObject from = je.getAsJsonObject(); + if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) { + continue; + } + node.addProperty("doId", from.get("doId").getAsString() + "/Registry"); + node.addProperty("type", "Registry"); + node.addProperty("name", from.get("name").getAsString() + "搜索引擎"); + graph.addNode(node); + graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString()); } - node.addProperty("doId", from.get("doId").getAsString() + "/Registry"); - node.addProperty("type", "Registry"); - node.addProperty("name", from.get("name").getAsString() + "搜索引擎"); - graph.addNode(node); - graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString()); - } - JsonObject gateway = new JsonObject(); - gateway.addProperty("doId", root.get("doId").getAsString() + "/GateWay"); - gateway.addProperty("type", "GateWay"); - gateway.addProperty("name", root.get("name").getAsString() + "网关"); - graph.addNode(gateway); - //TODO 通过SearchEngine把Repo的关系给弄上 - //----------------- - ContractResult currentRepos = executeContract(RepoProxy.router, "listRepo", arg); - JsonArray repos = currentRepos.result.getAsJsonObject().get("data").getAsJsonArray(); - for (JsonElement je : repos) { - JsonObject from = je.getAsJsonObject(); - String name = from.get("name").getAsString(); - if (name.equals("AuditProxy") || name.equals("ControlProxy")) - continue; - if (name.equals("Registry")||name.equals("SearchEngine")||name.equals("GateWay")) - continue; + JsonObject gateway = new JsonObject(); + gateway.addProperty("doId", root.get("doId").getAsString() + "/GateWay"); + gateway.addProperty("type", "GateWay"); + gateway.addProperty("name", root.get("name").getAsString() + "网关"); + graph.addNode(gateway); + //TODO 通过SearchEngine把Repo的关系给弄上 + //----------------- + ContractResult currentRepos = executeContract(RepoProxy.router, "listRepo", arg); + JsonArray repos = currentRepos.result.getAsJsonObject().get("data").getAsJsonArray(); + for (JsonElement je : repos) { + JsonObject from = je.getAsJsonObject(); + String name = from.get("name").getAsString(); + if (name.equals("AuditProxy") || name.equals("ControlProxy")) + continue; + if (name.equals("Registry") || name.equals("SearchEngine") || name.equals("GateWay")) + continue; - JsonObject node = new JsonObject(); - node.add("name", from.get("name")); - node.add("doId", from.get("doId")); - node.addProperty("type", "Repo"); - graph.addNode(node); - graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString()); - graph.addEdge(node.get("doId").getAsString(), gateway.get("doId").getAsString()); + JsonObject node = new JsonObject(); + node.add("name", from.get("name")); + node.add("doId", from.get("doId")); + node.addProperty("type", "Repo"); + graph.addNode(node); + graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString()); + graph.addEdge(node.get("doId").getAsString(), gateway.get("doId").getAsString()); + } + graph.pruneEdges(); + return graph.ret; + }catch ( Exception e){ + List ret = new ArrayList<>(); + JsonObject errorInfo = new JsonObject(); + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(bo)); + errorInfo.addProperty("stacktrace",bo.toString()); + return ret; } - graph.pruneEdges(); - return graph.ret; } private static ContractResult executeContract(String contractName, String operation, JsonElement arg) { @@ -128,15 +141,29 @@ public class TopologyCollector { return false; } + static StringBuilder debugInfo = new StringBuilder(); + + public static String getDebugInfo() { + return debugInfo.toString(); + } + + public static String resetDebugInfo() { + debugInfo = new StringBuilder(); + return "done"; + } + public synchronized static List getLevelTopology(int arg) { if (isCacheValid()) { + LOGGER.info("getLevelTopology use Cache!"); return cachedGraph.ret; } + LOGGER.info("getLevelTopology refresh"); List points = getCurrentTopology(); TopologyGraph graph = new TopologyGraph(); graph.addGraph(points); if (arg > 0) { ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a")); + JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray(); for (JsonElement je : routersArray) { if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) { diff --git a/backend/src/main/resources/log4j2.properties b/backend/src/main/resources/log4j2.properties new file mode 100644 index 0000000..e35a761 --- /dev/null +++ b/backend/src/main/resources/log4j2.properties @@ -0,0 +1,8 @@ +filter.threshold.type=ThresholdFilter +filter.threshold.level=info +appender.console.type=Console +appender.console.name=STDOUT +appender.console.layout.type=PatternLayout +appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White} +rootLogger.level=all +rootLogger.appenderRef.stdout.ref=STDOUT \ No newline at end of file diff --git a/backend/src/test/java/AuditConfigTest.java b/backend/src/test/java/AuditConfigTest.java new file mode 100644 index 0000000..f0ef27a --- /dev/null +++ b/backend/src/test/java/AuditConfigTest.java @@ -0,0 +1,36 @@ +import org.bdware.doip.audit.EndpointConfig; +import org.bdware.doip.audit.client.AuditIrpClient; +import org.bdware.doip.audit.config.TempConfigStorage; +import org.bdware.doip.audit.writer.AuditConfig; +import org.junit.Test; + +public class AuditConfigTest { + @Test + public void run() { + + long start = System.currentTimeMillis(); + String str = "{\n" + + " \"privateKey\": \"4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b\",\n" + + " \"publicKey\": \"04f9b9b8f324908464f78a6235e2dd93e4dfdaf045e9b1b5cfd57374516cc61a79a86fc2b42d3321a5b49a0f25381a7bed61901b40b729f72354e716673d551e98\",\n" + + " \"prefix\": \"shanxi\",\n" + + " \"router\": \"GlobalRouter\",\n" + + " \"routerURI\": \"tcp://127.0.0.1:18041\",\n" + + " \"auditType\": \"OnlyHash\"\n" + + " }"; + TempConfigStorage storage = new TempConfigStorage(str); + long end = (System.currentTimeMillis() - start); + System.out.println("time1:" + end); + + EndpointConfig endpointConfig = storage.loadAsEndpointConfig(); + end = (System.currentTimeMillis() - start); + System.out.println("time2:" + end); + AuditIrpClient irpClient = new AuditIrpClient(endpointConfig); + end = (System.currentTimeMillis() - start); + System.out.println("time3:" + end); + AuditConfig auditConfig = irpClient.getAuditConfig(); + end = (System.currentTimeMillis() - start); + System.out.println("time4:" + end); + // System.out.println(new Gson().toJson(auditConfig)); + for (; ; ) ; + } +} diff --git a/backend/src/test/java/DeployTestNet.java b/backend/src/test/java/DeployTestNet.java index c7e2642..21544bf 100644 --- a/backend/src/test/java/DeployTestNet.java +++ b/backend/src/test/java/DeployTestNet.java @@ -3,8 +3,8 @@ import org.bdware.ypkdeploy.HTTPTool; public class DeployTestNet { @Test public void deployControlProxy() { - HTTPTool.batchRun("./deploy/CP_bdtest.json", true); - HTTPTool.batchRun("./deploy/CP_bdtest_eg.json", true); - HTTPTool.batchRun("./deploy/CP_bdtest_rs.json", true); + HTTPTool.deploy("./deploy/CP_bdtest.json"); + HTTPTool.deploy("./deploy/CP_bdtest_eg.json"); + HTTPTool.deploy("./deploy/CP_bdtest_rs.json"); } } diff --git a/backend/todo.md b/backend/todo.md new file mode 100644 index 0000000..73f999d --- /dev/null +++ b/backend/todo.md @@ -0,0 +1,2 @@ +1. TopologyCollector中的缓存逻辑优化,要按不同的level来改 +2. \ No newline at end of file diff --git a/backend/yjs/ControlProxy.yjs b/backend/yjs/ControlProxy.yjs index 1dffecd..7fde766 100755 --- a/backend/yjs/ControlProxy.yjs +++ b/backend/yjs/ControlProxy.yjs @@ -143,61 +143,67 @@ contract ControlProxy { } //总体拓扑图 //@范博 + export function setTopologyLevel(arg) { + Global.level = arg/1.0; + return Global; + } export function getAllTopology2() { - return getAllTopology(2); - // var nodeList = []; - // nodeList.push({ - // "name":"小店区仓库", "doId":"bdware.ss.ab/Repo1", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/Repo2", "bdware.ss.zz/SearchEngine"] - // } - // ); - // nodeList.push({ - // "name":"小山区仓库", "doId":"bdware.ss.ab/Repo2", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/SearchEngine"] - // } - // ); - // nodeList.push({ - // "name":"太原内部共享网关", "doId":"bdware.ss/Gateway1", "type":"Gateway", "previousNode":["bdware/Gateway1", "bdware/Gateway2"] - // } - // ); - // nodeList.push({ - // "name":"太原对外开放网关", "doId":"bdware.ss/Gateway2", "type":"Gateway", "previousNode":["bdware/Gateway1"] - // } - // ); - // nodeList.push({ - // "name":"山西内部共享网关", "doId":"bdware/Gateway1", "type":"Gateway" - // } - // ); - // nodeList.push({ - // "name":"山西内部共享网关2", "doId":"bdware/Gateway2", "type":"Gateway" - // } - // ); - // nodeList.push({ - // "name":"xxx搜索引擎", "doId":"bdware.ss/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] - // } - // ); - // nodeList.push({ - // "name":"山西内部共享搜索引擎2", "doId":"bdware.ss.ab/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss/SearchEngine"] - // } - // ); - // nodeList.push({ - // "name":"yyy搜索引擎", "doId":"bdware.ss.cc/SearchEngine", "type":"SearchEngine" - // } - // ); - // nodeList.push({ - // "name":"zzz搜索引擎", "doId":"bdware.ss.zz/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] - // } - // ); - // nodeList.push({ - // "name":"贵州省域路由器", "doId":"bdware.ss.ab", "type":"Router", "previousNode":["bdware"] - // } - // ); - // nodeList.push({ - // "name":"山西省域路由器", "doId":"bdware.ss", "type":"Router", "previousNode":["bdware"] - // } - // ); - // nodeList.push({ - // "name":"数瑞测试网", "doId":"bdware", "type":"Router" - // } - // ); - // return nodeList; + if (Global.level==null) + Global.level = 0; + return getAllTopology(Global.level); + // var nodeList = []; + // nodeList.push({ + // "name":"小店区仓库", "doId":"bdware.ss.ab/Repo1", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/Repo2", "bdware.ss.zz/SearchEngine"] + // } + // ); + // nodeList.push({ + // "name":"小山区仓库", "doId":"bdware.ss.ab/Repo2", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/SearchEngine"] + // } + // ); + // nodeList.push({ + // "name":"太原内部共享网关", "doId":"bdware.ss/Gateway1", "type":"Gateway", "previousNode":["bdware/Gateway1", "bdware/Gateway2"] + // } + // ); + // nodeList.push({ + // "name":"太原对外开放网关", "doId":"bdware.ss/Gateway2", "type":"Gateway", "previousNode":["bdware/Gateway1"] + // } + // ); + // nodeList.push({ + // "name":"山西内部共享网关", "doId":"bdware/Gateway1", "type":"Gateway" + // } + // ); + // nodeList.push({ + // "name":"山西内部共享网关2", "doId":"bdware/Gateway2", "type":"Gateway" + // } + // ); + // nodeList.push({ + // "name":"xxx搜索引擎", "doId":"bdware.ss/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] + // } + // ); + // nodeList.push({ + // "name":"山西内部共享搜索引擎2", "doId":"bdware.ss.ab/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss/SearchEngine"] + // } + // ); + // nodeList.push({ + // "name":"yyy搜索引擎", "doId":"bdware.ss.cc/SearchEngine", "type":"SearchEngine" + // } + // ); + // nodeList.push({ + // "name":"zzz搜索引擎", "doId":"bdware.ss.zz/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] + // } + // ); + // nodeList.push({ + // "name":"贵州省域路由器", "doId":"bdware.ss.ab", "type":"Router", "previousNode":["bdware"] + // } + // ); + // nodeList.push({ + // "name":"山西省域路由器", "doId":"bdware.ss", "type":"Router", "previousNode":["bdware"] + // } + // ); + // nodeList.push({ + // "name":"数瑞测试网", "doId":"bdware", "type":"Router" + // } + // ); + // return nodeList; } } diff --git a/backend/yjs/search.yjs b/backend/yjs/search.yjs index 7973ae8..8a38f65 100755 --- a/backend/yjs/search.yjs +++ b/backend/yjs/search.yjs @@ -6,7 +6,7 @@ module SearchModule{ //str.contains(arg..) //输入参数,doId,如bdware.txte/Repo //返回结果:一个数组,里面是doId"contains"这个参数的列表。 - + export function getAllRepoCount() { return executeContract("Registry","getAllRepoCount",arg).result; //return Global.allRepoCount; @@ -24,7 +24,8 @@ module SearchModule{ //return Global.allRepoCount; } export function getAllDoCount() { - return executeContract("Registry","getAllDoCount",arg).result; + + return executeContract("Registry","getAllDoCount",arg).result; //return Global.allRepoCount; } //不确定 @@ -46,15 +47,15 @@ module SearchModule{ export function testCount(arg){ return {"data":"key"}; } - + //=====全域监管:数字对象溯源 针对单个DO的,通过SQL查询来实现。 - //根据 doId --> 找到“数字对象世系” + //根据 doId --> 找到“数字对象世系” //86.500.1/Repo.1/Doab //根据 doId+时间范围+interval+protocol --> 不同operation的统计数据 (AuditProxy) //countDORecordByDate() //{"doId":xxxx,"startTime","endTime","interval","eventPrefix":["doip_create","doip_update"]} //{"eventxxx":[1,2,3],"event2":[1,2,3]} - + //根据 doId +查找条件(时间范围 protocol operation user?) +offset/count -->总数+指定条数的数组(AuditProxy) // queryDoRecordByDate //{"doId":xxxx,"startTime","endTime","eventPrefix":["doip_create","doip_update"]} @@ -63,9 +64,9 @@ module SearchModule{ //{"doId":xxxx,"offset","count","eventPrefix":["doip_create","doip_update"]} //{"total":xx,"count":xx, "data":[{doip_request的某一行。},]} //============== - - - + + + //DO的元数据 //{ // "date": "...", @@ -95,7 +96,7 @@ module SearchModule{ var res=executeContract("Registry","searchByMultiTag",arg); return res.result; //ret=[]; - + //ret.push({ // "doId":"bdware.ss/Repo1/Do.a","name":"数字对象a","meta":{},"owner":"zzz","createTime":1641885492715} // ); diff --git a/backend/yjs/union.yjs b/backend/yjs/union.yjs index e40cdc9..27d3fec 100755 --- a/backend/yjs/union.yjs +++ b/backend/yjs/union.yjs @@ -35,7 +35,7 @@ module unions { "name":"北大", "address":"ws://39.106.6.6:18010", "status":"在线", "contact":"网管1号", "email":"abc@pku.edu.cn" }); Global.unions.push({ - "name":"南大大", "address":"ws://39.106.6.9:18010", "status":"在线", "contact":"网管1号", "email":"abc@pku.edu.cn" + "name":"南大", "address":"ws://39.106.6.9:18010", "status":"在线", "contact":"网管1号", "email":"abc@pku.edu.cn" }); return { "code":0 diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..158b703 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +REPO_USRNAME=caihuaqian@internetapi.cn +REPO_PASSWORD=527e259ef952a450d157fdb51ac4915154cea317 +REPO_HOST=https://gitea.internetapi.cn/ \ No newline at end of file