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
.model
.name
.TaxonNameBase
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
27 * TODO add the following to a wiki page:
28 * 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
29 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
35 public class CichorieaeCacheUpdater
{
36 private static final Logger logger
= Logger
.getLogger(CichorieaeCacheUpdater
.class);
38 //database validation status (create, update, validate ...)
39 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.VALIDATE
;
40 static final ICdmDataSource cdmDestination
= CdmDestinations
.cdm_production_cichorieae();
42 static final List
<String
> classListStrings
= Arrays
.asList(new String
[]{
43 //IdentifiableEntity.class.getName(),
44 // IdentifiableEntity.class.getName(),
45 TaxonNameBase
.class.getName(),
46 TaxonBase
.class.getName()
48 //new ArrayList<Class<? extends IdentifiableEntity>>();
50 // **************** ALL *********************
53 // static final boolean doTaxonDescription = true;
54 // static final boolean doSpecimenDescription = true;
55 // static final boolean doNameDescription = true;
58 // static final boolean doPerson = true;
59 // static final boolean doTeam = true;
60 // static final boolean doInstitution = true;
63 // static final boolean doCollection = true;
64 // static final boolean doReferenceBase = true;
66 // //SpecimenOrObservationBase
67 // static final boolean doFieldObservation = true;
68 // static final boolean doDeriveUnit = true;
69 // static final boolean doLivingBeing = true;
70 // static final boolean doObservation = true;
71 // static final boolean doSpecimen = true;
74 // static final boolean doMedia = true;
75 // static final boolean doMediaKey = true;
76 // static final boolean doFigure = true;
77 // static final boolean doPhylogenticTree = true;
81 // static final boolean doTaxon = true;
82 // static final boolean doSynonym = true;
84 // static final boolean doSequence = true;
87 // static final boolean doViralName = true;
88 // static final boolean doNonViralName = true;
89 // static final boolean doBotanicalName = true;
90 // static final boolean doZoologicalName = true;
91 // static final boolean doCultivarPlantName = true;
93 // static final boolean doClassification = true;
96 // static final boolean doFeatureTree = true;
97 // static final boolean doPolytomousKey = true;
99 // static final boolean doTermVocabulary = true;
100 // static final boolean doDefinedTermBase = true;
104 private boolean doInvoke(ICdmDataSource destination
){
105 boolean success
= true;
107 CacheUpdaterConfigurator config
;
109 config
= CacheUpdaterConfigurator
.NewInstance(destination
, classListStrings
);
112 CdmDefaultImport
<CacheUpdaterConfigurator
> myImport
= new CdmDefaultImport
<CacheUpdaterConfigurator
>();
113 success
&= myImport
.invoke(config
);
114 String successString
= success ?
"successful" : " with errors ";
115 System
.out
.println("End updating caches for "+ destination
.getDatabase() + "..." + successString
);
117 } catch (ClassNotFoundException e
) {
126 public static void main(String
[] args
) {
127 ICdmDataSource destination
= CdmDestinations
.chooseDestination(args
) != null ? CdmDestinations
.chooseDestination(args
) : cdmDestination
;
129 System
.out
.println("Start updating caches for "+ destination
.getDatabase() + "...");
130 CichorieaeCacheUpdater me
= new CichorieaeCacheUpdater();
131 me
.doInvoke(destination
);