/*
 * @(#)FxpsRetr.java
 *
 * Copyright (c) 2004 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
package com.jscape.inet.ftps;

/**
 * Responsible for retrieving file from source server.
 */
public class FxpsRetr
        extends Thread {

    private Fxps fxps;
    private Ftps source;
    private Ftps dest;
    private String filename;

    /**
     * Create new FxpsRetr instance
     *
     * @param fxps
     * @param source
     * @param dest
     * @param filename
     */
    public FxpsRetr(Fxps fxps, Ftps source, Ftps dest, String filename) {
        super();
        this.fxps = fxps;
        this.source = source;
        this.dest = dest;
        this.filename = filename;
    }

    /**
     * Run command
     */
    public void run() {
        try {
            source.issueCommand("RETR " + filename);
            source.readResponse();
        } catch (Exception e) {
            fxps.fireFxpFailed(source, dest, filename, e);
        }
    }
}
