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);
27 * Intended to be used for imports
29 public static ICdmDataSource
import_a(){
30 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
31 String cdmServer
= "localhost";
32 String cdmDB
= "import_a";
33 String cdmUserName
= "root";
34 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
37 public static ICdmDataSource
cdm_test_jaxb(){
38 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
39 String cdmServer
= "192.168.2.10";
40 String cdmDB
= "cdm_test_jaxb";
41 String cdmUserName
= "edit";
42 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
45 public static ICdmDataSource
cdm_test_jaxb2(){
46 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
47 String cdmServer
= "192.168.2.10";
48 String cdmDB
= "cdm_test_jaxb2";
49 String cdmUserName
= "edit";
50 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
53 public static ICdmDataSource
cdm_test_andreasM(){
54 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
55 String cdmServer
= "192.168.2.10";
56 String cdmDB
= "cdm_test_andreasM";
57 String cdmUserName
= "edit";
58 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
61 public static ICdmDataSource
cdm_test_andreasM2(){
62 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
63 String cdmServer
= "192.168.2.10";
64 String cdmDB
= "cdm_test_andreasM2";
65 String cdmUserName
= "edit";
66 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
69 public static ICdmDataSource
cdm_test_local_mysql(){
70 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
71 String cdmServer
= "127.0.0.1";
72 String cdmDB
= "cdm_test";
73 String cdmUserName
= "edit";
74 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
77 public static ICdmDataSource
cdm_test_local_mysql_fdac(){
78 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
79 String cdmServer
= "127.0.0.1";
80 String cdmDB
= "fdac";
81 String cdmUserName
= "edit";
82 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
85 public static ICdmDataSource
cdm_test_local_mysql_test(){
86 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
87 String cdmServer
= "127.0.0.1";
88 String cdmDB
= "test";
89 String cdmUserName
= "edit";
90 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
94 public static ICdmDataSource
cdm_portal(){
95 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
96 String cdmServer
= "192.168.2.10";
97 String cdmDB
= "cdm_portal";
98 String cdmUserName
= "edit";
99 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
102 public static ICdmDataSource
cdm_portal_test(){
103 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
104 String cdmServer
= "192.168.2.10";
105 String cdmDB
= "cdm_portal_test";
106 String cdmUserName
= "edit";
107 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
110 public static ICdmDataSource
cdm_test_patricia(){
111 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
112 String cdmServer
= "192.168.2.10";
113 String cdmDB
= "cdm_test_patricia";
114 String cdmUserName
= "edit";
115 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
119 public static ICdmDataSource
cdm_test_andreasK1(){
120 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
121 String cdmServer
= "192.168.2.10";
122 String cdmDB
= "cdm_test_andreasK1";
123 String cdmUserName
= "edit";
124 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
128 public static ICdmDataSource
cdm_pesi_erms(){
129 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
130 String cdmServer
= "192.168.2.10";
131 String cdmDB
= "cdm_pesi_erms";
132 String cdmUserName
= "edit";
133 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
136 public static ICdmDataSource
cdm_campanulaceae(){
137 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
138 String cdmServer
= "192.168.2.10";
139 String cdmDB
= "cdm_campanulaceae";
140 String cdmUserName
= "edit";
141 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
144 public static ICdmDataSource
cdm_ildis_dev(){
145 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
146 String cdmServer
= "160.45.63.201";
147 String cdmDB
= "cdm_edit_ildis";
148 String cdmUserName
= "edit";
149 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
153 // public static ICdmDataSource cdm_ildis_production(){
154 // DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
155 // String cdmServer = "160.45.63.151";
156 // String cdmDB = "cdm_edit_ildis";
157 // String cdmUserName = "edit";
158 // return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
161 public static ICdmDataSource
cdm_cyprus_dev(){
162 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
163 String cdmServer
= "160.45.63.201";
164 String cdmDB
= "cdm_cyprus";
165 String cdmUserName
= "edit";
166 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
169 public static ICdmDataSource
cdm_cyprus_production(){
170 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
171 String cdmServer
= "160.45.63.151";
172 String cdmDB
= "cdm_production_cyprus";
173 String cdmUserName
= "edit";
174 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
177 public static ICdmDataSource
cdm_cyprus_production_tunnel(){
178 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
179 String cdmServer
= "127.0.0.1";
181 String cdmDB
= "cdm_production_cyprus";
182 String cdmUserName
= "edit";
183 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
186 public static ICdmDataSource
cdm_cyprus_dev_tunnel(){
187 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
188 String cdmServer
= "127.0.0.1";
190 String cdmDB
= "cdm_cyprus";
191 String cdmUserName
= "edit";
192 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
195 public static ICdmDataSource
cdm_campanulaceae_production(){
196 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
197 String cdmServer
= "160.45.63.151";
198 String cdmDB
= "cdm_production_campanulaceae";
199 String cdmUserName
= "edit";
200 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
203 public static ICdmDataSource
cdm_flora_malesiana_preview(){
204 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
205 String cdmServer
= "160.45.63.201";
206 String cdmDB
= "cdm_edit_flora_malesiana_a";
207 String cdmUserName
= "edit";
208 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
211 public static ICdmDataSource
cdm_flora_malesiana_production(){
212 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
213 String cdmServer
= "160.45.63.151";
214 String cdmDB
= "cdm_production_flora_malesiana";
215 String cdmUserName
= "edit";
216 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
219 public static ICdmDataSource
cdm_flora_central_africa_preview(){
220 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
221 String cdmServer
= "160.45.63.201";
222 String cdmDB
= "cdm_edit_flora_central_africa";
223 String cdmUserName
= "edit";
224 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
227 public static ICdmDataSource
cdm_flora_central_africa_production(){
228 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
229 String cdmServer
= "160.45.63.151";
230 String cdmDB
= "cdm_production_flora_central_africa";
231 String cdmUserName
= "edit";
232 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
235 public static ICdmDataSource
cdm_pesi_euroMed(){
236 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
237 String cdmServer
= "192.168.2.10";
238 String cdmDB
= "cdm_pesi_euroMed";
239 String cdmUserName
= "edit";
240 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
243 public static ICdmDataSource
cdm_pesi_all(){
244 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
245 String cdmServer
= "192.168.2.10";
246 String cdmDB
= "cdm_pesi_all";
247 String cdmUserName
= "edit";
248 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
251 public static ICdmDataSource
cdm_portal_test_localhost(){
252 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
253 String cdmServer
= "127.0.0.1";
254 String cdmDB
= "cdm_portal_test";
255 String cdmUserName
= "edit";
256 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
259 public static ICdmDataSource
cdm_portal_test_localhost2(){
260 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
261 String cdmServer
= "127.0.0.1";
262 String cdmDB
= "cdm_portal_test2";
263 String cdmUserName
= "edit";
264 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
267 public static ICdmDataSource
cdm_local_cichorieae(){
268 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
269 String cdmServer
= "127.0.0.1";
270 String cdmDB
= "cdm_edit_cichorieae";
271 String cdmUserName
= "edit";
272 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
275 public static ICdmDataSource
cdm_local_dipera(){
276 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
277 String cdmServer
= "127.0.0.1";
278 String cdmDB
= "cdm_edit_diptera";
279 String cdmUserName
= "edit";
280 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
283 public static ICdmDataSource
cdm_local_palmae(){
284 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
285 String cdmServer
= "127.0.0.1";
286 String cdmDB
= "cdm_edit_palmae";
287 String cdmUserName
= "edit";
288 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
291 public static ICdmDataSource
cdm_local_globis(){
292 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
293 String cdmServer
= "127.0.0.1";
294 String cdmDB
= "cdm_globis";
295 String cdmUserName
= "edit";
296 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
299 public static ICdmDataSource
cdm_local_cichorieae_d(){
300 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
301 String cdmServer
= "127.0.0.1";
302 String cdmDB
= "cdm_edit_cichorieae_d";
303 String cdmUserName
= "root";
304 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
307 public static ICdmDataSource
cdm_local_postgres_CdmTest(){
308 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
309 String cdmServer
= "127.0.0.1";
310 String cdmDB
= "CdmTest";
311 String cdmUserName
= "edit";
312 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
315 public static ICdmDataSource
cdm_local_tdwg2010(){
316 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
317 String cdmServer
= "127.0.0.1";
318 String cdmDB
= "cdm_tdwg2010";
319 String cdmUserName
= "edit";
320 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
324 public static ICdmDataSource
NULL(){
329 public static ICdmDataSource
localH2(){
330 return CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
333 public static ICdmDataSource
localH2(String database
, String username
, String filePath
){
334 return CdmDataSource
.NewH2EmbeddedInstance(database
, "sa", "", filePath
, null);
337 public static ICdmDataSource
localH2Salvador(){
338 return CdmDataSource
.NewH2EmbeddedInstance("salvador", "sa", "");
341 public static ICdmDataSource
localH2Diptera(){
342 return CdmDataSource
.NewH2EmbeddedInstance("diptera", "sa", "");
346 public static ICdmDataSource
localH2Cichorieae(){
347 return CdmDataSource
.NewH2EmbeddedInstance("cichorieae", "sa", "");
350 public static ICdmDataSource
localH2Palmae(){
351 return CdmDataSource
.NewH2EmbeddedInstance("palmae", "sa", "");
354 public static ICdmDataSource
localH2EuroMed(){
355 return CdmDataSource
.NewH2EmbeddedInstance("euroMed", "sa", "");
358 public static ICdmDataSource
localH2Erms(){
359 return CdmDataSource
.NewH2EmbeddedInstance("erms", "sa", "");
362 public static ICdmDataSource
localH2_viola(){
363 return CdmDataSource
.NewH2EmbeddedInstance("testViola", "sa", "");
366 public static ICdmDataSource
localH2_LIAS(){
367 return CdmDataSource
.NewH2EmbeddedInstance("testLIAS", "sa", "");
370 public static ICdmDataSource
localH2_Erythroneura(){
371 return CdmDataSource
.NewH2EmbeddedInstance("testErythroneura", "sa", "");
374 public static ICdmDataSource
localH2_Cicad(){
375 return CdmDataSource
.NewH2EmbeddedInstance("testCicad", "sa", "");
378 public static ICdmDataSource
localH2_ValRosandraFRIDAKey(){
379 return CdmDataSource
.NewH2EmbeddedInstance("testValRosandraFRIDAKey", "sa", "");
382 public static ICdmDataSource
localH2_FreshwaterAquaticInsects(){
383 return CdmDataSource
.NewH2EmbeddedInstance("testFreshwaterAquaticInsects", "sa", "");
386 public static ICdmDataSource
cdm_portal_test_pollux(){
387 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
388 String cdmServer
= "192.168.2.11";
389 String cdmDB
= "cdm_portal_test";
390 String cdmUserName
= "edit";
391 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
394 public static ICdmDataSource
cdm_edit_cichorieae_PG(){
395 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
396 String cdmServer
= "127.0.0.1";
397 String cdmDB
= "cdm_edit_cichorieae_a";
398 String cdmUserName
= "edit";
400 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
403 public static ICdmDataSource
cdm_edit_cichorieae_a(){
404 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
405 String cdmServer
= "192.168.2.10";
406 String cdmDB
= "cdm_edit_cichorieae_a";
407 String cdmUserName
= "edit";
408 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
411 public static ICdmDataSource
cdm_cichorieae_preview(){
412 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
413 String cdmServer
= "160.45.63.201";
414 String cdmDB
= "cdm_edit_cichorieae";
415 String cdmUserName
= "edit";
416 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
419 public static ICdmDataSource
cdm_production_cichorieae(){
420 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
421 String cdmServer
= "160.45.63.151";
422 // String cdmServer = "127.0.0.1";
423 String cdmDB
= "cdm_production_cichorieae";
424 String cdmUserName
= "edit";
425 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
428 public static ICdmDataSource
cdm_production_palmae(){
429 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
430 String cdmServer
= "160.45.63.151";
431 String cdmDB
= "cdm_production_palmae";
432 String cdmUserName
= "edit";
433 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
438 public static ICdmDataSource
local_cdm_edit_cichorieae_a(){
439 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
440 String cdmServer
= "127.0.0.1";
441 String cdmDB
= "cdm_edit_cichorieae_a";
442 String cdmUserName
= "edit";
443 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
446 public static ICdmDataSource
local_cdm_edit_cichorieae_b(){
447 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
448 String cdmServer
= "127.0.0.1";
449 String cdmDB
= "cdm_edit_cichorieae_b";
450 String cdmUserName
= "edit";
451 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
454 public static ICdmDataSource
cdm_edit_diptera_a(){
455 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
456 String cdmServer
= "192.168.2.10";
457 String cdmDB
= "cdm_edit_diptera_a";
458 String cdmUserName
= "edit";
459 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
462 public static ICdmDataSource
cdm_edit_palmae_a(){
463 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
464 String cdmServer
= "192.168.2.10";
465 String cdmDB
= "cdm_edit_palmae_a";
466 String cdmUserName
= "edit";
467 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
470 public static ICdmDataSource
cdm_edit_diptera_preview_B(){
471 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
472 String cdmServer
= "127.0.0.1";
473 String cdmDB
= "cdm_edit_diptera_b";
474 String cdmUserName
= "edit";
476 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
479 public static ICdmDataSource
cdm_edit_cichorieae_preview_B(){
480 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
481 String cdmServer
= "127.0.0.1";
482 String cdmDB
= "cdm_edit_cichorieae_b";
483 String cdmUserName
= "edit";
485 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
488 public static ICdmDataSource
cdm_edit_palmae_preview_A(){
489 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
490 String cdmServer
= "127.0.0.1";
491 String cdmDB
= "cdm_edit_palmae_a";
492 String cdmUserName
= "edit";
494 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
497 public static ICdmDataSource
cdm_edit_palmae_preview_B(){
498 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
499 String cdmServer
= "127.0.0.1";
500 String cdmDB
= "cdm_edit_palmae_b";
501 String cdmUserName
= "edit";
503 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
506 public static ICdmDataSource
cdm_edit_salvador(){
507 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
508 String cdmServer
= "192.168.2.10";
509 String cdmDB
= "cdm_edit_salvador";
510 String cdmUserName
= "edit";
511 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
514 public static ICdmDataSource
cdm_import_salvador() {
515 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
516 String cdmServer
= "192.168.2.10";
517 String cdmDB
= "cdm_import_salvador";
518 String cdmUserName
= "edit";
519 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
522 public static ICdmDataSource
cdm_salvador_production() {
523 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
524 String cdmServer
= "192.168.2.10";
525 String cdmDB
= "salvador_cdm";
526 String cdmUserName
= "salvador";
527 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
531 // public static ICdmDataSource LAPTOP_HP(){
532 // DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005;
533 // String cdmServer = "LAPTOPHP";
534 // String cdmDB = "cdmTest";
535 // String cdmUserName = "edit";
536 // return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
544 * TODO only supports MySQL and PostgreSQL
554 private static ICdmDataSource
makeDestination(DatabaseTypeEnum dbType
, String cdmServer
, String cdmDB
, int port
, String cdmUserName
, String pwd
){
555 //establish connection
556 pwd
= AccountStore
.readOrStorePassword(cdmServer
, cdmDB
, cdmUserName
, pwd
);
557 ICdmDataSource destination
;
558 if(dbType
.equals(DatabaseTypeEnum
.MySQL
)){
559 destination
= CdmDataSource
.NewMySqlInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
560 } else if(dbType
.equals(DatabaseTypeEnum
.PostgreSQL
)){
561 destination
= CdmDataSource
.NewPostgreSQLInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
564 throw new RuntimeException("Unsupported DatabaseType");
572 * Accepts a string array and tries to find a method returning an ICdmDataSource with
573 * the name of the given first string in the array
578 public static ICdmDataSource
chooseDestination(String
[] args
) {
585 String possibleDestination
= args
[0];
587 Method
[] methods
= CdmDestinations
.class.getMethods();
589 for (Method method
: methods
){
590 if(method
.getName().equals(possibleDestination
)){
592 return (ICdmDataSource
) method
.invoke(null, null);
593 } catch (IllegalArgumentException e
) {
594 // TODO Auto-generated catch block
596 } catch (IllegalAccessException e
) {
597 // TODO Auto-generated catch block
599 } catch (InvocationTargetException e
) {
600 // TODO Auto-generated catch block