Project

General

Profile

Revision 6a915f5e

ID6a915f5e6fbad94ef907180d7cdf1ee5a4ca02d4
Parent 80467b49
Child 24bf3f9c

Added by Andreas Müller about 9 years ago

moved vibrant to app-import

View differences:

.gitattributes
69 69
app-import/src/main/java/eu/etaxonomy/cdm/app/tcs/TcsXmlTestActivator.java -text
70 70
app-import/src/main/java/eu/etaxonomy/cdm/app/util/TestDatabase.java -text
71 71
app-import/src/main/java/eu/etaxonomy/cdm/app/util/TestTransaction.java -text
72
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/IopiActivator.java -text
73
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/MclActivator.java -text
74
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/VibrantActivator.java -text
72 75
app-import/src/main/java/eu/etaxonomy/cdm/app/viennaImport/ViennaActivator.java -text
73 76
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/cichorieae/CichorieaeActivator.java -text
74 77
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/cichorieae/CichorieaeCacheUpdater.java -text
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/IopiActivator.java
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 java.util.UUID;
13

  
14
import org.apache.log4j.Logger;
15

  
16
import eu.etaxonomy.cdm.app.common.BerlinModelSources;
17
import eu.etaxonomy.cdm.app.common.CdmDestinations;
18
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
19
import eu.etaxonomy.cdm.database.DbSchemaValidation;
20
import eu.etaxonomy.cdm.database.ICdmDataSource;
21
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
22
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
23
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
24
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
25
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;
26
import eu.etaxonomy.cdm.io.common.Source;
27
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer;
28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
29

  
30

  
31
/**
32
 * TODO add the following to a wiki page:
33
 * 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 
34
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
35
 * 
36
 * 
37
 * @author a.mueller
38
 *
39
 */
40
public class IopiActivator {
41
	@SuppressWarnings("unused")
42
	private static final Logger logger = Logger.getLogger(IopiActivator.class);
43

  
44
	//database validation status (create, update, validate ...)
45
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
46
	static final Source berlinModelSource = BerlinModelSources.iopi();
47
	
48
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
49
	static final ICdmDataSource cdmDestination = cdm_test_local_iopi();
50
	
51
	static final boolean useSingleClassification = false;
52
	static final Integer sourceSecId = null; //7000000; 
53
	static final UUID classificationUuid = null; //UUID.fromString("aa3fbaeb-f5dc-4e75-8d60-c8f93beb7ba6");
54
	
55
	static final UUID sourceRefUuid = UUID.fromString("df68c748-3c64-4b96-9a47-db51fb9d387e");
56
	
57
	// set to zero for unlimited nameFacts
58
	static final int maximumNumberOfNameFacts = 0;
59
	
60
	static final int partitionSize = 1500;
61
	
62
	//check - import
63
	static final CHECK check = CHECK.CHECK_AND_IMPORT;
64

  
65
	//editor - import
66
	static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;
67
	
68
	//NomeclaturalCode
69
	static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICBN;
70

  
71
	//ignore null
72
	static final boolean ignoreNull = true;
73
	
74
	static boolean useClassification = true;
75
	
76
	
77
// **************** ALL *********************	
78

  
79
	//authors
80
	static final boolean doAuthors = true;
81
	//references
82
	static final DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
83
	//names
84
	static final boolean doTaxonNames = true;
85
	static final boolean doRelNames = true;
86
	static final boolean doNameStatus = true;
87
	
88
	//taxa
89
	static final boolean doTaxa = true;
90
	static final boolean doRelTaxa = true;
91
	static final boolean doFacts = true;
92

  
93
	//etc.
94

  
95
	
96
// **************** SELECTED *********************
97

  
98
//	static final boolean doUser = true;
99
//	//authors
100
//	static final boolean doAuthors = false;
101
//	//references
102
//	static final DO_REFERENCES doReferences =  DO_REFERENCES.NONE;
103
//	//names
104
//	static final boolean doTaxonNames = false;
105
//	static final boolean doRelNames = false;
106
//	static final boolean doNameStatus = false;
107
//	static final boolean doTypes = false;
108
//	static final boolean doNameFacts = false;
109
//	
110
//	//taxa 
111
//	static final boolean doTaxa = false;
112
//	static final boolean doRelTaxa = false;
113
//	static final boolean doFacts = false;
114
//	
115
//	//etc.
116
//	static final boolean doMarker = false;
117

  
118
	
119
//******** ALWAYS IGNORE *****************************
120
	
121
	static final boolean doUser = false;
122
	static final boolean doOccurences = false;
123
	static final boolean doCommonNames = false;
124
	static final boolean doTypes = false;  
125
	static final boolean doNameFacts = false;
126
	static final boolean doMarker = false;
127

  
128
	
129
	public void importIopi (Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
130
		System.out.println("Start import from BerlinModel("+ berlinModelSource.getDatabase() + ") to " + cdmDestination.getDatabase() + " ...");
131
		//make BerlinModel Source
132
				
133
		BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source,  destination);
134
		
135
		config.setClassificationUuid(classificationUuid);
136
		config.setSourceSecId(sourceSecId);
137
		
138
		config.setNomenclaturalCode(nomenclaturalCode);
139

  
140
		config.setIgnoreNull(ignoreNull);
141
		config.setDoAuthors(doAuthors);
142
		config.setDoReferences(doReferences);
143
		config.setDoTaxonNames(doTaxonNames);
144
		config.setDoRelNames(doRelNames);
145
		config.setDoNameStatus(doNameStatus);
146
		config.setDoTypes(doTypes);
147
		config.setDoNameFacts(doNameFacts);
148
		config.setUseClassification(useClassification);
149
		config.setSourceRefUuid(sourceRefUuid);
150
		
151
		config.setDoTaxa(doTaxa);
152
		config.setDoRelTaxa(doRelTaxa);
153
		config.setDoFacts(doFacts);
154
		config.setDoOccurrence(doOccurences);
155
		config.setDoCommonNames(doCommonNames);
156
		
157
		config.setDoMarker(doMarker);
158
		config.setDoUser(doUser);
159
		config.setEditor(editor);
160
		config.setDbSchemaValidation(hbm2dll);
161
		
162
		// maximum number of name facts to import
163
		config.setMaximumNumberOfNameFacts(maximumNumberOfNameFacts);
164

  
165
		config.setUseSingleClassification(useSingleClassification);
166
		
167
		config.setCheck(check);
168
		config.setEditor(editor);
169
		config.setRecordsPerTransaction(partitionSize);
170

  
171
		
172
		// invoke import
173
		CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();
174
		bmImport.invoke(config);
175
		
176
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
177
		
178
	}
179
	
180
	/**
181
	 * @param args
182
	 */
183
	public static void main(String[] args) {
184
		IopiActivator importActivator = new IopiActivator();
185
		Source source = berlinModelSource;
186
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
187
		
188
		importActivator.importIopi(source, cdmRepository, hbm2dll);
189

  
190
	}
191
	
192
	public static ICdmDataSource cdm_test_local_iopi(){
193
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
194
		String cdmServer = "127.0.0.1";
195
		String cdmDB = "iopi"; 
196
		String cdmUserName = "root";
197
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
198
	}
199
	
200

  
201
}
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/MclActivator.java
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 java.util.UUID;
13

  
14
import org.apache.log4j.Logger;
15

  
16
import eu.etaxonomy.cdm.app.common.BerlinModelSources;
17
import eu.etaxonomy.cdm.app.common.CdmDestinations;
18
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
19
import eu.etaxonomy.cdm.database.DbSchemaValidation;
20
import eu.etaxonomy.cdm.database.ICdmDataSource;
21
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
22
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
23
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
24
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
25
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;
26
import eu.etaxonomy.cdm.io.common.Source;
27
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer;
28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
29

  
30

  
31
/**
32
 * TODO add the following to a wiki page:
33
 * 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 
34
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
35
 * 
36
 * 
37
 * @author a.mueller
38
 *
39
 */
40
public class MclActivator {
41
	@SuppressWarnings("unused")
42
	private static final Logger logger = Logger.getLogger(MclActivator.class);
43

  
44
	//database validation status (create, update, validate ...)
45
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
46
	static final Source berlinModelSource = BerlinModelSources.mcl();
47
	
48
	static final ICdmDataSource cdmDestination = cdm_test_local_mcl();
49
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
50
	
51
	static final boolean useSingleClassification = true;
52
	static final int sourceSecId = 1272;
53
	static final UUID classificationUuid = UUID.fromString("ba6efd26-5b45-4ce6-915d-4f9576e0bf0a");
54
	
55
	static final UUID sourceRefUuid = UUID.fromString("ca8b25d6-e251-4d2b-8b45-142e1e6448f7");
56
	
57
	// set to zero for unlimited nameFacts
58
	static final int maximumNumberOfNameFacts = 0;
59
	
60
	static final int partitionSize = 5000;
61
	
62
	//check - import
63
	static final CHECK check = CHECK.CHECK_AND_IMPORT;
64

  
65
	//editor - import
66
	static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;
67
	
68
	//NomeclaturalCode
69
	static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICBN;
70

  
71
	//ignore null
72
	static final boolean ignoreNull = true;
73
	
74
	static boolean useClassification = true;
75
	
76
	
77
// **************** ALL *********************	
78

  
79

  
80
	//authors
81
	static final boolean doAuthors = true;
82
	//references
83
	static final DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
84
	//names
85
	static final boolean doTaxonNames = true;
86
	static final boolean doRelNames = true;
87
	static final boolean doNameStatus = true;
88
	
89
	//taxa
90
	static final boolean doTaxa = true;
91
	static final boolean doRelTaxa = true;
92
	static final boolean doFacts = true;
93

  
94

  
95
	
96
// **************** SELECTED *********************
97

  
98
//	//authors
99
//	static final boolean doAuthors = false;
100
//	//references
101
//	static final DO_REFERENCES doReferences =  DO_REFERENCES.NONE;
102
//	//names
103
//	static final boolean doTaxonNames = false;
104
//	static final boolean doRelNames = false;
105
//	static final boolean doNameStatus = false;
106
//	
107
//	//taxa 
108
//	static final boolean doTaxa = false;
109
//	static final boolean doRelTaxa = true;
110
//	static final boolean doFacts = false;
111

  
112
	
113
	
114
// **********Always IGNORE:***********************************************
115
	
116
	//etc.
117
	static final boolean doUser = false;
118
	static final boolean doTypes = false;   //not available in MCL
119
	static final boolean doNameFacts = false;  //not available in MCL
120
	static final boolean doOccurences = false;     //not available in MCL
121
	static final boolean doCommonNames = false;   //not available in MCL
122
	static final boolean doMarker = false;   //not available in MCL
123
	
124
	
125
	public void importMcl (Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
126
		System.out.println("Start import from BerlinModel("+ berlinModelSource.getDatabase() + ") to " + cdmDestination.getDatabase() + " ...");
127
		//make BerlinModel Source
128
				
129
		BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source,  destination);
130
		
131
		config.setClassificationUuid(classificationUuid);
132
		config.setSourceSecId(sourceSecId);
133
		
134
		config.setNomenclaturalCode(nomenclaturalCode);
135

  
136
		config.setIgnoreNull(ignoreNull);
137
		config.setDoAuthors(doAuthors);
138
		config.setDoReferences(doReferences);
139
		config.setDoTaxonNames(doTaxonNames);
140
		config.setDoRelNames(doRelNames);
141
		config.setDoNameStatus(doNameStatus);
142
		config.setDoTypes(doTypes);
143
		config.setDoNameFacts(doNameFacts);
144
		config.setUseClassification(useClassification);
145
		config.setSourceRefUuid(sourceRefUuid);
146
		
147
		config.setDoTaxa(doTaxa);
148
		config.setDoRelTaxa(doRelTaxa);
149
		config.setDoFacts(doFacts);
150
		config.setDoOccurrence(doOccurences);
151
		config.setDoCommonNames(doCommonNames);
152
		
153
		config.setDoMarker(doMarker);
154
		config.setDoUser(doUser);
155
		config.setEditor(editor);
156
		config.setDbSchemaValidation(hbm2dll);
157
		
158
		// maximum number of name facts to import
159
		config.setMaximumNumberOfNameFacts(maximumNumberOfNameFacts);
160

  
161
		config.setUseSingleClassification(useSingleClassification);
162

  
163
		
164
		config.setCheck(check);
165
		config.setEditor(editor);
166
		config.setRecordsPerTransaction(partitionSize);
167

  
168
		
169
		// invoke import
170
		CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();
171
		bmImport.invoke(config);
172
		
173
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
174
		
175
	}
176
	
177
	/**
178
	 * @param args
179
	 */
180
	public static void main(String[] args) {
181
		MclActivator importActivator = new MclActivator();
182
		Source source = berlinModelSource;
183
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
184
		
185
		importActivator.importMcl(source, cdmRepository, hbm2dll);
186

  
187
	}
188
	
189
	public static ICdmDataSource cdm_test_local_mcl(){
190
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
191
		String cdmServer = "127.0.0.1";
192
		String cdmDB = "mcl"; 
193
		String cdmUserName = "root";
194
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
195
	}
196

  
197
}
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/VibrantActivator.java
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 java.util.UUID;
13

  
14
import org.apache.log4j.Logger;
15

  
16
import eu.etaxonomy.cdm.app.common.BerlinModelSources;
17
import eu.etaxonomy.cdm.app.common.CdmDestinations;
18
import eu.etaxonomy.cdm.app.pesi.EuroMedActivator;
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.berlinModel.in.BerlinModelImportConfigurator;
23
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
24
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
25
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
26
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;
27
import eu.etaxonomy.cdm.io.common.Source;
28
import eu.etaxonomy.cdm.io.pesi.out.PesiTransformer;
29
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
30

  
31

  
32
/**
33
 * TODO add the following to a wiki page:
34
 * 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 
35
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
36
 * 
37
 * 
38
 * @author a.mueller
39
 *
40
 */
41
public class VibrantActivator {
42
	@SuppressWarnings("unused")
43
	private static final Logger logger = Logger.getLogger(VibrantActivator.class);
44

  
45
	//database validation status (create, update, validate ...)
46
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
47
	static final Source iopiSource = BerlinModelSources.iopi();
48
	static final Source mclSource = BerlinModelSources.mcl();
49
	static final Source emSource = BerlinModelSources.euroMed_local();
50
	
51
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
52
	static final ICdmDataSource cdmDestination = cdm_test_local_vibrant();
53

  
54
	static final boolean doMcl = true;
55
	static final boolean doEuroMed = false;
56
	static final boolean doIopi = true;
57
	
58
	
59
	/**
60
	 * @param args
61
	 */
62
	public static void main(String[] args) {
63
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
64
		
65
		if (doMcl){
66
			MclActivator mclActivator = new MclActivator();
67
			mclActivator.importMcl(mclSource, cdmRepository, hbm2dll);
68
			hbm2dll = DbSchemaValidation.NONE;
69
		}
70
		
71
		if (doEuroMed){
72
			EuroMedActivator emActivator = new EuroMedActivator();
73
			emActivator.importEm2CDM(emSource, cdmRepository, hbm2dll);
74
			hbm2dll = DbSchemaValidation.NONE;
75
		}
76
		
77
		if (doIopi){
78
			IopiActivator iopiActivator = new IopiActivator();
79
			iopiActivator.importIopi(iopiSource, cdmRepository, hbm2dll);
80
			hbm2dll = DbSchemaValidation.NONE;
81
		}
82

  
83
	}
84
	
85
	public static ICdmDataSource cdm_test_local_vibrant(){
86
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
87
		String cdmServer = "127.0.0.1";
88
		String cdmDB = "vibrant"; 
89
		String cdmUserName = "root";
90
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
91
	}
92

  
93
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)