(no commit message)
[cdmlib-apps.git] / cdm-pesi / src / main / java / eu / etaxonomy / cdm / app / pesi / PesiSources.java
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.app.pesi;
11
12 import org.apache.log4j.Logger;
13
14 import eu.etaxonomy.cdm.app.common.ImportUtils;
15 import eu.etaxonomy.cdm.common.AccountStore;
16 import eu.etaxonomy.cdm.io.common.Source;
17
18 /**
19 * @author a.babadshanjan
20 * @created 12.05.2009
21 */
22 public class PesiSources {
23 @SuppressWarnings("unused")
24 private static final Logger logger = Logger.getLogger(PesiSources.class);
25
26 public static Source faunEu(){
27 // Fauna Europaea
28
29 String dbms = Source.SQL_SERVER_2008;
30
31 String strServer = "BGBM42"; // "192.168.1.36";
32
33 String strDB = "FaunEu";
34 int port = 1433;
35 String userName = "WebUser";
36 return ImportUtils.makeSource(dbms, strServer, strDB, port, userName, null);
37 }
38
39 public static Source faunaEu_previous(){
40 // Fauna Europaea
41
42 String dbms = Source.SQL_SERVER_2008;
43
44 String strServer = "BGBM42"; // "192.168.1.36";
45
46 String strDB = "FaunEu_2_2";
47 int port = 1433;
48 String userName = "WebUser";
49 return ImportUtils.makeSource(dbms, strServer, strDB, port, userName, null);
50 }
51 public static Source faunaEu_old(){
52 // Fauna Europaea
53
54 String dbms = Source.SQL_SERVER_2008;
55
56 String strServer = "BGBM42"; // "192.168.1.36";
57
58 String strDB = "FaunaEu_1_3";
59 int port = 1433;
60 String userName = "WebUser";
61 return ImportUtils.makeSource(dbms, strServer, strDB, port, userName, null);
62 }
63
64 public static Source PESI_ERMS(){
65 // BerlinModel - Pesi-ERMS
66 String dbms = Source.SQL_SERVER_2008;
67 String strServer = "BGBM42";
68 String strDB = "ERMS";
69 int port = 1433;
70 String userName = "WebUser";
71 return makeSource(dbms, strServer, strDB, port, userName, null);
72 }
73
74
75 /**
76 * Initializes the source.
77 * @param dbms
78 * @param strServer
79 * @param strDB
80 * @param port
81 * @param userName
82 * @param pwd
83 * @return the source
84 */
85 private static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){
86 //establish connection
87 Source source = null;
88 source = new Source(dbms, strServer, strDB);
89 source.setPort(port);
90
91 pwd = AccountStore.readOrStorePassword(dbms, strServer, userName, pwd);
92 source.setUserAndPwd(userName, pwd);
93 // write pwd to account store
94 return source;
95 }
96
97
98 }