1 |
6a915f5e
|
Andreas Müller
|
/**
|
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 |
55d8bf29
|
Andreas Müller
|
import java.net.URI;
|
13 |
|
|
import java.util.UUID;
|
14 |
|
|
|
15 |
6a915f5e
|
Andreas Müller
|
import org.apache.log4j.Logger;
|
16 |
|
|
|
17 |
5f289246
|
Andreas Müller
|
import eu.etaxonomy.cdm.app.berlinModelImport.BerlinModelSources;
|
18 |
6a915f5e
|
Andreas Müller
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
19 |
|
|
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
|
20 |
|
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
21 |
|
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
22 |
|
|
import eu.etaxonomy.cdm.io.common.Source;
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/**
|
26 |
|
|
* TODO add the following to a wiki page:
|
27 |
|
|
* 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
|
28 |
|
|
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
|
29 |
|
|
*
|
30 |
|
|
*
|
31 |
|
|
* @author a.mueller
|
32 |
|
|
*
|
33 |
|
|
*/
|
34 |
|
|
public class VibrantActivator {
|
35 |
|
|
private static final Logger logger = Logger.getLogger(VibrantActivator.class);
|
36 |
|
|
|
37 |
|
|
//database validation status (create, update, validate ...)
|
38 |
55d8bf29
|
Andreas Müller
|
// static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
39 |
|
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
40 |
|
|
|
41 |
6a915f5e
|
Andreas Müller
|
static final Source iopiSource = BerlinModelSources.iopi();
|
42 |
|
|
static final Source mclSource = BerlinModelSources.mcl();
|
43 |
81782e09
|
Andreas Müller
|
static final Source emSource = BerlinModelSources.PESI3_euroMed();
|
44 |
55d8bf29
|
Andreas Müller
|
static final URI dioscoreaceaeSource = DwcaScratchpadImportActivator.dwca_emonocots_dioscoreaceae();
|
45 |
|
|
static final URI cypripedioideaeSource = DwcaScratchpadImportActivator.dwca_emonocots_cypripedioideae();
|
46 |
|
|
static final URI zingiberaceaeSource = DwcaScratchpadImportActivator.dwca_emonocots_zingiberaceae();
|
47 |
6a915f5e
|
Andreas Müller
|
|
48 |
|
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
|
49 |
55d8bf29
|
Andreas Müller
|
// static final ICdmDataSource cdmDestination = cdm_test_local_vibrant();
|
50 |
|
|
// static final ICdmDataSource cdmDestination = cdm_vibrant_dev();
|
51 |
|
|
static final ICdmDataSource cdmDestination = cdm_vibrant_emonoctos_dev();
|
52 |
|
|
|
53 |
6a915f5e
|
Andreas Müller
|
|
54 |
55d8bf29
|
Andreas Müller
|
static final boolean doMcl = false;
|
55 |
|
|
static final boolean doEuroMed = false;
|
56 |
512f31a5
|
Andreas Müller
|
static final boolean doIopi = false;
|
57 |
55d8bf29
|
Andreas Müller
|
static final boolean doDioscoreaceae = true;
|
58 |
|
|
static final boolean doZingiberaceae = false;
|
59 |
|
|
static final boolean doCypripedioideae = false;
|
60 |
6a915f5e
|
Andreas Müller
|
|
61 |
|
|
|
62 |
|
|
/**
|
63 |
|
|
* @param args
|
64 |
|
|
*/
|
65 |
|
|
public static void main(String[] args) {
|
66 |
|
|
ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
|
67 |
|
|
|
68 |
|
|
if (doMcl){
|
69 |
|
|
MclActivator mclActivator = new MclActivator();
|
70 |
|
|
mclActivator.importMcl(mclSource, cdmRepository, hbm2dll);
|
71 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
if (doEuroMed){
|
75 |
|
|
EuroMedActivator emActivator = new EuroMedActivator();
|
76 |
|
|
emActivator.importEm2CDM(emSource, cdmRepository, hbm2dll);
|
77 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
if (doIopi){
|
81 |
|
|
IopiActivator iopiActivator = new IopiActivator();
|
82 |
|
|
iopiActivator.importIopi(iopiSource, cdmRepository, hbm2dll);
|
83 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
84 |
|
|
}
|
85 |
3796d5f7
|
Andreas Müller
|
|
86 |
55d8bf29
|
Andreas Müller
|
if (doDioscoreaceae){
|
87 |
|
|
DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
|
88 |
|
|
UUID uuid = UUID.fromString("3bf59b32-9269-4225-944f-570256d40a9b");
|
89 |
|
|
scratchpadActivator.doImport(dioscoreaceaeSource, cdmRepository,uuid , "Dioscoreaceae (Scratchpads)", hbm2dll);
|
90 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
if (doZingiberaceae){
|
94 |
|
|
DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
|
95 |
|
|
UUID uuid = UUID.fromString("8fb0f951-ccd8-41c4-8d0b-99ba1fbd2dc2");
|
96 |
|
|
scratchpadActivator.doImport(zingiberaceaeSource, cdmRepository, uuid, " (Scratchpads)", hbm2dll);
|
97 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
if (doCypripedioideae){
|
101 |
|
|
DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
|
102 |
|
|
UUID uuid = UUID.fromString("a2b0ecf5-1a9d-4d94-a9ef-f57717a49bfd");
|
103 |
|
|
scratchpadActivator.doImport(cypripedioideaeSource, cdmRepository, uuid, " (Scratchpads)", hbm2dll);
|
104 |
|
|
hbm2dll = DbSchemaValidation.NONE;
|
105 |
|
|
}
|
106 |
|
|
|
107 |
3796d5f7
|
Andreas Müller
|
if (doEuroMed){
|
108 |
|
|
logger.warn("DON'T FORGET to reset E+M filter");
|
109 |
|
|
System.out.println("DON'T FORGET to reset E+M filter");
|
110 |
|
|
}
|
111 |
6a915f5e
|
Andreas Müller
|
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
public static ICdmDataSource cdm_test_local_vibrant(){
|
115 |
|
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
116 |
|
|
String cdmServer = "127.0.0.1";
|
117 |
|
|
String cdmDB = "vibrant";
|
118 |
|
|
String cdmUserName = "root";
|
119 |
|
|
return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
|
120 |
|
|
}
|
121 |
55d8bf29
|
Andreas Müller
|
|
122 |
|
|
public static ICdmDataSource cdm_vibrant_dev(){
|
123 |
|
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
124 |
|
|
String cdmServer = "160.45.63.201";
|
125 |
|
|
String cdmDB = "cdm_vibrant_index";
|
126 |
|
|
String cdmUserName = "edit";
|
127 |
|
|
return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
|
128 |
|
|
}
|
129 |
|
|
|
130 |
|
|
public static ICdmDataSource cdm_vibrant_emonoctos_dev(){
|
131 |
|
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
132 |
|
|
String cdmServer = "160.45.63.201";
|
133 |
|
|
String cdmDB = "cdm_vibrant_index_emonocots";
|
134 |
|
|
String cdmUserName = "edit";
|
135 |
|
|
return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
|
136 |
|
|
}
|
137 |
6a915f5e
|
Andreas Müller
|
|
138 |
|
|
}
|