Révision 2862

tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java (revision 2862)
15 15
import org.txm.annotation.kr.core.repository.KnowledgeRepositoryManager;
16 16
import org.txm.annotation.kr.core.repository.SQLKnowledgeRepository;
17 17
import org.txm.core.results.TXMResult;
18
import org.txm.objects.CorpusBuild;
18 19
import org.txm.objects.Project;
19 20
import org.txm.searchengine.cqp.corpus.CQPCorpus;
20 21
import org.txm.searchengine.cqp.corpus.MainCorpus;
......
427 428
		
428 429
		if (r instanceof MainCorpus && "clean".equals(state)) {
429 430
			MainCorpus c = (MainCorpus) r;
431
			
432
			for (String krname : KRAnnotationEngine.getKnowledgeRepositoryNames(c)) {
433
				Log.fine("cleaning KR: "+krname);
434
				KRAnnotationEngine.unregisterKnowledgeRepositoryName(c, krname);
435
			}
430 436
			if (c.getProjectDirectory() == null || !c.getProjectDirectory().exists()) {
431 437
				return;
432 438
			}
......
436 442
			}
437 443
		}
438 444
		else if (r instanceof Project && "clean".equals(state)) {
439
			Project c = (Project) r;
440
			File buildDirectory = new File(c.getProjectDirectory(), "temporary_annotations");
445
			Project p = (Project) r;
446
			for (MainCorpus c : p.getChildren(MainCorpus.class)) { //if any MainCorpus is remaining, clean it
447
				for (String krname : KRAnnotationEngine.getKnowledgeRepositoryNames(c)) {
448
					Log.fine("cleaning KR: "+krname);
449
					KRAnnotationEngine.unregisterKnowledgeRepositoryName(c, krname);
450
				}
451
			}
452
			File buildDirectory = new File(p.getProjectDirectory(), "temporary_annotations");
441 453
			if (buildDirectory.exists()) {
442 454
				DeleteDir.deleteDirectory(buildDirectory);
443 455
			}
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepositoryManager.java (revision 2862)
1 1
package org.txm.annotation.kr.core.repository;
2 2

  
3 3
import java.io.File;
4
import java.util.ArrayList;
5 4
import java.util.HashMap;
6 5
import java.util.List;
7 6

  
......
13 12
import org.txm.Toolbox;
14 13
import org.txm.annotation.kr.core.DatabasePersistenceManager;
15 14
import org.txm.annotation.kr.core.KRAnnotationEngine;
16
import org.txm.core.preferences.TBXPreferences;
17
import org.txm.objects.BaseOldParameters;
18 15
import org.txm.objects.Project;
19 16
import org.txm.searchengine.cqp.corpus.MainCorpus;
20 17
import org.txm.sql.SQLConnection;
......
26 23
public class KnowledgeRepositoryManager extends DatabasePersistenceManager {
27 24
	
28 25
	// private static KnowledgeRepositoryManager INSTANCE = null;
26
	/**
27
	 * repositories cache. shared between corpus	
28
	 */
29 29
	private static HashMap<String, KnowledgeRepository> repositories = new HashMap<>();
30 30
	
31 31
	// public static KnowledgeRepositoryManager getInstance(){
......
343 343
	public static void deleteKnowledgeRepository(KnowledgeRepository kr) {
344 344
		// Delete all Annotation Types and Typed Values
345 345
		List<AnnotationType> annotTypes = kr.getAllAnnotationTypes();
346
		for (AnnotationType annotType : annotTypes)
346
		for (AnnotationType annotType : annotTypes) {
347 347
			kr.deleteType(annotType);
348
		
348
		}
349 349
		repositories.remove(kr);
350 350
	}
351 351
	

Formats disponibles : Unified diff