32ce7c8c4e618948a9474edf300fa598d7267c7f
3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.app
.common
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.app
.tcs
.TcsSources
;
18 import eu
.etaxonomy
.cdm
.common
.AccountStore
;
19 import eu
.etaxonomy
.cdm
.io
.common
.Source
;
26 public class CdmImportSources
{
27 @SuppressWarnings("unused")
28 private static final Logger logger
= Logger
.getLogger(CdmImportSources
.class);
31 public static Source
AFRICA_CHECKLIST_ACCESS(){
33 String dbms
= Source
.ACCESS
;
34 String strServer
= null;
35 //String strDB = "fernsTest";
36 String strDB
= "C:\\localCopy\\Data\\eflora\\africa\\checklist\\checklist_flore_afrique_centrale_corr.mdb";
39 return makeSource(dbms
, strServer
, strDB
, port
, userName
, null);
43 public static Source
AFRICA_FERNS_ACCESS(){
45 String dbms
= Source
.ACCESS
;
46 String strServer
= null;
47 //String strDB = "fernsTest";
48 String strDB
= "C:\\localCopy\\Data\\eflora\\africa\\ferns\\Synopsis_Database_corrected.mdb";
51 return makeSource(dbms
, strServer
, strDB
, port
, userName
, null);
54 public static Source
GLOBIS(){
55 String dbms
= Source
.SQL_SERVER_2005
;
56 String strServer
= "LENOVO-T61";
57 String strDB
= "globis";
59 String userName
= "adam";
60 return makeSource(dbms
, strServer
, strDB
, port
, userName
, null);
63 public static Source
GLOBIS_ODBC(){
64 String dbms
= Source
.ODDBC
;
65 String strServer
= "LENOVO-T61";
66 String strDB
= "globis";
68 String userName
= "sa";
69 return makeSource(dbms
, strServer
, strDB
, port
, userName
, null);
72 public static Source
GLOBIS_MDB(){
73 String dbms
= Source
.ACCESS
;
74 String strServer
= null;
75 String strDB
= "C:\\localCopy\\Data\\globis\\globis.mdb";
78 return makeSource(dbms
, strServer
, strDB
, port
, userName
, null);
82 public static URI
SYNTHESYS_SPECIMEN(){
84 URL url
= new TcsSources().getClass().getResource("/specimen/SynthesysSpecimenExample.xls");
85 String sourceUrl
= url
.toString();
86 URI uri
= URI
.create(sourceUrl
);
91 * Initializes the source.
100 private static Source
makeSource(String dbms
, String strServer
, String strDB
, int port
, String userName
, String pwd
){
101 //establish connection
102 Source source
= null;
103 source
= new Source(dbms
, strServer
, strDB
);
104 source
.setPort(port
);
106 pwd
= AccountStore
.readOrStorePassword(dbms
, strServer
, userName
, pwd
);
107 source
.setUserAndPwd(userName
, pwd
);
108 // write pwd to account store