/** * * * <pre> * <b>Description:</b> * Constructor. * </pre> * * @param String sFtpHost -- name connect ftp host * @param String sUserName -- connect user name * @param String sPassword -- connect user password */ public FTPHelper(Connection oConn, Logger oLog) { this(oConn); log = oLog; if (LogLevel.getValue(log.getLogLevel()).ordinal() > LogLevel.DEBUG.ordinal()) { log.setLogLevel(LogLevel.DEBUG); } }
private synchronized void connect2Server() throws SocketException, IOException { if (oFtp == null) { this.oFtp = new FTPClient(); } if (log != null) { if (LogLevel.getValue(log.getLogLevel()).ordinal() > LogLevel.DEBUG.ordinal()) { oFtp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.err))); } } if (_port == 0) { oFtp.connect(this._sFtpHost, 21); } else { oFtp.connect(this._sFtpHost, _port); } if (!oFtp.login(this._sFtpUserName, this._sFtpPassword)) { logError("Can't login to server. FTP responce: " + oFtp.getReplyString()); } oFtp.enterLocalPassiveMode(); }