fix pingRepo and Registry

This commit is contained in:
Hongwei Zhang 2022-07-01 00:46:10 +08:00
parent 410a133ada
commit de24c21c95
7 changed files with 81 additions and 108 deletions

View File

@ -14,7 +14,7 @@ plugins {
id 'java' id 'java'
id 'java-library' id 'java-library'
} }
version = "1.2.5" version = "1.3.4"
group = 'org.bdware.sc.controlproxy' group = 'org.bdware.sc.controlproxy'
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {

View File

@ -50,9 +50,10 @@ public class TopologyCollector {
} }
//--------Router网构建完毕 //--------Router网构建完毕
//--------构建SearchEngine网----- //--------构建SearchEngine网-----
JsonObject searchEngine = new JsonObject(); JsonObject searchEngine = new JsonObject();
searchEngine.addProperty("doId", root.get("doId").getAsString() + "/SearchEngine"); searchEngine.addProperty("doId", root.get("doId").getAsString() + "/Registry");
searchEngine.addProperty("type", "SearchEngine"); searchEngine.addProperty("type", "Registry");
searchEngine.addProperty("name", root.get("name").getAsString() + "搜索引擎"); searchEngine.addProperty("name", root.get("name").getAsString() + "搜索引擎");
graph.addNode(searchEngine); graph.addNode(searchEngine);
//下级SearchEngine同步至上级 //下级SearchEngine同步至上级
@ -62,8 +63,8 @@ public class TopologyCollector {
if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) { if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) {
continue; continue;
} }
node.addProperty("doId", from.get("doId").getAsString() + "/SearchEngine"); node.addProperty("doId", from.get("doId").getAsString() + "/Registry");
node.addProperty("type", "SearchEngine"); node.addProperty("type", "Registry");
node.addProperty("name", from.get("name").getAsString() + "搜索引擎"); node.addProperty("name", from.get("name").getAsString() + "搜索引擎");
graph.addNode(node); graph.addNode(node);
graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString()); graph.addEdge(node.get("doId").getAsString(), searchEngine.get("doId").getAsString());
@ -83,7 +84,7 @@ public class TopologyCollector {
String name = from.get("name").getAsString(); String name = from.get("name").getAsString();
if (name.equals("AuditProxy") || name.equals("ControlProxy")) if (name.equals("AuditProxy") || name.equals("ControlProxy"))
continue; continue;
if (name.equals("SearchEngine") || name.equals("GateWay")) if (name.equals("Registry")||name.equals("SearchEngine")||name.equals("GateWay"))
continue; continue;
JsonObject node = new JsonObject(); JsonObject node = new JsonObject();

View File

@ -1,15 +0,0 @@
filter.threshold.type=ThresholdFilter
filter.threshold.level=debug
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}
appender.rolling.type=File
appender.rolling.name=log
appender.rolling.append=true
appender.rolling.fileName=./log/gateway.log
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d-%m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log

View File

@ -1,15 +0,0 @@
filter.threshold.type=ThresholdFilter
filter.threshold.level=debug
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}
appender.rolling.type=File
appender.rolling.name=log
appender.rolling.append=true
appender.rolling.fileName=./log/gateway.log
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d-%m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log

View File

@ -62,15 +62,17 @@ contract ControlProxy {
"msg":"missing arguments repoId ", "code":1 "msg":"missing arguments repoId ", "code":1
}; };
} }
var ret = executeContract("Gateway", "pingRepo", arg.doId); // var ret = executeContract("Gateway", "pingRepo", arg.doId);
ret = ret.result; // ret = ret.result;
if (ret.rrt > 0) // if (ret.rrt > 0)
return { // return {
"msg":"success", "rrt":ret.rrt, "code":0, "repoInfo":JSON.parse(ret.repoInfo) // "msg":"success", "rrt":ret.rrt, "code":0, "repoInfo":JSON.parse(ret.repoInfo)
}; else return { // }; else return {
"msg":"repo is unconnected", "code":1 // "msg":"repo is unconnected", "code":1
}; // };
return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg.doId);
} }
@Description("shanxi/TestLocal shanxi/Repository") @Description("shanxi/TestLocal shanxi/Repository")
export function testPingRepo(arg) { export function testPingRepo(arg) {
return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg); return org.bdware.sc.controlproxy.RepoProxy.pingRepo(arg);
@ -143,59 +145,59 @@ contract ControlProxy {
//@范博 //@范博
export function getAllTopology2() { export function getAllTopology2() {
return getAllTopology(2); return getAllTopology(2);
var nodeList = []; // var nodeList = [];
nodeList.push({ // 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"] // "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({ // nodeList.push({
"name":"小山区仓库", "doId":"bdware.ss.ab/Repo2", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/SearchEngine"] // "name":"小山区仓库", "doId":"bdware.ss.ab/Repo2", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/SearchEngine"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"太原内部共享网关", "doId":"bdware.ss/Gateway1", "type":"Gateway", "previousNode":["bdware/Gateway1", "bdware/Gateway2"] // "name":"太原内部共享网关", "doId":"bdware.ss/Gateway1", "type":"Gateway", "previousNode":["bdware/Gateway1", "bdware/Gateway2"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"太原对外开放网关", "doId":"bdware.ss/Gateway2", "type":"Gateway", "previousNode":["bdware/Gateway1"] // "name":"太原对外开放网关", "doId":"bdware.ss/Gateway2", "type":"Gateway", "previousNode":["bdware/Gateway1"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"山西内部共享网关", "doId":"bdware/Gateway1", "type":"Gateway" // "name":"山西内部共享网关", "doId":"bdware/Gateway1", "type":"Gateway"
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"山西内部共享网关2", "doId":"bdware/Gateway2", "type":"Gateway" // "name":"山西内部共享网关2", "doId":"bdware/Gateway2", "type":"Gateway"
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"xxx搜索引擎", "doId":"bdware.ss/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] // "name":"xxx搜索引擎", "doId":"bdware.ss/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"山西内部共享搜索引擎2", "doId":"bdware.ss.ab/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss/SearchEngine"] // "name":"山西内部共享搜索引擎2", "doId":"bdware.ss.ab/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss/SearchEngine"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"yyy搜索引擎", "doId":"bdware.ss.cc/SearchEngine", "type":"SearchEngine" // "name":"yyy搜索引擎", "doId":"bdware.ss.cc/SearchEngine", "type":"SearchEngine"
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"zzz搜索引擎", "doId":"bdware.ss.zz/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"] // "name":"zzz搜索引擎", "doId":"bdware.ss.zz/SearchEngine", "type":"SearchEngine", "previousNode":["bdware.ss.cc/SearchEngine"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"贵州省域路由器", "doId":"bdware.ss.ab", "type":"Router", "previousNode":["bdware"] // "name":"贵州省域路由器", "doId":"bdware.ss.ab", "type":"Router", "previousNode":["bdware"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"山西省域路由器", "doId":"bdware.ss", "type":"Router", "previousNode":["bdware"] // "name":"山西省域路由器", "doId":"bdware.ss", "type":"Router", "previousNode":["bdware"]
} // }
); // );
nodeList.push({ // nodeList.push({
"name":"数瑞测试网", "doId":"bdware", "type":"Router" // "name":"数瑞测试网", "doId":"bdware", "type":"Router"
} // }
); // );
return nodeList; // return nodeList;
} }
} }

View File

@ -6,7 +6,7 @@ module RepoDetail {
//TODO TODO //TODO TODO
export function getDoList(arg) { export function getDoList(arg) {
print("GetDOList==========="); print("GetDOList===========");
var ret = executeContract("SearchEngine", "getDoList", arg); var ret = executeContract("Registry","getDoList", arg);
return ret.result; return ret.result;
} }
export function getDoList2(arg) { export function getDoList2(arg) {

View File

@ -8,33 +8,33 @@ module SearchModule{
//返回结果一个数组里面是doId"contains"这个参数的列表。 //返回结果一个数组里面是doId"contains"这个参数的列表。
export function getAllRepoCount() { export function getAllRepoCount() {
return executeContract("SearchEngine","getAllRepoCount",arg).result; return executeContract("Registry","getAllRepoCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
export function getAllUserCount() { export function getAllUserCount() {
return executeContract("SearchEngine","getAllUserCount",arg).result; return executeContract("Registry","getAllUserCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
export function getAllSearchCount() { export function getAllSearchCount() {
return executeContract("SearchEngine","getAllSearchCount",arg).result; return executeContract("Registry","getAllSearchCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
export function getAllUpdateCount() { export function getAllUpdateCount() {
return executeContract("SearchEngine","getAllUpdateCount",arg).result; return executeContract("Registry","getAllUpdateCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
export function getAllDoCount() { export function getAllDoCount() {
return executeContract("SearchEngine","getAllDoCount",arg).result; return executeContract("Registry","getAllDoCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
//不确定 //不确定
//{"open":51,"close":49} //{"open":51,"close":49}
export function getAllIndexCount() { export function getAllIndexCount() {
return executeContract("SearchEngine","getAllIndexCount",arg).result; return executeContract("Registry","getAllIndexCount",arg).result;
//return Global.allRepoCount; //return Global.allRepoCount;
} }
export function getDoCount(arg){ export function getDoCount(arg){
return executeContract("SearchEngine","getDoCount",arg); return executeContract("Registry","getDoCount",arg);
//return { //return {
//"data":[{ //"data":[{
// "doId":"bdware.txte/Repo1","count":10} // "doId":"bdware.txte/Repo1","count":10}
@ -77,7 +77,7 @@ module SearchModule{
//做成可以根据创建时间范围;标识模糊 //做成可以根据创建时间范围;标识模糊
//{"type":"creatTime","count":10,"offset":"0","from":"1141363811328","to":"1941363811328"} //{"type":"creatTime","count":10,"offset":"0","from":"1141363811328","to":"1941363811328"}
export function getDoFilter(arg){ export function getDoFilter(arg){
var res=executeContract("SearchEngine","searchByRange",arg); var res=executeContract("Registry","searchByRange",arg);
return res.result; return res.result;
} }
@ -92,7 +92,7 @@ module SearchModule{
@ArgSchema({"!params":[{"!type":"string","!keyword":"integer"}],"count":"integer","offset":"integer"}) @ArgSchema({"!params":[{"!type":"string","!keyword":"integer"}],"count":"integer","offset":"integer"})
export function search(arg){ export function search(arg){
arg = convertArgToJson(arg); arg = convertArgToJson(arg);
var res=executeContract("SearchEngine","searchByMultiTag",arg); var res=executeContract("Registry","searchByMultiTag",arg);
return res.result; return res.result;
//ret=[]; //ret=[];