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
.wp6
.cichorieae
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
18 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
19 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
20 import eu
.etaxonomy
.cdm
.io
.common
.CdmDefaultImport
;
21 import eu
.etaxonomy
.cdm
.io
.common
.ImportResult
;
22 import eu
.etaxonomy
.cdm
.io
.wp6
.CommonNameImportConfigurator
;
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 CichorieaeCommonNameActivator
{
35 private static final Logger logger
= Logger
.getLogger(CichorieaeCommonNameActivator
.class);
37 //database validation status (create, update, validate ...)
38 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.VALIDATE
;
39 static final ICdmDataSource cdmDestination
= CdmDestinations
.cdm_local_test_mysql();
40 static String source
= "C:/localCopy/Data/wp6/cich/Common names-Ueberarbeitung_AM.xls";
42 // **************** ALL *********************
44 private ImportResult
doInvoke(ICdmDataSource destination
){
48 File file
= new File(source
);
50 logger
.warn("File does not exist");
53 sourceUri
= file
.toURI();
55 CommonNameImportConfigurator config
;
57 config
= CommonNameImportConfigurator
.NewInstance(sourceUri
, destination
);
60 CdmDefaultImport
<CommonNameImportConfigurator
> myImport
= new CdmDefaultImport
<CommonNameImportConfigurator
>();
61 success
= myImport
.invoke(config
);
62 String successString
= success
.isSuccess() ?
"successful" : " with errors ";
63 System
.out
.println("End updating caches for "+ destination
.getDatabase() + "..." + successString
);
70 public static void main(String
[] args
) {
71 ICdmDataSource destination
= CdmDestinations
.chooseDestination(args
) != null ? CdmDestinations
.chooseDestination(args
) : cdmDestination
;
73 System
.out
.println("Start updating caches for "+ destination
.getDatabase() + "...");
74 CichorieaeCommonNameActivator me
= new CichorieaeCommonNameActivator();
75 me
.doInvoke(destination
);