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
.eflora
;
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_alex(){
38 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
39 String cdmServer
= "192.168.2.10";
40 String cdmDB
= "cdm_production_palmae";
41 String cdmUserName
= "edit";
42 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
46 public static ICdmDataSource
cdm_test_useSummary(){
47 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
48 String cdmServer
= "localhost";
49 String cdmDB
= "palmae_2011_07_17";
50 String cdmUserName
= "edit";
51 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
54 public static ICdmDataSource
cdm_test_jaxb(){
55 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
56 String cdmServer
= "192.168.2.10";
57 String cdmDB
= "cdm_test_jaxb";
58 String cdmUserName
= "edit";
59 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
62 public static ICdmDataSource
cdm_test_jaxb2(){
63 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
64 String cdmServer
= "192.168.2.10";
65 String cdmDB
= "cdm_test_jaxb2";
66 String cdmUserName
= "edit";
67 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
70 public static ICdmDataSource
cdm_test_andreasM(){
71 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
72 String cdmServer
= "192.168.2.10";
73 String cdmDB
= "cdm_test_andreasM";
74 String cdmUserName
= "edit";
75 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
78 public static ICdmDataSource
cdm_test_andreasM2(){
79 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
80 String cdmServer
= "192.168.2.10";
81 String cdmDB
= "cdm_test_andreasM2";
82 String cdmUserName
= "edit";
83 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
86 public static ICdmDataSource
cdm_test_local_mysql(){
87 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
88 String cdmServer
= "127.0.0.1";
89 String cdmDB
= "cdm_test";
90 String cdmUserName
= "edit";
91 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
94 public static ICdmDataSource
cdm_test_local_mysql_fdac(){
95 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
96 String cdmServer
= "127.0.0.1";
97 String cdmDB
= "fdac";
98 String cdmUserName
= "edit";
99 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
102 public static ICdmDataSource
cdm_test_local_mysql_test(){
103 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
104 String cdmServer
= "127.0.0.1";
105 String cdmDB
= "test";
106 String cdmUserName
= "edit";
107 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
111 public static ICdmDataSource
cdm_portal(){
112 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
113 String cdmServer
= "192.168.2.10";
114 String cdmDB
= "cdm_portal";
115 String cdmUserName
= "edit";
116 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
119 public static ICdmDataSource
cdm_portal_test(){
120 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
121 String cdmServer
= "192.168.2.10";
122 String cdmDB
= "cdm_portal_test";
123 String cdmUserName
= "edit";
124 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
127 public static ICdmDataSource
cdm_test_patricia(){
128 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
129 String cdmServer
= "192.168.2.10";
130 String cdmDB
= "cdm_test_patricia";
131 String cdmUserName
= "edit";
132 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
136 public static ICdmDataSource
cdm_test_andreasK1(){
137 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
138 String cdmServer
= "192.168.2.10";
139 String cdmDB
= "cdm_test_andreasK1";
140 String cdmUserName
= "edit";
141 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
145 public static ICdmDataSource
cdm_pesi_erms(){
146 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
147 String cdmServer
= "192.168.2.10";
148 String cdmDB
= "cdm_pesi_erms";
149 String cdmUserName
= "edit";
150 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
153 public static ICdmDataSource
cdm_campanulaceae(){
154 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
155 String cdmServer
= "192.168.2.10";
156 String cdmDB
= "cdm_campanulaceae";
157 String cdmUserName
= "edit";
158 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
161 public static ICdmDataSource
cdm_ildis_dev(){
162 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
163 String cdmServer
= "160.45.63.201";
164 String cdmDB
= "cdm_edit_ildis";
165 String cdmUserName
= "edit";
166 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
170 // public static ICdmDataSource cdm_ildis_production(){
171 // DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
172 // String cdmServer = "160.45.63.151";
173 // String cdmDB = "cdm_edit_ildis";
174 // String cdmUserName = "edit";
175 // return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
178 public static ICdmDataSource
cdm_cyprus_dev(){
179 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
180 String cdmServer
= "160.45.63.201";
181 String cdmDB
= "cdm_cyprus";
182 String cdmUserName
= "edit";
183 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
186 public static ICdmDataSource
cdm_cyprus_production(){
187 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
188 String cdmServer
= "160.45.63.151";
189 String cdmDB
= "cdm_production_cyprus";
190 String cdmUserName
= "edit";
191 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
194 public static ICdmDataSource
cdm_cyprus_production_tunnel(){
195 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
196 String cdmServer
= "127.0.0.1";
198 String cdmDB
= "cdm_production_cyprus";
199 String cdmUserName
= "edit";
200 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
203 public static ICdmDataSource
cdm_cyprus_dev_tunnel(){
204 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
205 String cdmServer
= "127.0.0.1";
207 String cdmDB
= "cdm_cyprus";
208 String cdmUserName
= "edit";
209 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
212 public static ICdmDataSource
cdm_campanulaceae_production(){
213 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
214 String cdmServer
= "160.45.63.151";
215 String cdmDB
= "cdm_production_campanulaceae";
216 String cdmUserName
= "edit";
217 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
220 public static ICdmDataSource
cdm_flora_malesiana_preview(){
221 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
222 String cdmServer
= "160.45.63.201";
223 String cdmDB
= "cdm_edit_flora_malesiana";
224 String cdmUserName
= "edit";
225 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
228 public static ICdmDataSource
cdm_flora_malesiana_production(){
229 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
230 String cdmServer
= "160.45.63.151";
231 String cdmDB
= "cdm_production_flora_malesiana";
232 String cdmUserName
= "edit";
233 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
236 public static ICdmDataSource
cdm_flora_central_africa_preview(){
237 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
238 String cdmServer
= "160.45.63.201";
239 String cdmDB
= "cdm_edit_flora_central_africa";
240 String cdmUserName
= "edit";
241 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
244 public static ICdmDataSource
cdm_flora_central_africa_production(){
245 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
246 String cdmServer
= "160.45.63.151";
247 String cdmDB
= "cdm_production_flora_central_africa";
248 String cdmUserName
= "edit";
249 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
252 public static ICdmDataSource
cdm_pesi_euroMed(){
253 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
254 String cdmServer
= "192.168.2.10";
255 String cdmDB
= "cdm_pesi_euroMed";
256 String cdmUserName
= "edit";
257 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
260 public static ICdmDataSource
cdm_pesi_all(){
261 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
262 String cdmServer
= "192.168.2.10";
263 String cdmDB
= "cdm_pesi_all";
264 String cdmUserName
= "edit";
265 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
268 public static ICdmDataSource
cdm_portal_test_localhost(){
269 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
270 String cdmServer
= "127.0.0.1";
271 String cdmDB
= "cdm_portal_test";
272 String cdmUserName
= "edit";
273 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
276 public static ICdmDataSource
cdm_portal_test_localhost2(){
277 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
278 String cdmServer
= "127.0.0.1";
279 String cdmDB
= "cdm_portal_test2";
280 String cdmUserName
= "edit";
281 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
284 public static ICdmDataSource
cdm_local_cichorieae(){
285 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
286 String cdmServer
= "127.0.0.1";
287 String cdmDB
= "cdm_edit_cichorieae";
288 String cdmUserName
= "edit";
289 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
292 public static ICdmDataSource
cdm_local_dipera(){
293 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
294 String cdmServer
= "127.0.0.1";
295 String cdmDB
= "cdm_edit_diptera";
296 String cdmUserName
= "edit";
297 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
300 public static ICdmDataSource
cdm_local_palmae(){
301 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
302 String cdmServer
= "127.0.0.1";
303 String cdmDB
= "cdm_edit_palmae";
304 String cdmUserName
= "edit";
305 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
308 public static ICdmDataSource
cdm_local_globis(){
309 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
310 String cdmServer
= "127.0.0.1";
311 String cdmDB
= "cdm_globis";
312 String cdmUserName
= "edit";
313 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
316 public static ICdmDataSource
cdm_local_cichorieae_d(){
317 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
318 String cdmServer
= "127.0.0.1";
319 String cdmDB
= "cdm_edit_cichorieae_d";
320 String cdmUserName
= "root";
321 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
324 public static ICdmDataSource
cdm_local_postgres_CdmTest(){
325 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
326 String cdmServer
= "127.0.0.1";
327 String cdmDB
= "CdmTest";
328 String cdmUserName
= "edit";
329 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
332 public static ICdmDataSource
cdm_local_tdwg2010(){
333 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
334 String cdmServer
= "127.0.0.1";
335 String cdmDB
= "cdm_tdwg2010";
336 String cdmUserName
= "edit";
337 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
341 public static ICdmDataSource
NULL(){
346 public static ICdmDataSource
localH2(){
347 return CdmDataSource
.NewH2EmbeddedInstance("cdm", "sa", "");
350 public static ICdmDataSource
localH2(String database
, String username
, String filePath
){
351 return CdmDataSource
.NewH2EmbeddedInstance(database
, "sa", "", filePath
, null);
354 public static ICdmDataSource
localH2Salvador(){
355 return CdmDataSource
.NewH2EmbeddedInstance("salvador", "sa", "");
358 public static ICdmDataSource
localH2Diptera(){
359 return CdmDataSource
.NewH2EmbeddedInstance("diptera", "sa", "");
363 public static ICdmDataSource
localH2Cichorieae(){
364 return CdmDataSource
.NewH2EmbeddedInstance("cichorieae", "sa", "");
367 public static ICdmDataSource
localH2Palmae(){
368 return CdmDataSource
.NewH2EmbeddedInstance("palmae", "sa", "");
371 public static ICdmDataSource
localH2EuroMed(){
372 return CdmDataSource
.NewH2EmbeddedInstance("euroMed", "sa", "");
375 public static ICdmDataSource
localH2Erms(){
376 return CdmDataSource
.NewH2EmbeddedInstance("erms", "sa", "");
379 public static ICdmDataSource
localH2_viola(){
380 return CdmDataSource
.NewH2EmbeddedInstance("testViola", "sa", "");
383 public static ICdmDataSource
localH2_LIAS(){
384 return CdmDataSource
.NewH2EmbeddedInstance("testLIAS", "sa", "");
387 public static ICdmDataSource
localH2_Erythroneura(){
388 return CdmDataSource
.NewH2EmbeddedInstance("testErythroneura", "sa", "");
391 public static ICdmDataSource
localH2_Cicad(){
392 return CdmDataSource
.NewH2EmbeddedInstance("testCicad", "sa", "");
395 public static ICdmDataSource
localH2_ValRosandraFRIDAKey(){
396 return CdmDataSource
.NewH2EmbeddedInstance("testValRosandraFRIDAKey", "sa", "");
399 public static ICdmDataSource
localH2_FreshwaterAquaticInsects(){
400 return CdmDataSource
.NewH2EmbeddedInstance("testFreshwaterAquaticInsects", "sa", "");
403 public static ICdmDataSource
cdm_portal_test_pollux(){
404 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
405 String cdmServer
= "192.168.2.11";
406 String cdmDB
= "cdm_portal_test";
407 String cdmUserName
= "edit";
408 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
411 public static ICdmDataSource
cdm_algaterra_preview(){
412 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
413 String cdmServer
= "160.45.63.201";
414 String cdmDB
= "cdm_edit_algaterra";
415 String cdmUserName
= "edit";
416 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
419 public static ICdmDataSource
cdm_edit_cichorieae_PG(){
420 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.PostgreSQL
;
421 String cdmServer
= "127.0.0.1";
422 String cdmDB
= "cdm_edit_cichorieae_a";
423 String cdmUserName
= "edit";
425 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
428 public static ICdmDataSource
cdm_cichorieae_preview(){
429 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
430 String cdmServer
= "160.45.63.201";
431 String cdmDB
= "cdm_edit_cichorieae";
432 String cdmUserName
= "edit";
433 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
436 public static ICdmDataSource
cdm_production_cichorieae(){
437 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
438 String cdmServer
= "160.45.63.151";
439 // String cdmServer = "127.0.0.1";
440 String cdmDB
= "cdm_production_cichorieae";
441 String cdmUserName
= "edit";
442 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
445 public static ICdmDataSource
cdm_production_palmae(){
446 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
447 String cdmServer
= "160.45.63.151";
448 String cdmDB
= "cdm_production_palmae";
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.151";
457 String cdmDB
= "cdm_production_diptera";
458 String cdmUserName
= "edit";
459 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
462 public static ICdmDataSource
local_cdm_edit_cichorieae_a(){
463 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
464 String cdmServer
= "127.0.0.1";
465 String cdmDB
= "cdm_edit_cichorieae_a";
466 String cdmUserName
= "edit";
467 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
470 public static ICdmDataSource
local_cdm_edit_cichorieae_b(){
471 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
472 String cdmServer
= "127.0.0.1";
473 String cdmDB
= "cdm_edit_cichorieae_b";
474 String cdmUserName
= "edit";
475 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
478 public static ICdmDataSource
cdm_edit_palmae_a(){
479 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
480 String cdmServer
= "192.168.2.10";
481 String cdmDB
= "cdm_edit_palmae_a";
482 String cdmUserName
= "edit";
483 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
486 public static ICdmDataSource
cdm_edit_diptera_preview_B(){
487 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
488 String cdmServer
= "127.0.0.1";
489 String cdmDB
= "cdm_edit_diptera_b";
490 String cdmUserName
= "edit";
492 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
495 public static ICdmDataSource
cdm_edit_cichorieae_preview(){
496 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
497 String cdmServer
= "127.0.0.1";
498 String cdmDB
= "cdm_edit_cichorieae";
499 String cdmUserName
= "edit";
501 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
504 public static ICdmDataSource
cdm_edit_palmae_preview(){
505 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
506 String cdmServer
= "127.0.0.1";
507 String cdmDB
= "cdm_edit_palmae";
508 String cdmUserName
= "edit";
510 return makeDestination(dbType
, cdmServer
, cdmDB
, port
, cdmUserName
, null);
513 public static ICdmDataSource
cdm_edit_salvador(){
514 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
515 String cdmServer
= "192.168.2.10";
516 String cdmDB
= "cdm_edit_salvador";
517 String cdmUserName
= "edit";
518 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
521 public static ICdmDataSource
cdm_import_salvador() {
522 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
523 String cdmServer
= "192.168.2.10";
524 String cdmDB
= "cdm_import_salvador";
525 String cdmUserName
= "edit";
526 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
529 public static ICdmDataSource
cdm_salvador_production() {
530 DatabaseTypeEnum dbType
= DatabaseTypeEnum
.MySQL
;
531 String cdmServer
= "192.168.2.10";
532 String cdmDB
= "salvador_cdm";
533 String cdmUserName
= "salvador";
534 return makeDestination(dbType
, cdmServer
, cdmDB
, -1, cdmUserName
, null);
538 // public static ICdmDataSource LAPTOP_HP(){
539 // DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005;
540 // String cdmServer = "LAPTOPHP";
541 // String cdmDB = "cdmTest";
542 // String cdmUserName = "edit";
543 // return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
551 * TODO only supports MySQL and PostgreSQL
561 private static ICdmDataSource
makeDestination(DatabaseTypeEnum dbType
, String cdmServer
, String cdmDB
, int port
, String cdmUserName
, String pwd
){
562 //establish connection
563 pwd
= AccountStore
.readOrStorePassword(cdmServer
, cdmDB
, cdmUserName
, pwd
);
564 ICdmDataSource destination
;
565 if(dbType
.equals(DatabaseTypeEnum
.MySQL
)){
566 destination
= CdmDataSource
.NewMySqlInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
567 } else if(dbType
.equals(DatabaseTypeEnum
.PostgreSQL
)){
568 destination
= CdmDataSource
.NewPostgreSQLInstance(cdmServer
, cdmDB
, port
, cdmUserName
, pwd
, null);
571 throw new RuntimeException("Unsupported DatabaseType");
579 * Accepts a string array and tries to find a method returning an ICdmDataSource with
580 * the name of the given first string in the array
585 public static ICdmDataSource
chooseDestination(String
[] args
) {
592 String possibleDestination
= args
[0];
594 Method
[] methods
= CdmDestinations
.class.getMethods();
596 for (Method method
: methods
){
597 if(method
.getName().equals(possibleDestination
)){
599 return (ICdmDataSource
) method
.invoke(null, null);
600 } catch (IllegalArgumentException e
) {
601 // TODO Auto-generated catch block
603 } catch (IllegalAccessException e
) {
604 // TODO Auto-generated catch block
606 } catch (InvocationTargetException e
) {
607 // TODO Auto-generated catch block