2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.app
.common
;
12 import java
.lang
.reflect
.Method
;
14 import org
.apache
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.common
.AccountStore
;
17 import eu
.etaxonomy
.cdm
.database
.CdmDataSource
;
18 import eu
.etaxonomy
.cdm
.database
.DatabaseTypeEnum
;
19 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
21 public class CdmDestinations
{
22 @SuppressWarnings("unused")
23 private static Logger logger
= Logger
.getLogger(CdmDestinations
.class);
25 public static ICdmDataSource
cdm_redlist_animalia_localhost(){
26 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
27 String cdmServer
= "localhost";
28 String cdmDB
= "cdm_bfn_imports_animalia";
29 String cdmUserName
= "edit";
30 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
33 public static ICdmDataSource
cdm_redlist_animalia_production(){
34 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
35 String cdmServer
= "160.45.63.171";
36 String cdmDB
= "cdm_production_rl_animals";
37 String cdmUserName
= "edit";
38 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
41 public static ICdmDataSource
cdm_redlist_plant_localhost(){
42 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
43 String cdmServer
= "localhost";
44 String cdmDB
= "cdm_bfn_imports_plants";
45 String cdmUserName
= "edit";
46 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
49 public static ICdmDataSource
cdm_redlist_lumbricidae(){
50 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
51 String cdmServer
= "160.45.63.171";
52 String cdmDB
= "cdm_production_rl_lumbricidae";
53 String cdmUserName
= "edit";
54 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
57 public static ICdmDataSource
cdm_testDB_localhost(){
58 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
59 String cdmServer
= "localhost";
60 String cdmDB
= "testDB";
61 String cdmUserName
= "root";
62 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
65 public static ICdmDataSource
cdm_test_useSummary(){
66 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
67 String cdmServer
= "localhost";
68 String cdmDB
= "palmae_2011_07_17";
69 String cdmUserName
= "root";
70 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
73 public static ICdmDataSource
cdm_test_local_mysql(){
74 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
75 String cdmServer
= "127.0.0.1";
76 String cdmDB
= "cdm_test";
77 String cdmUserName
= "root";
78 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
82 public static ICdmDataSource
cdm_test_local_mysql_moose(){
83 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
84 String cdmServer
= "127.0.0.1";
85 String cdmDB
= "moose";
86 String cdmUserName
= "edit";
87 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
90 public static ICdmDataSource
cdm_test_local_mysql_standardliste(){
91 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
92 String cdmServer
= "127.0.0.1";
93 String cdmDB
= "standardliste";
94 String cdmUserName
= "root";
95 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
99 public static ICdmDataSource
cdm_test_local_mysql_dwca(){
100 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
101 String cdmServer
= "127.0.0.1";
102 String cdmDB
= "dwca";
103 String cdmUserName
= "edit";
104 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
108 public static ICdmDataSource
cdm_test_local_mysql_fdac(){
109 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
110 String cdmServer
= "127.0.0.1";
111 String cdmDB
= "fdac";
112 String cdmUserName
= "edit";
113 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
116 public static ICdmDataSource
cdm_test_local_mysql_test(){
117 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
118 String cdmServer
= "127.0.0.1";
119 String cdmDB
= "test";
120 String cdmUserName
= "edit"; //root on pesiimport2
121 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
124 public static ICdmDataSource
cdm_test_local_euromed(){
125 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
126 String cdmServer
= "127.0.0.1";
127 String cdmDB
= "euroMed";
128 String cdmUserName
= "root";
129 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
132 public static ICdmDataSource
cdm_test_local_euromed2(){
133 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
134 String cdmServer
= "127.0.0.1";
135 String cdmDB
= "euroMed2";
136 String cdmUserName
= "root";
137 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
139 public static ICdmDataSource
cdm_test_local_euromed3(){
140 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
141 String cdmServer
= "127.0.0.1";
142 String cdmDB
= "euroMed3";
143 String cdmUserName
= "root";
144 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
147 public static ICdmDataSource
cdm_test_col(){
148 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
149 String cdmServer
= "160.45.63.175";
150 String cdmDB
= "cdm_col";
151 String cdmUserName
= "edit";
152 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
155 public static ICdmDataSource
cdm_test_col2(){
156 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
157 String cdmServer
= "160.45.63.175";
158 String cdmDB
= "cdm_col2";
159 String cdmUserName
= "edit";
160 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
163 public static ICdmDataSource
cdm_col_local(){
164 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
165 String cdmServer
= "127.0.0.1";
166 String cdmDB
= "col_test";
167 String cdmUserName
= "edit";
168 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
171 public static ICdmDataSource
cdm_col2_local(){
172 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
173 String cdmServer
= "127.0.0.1";
174 String cdmDB
= "col_test2";
175 String cdmUserName
= "edit";
176 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
180 public static ICdmDataSource
cdm_local_EDITImport(){
181 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
182 String cdmServer
= "127.0.0.1";
183 String cdmDB
= "EDITImport";
184 String cdmUserName
= "edit"; //root on pesiimport2
185 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
188 public static ICdmDataSource
cdm_test_euroMed(){
189 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
190 String cdmServer
= "160.45.63.175";
191 String cdmDB
= "cdm_test_euromed";
192 String cdmUserName
= "edit";
193 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
196 public static ICdmDataSource
cdm_pesi_euromed(){
197 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
198 String cdmServer
= "160.45.63.175";
199 String cdmDB
= "cdm_pesi_euromed";
200 String cdmUserName
= "edit";
201 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
204 public static ICdmDataSource
cdm_corvidae_dev(){
205 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
206 String cdmServer
= "160.45.63.175";
207 String cdmDB
= "cdm_corvidae";
208 String cdmUserName
= "edit";
209 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
212 public static ICdmDataSource
cdm_ildis_dev(){
213 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
214 String cdmServer
= "160.45.63.175";
215 String cdmDB
= "cdm_edit_ildis";
216 String cdmUserName
= "edit";
217 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
221 // public static ICdmDataSource cdm_ildis_production(){
222 // DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
223 // String cdmServer = "160.45.63.171";
224 // String cdmDB = "cdm_edit_ildis";
225 // String cdmUserName = "edit";
226 // return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
230 public static ICdmDataSource
cdm_redlist_moose_dev(){
231 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
232 String cdmServer
= "160.45.63.175";
233 String cdmDB
= "cdm_mt_moose";
234 String cdmUserName
= "edit";
235 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
238 public static ICdmDataSource
cdm_redlist_moose_production(){
239 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
240 String cdmServer
= "160.45.63.171";
241 String cdmDB
= "cdm_production_rl_moose";
242 String cdmUserName
= "edit";
243 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
246 public static ICdmDataSource
cdm_redlist_standardlist_dev(){
247 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
248 String cdmServer
= "160.45.63.175";
249 String cdmDB
= "cdm_mt_standardliste";
250 String cdmUserName
= "edit";
251 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
254 public static ICdmDataSource
cdm_cyprus_dev(){
255 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
256 String cdmServer
= "160.45.63.175";
257 String cdmDB
= "cdm_cyprus";
258 String cdmUserName
= "edit";
259 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
262 public static ICdmDataSource
cdm_cyprus_production(){
263 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
264 String cdmServer
= "160.45.63.171";
265 String cdmDB
= "cdm_production_cyprus";
266 String cdmUserName
= "edit";
267 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
270 public static ICdmDataSource
cdm_cyprus_production_tunnel(){
271 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
272 String cdmServer
= "127.0.0.1";
274 String cdmDB
= "cdm_production_cyprus";
275 String cdmUserName
= "edit";
276 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
279 public static ICdmDataSource
cdm_cyprus_dev_tunnel(){
280 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
281 String cdmServer
= "127.0.0.1";
283 String cdmDB
= "cdm_cyprus";
284 String cdmUserName
= "edit";
285 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
288 public static ICdmDataSource
cdm_campanulaceae_production(){
289 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
290 String cdmServer
= "160.45.63.171";
291 String cdmDB
= "cdm_production_campanulaceae";
292 String cdmUserName
= "edit";
293 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
296 public static ICdmDataSource
cdm_flora_malesiana_preview(){
297 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
298 String cdmServer
= "160.45.63.175";
299 String cdmDB
= "cdm_edit_flora_malesiana";
300 String cdmUserName
= "edit";
301 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
304 public static ICdmDataSource
cdm_flora_malesiana_production(){
305 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
306 String cdmServer
= "160.45.63.171";
307 String cdmDB
= "cdm_production_flora_malesiana";
308 String cdmUserName
= "edit";
309 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
312 public static ICdmDataSource
cdm_portal_test_localhost(){
313 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
314 String cdmServer
= "127.0.0.1";
315 String cdmDB
= "cdm_portal_test";
316 String cdmUserName
= "edit";
317 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
320 public static ICdmDataSource
cdm_portal_test_localhost2(){
321 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
322 String cdmServer
= "127.0.0.1";
323 String cdmDB
= "cdm_portal_test2";
324 String cdmUserName
= "edit";
325 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
328 public static ICdmDataSource
cdm_local_cichorieae(){
329 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
330 String cdmServer
= "127.0.0.1";
331 String cdmDB
= "cdm_edit_cichorieae";
332 String cdmUserName
= "edit";
333 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
338 public static ICdmDataSource
cdm_local_palmae(){
339 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
340 String cdmServer
= "127.0.0.1";
341 String cdmDB
= "cdm_edit_caryo";
342 String cdmUserName
= "edit";
343 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
346 public static ICdmDataSource
cdm_local_caryo(){
347 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
348 String cdmServer
= "127.0.0.1";
349 String cdmDB
= "cdm_edit_palmae";
350 String cdmUserName
= "edit";
351 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
354 public static ICdmDataSource
cdm_globis_dev(){
355 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
356 String cdmServer
= "160.45.63.175";
357 String cdmDB
= "cdm_edit_globis";
358 String cdmUserName
= "edit";
359 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
362 public static ICdmDataSource
cdm_globis_production(){
363 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
364 String cdmServer
= "160.45.63.171";
365 String cdmDB
= "cdm_production_globis";
366 String cdmUserName
= "edit";
367 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
370 public static ICdmDataSource
cdm_local_globis(){
371 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
372 String cdmServer
= "127.0.0.1";
373 String cdmDB
= "cdm_globis";
374 String cdmUserName
= "edit";
375 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
378 public static ICdmDataSource
cdm_local_postgres_CdmTest(){
379 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
380 String cdmServer
= "127.0.0.1";
381 String cdmDB
= "CdmTest";
382 String cdmUserName
= "edit";
383 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
386 public static ICdmDataSource
cdm_local_tdwg2010(){
387 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
388 String cdmServer
= "127.0.0.1";
389 String cdmDB
= "cdm_tdwg2010";
390 String cdmUserName
= "edit";
391 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
395 public static ICdmDataSource
NULL(){
400 public static ICdmDataSource
localH2(){
401 return CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
404 public static ICdmDataSource
localH2(String database
, String username
, String filePath
){
405 return CdmDataSource
.NewH2EmbeddedInstance(database
, "sa", "", filePath
, null);
408 public static ICdmDataSource
localH2Salvador(){
409 return CdmDataSource
.NewH2EmbeddedInstance("salvador", "sa", "");
412 public static ICdmDataSource
localH2Armeria(){
413 return CdmDataSource
.NewH2EmbeddedInstance("armeria", "sa", "");
416 public static ICdmDataSource
localH2Standardliste(){
417 return CdmDataSource
.NewH2EmbeddedInstance("standardliste", "sa", "");
420 public static ICdmDataSource
localH2Cichorieae(){
421 return CdmDataSource
.NewH2EmbeddedInstance("cichorieae", "sa", "");
424 public static ICdmDataSource
localH2Palmae(){
425 return CdmDataSource
.NewH2EmbeddedInstance("palmae", "sa", "");
428 public static ICdmDataSource
localH2EuroMed(){
429 return CdmDataSource
.NewH2EmbeddedInstance("euroMed", "sa", "");
432 public static ICdmDataSource
localH2Erms(){
433 return CdmDataSource
.NewH2EmbeddedInstance("erms", "sa", "");
437 public static ICdmDataSource
cdm_algaterra_preview(){
438 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
439 String cdmServer
= "160.45.63.175";
440 String cdmDB
= "cdm_edit_algaterra";
441 String cdmUserName
= "edit";
442 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
445 public static ICdmDataSource
cdm_algaterra_production(){
446 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
447 String cdmServer
= "160.45.63.171";
448 String cdmDB
= "cdm_production_algaterra";
449 String cdmUserName
= "edit";
450 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
453 public static ICdmDataSource
cdm_edit_cichorieae_local_PG(){
454 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
455 String cdmServer
= "127.0.0.1";
456 String cdmDB
= "cdm_edit_cichorieae_a";
457 String cdmUserName
= "edit";
459 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
462 public static ICdmDataSource
cdm_cichorieae_preview(){
463 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
464 String cdmServer
= "160.45.63.175";
465 String cdmDB
= "cdm_edit_cichorieae";
466 String cdmUserName
= "edit";
467 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
470 public static ICdmDataSource
cdm_production_cichorieae(){
471 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
472 String cdmServer
= "160.45.63.171";
473 // String cdmServer = "127.0.0.1";
474 String cdmDB
= "cdm_production_cichorieae";
475 String cdmUserName
= "edit";
476 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
479 public static ICdmDataSource
cdm_production_palmae(){
480 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
481 String cdmServer
= "160.45.63.171";
482 String cdmDB
= "cdm_production_palmae";
483 String cdmUserName
= "edit";
484 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
487 public static ICdmDataSource
cdm_production_flora_deutschland(){
488 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
489 String cdmServer
= "160.45.63.171";
490 String cdmDB
= "cdm_production_rl_standardliste";
491 String cdmUserName
= "edit";
492 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
495 public static ICdmDataSource
cdm_production_caryophyllales(){
496 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
497 String cdmServer
= "160.45.63.171";
498 String cdmDB
= "cdm_production_caryophyllales";
499 String cdmUserName
= "edit";
500 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
504 public static ICdmDataSource
cdm_production_diptera(){
505 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
506 String cdmServer
= "160.45.63.171";
507 String cdmDB
= "cdm_production_diptera";
508 String cdmUserName
= "edit";
509 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
512 public static ICdmDataSource
cdm_edit_cichorieae_preview(){
513 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
514 String cdmServer
= "127.0.0.1";
515 String cdmDB
= "cdm_edit_cichorieae";
516 String cdmUserName
= "edit";
518 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
521 public static ICdmDataSource
cdm_edit_cichorieae_preview_direct(){
522 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
523 String cdmServer
= "160.45.63.175";
524 String cdmDB
= "cdm_edit_cichorieae";
525 String cdmUserName
= "edit";
527 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
530 public static ICdmDataSource
cdm_production_piB(String database
){
531 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
532 String cdmServer
= "160.45.63.171";
533 String cdmDB
= "cdm_production_" + database
+ "_pilot";
534 String cdmUserName
= "edit";
535 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
538 public static ICdmDataSource
cdm_local_piB(String database
){
539 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
540 String cdmServer
= "127.0.0.1";
541 String cdmDB
= "piB_" + database
;
542 String cdmUserName
= "root";
543 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
549 public static ICdmDataSource
mon_cdm() {
550 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
551 String cdmServer
= "localhost";
552 String cdmDB
= "cdm_local";
553 String cdmUserName
= "root";
554 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
557 public static ICdmDataSource
proibiosphere_chenopodium_local() {
558 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
559 String cdmServer
= "localhost";
560 String cdmDB
= "cdm_production_proibiosphere_chenopodium_pilot";
561 String cdmUserName
= "root";
562 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
565 public static ICdmDataSource
proibiosphere_ants_local() {
566 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
567 String cdmServer
= "localhost";
568 String cdmDB
= "cdm_production_proibiosphere_ants_pilot";
569 String cdmUserName
= "root";
570 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
573 public static ICdmDataSource
proibiosphere_fungi_local() {
574 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
575 String cdmServer
= "localhost";
576 String cdmDB
= "cdm_production_proibiosphere_fungi_pilot";
577 String cdmUserName
= "root";
578 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
581 public static ICdmDataSource
proibiosphere_campylopus_local() {
582 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
583 String cdmServer
= "localhost";
584 String cdmDB
= "cdm_production_proibiosphere_campylopus_pilot";
585 String cdmUserName
= "root";
586 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
590 public static ICdmDataSource
proibiosphere_eupolybothrus_local() {
591 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
592 String cdmServer
= "localhost";
593 String cdmDB
= "cdm_production_proibiosphere_eupolybothrus_pilot";
594 String cdmUserName
= "root";
595 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
598 public static ICdmDataSource
proibiosphere_spiders_local() {
599 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
600 String cdmServer
= "localhost";
601 String cdmDB
= "cdm_production_proibiosphere_spiders_pilot";
602 String cdmUserName
= "root";
603 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
610 * TODO only supports MySQL and PostgreSQL
620 public static ICdmDataSource
makeDestination(DatabaseTypeEnum dbType
, String cdmServer
, String cdmDB
, int port
, String cdmUserName
, String pwd
){
621 //establish connection
622 pwd
= AccountStore
.readOrStorePassword(cdmServer
, cdmDB
, cdmUserName
, pwd
);
623 ICdmDataSource destination
;
624 if(dbType
.equals(DatabaseTypeEnum
.MySQL
)){
625 destination
= CdmDataSource
.NewMySqlInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
626 } else if(dbType
.equals(DatabaseTypeEnum
.PostgreSQL
)){
627 destination
= CdmDataSource
.NewPostgreSQLInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
630 throw new RuntimeException("Unsupported DatabaseType");
638 * Accepts a string array and tries to find a method returning an ICdmDataSource with
639 * the name of the given first string in the array
644 public static ICdmDataSource
chooseDestination(String
[] args
) {
649 if(args
.length
!= 1) {
653 String possibleDestination
= args
[0];
655 Method
[] methods
= CdmDestinations
.class.getMethods();
657 for (Method method
: methods
){
658 if(method
.getName().equals(possibleDestination
)){
660 return (ICdmDataSource
) method
.invoke(null, null);
661 } catch (Exception e
) {
663 throw new RuntimeException(e
);