Project

General

Profile

Download (2.25 KB) Statistics
| Branch: | Tag: | Revision:
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.io.source.Source;
16

    
17
public class BerlinModelSources {
18
	private static final Logger logger = Logger.getLogger(BerlinModelSources.class);
19
	
20
	public static Source euroMed(){
21
		//	BerlinModel - Euro+Med
22
		String dbms = "SQLServer";
23
		String strServer = "BGBM111";
24
		String strDB = "EuroPlusMed_00_Edit";
25
		int port = 1247;
26
		String userName = "webUser";
27
		return  makeSource(dbms, strServer, strDB, port, userName, null);
28
	}
29
	
30
	public static Source editWP6(){
31
		//	BerlinModel - EditWp6
32
		String dbms = "SQLServer";
33
		String strServer = "BGBM111";
34
		String strDB = "EditWP6";
35
		int port = 1247;
36
		String userName = "webUser";
37
		return  makeSource(dbms, strServer, strDB, port, userName, null);
38
	}
39

    
40
	public static Source EDIT_Diptera(){
41
		//	BerlinModel - EditWp6
42
		String dbms = "SQLServer";
43
		String strServer = "BGBM111";
44
		String strDB = "EDIT_Diptera";
45
		int port = 1247;
46
		String userName = "webUser";
47
		return  makeSource(dbms, strServer, strDB, port, userName, null);
48
	}
49
	
50
	public static Source EDIT_Palmae(){
51
		//	BerlinModel - EditWp6
52
		String dbms = "SQLServer";
53
		String strServer = "BGBM111";
54
		String strDB = "EDIT_Palmae";
55
		int port = 1247;
56
		String userName = "webUser";
57
		return  makeSource(dbms, strServer, strDB, port, userName, null);
58
	}
59

    
60
	
61
	/**
62
	 * initializes source
63
	 * @return true, if connection establisehd
64
	 */
65
	private static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){
66
		//establish connection
67
		try {
68
			Source source = new Source(dbms, strServer, strDB);
69
			source.setPort(port);
70
			if (pwd == null){
71
				pwd = CdmUtils.readInputLine("Please insert password for " + CdmUtils.Nz(userName) + ": ");
72
			}
73
			source.setUserAndPwd(userName, pwd);
74
			return source;
75
		} catch (Exception e) {
76
			logger.error(e);
77
			return null;
78
		}
79
	}
80

    
81
}
(2-2/3)