Revision 433297e7
Added by Andreas Müller over 9 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/jaxb/JaxbImportActivator.java | ||
---|---|---|
26 | 26 |
/** |
27 | 27 |
* @author a.babadshanjan |
28 | 28 |
* @created 25.09.2008 |
29 |
* |
|
30 |
* NOTE: the result may go into |
|
31 |
* cdmlib-persistence\target\test-classes\eu\etaxonomy\cdm\h2\LocalH2 |
|
29 | 32 |
*/ |
30 | 33 |
public class JaxbImportActivator { |
31 | 34 |
|
32 | 35 |
/* SerializeFrom DB **/ |
33 | 36 |
// private static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test(); |
34 |
private static final ICdmDataSource cdmDestination = CdmDestinations.localH2Standardliste(); |
|
37 |
//if you run from IDE it may run into {cdmlib-folder}\cdmlib-persistence\target\test-classes\eu\etaxonomy\cdm\h2\LocalH2\ |
|
38 |
private static final ICdmDataSource cdmDestination = CdmDestinations.localH2Armeria(); |
|
35 | 39 |
|
36 | 40 |
|
37 | 41 |
// Import: |
38 | 42 |
private static String importFileNameString = |
39 | 43 |
//"C:\\workspace\\cdmlib_2.2\\cdmlib-io\\src\\test\\resources\\eu\\etaxonomy\\cdm\\io\\jaxb\\export_test_app_import.xml"; |
40 | 44 |
// "file:/C:/export_test_app_import.xml"; |
41 |
// "file:/C:/localCopy/Data/kr�hen/201206141338-jaxb_export-cdm.xml"; |
|
42 | 45 |
// "file:/C:/opt/data/rl/201406041541-jaxb_export-Regenwuermer.xml"; |
43 | 46 |
// "file:/C:/opt/data/rl/201406241132-jaxb_export-Armeria.xml"; |
44 |
"file:////PESIIMPORT3/redlist/standardliste/standardliste_jaxb.xml"; |
|
47 |
// "file:/F:/data/redlist/standardliste/standardliste_jaxb.xml"; |
|
48 |
// "//PESIIMPORT3/redlist/standardliste/standardliste_jaxb.xml"; |
|
49 |
"//PESIIMPORT3/redlist/201411261400-jaxb_export-armeria_demo_local.xml"; |
|
50 |
|
|
51 |
|
|
52 |
|
|
45 | 53 |
|
46 | 54 |
|
47 | 55 |
/** NUMBER_ROWS_TO_RETRIEVE = 0 is the default case to retrieve all rows. |
... | ... | |
137 | 145 |
|
138 | 146 |
JaxbImportActivator jia = new JaxbImportActivator(); |
139 | 147 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
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()); |
|
148 |
String fileStr = chooseFile(args)!= null ? chooseFile(args) : importFileNameString; |
|
149 |
File file = new File(fileStr); |
|
147 | 150 |
|
148 |
|
|
149 |
File fileTest = new File(uri); |
|
150 |
exists = fileTest.exists(); |
|
151 |
// System.out.println(exists); |
|
152 |
|
|
153 |
|
|
154 |
CdmApplicationController appCtr = null; |
|
155 |
// appCtr = jia.initDb(destination); |
|
156 |
|
|
151 |
URI uri = file.toURI(); |
|
152 |
System.out.println(new File(uri).exists()); |
|
153 |
if (! new File(uri).exists()){ |
|
154 |
System.out.println("File does not exist! Exit"); |
|
155 |
return; |
|
156 |
} |
|
157 | 157 |
jia.invokeImport(uri, destination); |
158 | 158 |
} |
159 | 159 |
|
Also available in: Unified diff
some new JAXB io infos