Revision 003ff122
Added by Andreas Müller over 9 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/jaxb/JaxbImportActivator.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.app.jaxb; |
11 | 11 |
|
12 |
import java.io.File; |
|
12 | 13 |
import java.net.URI; |
13 | 14 |
import java.net.URISyntaxException; |
14 | 15 |
|
... | ... | |
30 | 31 |
|
31 | 32 |
/* SerializeFrom DB **/ |
32 | 33 |
// private static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test(); |
33 |
private static final ICdmDataSource cdmDestination = CdmDestinations.localH2Armeria();
|
|
34 |
private static final ICdmDataSource cdmDestination = CdmDestinations.localH2Standardliste();
|
|
34 | 35 |
|
35 | 36 |
|
36 | 37 |
// Import: |
... | ... | |
39 | 40 |
// "file:/C:/export_test_app_import.xml"; |
40 | 41 |
// "file:/C:/localCopy/Data/kr�hen/201206141338-jaxb_export-cdm.xml"; |
41 | 42 |
// "file:/C:/opt/data/rl/201406041541-jaxb_export-Regenwuermer.xml"; |
42 |
"file:/C:/opt/data/rl/201406241132-jaxb_export-Armeria.xml"; |
|
43 |
// "file:/C:/opt/data/rl/201406241132-jaxb_export-Armeria.xml"; |
|
44 |
"file:////PESIIMPORT3/redlist/standardliste/standardliste_jaxb.xml"; |
|
43 | 45 |
|
44 | 46 |
|
45 | 47 |
/** NUMBER_ROWS_TO_RETRIEVE = 0 is the default case to retrieve all rows. |
... | ... | |
50 | 52 |
|
51 | 53 |
private static final Logger logger = Logger.getLogger(JaxbImportActivator.class); |
52 | 54 |
|
53 |
|
|
54 |
|
|
55 | 55 |
private void invokeImport(String importFileParamString, ICdmDataSource destination) { |
56 | 56 |
try { |
57 | 57 |
JaxbImportConfigurator jaxbImportConfigurator; |
... | ... | |
80 | 80 |
} catch (URISyntaxException e) { |
81 | 81 |
e.printStackTrace(); |
82 | 82 |
} |
83 |
|
|
83 |
} |
|
84 |
|
|
85 |
private void invokeImport(URI importUri, ICdmDataSource destination) { |
|
86 |
JaxbImportConfigurator jaxbImportConfigurator; |
|
87 |
if (destination != null){ |
|
88 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importUri, destination); |
|
89 |
}else { |
|
90 |
jaxbImportConfigurator = JaxbImportConfigurator.NewInstance(importUri, cdmDestination); |
|
91 |
} |
|
92 |
|
|
93 |
CdmDefaultImport<JaxbImportConfigurator> jaxbImport = |
|
94 |
new CdmDefaultImport<JaxbImportConfigurator>(); |
|
95 |
|
|
96 |
|
|
97 |
// invoke import |
|
98 |
logger.debug("Invoking Jaxb import"); |
|
99 |
|
|
100 |
jaxbImport.invoke(jaxbImportConfigurator, destination, true); |
|
84 | 101 |
|
85 | 102 |
} |
86 | 103 |
|
... | ... | |
121 | 138 |
JaxbImportActivator jia = new JaxbImportActivator(); |
122 | 139 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
123 | 140 |
String file = chooseFile(args)!= null ? chooseFile(args) : importFileNameString; |
141 |
|
|
142 |
File file2 = new File("//PESIIMPORT3/redlist/standardliste/standardliste_jaxb.xml"); |
|
143 |
boolean exists = file2.exists(); |
|
144 |
// System.out.println(exists); |
|
145 |
URI uri = file2.toURI(); |
|
146 |
// System.out.println(uri.toString()); |
|
147 |
|
|
148 |
|
|
149 |
File fileTest = new File(uri); |
|
150 |
exists = fileTest.exists(); |
|
151 |
// System.out.println(exists); |
|
152 |
|
|
153 |
|
|
124 | 154 |
CdmApplicationController appCtr = null; |
125 | 155 |
// appCtr = jia.initDb(destination); |
126 | 156 |
|
127 |
jia.invokeImport(file, destination);
|
|
157 |
jia.invokeImport(uri, destination);
|
|
128 | 158 |
} |
129 | 159 |
|
130 | 160 |
} |
Also available in: Unified diff
update JaxbImportActivator