//set all the config info public int SetModBaseInfo(ModInfo obj) { ModInfo mod = obj; /* * if(obj.Length > 0) * { * mod = obj; * } * else * { * return -1; * } * */ this.ModID = mod.modid; this.ModName = mod.modname; this.ModInit = mod.init; this.ModClassName = mod.cls; this.ModVer = mod.veriosn; this.ModDepends = mod.depends; this.ModSubs = mod.subs; this.ModPub = mod.pub; this.ModSubPub = mod.subpubs; this.ModRequests = mod.reqs; this.ModResponse = mod.Res; this.ModFanIns = mod.fanins; this.ModFanOuts = mod.fanouts; this.ModFanInPubs = mod.faninpubs; this.ModFanInClients = mod.faninc; this.ModFanOutClients = mod.fanoutc; this.ModIpaddr = mod.ipaddr; this.ModUserTasks = mod.usertasks; if (this.ModPortRec != 0) { throw (new Exception("The module has beed init")); } this.ModPortRec = mod.modid; return(0); }
public int NewModIdWithName(string modname, out int modid) { int rlt = 0; rlt = GetModIDFromName(modname, out modid); if (rlt < 0) { ModInfo mod = new ModInfo(); lock (modlocker) { mod.modid = ModuleIdRec; ModuleIdRec += 100; mod.modname = modname; ModDict.Add(mod.modid, mod); } mod.status = ModStatus.Generate; modid = mod.modid; return(0); } else { return(0); } }
private int InitFaninClientService(ModInfo mod) { return(RunInstanceMethod(mod, "FanInClientService")); }
private int InitUserTask(ModInfo mod) { return(RunInstanceMethod(mod, "UserTaskService")); }
private int InitSubPubService(ModInfo mod) { return(RunInstanceMethod(mod, "SubPubService")); }
private int InitRequestsService(ModInfo mod) { return(RunInstanceMethod(mod, "RequestService")); }
private int InitPublishService(ModInfo mod) { return(RunInstanceMethod(mod, "PublishService")); }
private int InitResponseService(ModInfo mod) { return(RunInstanceMethod(mod, "ResponseService")); }
private int InitDepend(ModInfo mod) { return(RunInstanceMethod(mod, "InitDependInfo")); }
private int InitMod2(ModuleCfgXml mx, ref ModInfo mod) { if (mod == null || mx == null) { Logging.logger.Error("the in put mod is null"); return(-1); } //2 mod.subs = new List <Point>(); if (mx.subs != null) { foreach (NameXml p in mx.subs.sub) { Point point = GetPubsPoint(p.name); if (point != null) { mod.subs.Add(point); } } } else { } //4 if (mx.subpubs != null) { foreach (SubPubXml s in mx.subpubs.subpub) { foreach (NameXml nx in s.sub) { Point p = GetPubsPoint(nx.name); if (p != null) { foreach (SubPub sp in mod.subpubs) { if (sp.pub.name == s.pub.name) { sp.subs.Add(p); } } } } } } else { } //5 mod.reqs = new List <Point>(); if (mx.requests != null) { foreach (NameXml r in mx.requests.request) { Point point = GetResponsePoint(r.name); mod.reqs.Add(point); } } //8 mod.faninc = new List <Point>(); if (mx.faninc != null) { foreach (NameXml f in mx.faninc.fanin) { Point p = GetFaninSPoint(f.name); if (p != null) { mod.faninc.Add(p); } } } //11 mod.fanoutc = new List <Point>(); if (mx.fanoutc != null) { foreach (NameXml fp in mx.fanoutc.fanout) { Point p = GetFanoutSPoint(fp.name); if (p != null) { mod.fanoutc.Add(p); } } } mod.usertasks = new List <string>(); if (mx.usertasks != null) { foreach (string s in mx.usertasks.name) { mod.usertasks.Add(s); } } else { } mod.status = ModStatus.Init; return(0); }
private int InitMod(ModuleCfgXml mx, ref ModInfo mod) { mod.modname = mx.name; mod.init = mx.init; mod.status = ModStatus.Generate; mod.depends = new List <string>(); mod.cls = mx.cls; mod.ipaddr = mx.ipaddr; int modport = mod.modid + 10; //1 mod.depends = new List <string>(); if (mx.depends != null) { foreach (string d in mx.depends.depend) { mod.depends.Add(d); } } //3 if (mx.pub != null) { mod.pub = new Point(); { mod.pub.ip = mx.ipaddr; mod.pub.port = modport++; mod.pub.name = mx.pub.name; } } else { mod.pub = null; } //4 mod.subpubs = new List <SubPub>(); if (mx.subpubs != null) { foreach (SubPubXml s in mx.subpubs.subpub) { SubPub sp = new SubPub(); sp.subs = new List <Point>(); sp.pub = new Point(); sp.pub.name = s.pub.name; sp.pub.ip = mx.ipaddr; sp.pub.port = modport++; mod.subpubs.Add(sp); } } else { } //6 if (mx.responses != null) { mod.Res = new Point(); mod.Res.name = mx.responses.name; mod.Res.ip = mx.ipaddr; mod.Res.port = modport++; } else { mod.Res = null; } //7 mod.fanins = new List <Point>(); if (mx.fanins != null) { foreach (NameXml f in mx.fanins.fanin) { Point point = new Point(); point.name = f.name; point.ip = mx.ipaddr; point.port = modport++; mod.fanins.Add(point); } } //9 mod.faninpubs = new List <FaninPub>(); if (mx.faninpubs != null) { foreach (FaninPubXml fp in mx.faninpubs.faninpub) { FaninPub f = new FaninPub(); f.fanin = new Point(); f.fanin.ip = mx.ipaddr; f.fanin.name = fp.fanin.name; f.fanin.port = modport++; f.pub = new Point(); f.pub.ip = mx.ipaddr; f.pub.name = fp.pub.name; f.pub.port = modport++; mod.faninpubs.Add(f); } } //10 mod.fanouts = new List <Point>(); if (mx.fanout != null) { foreach (NameXml p in mx.fanout.fanout) { Point point = new Point(); point.ip = mx.ipaddr; point.name = p.name; point.port = modport++; mod.fanouts.Add(point); } } mod.modport = modport; return(0); }