예제 #1
0
파일: eksTRAKTOR.cs 프로젝트: dzima1/IWI
        private void completed(Object sender, RunWorkerCompletedEventArgs eventArgs)
        {
            if (eTRSettings.createIndyx)
            {
                indyxDocs.noMoreDocuments();
                indyxThread.Join();
            }

            distributor = null;
            pageNodesBuffer = null;
            GC.Collect();

            reportHandler.completed(eventArgs);
        }
예제 #2
0
파일: eksTRAKTOR.cs 프로젝트: dzima1/IWI
        /// <summary>
        /// Uruchamia ekstrakcję treści stron znalezionych w dokumencie XML do plików tekstowych
        /// </summary>
        /// 
        /// <param name="inputXMLPath">Ścieżka do dokumentu XML zrzutu artykułów wiki (pages-articles.xml)</param>
        /// <param name="outputDirPath">Ścieżka do istniejącego katalogu, do którego mają być ekstraktowane teksty artykułów</param>
        public void run(String inputXMLPath, String outputDirPath)
        {
            if (advisorThread.IsBusy)
                throw new eTRAlreadyWorkingException();

            DirectoryInfo di = new DirectoryInfo(outputDirPath);
            if (!di.Exists)
                throw new eTROutputDirDontExistsException();

            if (di.GetFiles().Length != 0 || di.GetDirectories().Length != 0)
                throw new eTROutputDirNotEmptyException();

            this.inputXMLPath = inputXMLPath;

            outputDirPath.TrimEnd(new char[] { '\\' });

            extractedPages = 0;

            cleaner = new eTRCleaner(messageCollector);

            if (eTRSettings.saveAsFiles || eTRSettings.saveAsFilesOriginalPageText)
                distributor = new eTRDistributor(outputDirPath + "\\pagesTexts", messageCollector);

            if (eTRSettings.createCollectiveFile)
                collector = new eTRCollector(outputDirPath + "\\collectedArticles.dat");

            if (eTRSettings.createIndyx)
            {
                indyxDocs = new IxManualServedCrawler();
                indyxIndexer = new IxStdRIIndexer(outputDirPath + "\\index", eTRSettings.indyxThreadCount);
                indyxCreator = new IxCreator(indyxDocs, indyxIndexer, outputDirPath + "\\index");
                indyxThread = new Thread(new ThreadStart(indyxCreator.DoIndexing));
                indyxThread.Start();
            }

            ThreadPool.SetMaxThreads(eTRSettings.createdWorkerThreadsCount, eTRSettings.completionPortThreadsCount);

            pageNodesBuffer = new HashSet<Match>();
            inputXMLBuffer = new StringBuilder(eTRSettings.bufferStartCapacity);

            works = new Match[eTRSettings.createdWorkerThreadsCount];
            workFinishedEvents = new ManualResetEvent[eTRSettings.createdWorkerThreadsCount];
            worksLocks = new Object[eTRSettings.createdWorkerThreadsCount];
            for (int i = 0; i < eTRSettings.createdWorkerThreadsCount; i++)
                worksLocks[i] = new Object();

            advisorThread.RunWorkerAsync();
        }