static void Main(string[] args) { Console.Write("\n Repository Server Started!"); try { Repo repo = new Repo(); repo.initializeDispatcher(); ProcessPool.Receiver re = new ProcessPool.Receiver(); re.start("http://localhost", 8068); //start the receiver for repo ProcessPool.Sender sd = new ProcessPool.Sender("http://localhost", 8069); // start sender for repo while (true) { CM msg = re.getMessage(); if (msg.type == CM.MessageType.closeReceiver) { break; } if (msg.command == "SendRequest") { msg.show(); continue; } if (msg.command == null) { continue; } if (msg.command == "SendRequestToBuildServer") { msg.show(); repo.sendCreateDirtoBuild(msg); continue; } if (msg.command == "DirCreated") { msg.show(); repo.sendRequesttoBuild(msg); continue; } if (msg.command == "log") { continue; } if (msg.command == "sendTestResultToRepo") { msg.show(); continue; } CM reply = repo.messageDispatcher[msg.command](msg); reply.show(); sd.postMessage(reply); } } catch (Exception ex) { Console.Write("\n exception thrown:\n{0}\n\n", ex.Message); } }
//will create directory for diferent group of source files, and send created message back to repo private void createDir(CM msg) { System.IO.Directory.CreateDirectory("..\\..\\..\\ProcessMother\\" + msg.replyto); ProcessPool.Sender sdReplyToMotherBuild = new ProcessPool.Sender("http://localhost", 8068); CM reply = new CM(CM.MessageType.reply); reply.to = "http://localhost:" + (8068).ToString() + "/Ibuilder"; reply.from = "http://localhost:" + (8068).ToString() + "/Ibuilder"; reply.command = "DirCreated"; reply.filename = msg.filename; sdReplyToMotherBuild.postMessage(reply); }