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
.InvocationTargetException
;
13 import java
.lang
.reflect
.Method
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.common
.AccountStore
;
18 import eu
.etaxonomy
.cdm
.database
.CdmDataSource
;
19 import eu
.etaxonomy
.cdm
.database
.DatabaseTypeEnum
;
20 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
22 public class CdmDestinations
{
23 @SuppressWarnings("unused")
24 private static Logger logger
= Logger
.getLogger(CdmDestinations
.class);
26 public static ICdmDataSource
cdm_redlist_localhost(){
27 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
28 String cdmServer
= "localhost";
29 String cdmDB
= "cdm_production_rl_lumbricidae";
30 String cdmUserName
= "root";
31 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
34 public static ICdmDataSource
cdm_redlist_lumbricidae(){
35 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
36 String cdmServer
= "160.45.63.171";
37 String cdmDB
= "cdm_production_rl_lumbricidae";
38 String cdmUserName
= "edit";
39 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
42 public static ICdmDataSource
cdm_testDB_localhost(){
43 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
44 String cdmServer
= "localhost";
45 String cdmDB
= "testDB";
46 String cdmUserName
= "root";
47 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
50 public static ICdmDataSource
cdm_test_useSummary(){
51 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
52 String cdmServer
= "localhost";
53 String cdmDB
= "palmae_2011_07_17";
54 String cdmUserName
= "root";
55 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
58 public static ICdmDataSource
cdm_test_local_mysql(){
59 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
60 String cdmServer
= "127.0.0.1";
61 String cdmDB
= "cdm_test";
62 String cdmUserName
= "root";
63 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
67 public static ICdmDataSource
cdm_test_local_mysql_moose(){
68 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
69 String cdmServer
= "127.0.0.1";
70 String cdmDB
= "moose";
71 String cdmUserName
= "edit";
72 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
75 public static ICdmDataSource
cdm_test_local_mysql_standardliste(){
76 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
77 String cdmServer
= "127.0.0.1";
78 String cdmDB
= "standardliste";
79 String cdmUserName
= "root";
80 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
82 public static ICdmDataSource
cdm_test_local_mysql_standardliste2(){
83 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
84 String cdmServer
= "127.0.0.1";
85 String cdmDB
= "standardliste2";
86 String cdmUserName
= "root";
87 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
91 public static ICdmDataSource
cdm_test_local_mysql_dwca(){
92 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
93 String cdmServer
= "127.0.0.1";
94 String cdmDB
= "dwca";
95 String cdmUserName
= "edit";
96 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
100 public static ICdmDataSource
cdm_test_local_mysql_fdac(){
101 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
102 String cdmServer
= "127.0.0.1";
103 String cdmDB
= "fdac";
104 String cdmUserName
= "edit";
105 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
108 public static ICdmDataSource
cdm_test_local_mysql_test(){
109 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
110 String cdmServer
= "127.0.0.1";
111 String cdmDB
= "test";
112 String cdmUserName
= "edit"; //root on pesiimport2
113 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
116 public static ICdmDataSource
cdm_test_local_euromed(){
117 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
118 String cdmServer
= "127.0.0.1";
119 String cdmDB
= "euroMed";
120 String cdmUserName
= "root";
121 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
124 public static ICdmDataSource
cdm_test_local_euromed2(){
125 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
126 String cdmServer
= "127.0.0.1";
127 String cdmDB
= "euroMed2";
128 String cdmUserName
= "root";
129 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
131 public static ICdmDataSource
cdm_test_local_euromed3(){
132 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
133 String cdmServer
= "127.0.0.1";
134 String cdmDB
= "euroMed3";
135 String cdmUserName
= "root";
136 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
140 public static ICdmDataSource
cdm_local_EDITImport(){
141 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
142 String cdmServer
= "127.0.0.1";
143 String cdmDB
= "EDITImport";
144 String cdmUserName
= "edit"; //root on pesiimport2
145 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
148 public static ICdmDataSource
cdm_test_euroMed(){
149 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
150 String cdmServer
= "160.45.63.175";
151 String cdmDB
= "cdm_test_euromed";
152 String cdmUserName
= "edit";
153 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
156 public static ICdmDataSource
cdm_pesi_euromed(){
157 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
158 String cdmServer
= "160.45.63.175";
159 String cdmDB
= "cdm_pesi_euromed";
160 String cdmUserName
= "edit";
161 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
164 public static ICdmDataSource
cdm_corvidae_dev(){
165 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
166 String cdmServer
= "160.45.63.175";
167 String cdmDB
= "cdm_corvidae";
168 String cdmUserName
= "edit";
169 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
172 public static ICdmDataSource
cdm_ildis_dev(){
173 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
174 String cdmServer
= "160.45.63.175";
175 String cdmDB
= "cdm_edit_ildis";
176 String cdmUserName
= "edit";
177 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
181 // public static ICdmDataSource cdm_ildis_production(){
182 // DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
183 // String cdmServer = "160.45.63.171";
184 // String cdmDB = "cdm_edit_ildis";
185 // String cdmUserName = "edit";
186 // return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
190 public static ICdmDataSource
cdm_redlist_moose_dev(){
191 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
192 String cdmServer
= "160.45.63.175";
193 String cdmDB
= "cdm_mt_moose";
194 String cdmUserName
= "edit";
195 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
198 public static ICdmDataSource
cdm_redlist_standardlist_dev(){
199 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
200 String cdmServer
= "160.45.63.175";
201 String cdmDB
= "cdm_mt_standardliste";
202 String cdmUserName
= "edit";
203 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
206 public static ICdmDataSource
cdm_cyprus_dev(){
207 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
208 String cdmServer
= "160.45.63.175";
209 String cdmDB
= "cdm_cyprus";
210 String cdmUserName
= "edit";
211 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
214 public static ICdmDataSource
cdm_cyprus_production(){
215 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
216 String cdmServer
= "160.45.63.171";
217 String cdmDB
= "cdm_production_cyprus";
218 String cdmUserName
= "edit";
219 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
222 public static ICdmDataSource
cdm_cyprus_production_tunnel(){
223 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
224 String cdmServer
= "127.0.0.1";
226 String cdmDB
= "cdm_production_cyprus";
227 String cdmUserName
= "edit";
228 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
231 public static ICdmDataSource
cdm_cyprus_dev_tunnel(){
232 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
233 String cdmServer
= "127.0.0.1";
235 String cdmDB
= "cdm_cyprus";
236 String cdmUserName
= "edit";
237 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
240 public static ICdmDataSource
cdm_campanulaceae_production(){
241 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
242 String cdmServer
= "160.45.63.171";
243 String cdmDB
= "cdm_production_campanulaceae";
244 String cdmUserName
= "edit";
245 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
248 public static ICdmDataSource
cdm_flora_malesiana_preview(){
249 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
250 String cdmServer
= "160.45.63.175";
251 String cdmDB
= "cdm_edit_flora_malesiana";
252 String cdmUserName
= "edit";
253 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
256 public static ICdmDataSource
cdm_flora_malesiana_production(){
257 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
258 String cdmServer
= "160.45.63.171";
259 String cdmDB
= "cdm_production_flora_malesiana";
260 String cdmUserName
= "edit";
261 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
264 public static ICdmDataSource
cdm_portal_test_localhost(){
265 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
266 String cdmServer
= "127.0.0.1";
267 String cdmDB
= "cdm_portal_test";
268 String cdmUserName
= "edit";
269 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
272 public static ICdmDataSource
cdm_portal_test_localhost2(){
273 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
274 String cdmServer
= "127.0.0.1";
275 String cdmDB
= "cdm_portal_test2";
276 String cdmUserName
= "edit";
277 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
280 public static ICdmDataSource
cdm_local_cichorieae(){
281 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
282 String cdmServer
= "127.0.0.1";
283 String cdmDB
= "cdm_edit_cichorieae";
284 String cdmUserName
= "edit";
285 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
288 public static ICdmDataSource
cdm_local_dipera(){
289 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
290 String cdmServer
= "127.0.0.1";
291 String cdmDB
= "cdm_edit_diptera";
292 String cdmUserName
= "edit";
293 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
296 public static ICdmDataSource
cdm_local_palmae(){
297 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
298 String cdmServer
= "127.0.0.1";
299 String cdmDB
= "cdm_edit_palmae";
300 String cdmUserName
= "edit";
301 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
304 public static ICdmDataSource
cdm_globis_dev(){
305 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
306 String cdmServer
= "160.45.63.175";
307 String cdmDB
= "cdm_edit_globis";
308 String cdmUserName
= "edit";
309 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
312 public static ICdmDataSource
cdm_globis_production(){
313 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
314 String cdmServer
= "160.45.63.171";
315 String cdmDB
= "cdm_production_globis";
316 String cdmUserName
= "edit";
317 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
320 public static ICdmDataSource
cdm_local_globis(){
321 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
322 String cdmServer
= "127.0.0.1";
323 String cdmDB
= "cdm_globis";
324 String cdmUserName
= "edit";
325 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
328 public static ICdmDataSource
cdm_local_postgres_CdmTest(){
329 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
330 String cdmServer
= "127.0.0.1";
331 String cdmDB
= "CdmTest";
332 String cdmUserName
= "edit";
333 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
336 public static ICdmDataSource
cdm_local_tdwg2010(){
337 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
338 String cdmServer
= "127.0.0.1";
339 String cdmDB
= "cdm_tdwg2010";
340 String cdmUserName
= "edit";
341 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
345 public static ICdmDataSource
NULL(){
350 public static ICdmDataSource
localH2(){
351 return CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
354 public static ICdmDataSource
localH2(String database
, String username
, String filePath
){
355 return CdmDataSource
.NewH2EmbeddedInstance(database
, "sa", "", filePath
, null);
358 public static ICdmDataSource
localH2Salvador(){
359 return CdmDataSource
.NewH2EmbeddedInstance("salvador", "sa", "");
362 public static ICdmDataSource
localH2Armeria(){
363 return CdmDataSource
.NewH2EmbeddedInstance("armeria", "sa", "");
366 public static ICdmDataSource
localH2Standardliste(){
367 return CdmDataSource
.NewH2EmbeddedInstance("standardliste", "sa", "");
370 public static ICdmDataSource
localH2Cichorieae(){
371 return CdmDataSource
.NewH2EmbeddedInstance("cichorieae", "sa", "");
374 public static ICdmDataSource
localH2Palmae(){
375 return CdmDataSource
.NewH2EmbeddedInstance("palmae", "sa", "");
378 public static ICdmDataSource
localH2EuroMed(){
379 return CdmDataSource
.NewH2EmbeddedInstance("euroMed", "sa", "");
382 public static ICdmDataSource
localH2Erms(){
383 return CdmDataSource
.NewH2EmbeddedInstance("erms", "sa", "");
387 public static ICdmDataSource
cdm_algaterra_preview(){
388 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
389 String cdmServer
= "160.45.63.175";
390 String cdmDB
= "cdm_edit_algaterra";
391 String cdmUserName
= "edit";
392 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
395 public static ICdmDataSource
cdm_algaterra_production(){
396 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
397 String cdmServer
= "160.45.63.171";
398 String cdmDB
= "cdm_production_algaterra";
399 String cdmUserName
= "edit";
400 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
403 public static ICdmDataSource
cdm_edit_cichorieae_local_PG(){
404 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
405 String cdmServer
= "127.0.0.1";
406 String cdmDB
= "cdm_edit_cichorieae_a";
407 String cdmUserName
= "edit";
409 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
412 public static ICdmDataSource
cdm_cichorieae_preview(){
413 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
414 String cdmServer
= "160.45.63.175";
415 String cdmDB
= "cdm_edit_cichorieae";
416 String cdmUserName
= "edit";
417 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
420 public static ICdmDataSource
cdm_production_cichorieae(){
421 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
422 String cdmServer
= "160.45.63.171";
423 // String cdmServer = "127.0.0.1";
424 String cdmDB
= "cdm_production_cichorieae";
425 String cdmUserName
= "edit";
426 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
429 public static ICdmDataSource
cdm_production_palmae(){
430 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
431 String cdmServer
= "160.45.63.171";
432 String cdmDB
= "cdm_production_palmae";
433 String cdmUserName
= "edit";
434 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
437 public static ICdmDataSource
cdm_production_flora_deutschland(){
438 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
439 String cdmServer
= "160.45.63.171";
440 String cdmDB
= "cdm_production_rl_standardliste";
441 String cdmUserName
= "edit";
442 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
445 public static ICdmDataSource
cdm_production_caryophyllales(){
446 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
447 String cdmServer
= "160.45.63.171";
448 String cdmDB
= "cdm_production_caryophyllales";
449 String cdmUserName
= "edit";
450 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
454 public static ICdmDataSource
cdm_production_diptera(){
455 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
456 String cdmServer
= "160.45.63.171";
457 String cdmDB
= "cdm_production_diptera";
458 String cdmUserName
= "edit";
459 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
462 public static ICdmDataSource
cdm_edit_cichorieae_preview(){
463 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
464 String cdmServer
= "127.0.0.1";
465 String cdmDB
= "cdm_edit_cichorieae";
466 String cdmUserName
= "edit";
468 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
471 public static ICdmDataSource
cdm_edit_cichorieae_preview_direct(){
472 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
473 String cdmServer
= "160.45.63.175";
474 String cdmDB
= "cdm_edit_cichorieae";
475 String cdmUserName
= "edit";
477 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
480 public static ICdmDataSource
cdm_production_piB(String database
){
481 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
482 String cdmServer
= "160.45.63.171";
483 String cdmDB
= "cdm_production_" + database
+ "_pilot";
484 String cdmUserName
= "edit";
485 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
488 public static ICdmDataSource
cdm_local_piB(String database
){
489 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
490 String cdmServer
= "127.0.0.1";
491 String cdmDB
= "piB_" + database
;
492 String cdmUserName
= "root";
493 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
499 public static ICdmDataSource
mon_cdm() {
500 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
501 String cdmServer
= "localhost";
502 String cdmDB
= "cdm_local";
503 String cdmUserName
= "root";
504 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
507 public static ICdmDataSource
proibiosphere_chenopodium_local() {
508 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
509 String cdmServer
= "localhost";
510 String cdmDB
= "cdm_production_proibiosphere_chenopodium_pilot";
511 String cdmUserName
= "root";
512 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
515 public static ICdmDataSource
proibiosphere_ants_local() {
516 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
517 String cdmServer
= "localhost";
518 String cdmDB
= "cdm_production_proibiosphere_ants_pilot";
519 String cdmUserName
= "root";
520 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
523 public static ICdmDataSource
proibiosphere_fungi_local() {
524 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
525 String cdmServer
= "localhost";
526 String cdmDB
= "cdm_production_proibiosphere_fungi_pilot";
527 String cdmUserName
= "root";
528 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
531 public static ICdmDataSource
proibiosphere_campylopus_local() {
532 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
533 String cdmServer
= "localhost";
534 String cdmDB
= "cdm_production_proibiosphere_campylopus_pilot";
535 String cdmUserName
= "root";
536 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
540 public static ICdmDataSource
proibiosphere_eupolybothrus_local() {
541 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
542 String cdmServer
= "localhost";
543 String cdmDB
= "cdm_production_proibiosphere_eupolybothrus_pilot";
544 String cdmUserName
= "root";
545 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
548 public static ICdmDataSource
proibiosphere_spiders_local() {
549 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
550 String cdmServer
= "localhost";
551 String cdmDB
= "cdm_production_proibiosphere_spiders_pilot";
552 String cdmUserName
= "root";
553 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
555 // public static ICdmDataSource LAPTOP_HP(){
556 // DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005;
557 // String cdmServer = "LAPTOPHP";
558 // String cdmDB = "cdmTest";
559 // String cdmUserName = "edit";
560 // return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
568 * TODO only supports MySQL and PostgreSQL
578 public static ICdmDataSource
makeDestination(DatabaseTypeEnum dbType
, String cdmServer
, String cdmDB
, int port
, String cdmUserName
, String pwd
){
579 //establish connection
580 pwd
= AccountStore
.readOrStorePassword(cdmServer
, cdmDB
, cdmUserName
, pwd
);
581 ICdmDataSource destination
;
582 if(dbType
.equals(DatabaseTypeEnum
.MySQL
)){
583 destination
= CdmDataSource
.NewMySqlInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
584 } else if(dbType
.equals(DatabaseTypeEnum
.PostgreSQL
)){
585 destination
= CdmDataSource
.NewPostgreSQLInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
588 throw new RuntimeException("Unsupported DatabaseType");
596 * Accepts a string array and tries to find a method returning an ICdmDataSource with
597 * the name of the given first string in the array
602 public static ICdmDataSource
chooseDestination(String
[] args
) {
607 if(args
.length
!= 1) {
611 String possibleDestination
= args
[0];
613 Method
[] methods
= CdmDestinations
.class.getMethods();
615 for (Method method
: methods
){
616 if(method
.getName().equals(possibleDestination
)){
618 return (ICdmDataSource
) method
.invoke(null, null);
619 } catch (Exception e
) {
621 throw new RuntimeException(e
);