01: /*
02: * This program is free software; you can redistribute it and/or
03: * modify it under the terms of the GNU General Public License
04: * as published by the Free Software Foundation; either version 2
05: * of the License, or (at your option) any later version.
06: *
07: * This program is distributed in the hope that it will be useful,
08: * but WITHOUT ANY WARRANTY; without even the implied warranty of
09: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10: * GNU General Public License for more details.
11:
12: * You should have received a copy of the GNU General Public License
13: * along with this program; if not, write to the Free Software
14: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15: */
16: package net.sf.jftp.config;
17:
18: import net.sf.jftp.*;
19: import net.sf.jftp.config.*;
20: import net.sf.jftp.gui.*;
21: import net.sf.jftp.gui.base.UIUtils;
22: import net.sf.jftp.system.logging.Log;
23: import net.sf.jftp.util.*;
24:
25: import java.io.*;
26:
27: public class LoadSet {
28: // private BufferedInputStream in = null;
29: // private String result[] = new String[6];
30: public static String[] loadSet(String file, boolean ask) {
31: try {
32: BufferedReader breader = new BufferedReader(new FileReader(
33: file));
34: String[] result = new String[6];
35: result[0] = breader.readLine();
36: result[1] = breader.readLine();
37: result[2] = breader.readLine();
38: result[3] = breader.readLine();
39: result[4] = breader.readLine();
40: result[5] = breader.readLine();
41:
42: if ((result[2].equals("") || !Settings.getStorePasswords())
43: && ask) {
44: result[2] = UIUtils
45: .getPasswordFromUser(JFtp.statusP.jftp);
46: Log.debug("fetched: " + result[2] + ", storing: "
47: + Settings.getStorePasswords());
48: }
49:
50: return result;
51: } catch (Exception ex) {
52: // don't need this, occurs if first run
53: //Log.debug(ex.toString() + "@LoadSet::loadSet()");
54: }
55:
56: return new String[1];
57: }
58:
59: public static String[] loadSet(String file) {
60: return loadSet(file, false);
61: }
62: }
|