1
|
/**
|
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.io.common;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
|
16
|
/**
|
17
|
* @author a.mueller
|
18
|
* @created 29.01.2009
|
19
|
* @version 1.0
|
20
|
*/
|
21
|
public class CdmDefaultImport<T extends IImportConfigurator> extends CdmDefaultIOBase<IImportConfigurator> implements ICdmImporter<T> {
|
22
|
@SuppressWarnings("unused")
|
23
|
private static final Logger logger = Logger.getLogger(CdmDefaultImport.class);
|
24
|
|
25
|
public boolean invoke(T config){
|
26
|
ICdmDataSource destination = config.getDestination();
|
27
|
boolean omitTermLoading = false;
|
28
|
return invoke(config, destination, omitTermLoading);
|
29
|
}
|
30
|
|
31
|
public boolean invoke(IImportConfigurator config, ICdmDataSource destination, boolean omitTermLoading){
|
32
|
boolean createNew = false;
|
33
|
|
34
|
if (startApplicationController(config, destination, omitTermLoading, createNew) == false){
|
35
|
return false;
|
36
|
}else{
|
37
|
CdmApplicationAwareDefaultImport<?> defaultImport = (CdmApplicationAwareDefaultImport<?>)getCdmAppController().getBean("defaultImport");
|
38
|
return defaultImport.invoke(config);
|
39
|
}
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* Starts the CdmApplicationController if not yet started
|
44
|
* @param config Configuration
|
45
|
* @param destination destination
|
46
|
* @return false if start not successful
|
47
|
*/
|
48
|
public boolean startController(IImportConfigurator config, ICdmDataSource destination){
|
49
|
boolean omitTermLoading = false;
|
50
|
boolean createNew = false;
|
51
|
return startApplicationController(config, destination, omitTermLoading, createNew);
|
52
|
}
|
53
|
|
54
|
}
|