1 |
91138b6c
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
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.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.cdm.app.sdd;
|
11 |
|
|
|
12 |
|
|
import java.net.URI;
|
13 |
|
|
import java.net.URISyntaxException;
|
14 |
|
|
|
15 |
|
|
import org.apache.log4j.Logger;
|
16 |
|
|
|
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.IImportConfigurator.CHECK;
|
22 |
|
|
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* @author h.fradin
|
26 |
|
|
* @created 24.10.2008
|
27 |
|
|
* @version 1.0
|
28 |
|
|
*/
|
29 |
|
|
public class LIASActivator {
|
30 |
|
|
@SuppressWarnings("unused")
|
31 |
|
|
private static Logger logger = Logger.getLogger(LIASActivator.class);
|
32 |
|
|
|
33 |
|
|
//database validation status (create, update, validate ...)
|
34 |
|
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
35 |
|
|
static final String sddSource = SDDSources.LIAS_local();
|
36 |
|
|
static final ICdmDataSource cdmDestination = CdmDestinations.localH2_LIAS();
|
37 |
|
|
|
38 |
|
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_portal_test_localhost();
|
39 |
|
|
|
40 |
|
|
static final String sourceSecId = "LIAS_pub_ed_999999";
|
41 |
|
|
|
42 |
|
|
//check - import
|
43 |
|
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
44 |
|
|
|
45 |
|
|
/**
|
46 |
|
|
* @param args
|
47 |
|
|
*/
|
48 |
|
|
public static void main(String[] args) {
|
49 |
|
|
System.out.println("Start import from SDD("+ sddSource.toString() + ") ...");
|
50 |
|
|
|
51 |
|
|
//make Source
|
52 |
|
|
URI source;
|
53 |
|
|
try {
|
54 |
|
|
source = new URI(sddSource);
|
55 |
|
|
|
56 |
|
|
ICdmDataSource destination = cdmDestination;
|
57 |
|
|
|
58 |
|
|
SDDImportConfigurator sddImportConfigurator = SDDImportConfigurator.NewInstance(source, destination);
|
59 |
|
|
|
60 |
|
|
sddImportConfigurator.setSourceSecId(sourceSecId);
|
61 |
|
|
|
62 |
|
|
sddImportConfigurator.setCheck(check);
|
63 |
|
|
sddImportConfigurator.setDbSchemaValidation(hbm2dll);
|
64 |
|
|
|
65 |
|
|
// invoke import
|
66 |
|
|
CdmDefaultImport<SDDImportConfigurator> sddImport = new CdmDefaultImport<SDDImportConfigurator>();
|
67 |
|
|
|
68 |
|
|
sddImport.invoke(sddImportConfigurator);
|
69 |
|
|
System.out.println("End import from SDD ("+ source.toString() + ")...");
|
70 |
|
|
} catch (URISyntaxException e) {
|
71 |
|
|
e.printStackTrace();
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
}
|