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_localhost(){
26 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
27 String cdmServer
= "localhost";
28 String cdmDB
= "cdm_bfn_imports";
29 String cdmUserName
= "root";
30 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
33 public static ICdmDataSource
cdm_redlist_plant_localhost(){
34 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
35 String cdmServer
= "localhost";
36 String cdmDB
= "cdm_bfn_imports_plants";
37 String cdmUserName
= "root";
38 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
41 public static ICdmDataSource
cdm_redlist_lumbricidae(){
42 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
43 String cdmServer
= "160.45.63.171";
44 String cdmDB
= "cdm_production_rl_lumbricidae";
45 String cdmUserName
= "edit";
46 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
49 public static ICdmDataSource
cdm_testDB_localhost(){
50 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
51 String cdmServer
= "localhost";
52 String cdmDB
= "testDB";
53 String cdmUserName
= "root";
54 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
57 public static ICdmDataSource
cdm_test_useSummary(){
58 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
59 String cdmServer
= "localhost";
60 String cdmDB
= "palmae_2011_07_17";
61 String cdmUserName
= "root";
62 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
65 public static ICdmDataSource
cdm_test_local_mysql(){
66 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
67 String cdmServer
= "127.0.0.1";
68 String cdmDB
= "cdm_test";
69 String cdmUserName
= "root";
70 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
74 public static ICdmDataSource
cdm_test_local_mysql_moose(){
75 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
76 String cdmServer
= "127.0.0.1";
77 String cdmDB
= "moose";
78 String cdmUserName
= "edit";
79 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
82 public static ICdmDataSource
cdm_test_local_mysql_standardliste(){
83 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
84 String cdmServer
= "127.0.0.1";
85 String cdmDB
= "standardliste";
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_moose_production(){
199 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
200 String cdmServer
= "160.45.63.171";
201 String cdmDB
= "cdm_production_rl_moose";
202 String cdmUserName
= "edit";
203 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
206 public static ICdmDataSource
cdm_redlist_standardlist_dev(){
207 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
208 String cdmServer
= "160.45.63.175";
209 String cdmDB
= "cdm_mt_standardliste";
210 String cdmUserName
= "edit";
211 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
214 public static ICdmDataSource
cdm_cyprus_dev(){
215 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
216 String cdmServer
= "160.45.63.175";
217 String cdmDB
= "cdm_cyprus";
218 String cdmUserName
= "edit";
219 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
222 public static ICdmDataSource
cdm_cyprus_production(){
223 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
224 String cdmServer
= "160.45.63.171";
225 String cdmDB
= "cdm_production_cyprus";
226 String cdmUserName
= "edit";
227 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
230 public static ICdmDataSource
cdm_cyprus_production_tunnel(){
231 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
232 String cdmServer
= "127.0.0.1";
234 String cdmDB
= "cdm_production_cyprus";
235 String cdmUserName
= "edit";
236 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
239 public static ICdmDataSource
cdm_cyprus_dev_tunnel(){
240 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
241 String cdmServer
= "127.0.0.1";
243 String cdmDB
= "cdm_cyprus";
244 String cdmUserName
= "edit";
245 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
248 public static ICdmDataSource
cdm_campanulaceae_production(){
249 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
250 String cdmServer
= "160.45.63.171";
251 String cdmDB
= "cdm_production_campanulaceae";
252 String cdmUserName
= "edit";
253 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
256 public static ICdmDataSource
cdm_flora_malesiana_preview(){
257 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
258 String cdmServer
= "160.45.63.175";
259 String cdmDB
= "cdm_edit_flora_malesiana";
260 String cdmUserName
= "edit";
261 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
264 public static ICdmDataSource
cdm_flora_malesiana_production(){
265 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
266 String cdmServer
= "160.45.63.171";
267 String cdmDB
= "cdm_production_flora_malesiana";
268 String cdmUserName
= "edit";
269 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
272 public static ICdmDataSource
cdm_portal_test_localhost(){
273 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
274 String cdmServer
= "127.0.0.1";
275 String cdmDB
= "cdm_portal_test";
276 String cdmUserName
= "edit";
277 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
280 public static ICdmDataSource
cdm_portal_test_localhost2(){
281 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
282 String cdmServer
= "127.0.0.1";
283 String cdmDB
= "cdm_portal_test2";
284 String cdmUserName
= "edit";
285 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
288 public static ICdmDataSource
cdm_local_cichorieae(){
289 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
290 String cdmServer
= "127.0.0.1";
291 String cdmDB
= "cdm_edit_cichorieae";
292 String cdmUserName
= "edit";
293 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
296 public static ICdmDataSource
cdm_local_diptera(){
297 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
298 String cdmServer
= "127.0.0.1";
299 String cdmDB
= "cdm_edit_diptera";
300 String cdmUserName
= "edit";
301 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
304 public static ICdmDataSource
cdm_local_palmae(){
305 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
306 String cdmServer
= "127.0.0.1";
307 String cdmDB
= "cdm_edit_palmae";
308 String cdmUserName
= "edit";
309 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
312 public static ICdmDataSource
cdm_globis_dev(){
313 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
314 String cdmServer
= "160.45.63.175";
315 String cdmDB
= "cdm_edit_globis";
316 String cdmUserName
= "edit";
317 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
320 public static ICdmDataSource
cdm_globis_production(){
321 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
322 String cdmServer
= "160.45.63.171";
323 String cdmDB
= "cdm_production_globis";
324 String cdmUserName
= "edit";
325 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
328 public static ICdmDataSource
cdm_local_globis(){
329 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
330 String cdmServer
= "127.0.0.1";
331 String cdmDB
= "cdm_globis";
332 String cdmUserName
= "edit";
333 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
336 public static ICdmDataSource
cdm_local_postgres_CdmTest(){
337 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
338 String cdmServer
= "127.0.0.1";
339 String cdmDB
= "CdmTest";
340 String cdmUserName
= "edit";
341 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
344 public static ICdmDataSource
cdm_local_tdwg2010(){
345 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
346 String cdmServer
= "127.0.0.1";
347 String cdmDB
= "cdm_tdwg2010";
348 String cdmUserName
= "edit";
349 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
353 public static ICdmDataSource
NULL(){
358 public static ICdmDataSource
localH2(){
359 return CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
362 public static ICdmDataSource
localH2(String database
, String username
, String filePath
){
363 return CdmDataSource
.NewH2EmbeddedInstance(database
, "sa", "", filePath
, null);
366 public static ICdmDataSource
localH2Salvador(){
367 return CdmDataSource
.NewH2EmbeddedInstance("salvador", "sa", "");
370 public static ICdmDataSource
localH2Armeria(){
371 return CdmDataSource
.NewH2EmbeddedInstance("armeria", "sa", "");
374 public static ICdmDataSource
localH2Standardliste(){
375 return CdmDataSource
.NewH2EmbeddedInstance("standardliste", "sa", "");
378 public static ICdmDataSource
localH2Cichorieae(){
379 return CdmDataSource
.NewH2EmbeddedInstance("cichorieae", "sa", "");
382 public static ICdmDataSource
localH2Palmae(){
383 return CdmDataSource
.NewH2EmbeddedInstance("palmae", "sa", "");
386 public static ICdmDataSource
localH2EuroMed(){
387 return CdmDataSource
.NewH2EmbeddedInstance("euroMed", "sa", "");
390 public static ICdmDataSource
localH2Erms(){
391 return CdmDataSource
.NewH2EmbeddedInstance("erms", "sa", "");
395 public static ICdmDataSource
cdm_algaterra_preview(){
396 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
397 String cdmServer
= "160.45.63.175";
398 String cdmDB
= "cdm_edit_algaterra";
399 String cdmUserName
= "edit";
400 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
403 public static ICdmDataSource
cdm_algaterra_production(){
404 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
405 String cdmServer
= "160.45.63.171";
406 String cdmDB
= "cdm_production_algaterra";
407 String cdmUserName
= "edit";
408 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
411 public static ICdmDataSource
cdm_edit_cichorieae_local_PG(){
412 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
413 String cdmServer
= "127.0.0.1";
414 String cdmDB
= "cdm_edit_cichorieae_a";
415 String cdmUserName
= "edit";
417 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
420 public static ICdmDataSource
cdm_cichorieae_preview(){
421 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
422 String cdmServer
= "160.45.63.175";
423 String cdmDB
= "cdm_edit_cichorieae";
424 String cdmUserName
= "edit";
425 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
428 public static ICdmDataSource
cdm_production_cichorieae(){
429 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
430 String cdmServer
= "160.45.63.171";
431 // String cdmServer = "127.0.0.1";
432 String cdmDB
= "cdm_production_cichorieae";
433 String cdmUserName
= "edit";
434 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
437 public static ICdmDataSource
cdm_production_palmae(){
438 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
439 String cdmServer
= "160.45.63.171";
440 String cdmDB
= "cdm_production_palmae";
441 String cdmUserName
= "edit";
442 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
445 public static ICdmDataSource
cdm_production_flora_deutschland(){
446 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
447 String cdmServer
= "160.45.63.171";
448 String cdmDB
= "cdm_production_rl_standardliste";
449 String cdmUserName
= "edit";
450 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
453 public static ICdmDataSource
cdm_production_caryophyllales(){
454 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
455 String cdmServer
= "160.45.63.171";
456 String cdmDB
= "cdm_production_caryophyllales";
457 String cdmUserName
= "edit";
458 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
462 public static ICdmDataSource
cdm_production_diptera(){
463 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
464 String cdmServer
= "160.45.63.171";
465 String cdmDB
= "cdm_production_diptera";
466 String cdmUserName
= "edit";
467 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
470 public static ICdmDataSource
cdm_edit_cichorieae_preview(){
471 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
472 String cdmServer
= "127.0.0.1";
473 String cdmDB
= "cdm_edit_cichorieae";
474 String cdmUserName
= "edit";
476 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
479 public static ICdmDataSource
cdm_edit_cichorieae_preview_direct(){
480 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
481 String cdmServer
= "160.45.63.175";
482 String cdmDB
= "cdm_edit_cichorieae";
483 String cdmUserName
= "edit";
485 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
488 public static ICdmDataSource
cdm_production_piB(String database
){
489 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
490 String cdmServer
= "160.45.63.171";
491 String cdmDB
= "cdm_production_" + database
+ "_pilot";
492 String cdmUserName
= "edit";
493 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
496 public static ICdmDataSource
cdm_local_piB(String database
){
497 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
498 String cdmServer
= "127.0.0.1";
499 String cdmDB
= "piB_" + database
;
500 String cdmUserName
= "root";
501 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
507 public static ICdmDataSource
mon_cdm() {
508 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
509 String cdmServer
= "localhost";
510 String cdmDB
= "cdm_local";
511 String cdmUserName
= "root";
512 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
515 public static ICdmDataSource
proibiosphere_chenopodium_local() {
516 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
517 String cdmServer
= "localhost";
518 String cdmDB
= "cdm_production_proibiosphere_chenopodium_pilot";
519 String cdmUserName
= "root";
520 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
523 public static ICdmDataSource
proibiosphere_ants_local() {
524 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
525 String cdmServer
= "localhost";
526 String cdmDB
= "cdm_production_proibiosphere_ants_pilot";
527 String cdmUserName
= "root";
528 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
531 public static ICdmDataSource
proibiosphere_fungi_local() {
532 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
533 String cdmServer
= "localhost";
534 String cdmDB
= "cdm_production_proibiosphere_fungi_pilot";
535 String cdmUserName
= "root";
536 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
539 public static ICdmDataSource
proibiosphere_campylopus_local() {
540 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
541 String cdmServer
= "localhost";
542 String cdmDB
= "cdm_production_proibiosphere_campylopus_pilot";
543 String cdmUserName
= "root";
544 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
548 public static ICdmDataSource
proibiosphere_eupolybothrus_local() {
549 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
550 String cdmServer
= "localhost";
551 String cdmDB
= "cdm_production_proibiosphere_eupolybothrus_pilot";
552 String cdmUserName
= "root";
553 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
556 public static ICdmDataSource
proibiosphere_spiders_local() {
557 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
558 String cdmServer
= "localhost";
559 String cdmDB
= "cdm_production_proibiosphere_spiders_pilot";
560 String cdmUserName
= "root";
561 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
563 // public static ICdmDataSource LAPTOP_HP(){
564 // DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005;
565 // String cdmServer = "LAPTOPHP";
566 // String cdmDB = "cdmTest";
567 // String cdmUserName = "edit";
568 // return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
576 * TODO only supports MySQL and PostgreSQL
586 public static ICdmDataSource
makeDestination(DatabaseTypeEnum dbType
, String cdmServer
, String cdmDB
, int port
, String cdmUserName
, String pwd
){
587 //establish connection
588 pwd
= AccountStore
.readOrStorePassword(cdmServer
, cdmDB
, cdmUserName
, pwd
);
589 ICdmDataSource destination
;
590 if(dbType
.equals(DatabaseTypeEnum
.MySQL
)){
591 destination
= CdmDataSource
.NewMySqlInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
592 } else if(dbType
.equals(DatabaseTypeEnum
.PostgreSQL
)){
593 destination
= CdmDataSource
.NewPostgreSQLInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
596 throw new RuntimeException("Unsupported DatabaseType");
604 * Accepts a string array and tries to find a method returning an ICdmDataSource with
605 * the name of the given first string in the array
610 public static ICdmDataSource
chooseDestination(String
[] args
) {
615 if(args
.length
!= 1) {
619 String possibleDestination
= args
[0];
621 Method
[] methods
= CdmDestinations
.class.getMethods();
623 for (Method method
: methods
){
624 if(method
.getName().equals(possibleDestination
)){
626 return (ICdmDataSource
) method
.invoke(null, null);
627 } catch (Exception e
) {
629 throw new RuntimeException(e
);