Ejemplo n.º 1
0
        /// <summary>
        /// This method is called when the user selects the analyze button
        /// in the client GUI. Once the analyze method is called, the following
        /// are the steps involved to find the dependencies
        /// 1. List of files for which analysis is needed is stored
        /// 2. If there are 2 servers then there will be two list for 2 different servers
        /// 3. List of files are sent to individual servers where the partial type tables are created
        /// 4. The partial type tables are sent back from each of the server to the client
        /// 5. These partial type tables are merged in the client and again the merged tables are sent to
        /// individual servers
        /// 6. using the merged table, each of the server do the analysis for the second pass
        /// 7. Each of the server sends the merged type tables to the client
        /// 8. Client uses this merged type tables of the servers to create the final merged list
        /// which contains the details of type and package dependencies
        /// </summary>
        /// <param name="sender">Default sender object returned by the platform</param>
        /// <param name="e"></param>
        private void AnalyzeButton_Click(object sender, RoutedEventArgs e)
        {
            String xmlString = "";

            try
            {
                ClearServerFilesList();
                ClearTypeTables();
                CreateServerFilesList(1, listBox1);
                CreateServerFilesList(2, listBox2);

                if (!AnalyzeServer1())
                {
                    return;
                }
                if (!AnalyzeServer2())
                {
                    return;
                }

                if (server1ServiceChannel != null && server2ServiceChannel != null)
                {
                    if (mergedTypeTable != null)
                    {
                        mergedTypeTable.Clear();
                    }
                    mergedTypeTable = client.mergeTypeTables(server1TypeTable, server2TypeTable);
                    if (server1Files.Count != 0)
                    {
                        client.SendMergedTypeTable(server1ServiceChannel, mergedTypeTable);
                    }
                    if (server2Files.Count != 0)
                    {
                        client.SendMergedTypeTable(server2ServiceChannel, mergedTypeTable);
                    }
                }

                mergeFinalRepoTable();
                xmlString     = createXmlData();
                resultsWindow = new ResultsWindow(repoMerged, xmlString);
                resultsWindow.Show();
            }
            catch (Exception ex)
            {
                Console.Write("\n\n Error in the input data. Exception {0}. Please check the input data\n", ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Is called on click of Analyze button
        /// Gets the list of files selected by the user
        /// sends it to the server to start the analysis
        /// gets the analyzed results
        /// merges the analyzed type tables if there are 2 different connected servers
        /// sends the merged result to each of the servers
        /// sends signal to the server to start round 2 of the analysis
        /// gets the repository instance from each of the servers
        /// merges the repository if there are 2 different connected servers
        /// creates an instance of result window and passed the final repository
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AnalyzeButton_Click(object sender, RoutedEventArgs e)
        {
            clearFiles();
            if (svcServer1Channel != null)
            {
                client.SetRepo(svcServer1Channel);
                getUserSelectedFilesServer1();
                if (server1Files.Count > 0)
                {
                    server1TypeTable = client.SetFilesList(svcServer1Channel, server1Files, server1Port);
                }
                else
                {
                    showErrorWindow(1);
                    return;
                }
            }
            if (svcServer2Channel != null)
            {
                client.SetRepo(svcServer2Channel);
                getUserSelectedFilesServer2();
                if (server2Files.Count > 0)
                {
                    server2TypeTable = client.SetFilesList(svcServer2Channel, server2Files, server2Port);
                }
                else
                {
                    showErrorWindow(2);
                    return;
                }
            }
            if (svcServer1Channel != null && svcServer2Channel != null)
            {
                mergedTypeTable = client.mergeTypeTables(server1TypeTable, server2TypeTable);
                client.SendMergedTypeTable(svcServer1Channel, mergedTypeTable);
                client.SendMergedTypeTable(svcServer2Channel, mergedTypeTable);
            }
            if (svcServer1Channel != null)
            {
                client.GetAnalyzedData(svcServer1Channel, server1Files);
                repo1Server = client.GetRepo(svcServer1Channel);
            }
            if (svcServer2Channel != null)
            {
                client.GetAnalyzedData(svcServer2Channel, server2Files);
                repo2Server = client.GetRepo(svcServer2Channel);
            }

            if (svcServer1Channel != null && svcServer2Channel != null)
            {
                repoMerged = client.mergeRepo(repo1Server, repo2Server);
            }
            else if (svcServer1Channel != null && svcServer2Channel == null)
            {
                repoMerged = repo1Server;
            }
            else if (svcServer1Channel == null && svcServer2Channel != null)
            {
                repoMerged = repo2Server;
            }

            resultsWindow = new ResultsWindow(repoMerged);
            resultsWindow.Show();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Is called on click of Analyze button
        /// Gets the list of files selected by the user
        /// sends it to the server to start the analysis
        /// gets the analyzed results
        /// merges the analyzed type tables if there are 2 different connected servers
        /// sends the merged result to each of the servers
        /// sends signal to the server to start round 2 of the analysis 
        /// gets the repository instance from each of the servers
        /// merges the repository if there are 2 different connected servers
        /// creates an instance of result window and passed the final repository
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AnalyzeButton_Click(object sender, RoutedEventArgs e)
        {
            clearFiles();
            if (svcServer1Channel != null)
            {
                client.SetRepo(svcServer1Channel);
                getUserSelectedFilesServer1();
                if (server1Files.Count > 0)
                    server1TypeTable = client.SetFilesList(svcServer1Channel, server1Files, server1Port);
                else
                {
                    showErrorWindow(1);
                    return;
                }
            }
            if (svcServer2Channel != null)
            {
                client.SetRepo(svcServer2Channel);
                getUserSelectedFilesServer2();
                if (server2Files.Count > 0)
                    server2TypeTable = client.SetFilesList(svcServer2Channel, server2Files, server2Port);
                else
                {
                    showErrorWindow(2);
                    return;
                }
            }
            if (svcServer1Channel != null && svcServer2Channel != null)
            {
                mergedTypeTable = client.mergeTypeTables(server1TypeTable, server2TypeTable);
                client.SendMergedTypeTable(svcServer1Channel, mergedTypeTable);
                client.SendMergedTypeTable(svcServer2Channel, mergedTypeTable);
            }
            if (svcServer1Channel != null)
            {
                client.GetAnalyzedData(svcServer1Channel, server1Files);
                repo1Server = client.GetRepo(svcServer1Channel);
            }
            if (svcServer2Channel != null)
            {
                client.GetAnalyzedData(svcServer2Channel, server2Files);
                repo2Server = client.GetRepo(svcServer2Channel);
            }

            if (svcServer1Channel != null && svcServer2Channel != null)
                repoMerged = client.mergeRepo(repo1Server, repo2Server);
            else if (svcServer1Channel != null && svcServer2Channel == null)
                repoMerged = repo1Server;
            else if (svcServer1Channel == null && svcServer2Channel != null)
                repoMerged = repo2Server;

            resultsWindow = new ResultsWindow(repoMerged);
            resultsWindow.Show();
        }