adapt the import classes to the new return type ImportResult
[cdmlib-apps.git] / app-import / src / main / java / eu / etaxonomy / cdm / app / berlinModelImport / SourceBase.java
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.berlinModelImport;
11
12 import eu.etaxonomy.cdm.common.AccountStore;
13 import eu.etaxonomy.cdm.io.common.Source;
14
15 /**
16 * @author a.mueller
17 * @date 14.11.2012
18 *
19 */
20 public abstract class SourceBase {
21
22
23 /**
24 * Initializes the source.
25 * @param dbms
26 * @param strServer
27 * @param strDB
28 * @param port
29 * @param userName
30 * @param pwd
31 * @return the source
32 */
33 public static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){
34 //establish connection
35 Source source = null;
36 source = new Source(dbms, strServer, strDB);
37 source.setPort(port);
38
39 pwd = AccountStore.readOrStorePassword(dbms, strServer, userName, pwd);
40 source.setUserAndPwd(userName, pwd);
41 // write pwd to account store
42 return source;
43 }
44 }