/*----< get all the files in the repo which will used to generate the xml files >-------------*/ private void allFilesinRepo(object sender, RoutedEventArgs e) { CM msg1 = new CM(CM.MessageType.request); msg1.from = "http://localhost:" + (8068).ToString() + "/Ibuilder"; msg1.to = "http://localhost:" + (8068).ToString() + "/Ibuilder"; msg1.author = "Quanfeng Du"; msg1.command = "RequestDirs"; msg1.arguments.Add(""); sndrToRepo.postMessage(msg1); }
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); }
//send the request files and the conresponding scource files to the build mother private void sendRequesttoBuild(CM msg) { string path = Path.Combine("..\\..\\..\\Repository\\BuildRequests", msg.filename); string direc = parseDir(path); CM reply = new CM(CM.MessageType.request); reply.to = "http://localhost:" + (8079).ToString() + "/Ibuilder"; reply.from = "http://localhost:" + (8079).ToString() + "/Ibuilder"; reply.command = "sendRequestFileToBuild"; reply.filename = path; sdToMotherBuild.postMessage(reply); sdToMotherBuild.WritePath_ = "..\\..\\..\\ProcessMother\\BuildRequests"; Console.Write("\n\n repository send file {0} to build mother ..\\..\\..\\ProcessMother\\BuildRequests", msg.filename); sdToMotherBuild.postFile(path); //post the requet files List <string> sourceFiles = Directory.GetFiles("..\\..\\..\\Repository\\sourceFIles\\" + direc, "*.*").ToList(); sdToMotherBuild.WritePath_ = "..\\..\\..\\ProcessMother\\" + direc; foreach (string file in sourceFiles) // post the scource fils associated with the request files { Console.Write("\n\n repository send source file {0} to build mother ..\\..\\..\\ProcessMother\\{1}", Path.GetFileName(file), direc); sdToMotherBuild.postFile(file); } }
/*----< send the number of process >-------------*/ private void SendProcessNumber(object sender, RoutedEventArgs e) { sndr.postMessage(SendNumProcess()); }