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.
9 package eu
.etaxonomy
.cdm
.app
.sdd
;
11 import java
.net
.URISyntaxException
;
13 import org
.apache
.logging
.log4j
.LogManager
;
14 import org
.apache
.logging
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
17 import eu
.etaxonomy
.cdm
.common
.URI
;
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
.IImportConfigurator
.CHECK
;
22 import eu
.etaxonomy
.cdm
.io
.sdd
.in
.SDDImportConfigurator
;
28 public class CicadActivator
{
30 @SuppressWarnings("unused")
31 private static final Logger logger
= LogManager
.getLogger();
33 //database validation status (create, update, validate ...)
34 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.CREATE
;
35 static final String sddSource
= SDDSources
.Cicad_local();
36 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
37 static final ICdmDataSource cdmDestination
= CdmDestinations
.localH2();
39 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_portal_test_localhost();
41 static final String sourceSecId
= "Cicad_pub_ed_999999";
44 static final CHECK check
= CHECK
.IMPORT_WITHOUT_CHECK
;
49 public static void main(String
[] args
) {
50 System
.out
.println("Start import from SDD("+ sddSource
.toString() + ") ...");
55 source
= new URI(sddSource
);
56 ICdmDataSource destination
= cdmDestination
;
58 SDDImportConfigurator sddImportConfigurator
= SDDImportConfigurator
.NewInstance(source
, destination
);
60 sddImportConfigurator
.setSourceSecId(sourceSecId
);
62 sddImportConfigurator
.setCheck(check
);
63 sddImportConfigurator
.setDbSchemaValidation(hbm2dll
);
66 CdmDefaultImport
<SDDImportConfigurator
> sddImport
= new CdmDefaultImport
<SDDImportConfigurator
>();
68 sddImport
.invoke(sddImportConfigurator
);
69 System
.out
.println("End import from SDD ("+ source
.toString() + ")...");
70 } catch (URISyntaxException e
) {