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
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
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
.CacheUpdaterConfigurator
;
21 import eu
.etaxonomy
.cdm
.io
.common
.CdmDefaultImport
;
22 import eu
.etaxonomy
.cdm
.io
.common
.ImportResult
;
23 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
28 * TODO add the following to a wiki page:
29 * 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
30 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
36 public class CichorieaeCacheUpdater
{
37 private static final Logger logger
= Logger
.getLogger(CichorieaeCacheUpdater
.class);
39 //database validation status (create, update, validate ...)
40 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.VALIDATE
;
41 static final ICdmDataSource cdmDestination
= CdmDestinations
.cdm_production_cichorieae();
43 static final List
<String
> classListStrings
= Arrays
.asList(new String
[]{
44 //IdentifiableEntity.class.getName(),
45 // IdentifiableEntity.class.getName(),
46 TaxonName
.class.getName(),
47 TaxonBase
.class.getName()
49 //new ArrayList<Class<? extends IdentifiableEntity>>();
51 // **************** ALL *********************
54 // static final boolean doTaxonDescription = true;
55 // static final boolean doSpecimenDescription = true;
56 // static final boolean doNameDescription = true;
59 // static final boolean doPerson = true;
60 // static final boolean doTeam = true;
61 // static final boolean doInstitution = true;
64 // static final boolean doCollection = true;
65 // static final boolean doReferenceBase = true;
67 // //SpecimenOrObservationBase
68 // static final boolean doFieldObservation = true;
69 // static final boolean doDeriveUnit = true;
70 // static final boolean doLivingBeing = true;
71 // static final boolean doObservation = true;
72 // static final boolean doSpecimen = true;
75 // static final boolean doMedia = true;
76 // static final boolean doMediaKey = true;
77 // static final boolean doFigure = true;
78 // static final boolean doPhylogenticTree = true;
82 // static final boolean doTaxon = true;
83 // static final boolean doSynonym = true;
85 // static final boolean doSequence = true;
88 // static final boolean doViralName = true;
89 // static final boolean doNonViralName = true;
90 // static final boolean doBotanicalName = true;
91 // static final boolean doZoologicalName = true;
92 // static final boolean doCultivarPlantName = true;
94 // static final boolean doClassification = true;
97 // static final boolean doFeatureTree = true;
98 // static final boolean doPolytomousKey = true;
100 // static final boolean doTermVocabulary = true;
101 // static final boolean doDefinedTermBase = true;
105 private ImportResult
doInvoke(ICdmDataSource destination
){
106 ImportResult success
;
108 CacheUpdaterConfigurator config
;
110 config
= CacheUpdaterConfigurator
.NewInstance(destination
, classListStrings
);
113 CdmDefaultImport
<CacheUpdaterConfigurator
> myImport
= new CdmDefaultImport
<CacheUpdaterConfigurator
>();
114 success
= myImport
.invoke(config
);
115 String successString
= success
.isSuccess() ?
"successful" : " with errors ";
116 System
.out
.println("End updating caches for "+ destination
.getDatabase() + "..." + successString
);
118 } catch (ClassNotFoundException e
) {
120 success
= new ImportResult();
121 success
.addException(e
);
129 public static void main(String
[] args
) {
130 ICdmDataSource destination
= CdmDestinations
.chooseDestination(args
) != null ? CdmDestinations
.chooseDestination(args
) : cdmDestination
;
132 System
.out
.println("Start updating caches for "+ destination
.getDatabase() + "...");
133 CichorieaeCacheUpdater me
= new CichorieaeCacheUpdater();
134 me
.doInvoke(destination
);