2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.app
.vibrant
;
13 import java
.util
.UUID
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.app
.berlinModelImport
.BerlinModelSources
;
18 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
;
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.
34 public class VibrantActivator
{
35 private static final Logger logger
= Logger
.getLogger(VibrantActivator
.class);
37 //database validation status (create, update, validate ...)
38 // static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
39 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.VALIDATE
;
41 static final Source iopiSource
= BerlinModelSources
.iopi();
42 static final Source mclSource
= BerlinModelSources
.mcl();
43 static final Source emSource
= BerlinModelSources
.euroMed_PESI3();
44 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();
48 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
49 // 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();
54 static final boolean doMcl
= false;
55 static final boolean doEuroMed
= false;
56 static final boolean doIopi
= false;
57 static final boolean doDioscoreaceae
= true;
58 static final boolean doZingiberaceae
= false;
59 static final boolean doCypripedioideae
= false;
65 public static void main(String
[] args
) {
66 ICdmDataSource cdmRepository
= CdmDestinations
.chooseDestination(args
) != null ? CdmDestinations
.chooseDestination(args
) : cdmDestination
;
69 MclActivator mclActivator
= new MclActivator();
70 mclActivator
.importMcl(mclSource
, cdmRepository
, hbm2dll
);
71 hbm2dll
= DbSchemaValidation
.NONE
;
75 EuroMedVibrantActivator emActivator
= new EuroMedVibrantActivator();
76 emActivator
.importEm2CDM(emSource
, cdmRepository
, hbm2dll
);
77 hbm2dll
= DbSchemaValidation
.NONE
;
81 IopiActivator iopiActivator
= new IopiActivator();
82 iopiActivator
.importIopi(iopiSource
, cdmRepository
, hbm2dll
);
83 hbm2dll
= DbSchemaValidation
.NONE
;
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
;
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
;
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
;
108 logger
.warn("DON'T FORGET to reset E+M filter");
109 System
.out
.println("DON'T FORGET to reset E+M filter");
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);
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);
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);