/**\r
* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
\r
import org.apache.log4j.Logger;\r
\r
-import eu.etaxonomy.cdm.app.common.CdmDestinations;\r
-import eu.etaxonomy.cdm.database.DbSchemaValidation;\r
import eu.etaxonomy.cdm.database.ICdmDataSource;\r
import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator;\r
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;\r
+import eu.etaxonomy.cdm.io.common.ImportResult;\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
+import eu.etaxonomy.cdm.model.reference.Reference;\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
\r
\r
/**\r
* TODO add the following to a wiki page:\r
- * 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 base under another operation systen \r
+ * 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 base under another operation systen\r
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.\r
- * \r
- * \r
+ *\r
+ *\r
* @author a.mueller\r
*\r
*/\r
private static final Logger logger = Logger.getLogger(CacheUpdater.class);\r
\r
//database validation status (create, update, validate ...)\r
- static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;\r
- static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_production();\r
+// static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;\r
+// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_edit_cichorieae_preview_direct();\r
+// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_cichorieae();\r
+// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
+// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_euromed3();\r
+// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_flora_deutschland();\r
+ static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_caryophyllales();\r
+\r
\r
static final List<String> classListStrings = Arrays.asList(new String[]{\r
//IdentifiableEntity.class.getName(),\r
// IdentifiableEntity.class.getName(),\r
-// TaxonNameBase.class.getName(),\r
+// AgentBase.class.getName(),\r
+ Reference.class.getName(),\r
+ TaxonNameBase.class.getName(),\r
TaxonBase.class.getName()\r
});\r
//new ArrayList<Class<? extends IdentifiableEntity>>();\r
\r
\r
- \r
- private boolean doInvoke(ICdmDataSource destination){\r
- boolean success = true;\r
+\r
+ private ImportResult doInvoke(ICdmDataSource destination){\r
+ ImportResult result = new ImportResult();\r
\r
CacheUpdaterConfigurator config;\r
try {\r
config = CacheUpdaterConfigurator.NewInstance(destination, classListStrings);\r
- \r
+\r
// invoke import\r
CdmDefaultImport<CacheUpdaterConfigurator> myImport = new CdmDefaultImport<CacheUpdaterConfigurator>();\r
- success &= myImport.invoke(config);\r
- String successString = success ? "successful" : " with errors ";\r
- System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString);\r
- return success;\r
+ result = myImport.invoke(config);\r
+ //String successString = success ? "successful" : " with errors ";\r
+ //System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString);\r
+ return result;\r
} catch (ClassNotFoundException e) {\r
logger.error(e);\r
- return false;\r
- } \r
+ result.setSuccess(false);\r
+ return result;\r
+ }\r
}\r
- \r
+\r
/**\r
* @param args\r
*/\r
public static void main(String[] args) {\r
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;\r
- \r
+\r
System.out.println("Start updating caches for "+ destination.getDatabase() + "...");\r
CacheUpdater me = new CacheUpdater();\r
me.doInvoke(destination);\r
- \r
+\r
}\r
- \r
- // **************** ALL ********************* \r
+\r
+ // **************** ALL *********************\r
\r
// //DescriptionBase\r
// static final boolean doTaxonDescription = true;\r
// static final boolean doSpecimenDescription = true;\r
// static final boolean doNameDescription = true;\r
-// \r
+//\r
// //AgentBase\r
// static final boolean doPerson = true;\r
// static final boolean doTeam = true;\r
// static final boolean doInstitution = true;\r
-// \r
+//\r
// //MediaEntities\r
// static final boolean doCollection = true;\r
// static final boolean doReferenceBase = true;\r
-// \r
+//\r
// //SpecimenOrObservationBase\r
// static final boolean doFieldObservation = true;\r
// static final boolean doDeriveUnit = true;\r
// static final boolean doLivingBeing = true;\r
// static final boolean doObservation = true;\r
// static final boolean doSpecimen = true;\r
-// \r
+//\r
// //Media\r
// static final boolean doMedia = true;\r
// static final boolean doMediaKey = true;\r
// static final boolean doFigure = true;\r
// static final boolean doPhylogenticTree = true;\r
-// \r
-// \r
+//\r
+//\r
// //TaxonBase\r
// static final boolean doTaxon = true;\r
// static final boolean doSynonym = true;\r
-// \r
+//\r
// static final boolean doSequence = true;\r
-// \r
+//\r
// //Names\r
// static final boolean doViralName = true;\r
// static final boolean doNonViralName = true;\r
// static final boolean doBotanicalName = true;\r
// static final boolean doZoologicalName = true;\r
// static final boolean doCultivarPlantName = true;\r
-// \r
+//\r
// static final boolean doClassification = true;\r
-// \r
+//\r
// //TermBase\r
// static final boolean doFeatureTree = true;\r
// static final boolean doPolytomousKey = true;\r
-// \r
+//\r
// static final boolean doTermVocabulary = true;\r
// static final boolean doDefinedTermBase = true;\r
-// \r
- \r
+//\r
+\r
\r
}\r