1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.app.common;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.net.URL;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.app.tcs.TcsSources;
|
18
|
import eu.etaxonomy.cdm.common.AccountStore;
|
19
|
import eu.etaxonomy.cdm.io.common.Source;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @date 21.04.2010
|
24
|
*
|
25
|
*/
|
26
|
public class CdmImportSources {
|
27
|
@SuppressWarnings("unused")
|
28
|
private static final Logger logger = Logger.getLogger(CdmImportSources.class);
|
29
|
|
30
|
public static Source ROTE_LISTE_DB(){
|
31
|
String dbms = Source.ORACLE;
|
32
|
String strServer = "xxx";
|
33
|
String strDB = "dbName";
|
34
|
int port = 1433;
|
35
|
String userName = "adam";
|
36
|
return makeSource(dbms, strServer, strDB, port, userName, null);
|
37
|
}
|
38
|
|
39
|
|
40
|
public static Source GLOBIS(){
|
41
|
String dbms = Source.SQL_SERVER_2005;
|
42
|
String strServer = "LENOVO-T61";
|
43
|
String strDB = "globis";
|
44
|
int port = 0001;
|
45
|
String userName = "user";
|
46
|
return makeSource(dbms, strServer, strDB, port, userName, null);
|
47
|
}
|
48
|
|
49
|
public static Source GLOBIS_ODBC(){
|
50
|
String dbms = Source.ODDBC;
|
51
|
String strServer = "LENOVO-T61";
|
52
|
String strDB = "globis";
|
53
|
int port = 1433;
|
54
|
String userName = "sa";
|
55
|
return makeSource(dbms, strServer, strDB, port, userName, null);
|
56
|
}
|
57
|
|
58
|
public static Source GLOBIS_MDB(){
|
59
|
String dbms = Source.ACCESS;
|
60
|
String strServer = null;
|
61
|
String strDB = "C:\\localCopy\\Data\\globis\\globis.mdb";
|
62
|
int port = -1;
|
63
|
String userName = "";
|
64
|
return makeSource(dbms, strServer, strDB, port, userName, null);
|
65
|
}
|
66
|
|
67
|
public static Source GLOBIS_MDB_20120928(){
|
68
|
String dbms = Source.ACCESS;
|
69
|
String strServer = null;
|
70
|
String strDB = "C:\\localCopy\\Data\\globis\\globis.20120928.mdb";
|
71
|
int port = -1;
|
72
|
String userName = "";
|
73
|
return makeSource(dbms, strServer, strDB, port, userName, null);
|
74
|
}
|
75
|
|
76
|
// public static Source GLOBIS_MDB_20120928(){
|
77
|
// String dbms = Source.ACCESS;
|
78
|
// String strServer = null;
|
79
|
// String strDB = "\\\\PESIIMPORT3\\globis\\globis.20120928.mdb";
|
80
|
// int port = -1;
|
81
|
// String userName = "";
|
82
|
// return makeSource(dbms, strServer, strDB, port, userName, null);
|
83
|
// }
|
84
|
|
85
|
public static URI SYNTHESYS_SPECIMEN(){
|
86
|
// tcsXmlTest.xml
|
87
|
URL url = new TcsSources().getClass().getResource("/specimen/SynthesysSpecimenExample.xls");
|
88
|
String sourceUrl = url.toString();
|
89
|
URI uri = URI.create(sourceUrl);
|
90
|
return uri;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* Initializes the source.
|
95
|
* @param dbms
|
96
|
* @param strServer
|
97
|
* @param strDB
|
98
|
* @param port
|
99
|
* @param userName
|
100
|
* @param pwd
|
101
|
* @return the source
|
102
|
*/
|
103
|
private static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){
|
104
|
//establish connection
|
105
|
Source source = null;
|
106
|
source = new Source(dbms, strServer, strDB);
|
107
|
source.setPort(port);
|
108
|
|
109
|
pwd = AccountStore.readOrStorePassword(dbms, strServer, userName, pwd);
|
110
|
source.setUserAndPwd(userName, pwd);
|
111
|
// write pwd to account store
|
112
|
return source;
|
113
|
}
|
114
|
}
|