From 1eb2950c412bb8fb51d3740d72746fb576008986 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Sat, 25 Jun 2022 11:42:42 +0800 Subject: [PATCH] getAllTopology: grep cross-domain routers --- backend/build.gradle | 2 +- .../org/bdware/sc/controlproxy/TopologyCollector.java | 10 ++++++++++ backend/yjs/ControlProxy.yjs | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/build.gradle b/backend/build.gradle index d52ef5a..94bef4b 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -14,7 +14,7 @@ plugins { id 'java' id 'java-library' } -version = "1.2.0" +version = "1.2.2" group = 'org.bdware.sc.controlproxy' tasks.withType(JavaCompile) { 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 f202502..3af1684 100644 --- a/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java +++ b/backend/src/main/java/org/bdware/sc/controlproxy/TopologyCollector.java @@ -38,6 +38,9 @@ public class TopologyCollector { 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"); @@ -55,6 +58,9 @@ public class TopologyCollector { 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() + "/SearchEngine"); node.addProperty("type", "SearchEngine"); node.addProperty("name", from.get("name").getAsString() + "搜索引擎"); @@ -78,6 +84,7 @@ public class TopologyCollector { continue; if (name.equals("SearchEngine") || name.equals("GateWay")) continue; + JsonObject node = new JsonObject(); node.add("name", from.get("name")); node.add("doId", from.get("doId")); @@ -110,6 +117,9 @@ public class TopologyCollector { 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())) { + continue; + } try { String nextControlProxy = je.getAsJsonObject().get("doId").getAsString() + "/ControlProxy"; ContractResult cr = executeContract(RepoProxy.router, "resolveTest", new JsonPrimitive(nextControlProxy)); diff --git a/backend/yjs/ControlProxy.yjs b/backend/yjs/ControlProxy.yjs index 6b7c9ba..b276d1b 100755 --- a/backend/yjs/ControlProxy.yjs +++ b/backend/yjs/ControlProxy.yjs @@ -134,6 +134,7 @@ contract ControlProxy { //总体拓扑图 //@范博 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"]