コード例 #1
0
        // ----------------< Proceesed Server Request >----------------
        public static void serverProcessing(SvcMsg msg)
        {
            if (msg.cmd.ToString().Equals("Response"))
            {
                Console.Write("\nThis is the Response from  Server............\n\n");
                msg.ShowMessage();

                responeFromServerTesting(msg.body.ToString());
            }
            if (msg.cmd.ToString().Equals("Request"))
            {
                Console.Write("\nThis is the Request from  Server for TypeTable............\n\n");
                msg.ShowMessage();

                Intermediator im        = new Intermediator();
                string        typeTable = im.getTypeTable();

                SvcMsg msg1 = new SvcMsg();
                msg1.src  = new Uri(src);
                msg1.dst  = new Uri(dst);
                msg1.cmd  = SvcMsg.Command.Response;
                msg1.body = typeTable;

                Sender.sendingServer(msg1);
            }
        }
コード例 #2
0
        // ----------------< Proceesed client Request >----------------

        public static void clientProcessing(SvcMsg msg)
        {
            Intermediator im = new Intermediator();

            im.clearRepository();

            if (msg.cmd.ToString().Equals("Dependency"))
            {
                Console.Write("\n This is the new Request from Client for Dependency............\n\n");
                msg.ShowMessage();
                dependencyProcessing(msg);
            }

            if (msg.cmd.ToString().Equals("DependencyAll"))
            {
                Console.Write("\n This is the slients Request from Client for All Package Dependency ............\n\n");
                msg.ShowMessage();
                allDependencyProcessing(msg);
            }

            if (msg.cmd.ToString().Equals("ProjectList"))
            {
                Console.Write("\n This is the new Request from Client for ProjectList............\n\n");
                msg.ShowMessage();
                projectListProcessing(msg);
            }
        }
コード例 #3
0
        static void projectListProcessing(SvcMsg msg)
        {
            Intermediator im = new Intermediator();

            msg.body = im.getprojectList();
            clientConnect(msg);
        }
コード例 #4
0
        // ----------------< Proceesed client Request >---------------- 

        public static void clientProcessing(SvcMsg msg)
        {
            Intermediator im = new Intermediator();
            im.clearRepository();

            if (msg.cmd.ToString().Equals("Dependency"))
            {
                Console.Write("\n This is the new Request from Client for Dependency............\n\n");
                msg.ShowMessage();
                dependencyProcessing(msg);               
            }

            if (msg.cmd.ToString().Equals("DependencyAll"))
            {
                Console.Write("\n This is the slients Request from Client for All Package Dependency ............\n\n");
                msg.ShowMessage();
                allDependencyProcessing(msg);
            }

            if (msg.cmd.ToString().Equals("ProjectList"))
            {
                Console.Write("\n This is the new Request from Client for ProjectList............\n\n");
                msg.ShowMessage();                
                projectListProcessing(msg);
            }
        }
コード例 #5
0
 public static void ThreadProcedureServer()
 {
     while (true)
     {
         SvcMsg msg = GetMessageServer();
         Dispatcher.serverProcessing(msg);
     }
 }
コード例 #6
0
 public static void ThreadProcedure()
 {
     while (true)
     {
         SvcMsg msg = GetMessage();
         Dispatcher.clientProcessing(msg);
     }
 }
コード例 #7
0
        public static void serverConnect()
        {
            Console.Write("\nEntering in to server to server communication: \n");
            SvcMsg msg1 = new SvcMsg();

            msg1.src = new Uri(src);
            msg1.dst = new Uri(dst);
            msg1.cmd = SvcMsg.Command.Request;

            Sender.sendingServer(msg1);
        }
コード例 #8
0
        public static void clientConnect(SvcMsg msg)
        {
            SvcMsg msg1 = new SvcMsg();

            msg1.src  = new Uri(msg.dst.ToString());
            msg1.dst  = new Uri(msg.src.ToString());
            msg1.cmd  = msg.cmd;
            msg1.body = msg.body;

            Sender.sendingClient(msg1);
        }
コード例 #9
0
 public static void sendingServer(SvcMsg msg)
 {
     try
     {
         IMessageService proxy = CreateClientChannel(msg.dst.ToString());
         proxy.ServerMessage(msg);
     }
     catch (Exception ex)
     {
         Console.Write("\n\n" + ex.Message);
     }
 }
コード例 #10
0
        // send request to appropiate server for projectList
        public void sendRequestForprojectList(string dst)
        {
            IMessageService proxy = CreateClientChannel(dst);

            SvcMsg msg = new SvcMsg();

            msg.cmd  = SvcMsg.Command.ProjectList;
            msg.src  = new Uri(src);
            msg.dst  = new Uri(dst);
            msg.body = "";
            proxy.PostMessage(msg);
        }
コード例 #11
0
        //----< receive thread processing >------------------------------

        void ThreadProc()
        {
            while (true)
            {               
                rcvdMsg = recvr.GetMessage();

                // call window functions on UI thread
                this.Dispatcher.BeginInvoke(
                  System.Windows.Threading.DispatcherPriority.Normal,
                  OnNewMessage,
                  rcvdMsg);
            }
        }
コード例 #12
0
        static void Main(string[] args)
        {
            string src = "http://localhost:9001/MessageService";
            string dst = "http://localhost:9001/MessageService";
            SvcMsg msg = new SvcMsg();

            msg.src  = new Uri(src);
            msg.dst  = new Uri(dst);
            msg.cmd  = SvcMsg.Command.ProjectList;
            msg.body = "";

            clientProcessing(msg);
            SvcMsg msg1 = new SvcMsg();

            msg1.src  = new Uri(src);
            msg1.dst  = new Uri(dst);
            msg1.cmd  = SvcMsg.Command.Request;
            msg1.body = "";
            serverProcessing(msg);
        }
コード例 #13
0
        static void dependencyProcessing(SvcMsg msg)
        {
            string   temp    = "";
            bool     connect = false;
            DateTime timeout = DateTime.Now;

            timeout.AddSeconds(5);
            try
            {
                serverConnect();
            }
            catch (Exception ex)
            {
                Console.Write("\n\n" + ex.Message);
            }
            finally
            {
                while (true)
                {
                    if (check == true)
                    {
                        temp    = typeFromOtherServer;
                        connect = true;
                        break;
                    }
                    if (DateTime.Compare(timeout, DateTime.Now) < 0)
                    {
                        connect = false;
                        break;
                    }
                }
                Intermediator im = new Intermediator();
                if (connect)
                {
                    im.typeTableMerging(typeFromOtherServer);
                }
                im.dependencyAnalysis(msg.body.ToString());
                msg.body = im.getDependencyResult();
                clientConnect(msg);
            }
        }
コード例 #14
0
 static void dependencyProcessing(SvcMsg msg)
 {
     string temp = "";
     bool connect = false;
     DateTime timeout = DateTime.Now;           
     timeout.AddSeconds(5);
     try
     {
         serverConnect();
     }
     catch (Exception ex)
     {
         Console.Write("\n\n" + ex.Message);
     }
     finally
     {               
         while (true)
         {
             if (check == true)
             {
                 temp = typeFromOtherServer;
                 connect = true;
                 break;
             }
             if (DateTime.Compare(timeout,DateTime.Now) < 0 )
             {
                 connect = false;
                 break;
             }
         }
         Intermediator im = new Intermediator();
         if (connect)
         {
             im.typeTableMerging(typeFromOtherServer);
         }
         im.dependencyAnalysis(msg.body.ToString());
         msg.body = im.getDependencyResult();               
         clientConnect(msg);
     }
 }
コード例 #15
0
        //----< called by UI thread when dispatched from rcvThrd >-------

        void OnNewMessageHandler(SvcMsg msg)
        {            
            if (msg.cmd.ToString().Equals("ProjectList"))
            {
                messageCounter++;
                message_listbox.Items.Insert(0, " ");
                message_listbox.Items.Insert(0, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff"));
                message_listbox.Items.Insert(0, messageCounter+". Response for ProjectList From: " + msg.src.ToString());

                listbox1.Items.Clear();
                List<string> projectList = pc.getProjectList(msg.body.ToString());
                if (projectList!=null)
                {
                    foreach (string s in projectList)
                        listbox1.Items.Add(s);
                }
                else
                {
                    dependency_Result.Items.Add("There is Projects Available on Server");
                }
            }
            if (msg.cmd.ToString().Equals("Dependency"))
            {
                messageCounter++;
                message_listbox.Items.Insert(0, " ");
                message_listbox.Items.Insert(0, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff"));
                message_listbox.Items.Insert(0, messageCounter+". Response for Dependency From: " + msg.src.ToString());

                pc.outGoingResultAnalysis(msg.body.ToString());
               // dependency_Result.Text = msg.body.ToString();

            }
            if (msg.cmd.ToString().Equals("DependencyAll"))
            {
                pc.inComingResultAnalysis(msg.body.ToString());
            }
        }
コード例 #16
0
        // send request to appropiate server for Dependency
        public void sendRequestForAnalysis(string directory, string destination)
        {
            string dst1 = "";
            string dst2 = "";

            if (destination.Equals("http://localhost:9001/MessageService"))
            {
                dst1 = "http://localhost:9001/MessageService";
                dst2 = "http://localhost:9002/MessageService";
            }
            else
            {
                dst2 = "http://localhost:9001/MessageService";
                dst1 = "http://localhost:9002/MessageService";
            }

            IMessageService proxy = CreateClientChannel(dst1);
            SvcMsg          msg   = new SvcMsg();

            msg.cmd  = SvcMsg.Command.Dependency;
            msg.src  = new Uri(src);
            msg.dst  = new Uri(dst1);
            msg.body = directory;
            proxy.PostMessage(msg);
            try
            {
                IMessageService proxy1 = CreateClientChannel(dst2);
                SvcMsg          msg1   = new SvcMsg();
                msg1.cmd  = SvcMsg.Command.DependencyAll;
                msg1.src  = new Uri(src);
                msg1.dst  = new Uri(dst2);
                msg1.body = directory;
                proxy1.PostMessage(msg1);
            }
            catch { }
        }
コード例 #17
0
        // ----------------< Proceesed Server Request >---------------- 
        public static void serverProcessing(SvcMsg msg)
        {
            if (msg.cmd.ToString().Equals("Response"))
            {
                Console.Write("\nThis is the Response from  Server............\n\n");
                msg.ShowMessage();

                responeFromServerTesting(msg.body.ToString());
            }
            if (msg.cmd.ToString().Equals("Request"))
            {
                Console.Write("\nThis is the Request from  Server for TypeTable............\n\n");
                msg.ShowMessage();

                Intermediator im = new Intermediator();
                string typeTable = im.getTypeTable();

                SvcMsg msg1 = new SvcMsg();
                msg1.src = new Uri(src);
                msg1.dst = new Uri(dst);
                msg1.cmd = SvcMsg.Command.Response;
                msg1.body = typeTable;

                Sender.sendingServer(msg1);
            }
        }
コード例 #18
0
 // ------< Implement service method to receive messages from other Client >-------
 public void PostMessage(SvcMsg msg)
 {
     rcvBlockingQ.enQ(msg);
 }
コード例 #19
0
 public void ServerMessage(SvcMsg msg)
 {
 }
コード例 #20
0
 public static void sendingServer(SvcMsg msg)
 {
     try
     {
         IMessageService proxy = CreateClientChannel(msg.dst.ToString());
         proxy.ServerMessage(msg);
     }
     catch (Exception ex)
     {
         Console.Write("\n\n" + ex.Message);
     }
 }
コード例 #21
0
 // ------< Implement service method to receive messages from other Server >-------
 public void ServerMessage(SvcMsg msg)
 {
     rcvBlockingQServer.enQ(msg);
 }
コード例 #22
0
 // ------< Implement service method to receive messages from other Server >-------
 public void ServerMessage(SvcMsg msg)
 {
     rcvBlockingQServer.enQ(msg);
 }
コード例 #23
0
 // ------< Implement service method to receive messages from other Client >-------
 public void PostMessage(SvcMsg msg)
 {
     rcvBlockingQ.enQ(msg);
 }
コード例 #24
0
 // Implement service method to receive messages from other Peers
 public void PostMessage(SvcMsg msg)
 {
     msg.ShowMessage();
     rcvBlockingQ.enQ(msg);
 }
コード例 #25
0
        // send request to appropiate server for Dependency
        public void sendRequestForAnalysis(string directory, string destination)
        {
            string dst1 = "";
            string dst2 = "";
            if (destination.Equals("http://localhost:9001/MessageService"))
            {
                 dst1 = "http://localhost:9001/MessageService";
                 dst2 = "http://localhost:9002/MessageService";
            }
            else
            {
                 dst2 = "http://localhost:9001/MessageService";
                 dst1 = "http://localhost:9002/MessageService";
            }

            IMessageService proxy = CreateClientChannel(dst1);
            SvcMsg msg = new SvcMsg();
            msg.cmd = SvcMsg.Command.Dependency;
            msg.src = new Uri(src);
            msg.dst = new Uri(dst1);
            msg.body = directory;
            proxy.PostMessage(msg);
            try
            {
                IMessageService proxy1 = CreateClientChannel(dst2);
                SvcMsg msg1 = new SvcMsg();
                msg1.cmd = SvcMsg.Command.DependencyAll;
                msg1.src = new Uri(src);
                msg1.dst = new Uri(dst2);
                msg1.body = directory;
                proxy1.PostMessage(msg1);
            }
            catch { }
        }       
コード例 #26
0
 static void projectListProcessing(SvcMsg msg)
 {
     Intermediator im = new Intermediator();
     msg.body = im.getprojectList();
     clientConnect(msg);
 }
コード例 #27
0
 public void ServerMessage(SvcMsg msg)
 {        }
コード例 #28
0
        // send request to appropiate server for projectList
        public void sendRequestForprojectList(string dst)
        {
            IMessageService proxy = CreateClientChannel(dst);

            SvcMsg msg = new SvcMsg();
            msg.cmd = SvcMsg.Command.ProjectList;
            msg.src = new Uri(src);
            msg.dst = new Uri(dst);
            msg.body = "";
            proxy.PostMessage(msg);

        }
コード例 #29
0
        static void Main(string[] args)
        {
            string src = "http://localhost:9001/MessageService";
            string dst = "http://localhost:9001/MessageService";
            SvcMsg msg = new SvcMsg();
            msg.src = new Uri(src);
            msg.dst = new Uri(dst);
            msg.cmd = SvcMsg.Command.ProjectList;
            msg.body ="";

            clientProcessing(msg);
            SvcMsg msg1 = new SvcMsg();
            msg1.src = new Uri(src);
            msg1.dst = new Uri(dst);
            msg1.cmd = SvcMsg.Command.Request;
            msg1.body = "";
            serverProcessing(msg);
        }
コード例 #30
0
        public static void clientConnect(SvcMsg msg)
        {
            SvcMsg msg1 = new SvcMsg();
            msg1.src = new Uri(msg.dst.ToString());
            msg1.dst = new Uri(msg.src.ToString());
            msg1.cmd = msg.cmd;
            msg1.body = msg.body;

            Sender.sendingClient(msg1);        
        }
コード例 #31
0
        public static void serverConnect()
        {
                Console.Write("\nEntering in to server to server communication: \n");
                SvcMsg msg1 = new SvcMsg();
                msg1.src = new Uri(src);
                msg1.dst = new Uri(dst);
                msg1.cmd = SvcMsg.Command.Request;

                Sender.sendingServer(msg1);
        }
コード例 #32
0
 // Implement service method to receive messages from other Peers
 public void PostMessage(SvcMsg msg)
 {
     msg.ShowMessage();
     rcvBlockingQ.enQ(msg);
 }