Project

General

Profile

Download (2.83 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.common.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
	@SuppressWarnings("unused")
33
	private static final Logger logger = Logger.getLogger(VibrantActivator.class);
34

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

    
44
	static final boolean doMcl = false;
45
	static final boolean doEuroMed = true;
46
	static final boolean doIopi = false;
47
	
48
	
49
	/**
50
	 * @param args
51
	 */
52
	public static void main(String[] args) {
53
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
54
		
55
		if (doMcl){
56
			MclActivator mclActivator = new MclActivator();
57
			mclActivator.importMcl(mclSource, cdmRepository, hbm2dll);
58
			hbm2dll = DbSchemaValidation.NONE;
59
		}
60
		
61
		if (doEuroMed){
62
			EuroMedActivator emActivator = new EuroMedActivator();
63
			emActivator.importEm2CDM(emSource, cdmRepository, hbm2dll);
64
			hbm2dll = DbSchemaValidation.NONE;
65
		}
66
		
67
		if (doIopi){
68
			IopiActivator iopiActivator = new IopiActivator();
69
			iopiActivator.importIopi(iopiSource, cdmRepository, hbm2dll);
70
			hbm2dll = DbSchemaValidation.NONE;
71
		}
72

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

    
83
}
(4-4/4)