1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.io.berlinModel;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
15
|
import eu.etaxonomy.cdm.database.CdmDataSource;
|
16
|
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
|
17
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
18
|
|
19
|
public class CdmDestinations {
|
20
|
private static Logger logger = Logger.getLogger(CdmDestinations.class);
|
21
|
|
22
|
public static ICdmDataSource cdm_1_1(){
|
23
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
24
|
String cdmServer = "192.168.2.10";
|
25
|
String cdmDB = "cdm_1_1"; // values: "cdm_1_1" "cdm_build"
|
26
|
String cdmUserName = "edit";
|
27
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
28
|
}
|
29
|
|
30
|
|
31
|
public static ICdmDataSource cdm_build(){
|
32
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
33
|
String cdmServer = "192.168.2.10";
|
34
|
String cdmDB = "cdm_build"; // values: "cdm_1_1" "cdm_build"
|
35
|
String cdmUserName = "edit";
|
36
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
37
|
}
|
38
|
|
39
|
|
40
|
public static ICdmDataSource cdm_test(){
|
41
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
42
|
String cdmServer = "192.168.2.10";
|
43
|
String cdmDB = "cdm_test"; // values: "cdm_1_1" "cdm_build"
|
44
|
String cdmUserName = "edit";
|
45
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
46
|
}
|
47
|
|
48
|
|
49
|
public static ICdmDataSource cdm_test_andreasM(){
|
50
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
51
|
String cdmServer = "192.168.2.10";
|
52
|
String cdmDB = "cdm_test_andreasM";
|
53
|
String cdmUserName = "edit";
|
54
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
55
|
}
|
56
|
|
57
|
|
58
|
public static ICdmDataSource cdm_editor2(){
|
59
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
60
|
String cdmServer = "192.168.2.10";
|
61
|
String cdmDB = "cdm_editor_test2";
|
62
|
String cdmUserName = "edit";
|
63
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
64
|
}
|
65
|
|
66
|
public static ICdmDataSource cdm_portal(){
|
67
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
68
|
String cdmServer = "192.168.2.10";
|
69
|
String cdmDB = "cdm_portal";
|
70
|
String cdmUserName = "edit";
|
71
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
72
|
}
|
73
|
|
74
|
public static ICdmDataSource cdm_portal_test(){
|
75
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
76
|
String cdmServer = "192.168.2.10";
|
77
|
String cdmDB = "cdm_portal_test";
|
78
|
String cdmUserName = "edit";
|
79
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
80
|
}
|
81
|
|
82
|
public static ICdmDataSource cdm_portal_test_localhost(){
|
83
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
84
|
String cdmServer = "127.0.0.1";
|
85
|
String cdmDB = "cdm_portal_test";
|
86
|
String cdmUserName = "edit";
|
87
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
88
|
}
|
89
|
|
90
|
public static ICdmDataSource cdm_edit_cichorieae(){
|
91
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
92
|
String cdmServer = "192.168.2.10";
|
93
|
String cdmDB = "cdm_edit_cichorieae";
|
94
|
String cdmUserName = "edit";
|
95
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
96
|
}
|
97
|
|
98
|
public static ICdmDataSource cdm_edit_diptera(){
|
99
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
100
|
String cdmServer = "192.168.2.10";
|
101
|
String cdmDB = "cdm_edit_diptera";
|
102
|
String cdmUserName = "edit";
|
103
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
104
|
}
|
105
|
|
106
|
public static ICdmDataSource cdm_edit_palmae(){
|
107
|
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
|
108
|
String cdmServer = "192.168.2.10";
|
109
|
String cdmDB = "cdm_edit_palmae";
|
110
|
String cdmUserName = "edit";
|
111
|
return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
112
|
}
|
113
|
|
114
|
|
115
|
// public static ICdmDataSource LAPTOP_HP(){
|
116
|
// DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005;
|
117
|
// String cdmServer = "LAPTOPHP";
|
118
|
// String cdmDB = "cdmTest";
|
119
|
// String cdmUserName = "edit";
|
120
|
// return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null);
|
121
|
// }
|
122
|
|
123
|
|
124
|
/**
|
125
|
* initializes source
|
126
|
* @return true, if connection establisehd
|
127
|
*/
|
128
|
private static ICdmDataSource makeDestination(String cdmServer, String cdmDB, int port, String cdmUserName, String pwd ){
|
129
|
//establish connection
|
130
|
try {
|
131
|
if (pwd == null){
|
132
|
pwd = CdmUtils.readInputLine("Please insert password for " + CdmUtils.Nz(cdmUserName) + ": ");
|
133
|
}
|
134
|
//TODO not MySQL
|
135
|
ICdmDataSource destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd);
|
136
|
return destination;
|
137
|
} catch (Exception e) {
|
138
|
logger.error(e);
|
139
|
return null;
|
140
|
}
|
141
|
}
|
142
|
|
143
|
}
|