Project

General

Profile

Download (2.94 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.app.vibrant;
11

    
12
import org.apache.log4j.Logger;
13

    
14
import eu.etaxonomy.cdm.app.berlinModelImport.BerlinModelSources;
15
import eu.etaxonomy.cdm.app.common.CdmDestinations;
16
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
17
import eu.etaxonomy.cdm.database.DbSchemaValidation;
18
import eu.etaxonomy.cdm.database.ICdmDataSource;
19
import eu.etaxonomy.cdm.io.common.Source;
20

    
21

    
22
/**
23
 * TODO add the following to a wiki page:
24
 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen 
25
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
26
 * 
27
 * 
28
 * @author a.mueller
29
 *
30
 */
31
public class VibrantActivator {
32
	private static final Logger logger = Logger.getLogger(VibrantActivator.class);
33

    
34
	//database validation status (create, update, validate ...)
35
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
36
	static final Source iopiSource = BerlinModelSources.iopi();
37
	static final Source mclSource = BerlinModelSources.mcl();
38
	static final Source emSource = BerlinModelSources.PESI3_euroMed();
39
	
40
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
41
	static final ICdmDataSource cdmDestination = cdm_test_local_vibrant();
42

    
43
	static final boolean doMcl = true;
44
	static final boolean doEuroMed = true;
45
	static final boolean doIopi = false;
46
	
47
	
48
	/**
49
	 * @param args
50
	 */
51
	public static void main(String[] args) {
52
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
53
		
54
		if (doMcl){
55
			MclActivator mclActivator = new MclActivator();
56
			mclActivator.importMcl(mclSource, cdmRepository, hbm2dll);
57
			hbm2dll = DbSchemaValidation.NONE;
58
		}
59
		
60
		if (doEuroMed){
61
			EuroMedActivator emActivator = new EuroMedActivator();
62
			emActivator.importEm2CDM(emSource, cdmRepository, hbm2dll);
63
			hbm2dll = DbSchemaValidation.NONE;
64
		}
65
		
66
		if (doIopi){
67
			IopiActivator iopiActivator = new IopiActivator();
68
			iopiActivator.importIopi(iopiSource, cdmRepository, hbm2dll);
69
			hbm2dll = DbSchemaValidation.NONE;
70
		}
71
		
72
		if (doEuroMed){
73
			logger.warn("DON'T FORGET to reset E+M filter");
74
			System.out.println("DON'T FORGET to reset E+M filter");
75
		}
76

    
77
	}
78
	
79
	public static ICdmDataSource cdm_test_local_vibrant(){
80
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
81
		String cdmServer = "127.0.0.1";
82
		String cdmDB = "vibrant"; 
83
		String cdmUserName = "root";
84
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
85
	}
86

    
87
}
(5-5/5)