1 |
83863ca3
|
a.babadshanjan
|
/**
|
2 |
|
|
* Copyright (C) 2008 EDIT
|
3 |
b41ebb00
|
Katja Luther
|
* European Distributed Institute of Taxonomy
|
4 |
83863ca3
|
a.babadshanjan
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
package eu.etaxonomy.cdm.io.common;
|
8 |
|
|
|
9 |
|
|
import org.apache.log4j.Logger;
|
10 |
|
|
|
11 |
ad5965e7
|
Andreas Müller
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
12 |
83863ca3
|
a.babadshanjan
|
|
13 |
|
|
/**
|
14 |
6b2cc8fd
|
Andreas Müller
|
* This is an exporter that invokes the application aware defaultExport when invoked itself
|
15 |
83863ca3
|
a.babadshanjan
|
* @author a.babadshanjan
|
16 |
|
|
* @created 17.11.2008
|
17 |
|
|
*/
|
18 |
fc174c77
|
Andreas Müller
|
public class CdmDefaultExport<T extends IExportConfigurator>
|
19 |
|
|
extends CdmDefaultIOBase<IExportConfigurator>
|
20 |
|
|
implements ICdmExporter<T> {
|
21 |
6b2cc8fd
|
Andreas Müller
|
@SuppressWarnings("unused")
|
22 |
83863ca3
|
a.babadshanjan
|
private static final Logger logger = Logger.getLogger(CdmDefaultExport.class);
|
23 |
|
|
|
24 |
b41ebb00
|
Katja Luther
|
@Override
|
25 |
|
|
public ExportResult invoke(T config){
|
26 |
ad5965e7
|
Andreas Müller
|
ICdmDataSource source = config.getSource();
|
27 |
|
|
return invoke(config, source);
|
28 |
|
|
}
|
29 |
b41ebb00
|
Katja Luther
|
|
30 |
|
|
|
31 |
6c383b9f
|
Andreas Müller
|
/**
|
32 |
|
|
* @param config
|
33 |
|
|
* @param source
|
34 |
|
|
* @return
|
35 |
|
|
*/
|
36 |
b41ebb00
|
Katja Luther
|
public ExportResult invoke(IExportConfigurator config, ICdmDataSource source) {
|
37 |
f1badf83
|
Katja Luther
|
ExportResult result = ExportResult.NewInstance(config.getResultType());
|
38 |
ad5965e7
|
Andreas Müller
|
boolean createNew = false;
|
39 |
6c383b9f
|
Andreas Müller
|
boolean omitTermLoading = false;
|
40 |
ad5965e7
|
Andreas Müller
|
if (startApplicationController(config, source, omitTermLoading, createNew) == false){
|
41 |
b41ebb00
|
Katja Luther
|
String message = "Application conext could not be started";
|
42 |
|
|
result.addError(message);
|
43 |
|
|
return result;
|
44 |
ad5965e7
|
Andreas Müller
|
}else{
|
45 |
fc174c77
|
Andreas Müller
|
CdmApplicationAwareDefaultExport<IExportConfigurator> defaultExport =
|
46 |
|
|
(CdmApplicationAwareDefaultExport<IExportConfigurator>)getCdmAppController().getBean("defaultExport");
|
47 |
ad5965e7
|
Andreas Müller
|
return defaultExport.invoke(config);
|
48 |
83863ca3
|
a.babadshanjan
|
}
|
49 |
|
|
}
|
50 |
b41ebb00
|
Katja Luther
|
|
51 |
83863ca3
|
a.babadshanjan
|
}
|